pidgin: eed05980: Set _MESSAGE_{RECV,SEND} properly when r...

wabz at pidgin.im wabz at pidgin.im
Mon Apr 6 19:10:38 EDT 2009


-----------------------------------------------------------------
Revision: eed0598058a6e7cc5da7ad99f06bfe136291d2f9
Ancestor: 3e071df6d421d193c1bec1dea8606e1a059bcb02
Author: wabz at pidgin.im
Date: 2009-04-06T23:05:02
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/eed0598058a6e7cc5da7ad99f06bfe136291d2f9

Modified files:
        libpurple/server.c

ChangeLog: 

Set _MESSAGE_{RECV,SEND} properly when receiving chat messages. Thanks Sadrul!

-------------- next part --------------
============================================================
--- libpurple/server.c	3765f51e4eaa8ab0a6b533e07c639497950eb605
+++ libpurple/server.c	d73a293e8c6a272b342499f8f2160f4f49eb2b97
@@ -925,12 +925,6 @@ void serv_got_chat_in(PurpleConnection *
 	g_return_if_fail(who != NULL);
 	g_return_if_fail(message != NULL);
 
-	/*
-	 * XXX: Should we be setting this here, or relying on prpls to set it?
-	 */
-	if (g_strcmp0(purple_account_get_username(g->account), who))
-		flags |= PURPLE_MESSAGE_RECV;
-
 	for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) {
 		conv = (PurpleConversation *)bcs->data;
 
@@ -945,6 +939,14 @@ void serv_got_chat_in(PurpleConnection *
 	if (!conv)
 		return;
 
+	/* Did I send the message? */
+	if (purple_strequal(purple_conv_chat_get_nick(chat), who)) {
+		flags |= PURPLE_MESSAGE_SEND;
+		flags &= ~PURPLE_MESSAGE_RECV; /* Just in case some prpl sets it! */
+	} else {
+		flags |= PURPLE_MESSAGE_RECV;
+	}
+
 	/*
 	 * Make copies of the message and the sender in case plugins want
 	 * to free these strings and replace them with a modifed version.


More information about the Commits mailing list