From b010cd311687ed5a462821c00a436efa146426dd Mon Sep 17 00:00:00 2001 From: Bruno Deferrari Date: Sat, 30 May 2009 10:09:44 -0300 Subject: [PATCH 1/2] irc.logbot: Small refactoring --- extra/irc/logbot/logbot.factor | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/extra/irc/logbot/logbot.factor b/extra/irc/logbot/logbot.factor index ff8085a9a9..976a3832f4 100644 --- a/extra/irc/logbot/logbot.factor +++ b/extra/irc/logbot/logbot.factor @@ -21,15 +21,17 @@ SYMBOL: current-stream : timestamp-path ( timestamp -- path ) timestamp>ymd ".log" append log-directory prepend-path ; +: update-current-stream ( timestamp -- ) + current-stream get [ dispose ] when* + [ day-of-year current-day set ] + [ timestamp-path latin1 ] bi + current-stream set ; + +: same-day? ( timestamp -- ? ) day-of-year current-day get = ; + : timestamp>stream ( timestamp -- stream ) - dup day-of-year current-day get = [ - drop - ] [ - current-stream get [ dispose ] when* - [ day-of-year current-day set ] - [ timestamp-path latin1 ] bi - current-stream set - ] if current-stream get ; + dup same-day? [ drop ] [ update-current-stream ] if + current-stream get ; : log-message ( string timestamp -- ) [ add-timestamp ] [ timestamp>stream ] bi From 4c04ace2789c2849769d2b16bab81f9c816145ae Mon Sep 17 00:00:00 2001 From: Bruno Deferrari Date: Tue, 2 Jun 2009 09:09:27 -0300 Subject: [PATCH 2/2] irc.client: Temporary possible fix to the bug reported by anyhoo --- extra/irc/client/internals/internals.factor | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extra/irc/client/internals/internals.factor b/extra/irc/client/internals/internals.factor index 1b4a4550dc..b065dfe2f0 100644 --- a/extra/irc/client/internals/internals.factor +++ b/extra/irc/client/internals/internals.factor @@ -75,8 +75,9 @@ M: to-many-chats message-forwards sender>> participant-chats ; GENERIC: process-message ( irc-message -- ) M: object process-message drop ; M: ping process-message trailing>> /PONG ; -M: join process-message [ sender>> ] [ chat> ] bi join-participant ; -M: part process-message [ sender>> ] [ chat> ] bi part-participant ; +! FIXME: it shouldn't be checking for the presence of chat here... +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: nick process-message [ trailing>> ] [ sender>> ] bi rename-participant* ; M: rpl-nickname-in-use process-message name>> "_" append /NICK ;