From 41a60327ec98785d6aacb9e3d128f5505e9f3670 Mon Sep 17 00:00:00 2001 From: stefanor Date: Fri, 12 Jan 2007 01:50:56 +0000 Subject: [PATCH] remove from Config.hs all that is currently subsumed by rc-files --- Config.hs | 49 ------------------------------------------------- Lambdabot.hs | 12 ++++++------ Plugin/Base.hs | 4 ++-- online.rc | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 57 deletions(-) create mode 100644 online.rc diff --git a/Config.hs b/Config.hs index 7d3ad131..acc088cc 100644 --- a/Config.hs +++ b/Config.hs @@ -3,25 +3,14 @@ -- module Config where -import Message(Nick(Nick)) - -data Protocol = Irc | Xmpp - -- | The 'Config' type provides configurations for lambdabot. It is used -- when lambdabot is started to determine the name of lambdabot, what -- IRC-network lambdabot should join, which channels lambdabot should -- join upon successful connection, etc. -- data Config = Config { - name :: Nick, -- ^ The nickname of lambdabot - userinfo :: String, -- ^ The userinfo string for lambdabot - host :: String, -- ^ Host to join - port :: Int, -- ^ The port number to use on the host - protocol :: Protocol, -- ^ either irc or xmpp/jabber verbose :: Bool, -- ^ Should lambdabot be verbose? textwidth :: Int, -- ^ How many columns should we use - autojoin :: [Nick], -- ^ List of channels to autojoin - admins :: [Nick], -- ^ List of nicknames that are admins proxy :: Maybe ([Char], Integer), -- ^ A proxy given as -- a pair of host and port. @@ -53,46 +42,10 @@ data Config = Config { -- config :: Config config = Config { - name = nck "lambdabot", - userinfo = "Lambda_Robots:_100%_Loyal", - host = "irc.freenode.net", - protocol = Irc, - - port = 6667, verbose = True, textwidth = 350, proxy = Nothing, -- Just ("www-proxy",3128), - autojoin = [nck "#haskell" - ,nck "#haskell-blah" - ,nck "#haskell-overflow" - ,nck "#haskell.hac07" - {- ,nck "#haskell.de" - ,nck "#haskell.es" - ,nck "#haskell.fi" - ,nck "#haskell.fr" - ,nck "#haskell.hr" - ,nck "#haskell.it" - ,nck "#haskell.jp" - ,nck "#haskell.no" - ,nck "#haskell.se" -} - ,nck "#gentoo-haskell" - ,nck "#gentoo-uy" - ,nck "#ghc" - ,nck "#darcs" - ,nck "#oasis" - ,nck "#perl6" - ,nck "#jtiger" - ,nck "#unicycling" - ,nck "#ScannedInAvian"], - - admins = map nck [ - "Pseudonym", "shapr", "vincenz", "Igloo", - "Cale", "dons", "TheHunter", "musasabi", - "Lemmih", "sjanssen", "sorear", "int-e" - - ], - fortunePath = "/home/dons/fortune/", fptoolsPath = "/home/dons/fptools", @@ -105,5 +58,3 @@ config = Config { disabledCommands = ["listchans", "slap", "echo", "remember", "state"] } - where nck = Nick "freenode" - diff --git a/Lambdabot.hs b/Lambdabot.hs index ec96e031..1bbd638d 100644 --- a/Lambdabot.hs +++ b/Lambdabot.hs @@ -36,7 +36,6 @@ module Lambdabot ( import qualified Message as Msg import qualified Shared as S -import qualified Config (config, name, admins) import qualified IRCBase as IRC (IrcMessage, quit, privmsg) import Lib.Signals @@ -253,7 +252,7 @@ runIrc evcmds initialise ld plugins = withSocketsDo $ do rost <- initRoState r <- try $ evalLB (do withDebug "Initialising plugins" initialise withIrcSignalCatch mainLoop) - rost (initState (Config.admins Config.config) ld plugins evcmds) + rost (initState ld plugins evcmds) -- clean up and go home case r of @@ -280,9 +279,9 @@ initRoState = do -- -- | Default rw state -- -initState :: [Msg.Nick] -> S.DynLoad -> [String] -> [String] -> IRCRWState -initState as ld plugins evcmds = IRCRWState { - ircPrivilegedUsers = M.fromList $ zip (Msg.Nick "offlinerc" "null" : as) (repeat True), +initState :: S.DynLoad -> [String] -> [String] -> IRCRWState +initState ld plugins evcmds = IRCRWState { + ircPrivilegedUsers = M.singleton (Msg.Nick "offlinerc" "null") True, ircChannels = M.empty, ircModules = M.empty, ircServerMap = M.empty, @@ -717,7 +716,8 @@ mlines = (mbreak =<<) . lines -- | Don't send any output to alleged bots. checkRecip :: OutputFilter checkRecip who msg - | who == Config.name Config.config = return [] +-- FIXME: this doesn't work with plugin protocols :( +-- | who == Config.name Config.config = return [] | "bot" `isSuffixOf` lowerCaseString (Msg.nName who) = return [] | otherwise = return msg diff --git a/Plugin/Base.hs b/Plugin/Base.hs index 989c7cd4..4b6b4ed6 100644 --- a/Plugin/Base.hs +++ b/Plugin/Base.hs @@ -7,7 +7,7 @@ import Plugin import IRCBase (IrcMessage, timeReply, errShowMsg) -- import Message (getTopic, nick, joinChannel, body, fullName, channels) -import Message (getTopic, nick, joinChannel, server, body, Nick(..), lambdabotName, showNick, readNick) +import Message (getTopic, nick, server, body, Nick(..), lambdabotName, showNick, readNick) import qualified Data.Map as M (insert, delete) @@ -127,7 +127,7 @@ doTOPIC msg put (s { ircChannels = M.insert (mkCN loc) (tail $ head $ tail $ body msg) (ircChannels s)}) doRPL_WELCOME :: Callback -doRPL_WELCOME _msg = mapM_ (send . joinChannel) (autojoin config) +doRPL_WELCOME = doIGNORE doQUIT :: Callback doQUIT msg = doIGNORE msg diff --git a/online.rc b/online.rc new file mode 100644 index 00000000..2fca489c --- /dev/null +++ b/online.rc @@ -0,0 +1,37 @@ +irc-connect freenode chat.freenode.net 6667 lambdabot Lambda_Robots:_100%_Loyal +join freenode:#haskell +join freenode:#haskell +join freenode:#haskell-blah +join freenode:#haskell-overflow +join freenode:#haskell.hac07 +join freenode:#haskell.de +join freenode:#haskell.es +join freenode:#haskell.fi +join freenode:#haskell.fr +join freenode:#haskell.hr +join freenode:#haskell.it +join freenode:#haskell.jp +join freenode:#haskell.no +join freenode:#haskell.se +join freenode:#gentoo-haskell +join freenode:#gentoo-uy +join freenode:#ghc +join freenode:#darcs +join freenode:#oasis +join freenode:#perl6 +join freenode:#jtiger +join freenode:#unicycling +join freenode:#ScannedInAvian +admin + Pseudonym +admin + shapr +admin + vincenz +admin + Igloo +admin + Cale +admin + dons +admin + TheHunter +admin + musasabi +admin + Lemmih +admin + sjanssen +admin + sorear +admin + int-e +source passwd.rc