Wed, 03 Feb 2010 19:45:23 +0000
Fix sending '/messages/like/this '.
Fixes #10114.
| pidgin/gtkconv.c | file | annotate | diff | comparison | revisions |
--- a/pidgin/gtkconv.c Wed Feb 03 18:56:03 2010 +0000 +++ b/pidgin/gtkconv.c Wed Feb 03 19:45:23 2010 +0000 @@ -497,17 +497,15 @@ prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); if ((prpl_info != NULL) && (prpl_info->options & OPT_PROTO_SLASH_COMMANDS_NATIVE)) { - char *firstspace; - char *slash; - - firstspace = strchr(cmdline, ' '); - if (firstspace != NULL) { - slash = strrchr(firstspace, '/'); - } else { - slash = strchr(cmdline, '/'); - } - - if (slash == NULL) { + char *spaceslash; + + /* If the first word in the entered text has a '/' in it, then the user + * probably didn't mean it as a command. So send the text as message. */ + spaceslash = cmdline; + while (*spaceslash && *spaceslash != ' ' && *spaceslash != '/') + spaceslash++; + + if (*spaceslash != '/') { purple_conversation_write(conv, "", _("Unknown command."), PURPLE_MESSAGE_NO_LOG, time(NULL)); retval = TRUE; }