pidgin: 7f93eb29: Fix sending '/messages/like/this '.

sadrul at pidgin.im sadrul at pidgin.im
Thu Feb 4 00:45:40 EST 2010


-----------------------------------------------------------------
Revision: 7f93eb293109127d6a055f9a6aaa8baaa85207d1
Ancestor: d2e3ea90ebe345cb51c1e0fac73773dbd4930f1a
Author: sadrul at pidgin.im
Date: 2010-02-03T19:45:23
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/7f93eb293109127d6a055f9a6aaa8baaa85207d1

Modified files:
        pidgin/gtkconv.c

ChangeLog: 

Fix sending '/messages/like/this '.

Fixes #10114.

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	38f2b96cab4ed67da3f9e2254b300a217a3f8316
+++ pidgin/gtkconv.c	97d47d6e694e7ff110888a1ba5813520e66cf791
@@ -497,17 +497,15 @@ check_for_and_do_command(PurpleConversat
 						prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
 					if ((prpl_info != NULL) && (prpl_info->options & OPT_PROTO_SLASH_COMMANDS_NATIVE)) {
-						char *firstspace;
-						char *slash;
+						char *spaceslash;
 
-						firstspace = strchr(cmdline, ' ');
-						if (firstspace != NULL) {
-							slash = strrchr(firstspace, '/');
-						} else {
-							slash = strchr(cmdline, '/');
-						}
+						/* 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 (slash == NULL) {
+						if (*spaceslash != '/') {
 							purple_conversation_write(conv, "", _("Unknown command."), PURPLE_MESSAGE_NO_LOG, time(NULL));
 							retval = TRUE;
 						}


More information about the Commits mailing list