     " to " blue write-color
     channel>> write ;
 
+M: nick write-irc
+    "* " blue write-color
+    [ prefix>> parse-name write ] keep
+    " is now known as " blue write-color
+    trailing>> write ;
+
 M: unhandled write-irc
     "UNHANDLED: " write
     line>> blue write-color ;


USING: accessors kernel threads combinators concurrency.mailboxes
       sequences strings hashtables splitting fry assocs hashtables colors
       ui ui.gadgets ui.gadgets.panes ui.gadgets.editors
       ui.gadgets.scrollers ui.commands ui.gadgets.frames ui.gestures
       ui.gadgets.tabs ui.gadgets.grids ui.gadgets.packs ui.gadgets.labels
       io io.styles namespaces calendar calendar.format models continuations
       irc.client irc.client.private irc.messages irc.messages.private
       irc.ui.commandparser irc.ui.load qualified ;

RENAME: join sequences => sjoin



GENERIC: handle-inbox ( tab message -- )

: value-labels ( assoc val -- seq )
    '[ nip , = ] assoc-filter keys [ >lower <=> ] sort [ <label> ] map ;

: add-gadget-color ( pack seq color -- pack )
    '[ , >>color add-gadget ] each ;

: update-participants ( tab -- )
    [ userlist>> [ clear-gadget ] keep ]
    [ listener>> participants>> ] bi
    [ +operator+ value-labels dark-green add-gadget-color ]
    [ +voice+ value-labels blue add-gadget-color ]
    [ +normal+ value-labels black add-gadget-color ] tri drop ;

M: participant-changed handle-inbox
    drop update-participants ;
