irc.messages: Add predicate classes for ctcp and action messages
parent
34ec9af2ad
commit
460de5bbef
|
@ -71,4 +71,7 @@ IN: irc.messages.tests
|
||||||
{ name "nickname" }
|
{ name "nickname" }
|
||||||
{ trailing "Nickname is already in use" } } }
|
{ trailing "Nickname is already in use" } } }
|
||||||
[ ":ircserver.net 433 * nickname :Nickname is already in use"
|
[ ":ircserver.net 433 * nickname :Nickname is already in use"
|
||||||
string>irc-message f >>timestamp ] unit-test
|
string>irc-message f >>timestamp ] unit-test
|
||||||
|
|
||||||
|
{ t } [ ":someuser!n=user@some.where PRIVMSG #factortest :ACTION jumps!"
|
||||||
|
string>irc-message action? ] unit-test
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
! Copyright (C) 2009 Bruno Deferrari
|
! Copyright (C) 2009 Bruno Deferrari
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel fry splitting ascii calendar accessors combinators
|
USING: kernel fry splitting ascii calendar accessors combinators
|
||||||
arrays classes.tuple math.order words assocs strings irc.messages.base ;
|
arrays classes.tuple math.order words assocs strings irc.messages.base
|
||||||
|
combinators.short-circuit math ;
|
||||||
EXCLUDE: sequences => join ;
|
EXCLUDE: sequences => join ;
|
||||||
IN: irc.messages
|
IN: irc.messages
|
||||||
|
|
||||||
|
@ -61,8 +62,17 @@ IRC: rpl-names-end "366" nickname channel : comment ;
|
||||||
IRC: rpl-nickname-in-use "433" _ name ;
|
IRC: rpl-nickname-in-use "433" _ name ;
|
||||||
IRC: rpl-nick-collision "436" nickname : comment ;
|
IRC: rpl-nick-collision "436" nickname : comment ;
|
||||||
|
|
||||||
|
PREDICATE: channel-mode < mode name>> first "#&" member? ;
|
||||||
|
PREDICATE: participant-mode < channel-mode parameter>> ;
|
||||||
|
PREDICATE: ctcp < privmsg
|
||||||
|
trailing>> { [ length 1 > ] [ first 1 = ] [ peek 1 = ] } 1&& ;
|
||||||
|
PREDICATE: action < ctcp trailing>> rest "ACTION" head? ;
|
||||||
|
|
||||||
M: rpl-names post-process-irc-message ( rpl-names -- )
|
M: rpl-names post-process-irc-message ( rpl-names -- )
|
||||||
[ [ blank? ] trim " " split ] change-nicks drop ;
|
[ [ blank? ] trim " " split ] change-nicks drop ;
|
||||||
|
|
||||||
PREDICATE: channel-mode < mode name>> first "#&" member? ;
|
M: ctcp post-process-irc-message ( ctcp -- )
|
||||||
PREDICATE: participant-mode < channel-mode parameter>> ;
|
[ rest but-last ] change-text drop ;
|
||||||
|
|
||||||
|
M: action post-process-irc-message ( action -- )
|
||||||
|
[ 7 tail ] change-text call-next-method ;
|
||||||
|
|
Loading…
Reference in New Issue