Skip to content

Commit 9cf9eed

Browse files
committed
Add cabal file, fix warnings
1 parent 45b9ece commit 9cf9eed

File tree

10 files changed

+79
-13
lines changed

10 files changed

+79
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

LICENSE

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Copyright (c) 2009, Jasper Van der Jeugt
2+
 
3+
All rights reserved.
4+
 
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are
7+
met:
8+
 
9+
    * Redistributions of source code must retain the above copyright
10+
      notice, this list of conditions and the following disclaimer.
11+
 
12+
    * Redistributions in binary form must reproduce the above
13+
      copyright notice, this list of conditions and the following
14+
      disclaimer in the documentation and/or other materials provided
15+
      with the distribution.
16+
 
17+
    * Neither the name of Jasper Van der Jeugt nor the names of other
18+
      contributors may be used to endorse or promote products derived
19+
      from this software without specific prior written permission.
20+
 
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

NumberSix/Handlers.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module NumberSix.Handlers
22
( handlers
33
) where
44

5-
import NumberSix.Irc (Irc, Handler)
5+
import NumberSix.Irc (Handler)
66

77
import qualified NumberSix.Handlers.Ping
88
import qualified NumberSix.Handlers.Identify

NumberSix/Handlers/Google.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ google :: String -> Irc String
1414
google query = httpScrape url $ \tags ->
1515
case find (~== TagOpen "a" [("class", "l")]) tags of
1616
Just (TagOpen _ attrs) -> fromMaybe "Not found" $ lookup "href" attrs
17-
Nothing -> "Not found"
17+
_ -> "Not found"
1818
where
1919
url = "http://www.google.com/search?q=" ++ urlEncode query
2020

NumberSix/Handlers/Identify.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ module NumberSix.Handlers.Identify
33
) where
44

55
import Data.List (isInfixOf)
6-
import Control.Concurrent (threadDelay)
76
import Control.Monad (when, forM_)
87
import Data.Char (toUpper)
9-
import Control.Monad.Trans (liftIO)
108

119
import Network.IRC
1210

@@ -16,9 +14,9 @@ import NumberSix.Util
1614
handler :: Handler
1715
handler = makeHandler "identify" $ do
1816
params <- getParameters
19-
command <- getCommand
17+
command' <- getCommand
2018
channels <- getChannels
21-
when (command == "notice" && isCheckIdent params) $ do
19+
when (command' == "notice" && isCheckIdent params) $ do
2220
nick' <- getNick
2321
realName' <- getRealName
2422
writeMessage $ nick nick'

NumberSix/Handlers/Kick.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import Network.IRC
1212

1313
handler :: Handler
1414
handler = makeHandler "kick" $ onCommand "kick" $ do
15-
(channel : nick : _) <- getParameters
15+
(channel : nick' : _) <- getParameters
1616
myNick <- getNick
17-
when (nick == myNick) $ do
17+
when (nick' == myNick) $ do
1818
sleep 3
1919
writeMessage $ joinChan channel

NumberSix/Handlers/Seen.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ module NumberSix.Handlers.Seen
33
) where
44

55
import Control.Applicative ((<$>))
6-
import Data.Maybe (fromMaybe)
7-
import Control.Monad (forM_)
86

97
import NumberSix.Irc
108
import NumberSix.Util

NumberSix/Irc.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module NumberSix.Irc
22
( -- * Core types
33
IrcConfig (..)
44
, IrcState (..)
5-
, Irc (..)
5+
, Irc
66
, Handler (..)
77

88
-- * Obtaining parameters
@@ -40,7 +40,6 @@ import Control.Monad (when)
4040
import Control.Monad.Reader (ReaderT, ask)
4141
import Control.Monad.Trans (liftIO)
4242
import Data.Char (isSpace, toLower)
43-
import Data.Maybe (listToMaybe)
4443
import System.IO (Handle, hPutStr)
4544

4645
import Database.Redis.Redis (Redis)

NumberSix/Util/Redis.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module NumberSix.Util.Redis
88
import Data.List (intercalate)
99
import Control.Monad.Trans (liftIO)
1010

11-
import qualified Data.ByteString as SB
1211
import qualified Data.ByteString.Lazy as LB
1312
import Data.Binary (Binary, encode, decode)
1413
import Database.Redis.Redis

number-six.cabal

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Name: number-six
2+
Version: 0.1
3+
Synopsis: A sexy IRC bot
4+
License-file: LICENSE
5+
Author: Jasper Van der Jeugt
6+
Maintainer: [email protected]
7+
Stability: Experimental
8+
Category: Network
9+
Build-type: Simple
10+
Cabal-version: >= 1.2
11+
12+
Library
13+
Ghc-Options: -Wall
14+
Exposed-Modules: NumberSix.Handlers
15+
NumberSix.Handlers.Google
16+
NumberSix.Handlers.Hello
17+
NumberSix.Handlers.Identify
18+
NumberSix.Handlers.Kick
19+
NumberSix.Handlers.Ping
20+
NumberSix.Handlers.Seen
21+
NumberSix.Handlers.Tell
22+
NumberSix.Handlers.Twitter
23+
NumberSix.Irc
24+
NumberSix.Util
25+
NumberSix.Util.Http
26+
NumberSix.Util.Redis
27+
Build-depends: base >= 4 && < 5,
28+
monads-fd >= 0.1,
29+
random >= 1,
30+
containers >= 0.3,
31+
HTTP >= 4000,
32+
bytestring >= 0.9,
33+
utf8-string >= 0.3,
34+
redis >= 0.7,
35+
binary >= 0.5,
36+
tagsoup >= 0.10,
37+
irc >= 0.4,
38+
old-locale >= 1,
39+
time >= 1,
40+
dataenc >= 0.13

0 commit comments

Comments
 (0)