1 ! Copyright (C) 2009 Bruno Deferrari.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors irc.messages irc.messages.base kernel make ;
4 EXCLUDE: sequences => join ;
5 IN: irc.logbot.log-line
7 : dot-or-parens ( string -- string )
8 [ "." ] [ " (" prepend ")." append ] if-empty ;
10 GENERIC: >log-line ( object -- line )
12 M: irc-message >log-line line>> ;
15 [ "CTCP: " % dup sender>> % " " % text>> % ] "" make ;
18 [ "* " % dup sender>> % " " % text>> % ] "" make ;
21 [ "<" % dup sender>> % "> " % text>> % ] "" make ;
24 [ "* " % sender>> % " has joined the channel." % ] "" make ;
27 [ "* " % dup sender>> % " has left the channel" %
28 comment>> dot-or-parens % ] "" make ;
31 [ "* " % dup sender>> % " has quit" %
32 comment>> dot-or-parens % ] "" make ;
35 [ "* " % dup sender>> % " has kicked " % dup user>> %
36 " from the channel" % comment>> dot-or-parens % ] "" make ;
38 M: participant-mode >log-line
39 [ "* " % dup sender>> % " has set mode " % dup mode>> %
40 " to " % parameter>> % ] "" make ;
43 [ "* " % dup sender>> % " is now known as " % nickname>> % ] "" make ;
46 [ "* " % dup sender>> % " has set the topic for " % dup channel>> %
47 ": \"" % topic>> % "\"" % ] "" make ;