X-Git-Url: https://git.martlubbers.net/?p=cloogle-irc.git;a=blobdiff_plain;f=IRC.icl;h=f51bc8a2076b5b0fdb527290f644192e3264a912;hp=4a9fa95184f2c36900003a06be7fddd17763069f;hb=93f0540991809d459cfc3061c88fc07d1cfc948c;hpb=80375cb5c33d2a86e2b5e2bd5b7d8025e8a74f1f diff --git a/IRC.icl b/IRC.icl index 4a9fa95..f51bc8a 100644 --- a/IRC.icl +++ b/IRC.icl @@ -41,7 +41,7 @@ where , parseIRCMessage ":cherryh.freenode.net ISON a b c d e f :g h\r\n" , parseIRCMessage ":wilhelm.freenode.net 001 clooglebot :Welcome to the freenode Internet Relay Chat Network clooglebot\r\n" , parseIRCMessage "PING :orwell.freenode.net\r\n" - + , parseIRCMessage ":ChanServ!ChanServ@services. MODE #cloogle +o frobnicator\r\n" ] parseIRCMessage :: String -> Either [Error] IRCMessage @@ -82,7 +82,8 @@ where >>= \cs->pure (toString [c:cs]) parseHost :: Parser Char String - parseHost = jon "." <$> pSepBy parseName (pToken '.') + parseHost = jon "." <$> (pSepBy parseName (pToken '.')) + >>= \s->optional (pToken '.') >>= pure o maybe s (\p->s+++toString s) where parseName :: Parser Char String parseName = toString <$> pSome (pAlpha <|> pDigit <|> pOneOf ['-']) @@ -124,7 +125,7 @@ illegal = ['\x00','\r','\n'] instance toString IRCNumReply where toString m = lpad (toString $ toInt m.irc_reply) 3 '0' <+ " " <+ - m.irc_recipient <+ concat (gIRCPrint{|*|} m.irc_message) + m.irc_recipient <+ " " <+ concat (gIRCPrint{|*|} m.irc_message) instance toString IRCMessage where toString m = maybe "" (\s->either ((<+) ":") id s <+ " ") m.irc_prefix <+ either toString toString m.irc_command