1 ! Copyright (C) 2009 Bruno Deferrari
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel fry splitting ascii calendar accessors combinators
4 arrays classes.tuple math.order words assocs strings irc.messages.base
5 combinators.short-circuit math sequences ;
9 IRC: pass "PASS" password ;
10 IRC: nick "NICK" : nickname ;
11 IRC: user "USER" user mode _ : realname ;
12 IRC: oper "OPER" name password ;
13 IRC: mode "MODE" name mode parameter ;
14 IRC: service "SERVICE" nickname _ distribution type _ : info ;
15 IRC: quit "QUIT" : comment ;
16 IRC: squit "SQUIT" server : comment ;
18 IRC: join "JOIN" : channel ;
19 IRC: part "PART" channel : comment ;
20 IRC: topic "TOPIC" channel : topic ;
21 IRC: names "NAMES" channel ;
22 IRC: list "LIST" channel ;
23 IRC: invite "INVITE" nickname channel ;
24 IRC: kick "KICK" channel user : comment ;
26 IRC: privmsg "PRIVMSG" target : text ;
27 IRC: notice "NOTICE" target : text ;
29 IRC: motd "MOTD" target ;
30 IRC: lusers "LUSERS" mask target ;
31 IRC: version "VERSION" target ;
32 IRC: stats "STATS" query target ;
33 IRC: links "LINKS" server mask ;
34 IRC: time "TIME" target ;
35 IRC: connect "CONNECT" server port remote-server ;
36 IRC: trace "TRACE" target ;
37 IRC: admin "ADMIN" target ;
38 IRC: info "INFO" target ;
40 IRC: servlist "SERVLIST" mask type ;
41 IRC: squery "SQUERY" service-name : text ;
43 IRC: who "WHO" mask operator ;
44 IRC: whois "WHOIS" target mask ;
45 IRC: whowas "WHOWAS" nickname count target ;
47 IRC: kill "KILL" nickname : comment ;
48 IRC: ping "PING" server1 server2 ;
49 IRC: pong "PONG" server1 server2 ;
50 IRC: error "ERROR" : message ;
52 IRC: rpl-welcome "001" nickname : comment ;
53 IRC: rpl-whois-user "311" nicnamek user host _ : real-name ;
54 IRC: rpl-channel-modes "324" channel mode params ;
55 IRC: rpl-notopic "331" channel : topic ;
56 IRC: rpl-topic "332" channel : topic ;
57 IRC: rpl-inviting "341" channel nickname ;
58 IRC: rpl-names "353" nickname _ channel : nicks ;
59 IRC: rpl-names-end "366" nickname channel : comment ;
61 IRC: rpl-nickname-in-use "433" _ name ;
62 IRC: rpl-nick-collision "436" nickname : comment ;
64 PREDICATE: channel-mode < mode name>> first "#&" member? ;
65 PREDICATE: participant-mode < channel-mode parameter>> ;
66 PREDICATE: ctcp < privmsg
67 trailing>> { [ length 1 > ] [ first 1 = ] [ last 1 = ] } 1&& ;
68 PREDICATE: action < ctcp trailing>> rest "ACTION" head? ;
70 M: rpl-names post-process-irc-message ( rpl-names -- )
71 [ [ ascii:blank? ] trim split-words ] change-nicks drop ;
73 M: ctcp post-process-irc-message ( ctcp -- )
74 [ rest but-last ] change-text drop ;
76 M: action post-process-irc-message ( action -- )
77 [ 7 tail ] change-text call-next-method ;