irc.client: Calculate message forwards before processing it (because participants may be deleted from channels)
parent
8f287b2c26
commit
777cb541f7
|
@ -45,11 +45,11 @@ M: sequence chat-put [ chat-put ] with each ;
|
|||
|
||||
! Server message handling
|
||||
|
||||
GENERIC: forward-message ( irc-message -- )
|
||||
M: irc-message forward-message +server-chat+ chat-put ;
|
||||
M: to-one-chat forward-message dup chat> chat-put ;
|
||||
M: to-all-chats forward-message chats> chat-put ;
|
||||
M: to-many-chats forward-message dup sender>> participant-chats chat-put ;
|
||||
GENERIC: message-forwards ( irc-message -- seq )
|
||||
M: irc-message message-forwards drop +server-chat+ ;
|
||||
M: to-one-chat message-forwards chat> ;
|
||||
M: to-all-chats message-forwards drop chats> ;
|
||||
M: to-many-chats message-forwards sender>> participant-chats ;
|
||||
|
||||
GENERIC: process-message ( irc-message -- )
|
||||
M: object process-message drop ;
|
||||
|
@ -112,10 +112,13 @@ M: f handle-input handle-disconnect ;
|
|||
|
||||
! Processing loops
|
||||
|
||||
! FIXME: should get forward channels, process the message, and then forward
|
||||
: in-multiplexer-loop ( -- ? )
|
||||
irc> in-messages>> mailbox-get
|
||||
[ forward-message ] [ process-message ] [ irc-end? not ] tri ;
|
||||
irc> in-messages>> mailbox-get {
|
||||
[ message-forwards ]
|
||||
[ process-message ]
|
||||
[ swap chat-put ]
|
||||
[ irc-end? not ]
|
||||
} cleave ;
|
||||
|
||||
: strings>privmsg ( name string -- privmsg )
|
||||
" :" prepend append "PRIVMSG " prepend string>irc-message ;
|
||||
|
|
Loading…
Reference in New Issue