Index: src/common/command.c =================================================================== RCS file: /sources/weechat/weechat/src/common/command.c,v retrieving revision 1.158 diff -u -d -1 -0 -r1.158 command.c --- src/common/command.c 12 Feb 2007 17:39:35 -0000 1.158 +++ src/common/command.c 1 Mar 2007 02:28:22 -0000 @@ -737,20 +737,35 @@ user_message_display (server, buffer, text); if (next) { next[0] = saved_char; user_message (server, buffer, next); } } /* + * is_cmdlike: returns true if line looks like cmd, + * returns false if it should me treated as message + */ + +static +int is_cmdlike(char *cmdline) +{ + char *slash = strchr(cmdline+1, '/'); + char *space = strchr(cmdline+1, ' '); + // in exec_weechat_command space is the only delimiter + + return (cmdline[0] == '/') && (!slash || (space && slash > space)); +} + +/* * user_command: interprets user command (if beginning with '/') * any other text is sent to the server, if connected */ void user_command (t_irc_server *server, t_irc_channel *channel, char *command, int only_builtin) { t_gui_buffer *buffer; char *new_cmd, *ptr_cmd, *pos; char *command_with_colors; @@ -780,21 +795,21 @@ ptr_cmd = (new_cmd) ? new_cmd : command; while (ptr_cmd && ptr_cmd[0]) { pos = strchr (ptr_cmd, '\n'); if (pos) pos[0] = '\0'; irc_find_context (server, channel, NULL, &buffer); - if ((ptr_cmd[0] == '/') && (ptr_cmd[1] != '/')) + if (is_cmdlike(ptr_cmd)) { /* WeeChat internal command (or IRC command) */ (void) exec_weechat_command (server, channel, ptr_cmd, only_builtin); } else { if ((ptr_cmd[0] == '/') && (ptr_cmd[1] == '/')) ptr_cmd++; if (server && (!BUFFER_IS_SERVER(buffer)))