# HG changeset patch # User Richard Nelson # Date 1239059102 0 # Node ID fb44acfae44144284e0ca41932ad3e1d8ac2e6c6 # Parent f9a923fde1e4ad6c3dd7411aa05edd9401619f97 Set _MESSAGE_{RECV,SEND} properly when receiving chat messages. Thanks Sadrul! diff -r f9a923fde1e4 -r fb44acfae441 libpurple/server.c --- 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.