| 
									
										
										
										
											2008-07-14 20:53:08 -04:00
										 |  |  | ! Copyright (C) 2008 William Schlieper | 
					
						
							|  |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-15 02:46:49 -04:00
										 |  |  | USING: kernel vocabs.loader sequences strings splitting words irc.messages ;
 | 
					
						
							| 
									
										
										
										
											2008-07-14 20:53:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | IN: irc.ui.commandparser | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | "irc.ui.commands" require | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-15 02:46:49 -04:00
										 |  |  | : command ( string string -- string command )
 | 
					
						
							| 
									
										
										
										
											2008-09-06 18:15:25 -04:00
										 |  |  |     [ "say" ] when-empty
 | 
					
						
							| 
									
										
										
										
											2008-07-14 20:53:08 -04:00
										 |  |  |     dup "irc.ui.commands" lookup | 
					
						
							| 
									
										
										
										
											2008-07-15 02:46:49 -04:00
										 |  |  |     [ nip ] | 
					
						
							|  |  |  |     [ " " append prepend "quote" "irc.ui.commands" lookup ] if* ;
 | 
					
						
							| 
									
										
										
										
											2008-07-14 20:53:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : parse-message ( string -- )
 | 
					
						
							| 
									
										
										
										
											2008-07-15 02:46:49 -04:00
										 |  |  |     "/" ?head [ " " split1 swap command ] [ "say" command ] if execute ;
 |