 M: mode command-parameters>> ( mode -- seq )
     [ name>> ] [ channel>> ] [ mode>> ] tri 3array ;
 
+: (>>channel|nickname) ( string mode -- )
+    over channel? [ (>>channel) ] [ (>>nickname) ] if ;
+
 GENERIC: (>>command-parameters) ( params irc-message -- )
 
 M: irc-message (>>command-parameters) ( params irc-message -- ) 2drop ;

! Copyright (C) 2008 Bruno Deferrari
! See http://factorcode.org/license.txt for BSD license.
USING: kernel fry splitting ascii calendar accessors combinators qualified
       arrays classes.tuple math.order quotations ;
RENAME: join sequences => sjoin
EXCLUDE: sequences => join ;
IN: irc.messages

M: names-reply (>>command-parameters) ( params names-reply -- )
    [ >r first r> (>>who) ] [ >r third r> (>>channel) ] 2bi ;
M: mode    (>>command-parameters) ( params mode -- )
    { { [ >r 2array r> ] [ [ (>>mode) ] [ (>>channel|nickname) ] bi ] }
      { [ >r 3array r> ] [ [ (>>parameter) ] [ (>>mode) ] [ (>>channel) ] tri ] }
    } switch ;

PRIVATE>

