diff --git a/ChangeLog b/ChangeLog index 38d736895..851e661d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ ChangeLog - 2007-03-01 Version 0.2.4 (under dev!): + * prefix '/' disabled in commands (patch #5769) * fixed completion of redefined commands removed by plugins (bug #19176) * fixed memory leaks in perl and python plugins (bug #19163) * added "call" option to /key command, added new key function "insert" to diff --git a/src/common/command.c b/src/common/command.c index 5c8961522..6188ef634 100644 --- a/src/common/command.c +++ b/src/common/command.c @@ -782,6 +782,22 @@ user_message (t_irc_server *server, t_gui_buffer *buffer, char *text) } } +/* + * is_command: return 1 if line is a command, 0 otherwise + */ + +int +is_command (char *line) +{ + char *pos_slash, *pos_space; + + pos_slash = strchr (line + 1, '/'); + pos_space = strchr (line + 1, ' '); + + return (line[0] == '/') + && (!pos_slash || (pos_space && pos_slash > pos_space)); +} + /* * user_command: interprets user command (if beginning with '/') * any other text is sent to the server, if connected @@ -826,7 +842,7 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o irc_find_context (server, channel, NULL, &buffer); - if ((ptr_cmd[0] == '/') && (ptr_cmd[1] != '/')) + if (is_command (ptr_cmd)) { /* WeeChat internal command (or IRC command) */ (void) exec_weechat_command (server, channel, ptr_cmd, only_builtin); diff --git a/weechat/ChangeLog b/weechat/ChangeLog index 38d736895..851e661d7 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -5,6 +5,7 @@ ChangeLog - 2007-03-01 Version 0.2.4 (under dev!): + * prefix '/' disabled in commands (patch #5769) * fixed completion of redefined commands removed by plugins (bug #19176) * fixed memory leaks in perl and python plugins (bug #19163) * added "call" option to /key command, added new key function "insert" to diff --git a/weechat/src/common/command.c b/weechat/src/common/command.c index 5c8961522..6188ef634 100644 --- a/weechat/src/common/command.c +++ b/weechat/src/common/command.c @@ -782,6 +782,22 @@ user_message (t_irc_server *server, t_gui_buffer *buffer, char *text) } } +/* + * is_command: return 1 if line is a command, 0 otherwise + */ + +int +is_command (char *line) +{ + char *pos_slash, *pos_space; + + pos_slash = strchr (line + 1, '/'); + pos_space = strchr (line + 1, ' '); + + return (line[0] == '/') + && (!pos_slash || (pos_space && pos_slash > pos_space)); +} + /* * user_command: interprets user command (if beginning with '/') * any other text is sent to the server, if connected @@ -826,7 +842,7 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o irc_find_context (server, channel, NULL, &buffer); - if ((ptr_cmd[0] == '/') && (ptr_cmd[1] != '/')) + if (is_command (ptr_cmd)) { /* WeeChat internal command (or IRC command) */ (void) exec_weechat_command (server, channel, ptr_cmd, only_builtin);