Mercurial > pidgin.yaz
diff pidgin/gtkconv.c @ 29358:5f6571bb128d
Fix sending '/messages/like/this '.
Fixes #10114.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 03 Feb 2010 19:45:23 +0000 |
parents | 9c3e0f2e82ea |
children | 4c4ddafbc089 fdb61f7e8576 a32da45d80ba |
line wrap: on
line diff
--- 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; }