clean up some more code

This commit is contained in:
darkf 2013-10-25 15:24:12 -07:00
parent 3b2441db92
commit 96cb54a70a
1 changed files with 16 additions and 16 deletions

View File

@ -26,12 +26,6 @@ ircnick'("!"::xs, acc) -> acc.
ircnick'(x::xs, acc) -> ircnick'(xs, acc + x).
ircnick(str) -> ircnick'(str, "").
-- and then we'll kick off the main program.
-- 127.0.0.1
sock = sockopen("127.0.0.1", 6667). --("irc.freenode.net", 6667).
say(chan, msg) -> fputstr(sock, "PRIVMSG " + chan + " :" + msg + "\r\n").
handleMessage(nick, chan, "$ping") -> say(chan, nick + ": pong").
@ -75,18 +69,24 @@ handleCommand(_, "366", _) -> (). -- End of NAMES list
handleCommand(src, cmd, args) ->
putstrln("Unhandled command: " + cmd + ", with args: " + repr(args) + " from " + src).
handleLine(line) -> do
if head(line) == ":" then do
-- source
(source, rest) = takeUntilSpace(tail(line));
command::args = splitirc(rest);
handleCommand(source, command, args)
end else do
command::args = splitirc(line);
handleCommand(source, command, args)
end
handleLine(":" :: line) -> do
-- sourced message
(source, rest) = takeUntilSpace(line);
command::args = splitirc(rest);
handleCommand(source, command, args)
end.
handleLine(line) -> do
-- non-sourced message
command::args = splitirc(line);
handleCommand(source, command, args)
end.
-- now for our actual program!
-- build our socket and connect to the server
sock = sockopen("127.0.0.1", 6667).
-- send introduction
fputstr(sock, "PASS foobar\r\n").
fputstr(sock, "NICK quaileggeater\r\n").