Merge branch 'irc' of git://tiodante.com/git/factor

db4
Slava Pestov 2009-07-29 19:27:41 -05:00
commit 437bb913cc
2 changed files with 13 additions and 10 deletions

View File

@ -75,8 +75,9 @@ M: to-many-chats message-forwards sender>> participant-chats ;
GENERIC: process-message ( irc-message -- ) GENERIC: process-message ( irc-message -- )
M: object process-message drop ; M: object process-message drop ;
M: ping process-message trailing>> /PONG ; M: ping process-message trailing>> /PONG ;
M: join process-message [ sender>> ] [ chat> ] bi join-participant ; ! FIXME: it shouldn't be checking for the presence of chat here...
M: part process-message [ sender>> ] [ chat> ] bi part-participant ; M: join process-message [ sender>> ] [ chat> ] bi [ join-participant ] [ drop ] if* ;
M: part process-message [ sender>> ] [ chat> ] bi [ part-participant ] [ drop ] if* ;
M: quit process-message sender>> quit-participant ; M: quit process-message sender>> quit-participant ;
M: nick process-message [ trailing>> ] [ sender>> ] bi rename-participant* ; M: nick process-message [ trailing>> ] [ sender>> ] bi rename-participant* ;
M: rpl-nickname-in-use process-message name>> "_" append /NICK ; M: rpl-nickname-in-use process-message name>> "_" append /NICK ;

View File

@ -21,15 +21,17 @@ SYMBOL: current-stream
: timestamp-path ( timestamp -- path ) : timestamp-path ( timestamp -- path )
timestamp>ymd ".log" append log-directory prepend-path ; timestamp>ymd ".log" append log-directory prepend-path ;
: timestamp>stream ( timestamp -- stream ) : update-current-stream ( timestamp -- )
dup day-of-year current-day get = [
drop
] [
current-stream get [ dispose ] when* current-stream get [ dispose ] when*
[ day-of-year current-day set ] [ day-of-year current-day set ]
[ timestamp-path latin1 <file-appender> ] bi [ timestamp-path latin1 <file-appender> ] bi
current-stream set current-stream set ;
] if current-stream get ;
: same-day? ( timestamp -- ? ) day-of-year current-day get = ;
: timestamp>stream ( timestamp -- stream )
dup same-day? [ drop ] [ update-current-stream ] if
current-stream get ;
: log-message ( string timestamp -- ) : log-message ( string timestamp -- )
[ add-timestamp ] [ timestamp>stream ] bi [ add-timestamp ] [ timestamp>stream ] bi