]> gitweb.factorcode.org Git - factor-unmaintained.git/blob - irc-ui/commandparser/commandparser.factor
tabs: moved to ui.gadgets.tabs to match IN: declarations.
[factor-unmaintained.git] / irc-ui / commandparser / commandparser.factor
1 ! Copyright (C) 2008 William Schlieper
2 ! See http://factorcode.org/license.txt for BSD license.
3
4 USING: kernel vocabs.loader sequences strings splitting words irc.messages ;
5
6 IN: irc.ui.commandparser
7
8 : command ( string string -- string command )
9     [ "say" ] when-empty
10     dup "irc.ui.commands" lookup
11     [ nip ]
12     [ " " append prepend "quote" "irc.ui.commands" lookup ] if* ;
13
14 : parse-message ( string -- )
15     "/" ?head [ " " split1 swap command ] [ "say" command ] if execute ;