summaryrefslogtreecommitdiffstats
path: root/src/Reaktor
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-01-24 15:00:33 +0100
committertv <tv@krebsco.de>2019-01-24 15:02:22 +0100
commit34b66e54660d40378020058714e9499e86d3d96b (patch)
tree5ee9f518cf1b072e9cd20f159a2306956a903af4 /src/Reaktor
parent4fa5cb937c016f8c10bf8f40d017ca3a436db2d3 (diff)
Reaktor.Internal: play ping-pong quietly
Diffstat (limited to 'src/Reaktor')
-rw-r--r--src/Reaktor/Internal.hs3
-rw-r--r--src/Reaktor/Plugins/Register.hs23
2 files changed, 9 insertions, 17 deletions
diff --git a/src/Reaktor/Internal.hs b/src/Reaktor/Internal.hs
index 74db9c3..48a3f24 100644
--- a/src/Reaktor/Internal.hs
+++ b/src/Reaktor/Internal.hs
@@ -15,10 +15,7 @@ data Actions = Actions
{ aIsSecure :: Bool
, aSend :: Message -> IO ()
- , aSendQuiet :: Message -> IO ()
-
, aLog :: Blessings ByteString -> IO ()
- , aLogMsg :: Message -> IO ()
, aSetNick :: ByteString -> IO ()
, aGetNick :: IO ByteString
diff --git a/src/Reaktor/Plugins/Register.hs b/src/Reaktor/Plugins/Register.hs
index 314fc6f..ec3a11e 100644
--- a/src/Reaktor/Plugins/Register.hs
+++ b/src/Reaktor/Plugins/Register.hs
@@ -52,9 +52,7 @@ new Config{..} Actions{..} = do
Just ConfigNickServ{..} = cNickServ
release nick pass = do
- -- TODO Password type that doesn't get logged?
- aLogMsg (privmsg "NickServ" ["RELEASE", nick, "<password>"])
- aSendQuiet (privmsg "NickServ" ["RELEASE", nick, pass])
+ aSend (privmsg "NickServ" ["RELEASE", nick, pass])
channelsArg = BS.intercalate "," cChannels
-- TODO make this similar to privmsg (i.e. don't aSend)
@@ -113,8 +111,7 @@ new Config{..} Actions{..} = do
-- RFC2812 RPL_WELCOME
Message _ "001" [msgtarget,_text] -> do
nick <- aGetNick
- aLogMsg (privmsg "NickServ" ["IDENTIFY", nick, "<password>"])
- aSendQuiet (privmsg "NickServ" ["IDENTIFY", nick, pass])
+ aSend (privmsg "NickServ" ["IDENTIFY", nick, pass])
when (msgtarget /= nick) (release nick pass)
-- TODO structured prefix, and check just for "NickServ"?
@@ -124,22 +121,20 @@ new Config{..} Actions{..} = do
let stx = ("\STX"<>) . (<>"\STX")
if
| text == "You are now identified for " <> stx nick <> "." -> do
- -- XXX if msgtarget == nick then do
- -- XXX join
- -- XXX else do
- -- XXX aSend (Message Nothing "NICK" [nick])
-
-- otherwise join at NICK
when (msgtarget == nick) join
| text == stx nick <> " has been released." -> do
aSend (Message Nothing "NICK" [nick])
+
| text == "Invalid password for " <> stx nick <> "." -> do
- -- TODO change nick + warning
- error (BS.unpack text)
+ -- TODO warning
+ when (msgtarget == nick) join
+
| text == stx nick <> " is not a registered nickname." -> do
- -- TODO change nick + warning
- error (BS.unpack text)
+ -- TODO warning
+ when (msgtarget == nick) join
+
| otherwise ->
pure ()