Got /commands actually working, irc.ui no longer uses make-gadget et al
parent
26da6f40c0
commit
c02397d3a4
|
@ -1,16 +1,17 @@
|
||||||
! Copyright (C) 2008 William Schlieper
|
! Copyright (C) 2008 William Schlieper
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
|
||||||
USING: kernel vocabs.loader sequences strings irc.messages ;
|
USING: kernel vocabs.loader sequences strings splitting words irc.messages ;
|
||||||
|
|
||||||
IN: irc.ui.commandparser
|
IN: irc.ui.commandparser
|
||||||
|
|
||||||
"irc.ui.commands" require
|
"irc.ui.commands" require
|
||||||
|
|
||||||
: command ( string -- command )
|
: command ( string string -- string command )
|
||||||
dup empty? [ drop "say" ] when
|
dup empty? [ drop "say" ] when
|
||||||
dup "irc.ui.commands" lookup
|
dup "irc.ui.commands" lookup
|
||||||
[ "quote" "irc.ui.commands" lookup ] unless* ;
|
[ nip ]
|
||||||
|
[ " " append prepend "quote" "irc.ui.commands" lookup ] if* ;
|
||||||
|
|
||||||
: parse-message ( string -- )
|
: parse-message ( string -- )
|
||||||
"/" head? [ " " split1 swap command execute ] when ;
|
"/" ?head [ " " split1 swap command ] [ "say" command ] if execute ;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2008 William Schlieper
|
! Copyright (C) 2008 William Schlieper
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
|
||||||
USING: kernel irc.client irc.messages irc.ui
|
USING: accessors kernel irc.client irc.messages irc.ui namespaces ;
|
||||||
|
|
||||||
IN: irc.ui.commands
|
IN: irc.ui.commands
|
||||||
|
|
||||||
|
|
|
@ -95,10 +95,10 @@ M: irc-message write-irc
|
||||||
|
|
||||||
TUPLE: irc-editor < editor outstream listener client ;
|
TUPLE: irc-editor < editor outstream listener client ;
|
||||||
|
|
||||||
: <irc-editor> ( pane listener client -- editor )
|
: <irc-editor> ( page pane listener -- client editor )
|
||||||
[ irc-editor new-editor
|
irc-editor new-editor
|
||||||
swap >>listener swap <pane-stream> >>outstream
|
swap >>listener swap <pane-stream> >>outstream
|
||||||
] dip >>client ;
|
over client>> >>client ;
|
||||||
|
|
||||||
: editor-send ( irc-editor -- )
|
: editor-send ( irc-editor -- )
|
||||||
{ [ outstream>> ]
|
{ [ outstream>> ]
|
||||||
|
@ -117,10 +117,9 @@ TUPLE: irc-page < frame listener client ;
|
||||||
|
|
||||||
: <irc-page> ( listener client -- irc-page )
|
: <irc-page> ( listener client -- irc-page )
|
||||||
irc-page new-frame
|
irc-page new-frame
|
||||||
[ g swap client>> >>client swap [ swap (>>listener) ] keep
|
swap client>> >>client swap [ >>listener ] keep
|
||||||
[ <irc-pane> [ <scroller> g @center grid-add ] keep ]
|
[ <irc-pane> [ <scroller> @center grid-add* ] keep ]
|
||||||
[ g client>> <irc-editor> <scroller> g @bottom grid-add ] bi
|
[ <irc-editor> <scroller> @bottom grid-add* ] bi ;
|
||||||
g ] with-gadget ;
|
|
||||||
|
|
||||||
M: irc-page graft*
|
M: irc-page graft*
|
||||||
[ listener>> ] [ client>> ] bi
|
[ listener>> ] [ client>> ] bi
|
||||||
|
|
Loading…
Reference in New Issue