comparison libpurple/server.c @ 26503: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 5617edc6c7a5
children 1ba4bbd3b0cd
comparison
equal deleted inserted replaced
26502:f9a923fde1e4 26503:fb44acfae441
923 int plugin_return; 923 int plugin_return;
924 924
925 g_return_if_fail(who != NULL); 925 g_return_if_fail(who != NULL);
926 g_return_if_fail(message != NULL); 926 g_return_if_fail(message != NULL);
927 927
928 /*
929 * XXX: Should we be setting this here, or relying on prpls to set it?
930 */
931 if (g_strcmp0(purple_account_get_username(g->account), who))
932 flags |= PURPLE_MESSAGE_RECV;
933
934 for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { 928 for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) {
935 conv = (PurpleConversation *)bcs->data; 929 conv = (PurpleConversation *)bcs->data;
936 930
937 chat = PURPLE_CONV_CHAT(conv); 931 chat = PURPLE_CONV_CHAT(conv);
938 932
942 conv = NULL; 936 conv = NULL;
943 } 937 }
944 938
945 if (!conv) 939 if (!conv)
946 return; 940 return;
941
942 /* Did I send the message? */
943 if (purple_strequal(purple_conv_chat_get_nick(chat), who)) {
944 flags |= PURPLE_MESSAGE_SEND;
945 flags &= ~PURPLE_MESSAGE_RECV; /* Just in case some prpl sets it! */
946 } else {
947 flags |= PURPLE_MESSAGE_RECV;
948 }
947 949
948 /* 950 /*
949 * Make copies of the message and the sender in case plugins want 951 * Make copies of the message and the sender in case plugins want
950 * to free these strings and replace them with a modifed version. 952 * to free these strings and replace them with a modifed version.
951 */ 953 */