changeset 26585:fb44acfae441

Set _MESSAGE_{RECV,SEND} properly when receiving chat messages. Thanks Sadrul!
author Richard Nelson <wabz@pidgin.im>
date Mon, 06 Apr 2009 23:05:02 +0000
parents f9a923fde1e4
children 7fba18b43da3 0c796a1950b7
files libpurple/server.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/server.c	Mon Apr 06 13:18:36 2009 +0000
+++ b/libpurple/server.c	Mon Apr 06 23:05:02 2009 +0000
@@ -925,12 +925,6 @@
 	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 @@
 	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.