pidgin: 6e1b1525: Use serv_got_im/serv_got_chat_in instead..

qulogic at pidgin.im qulogic at pidgin.im
Tue May 11 01:15:55 EDT 2010


-----------------------------------------------------------------
Revision: 6e1b1525048546e7c13611af36e0069c2a957593
Ancestor: 2946037e3974559877f516df2006883ad5846e19
Author: qulogic at pidgin.im
Date: 2010-05-11T04:40:07
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/6e1b1525048546e7c13611af36e0069c2a957593

Modified files:
        libpurple/protocols/msn/msg.c

ChangeLog: 

Use serv_got_im/serv_got_chat_in instead of purple_conversation_write so
that Pidgin will play sounds when a wink or voiceclip is received.

Fixes #10929.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msg.c	683e5c61aad674c12273cd9174bdf5a51a3b97c0
+++ libpurple/protocols/msn/msg.c	c034903ee80099c6efbc12b695cee6e2ab242eca
@@ -939,8 +939,11 @@ datacast_inform_user(MsnSwitchBoard *swb
 	char *username, *str;
 	PurpleAccount *account;
 	PurpleBuddy *b;
+	PurpleConnection *pc;
+	gboolean chat;
 
 	account = swboard->session->account;
+	pc = purple_account_get_connection(account);
 
 	if ((b = purple_find_buddy(account, who)) != NULL)
 		username = g_markup_escape_text(purple_buddy_get_alias(b), -1);
@@ -949,8 +952,14 @@ datacast_inform_user(MsnSwitchBoard *swb
 	str = g_strdup_printf(msg, username, filename);
 	g_free(username);
 
+	swboard->flag |= MSN_SB_FLAG_IM;
+	if (swboard->current_users > 1)
+		chat = TRUE;
+	else
+		chat = FALSE;
+
 	if (swboard->conv == NULL) {
-		if (swboard->current_users > 1) 
+		if (chat) 
 			swboard->conv = purple_find_chat(account->gc, swboard->chat_id);
 		else {
 			swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
@@ -959,9 +968,15 @@ datacast_inform_user(MsnSwitchBoard *swb
 				swboard->conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, who);
 		}
 	}
-	swboard->flag |= MSN_SB_FLAG_IM;
 
-	purple_conversation_write(swboard->conv, NULL, str, PURPLE_MESSAGE_SYSTEM, time(NULL));
+	if (chat)
+		serv_got_chat_in(pc,
+		                 purple_conv_chat_get_id(PURPLE_CONV_CHAT(swboard->conv)),
+		                 who, PURPLE_MESSAGE_RECV|PURPLE_MESSAGE_SYSTEM, str,
+		                 time(NULL));
+	else
+		serv_got_im(pc, who, str, PURPLE_MESSAGE_RECV|PURPLE_MESSAGE_SYSTEM,
+		            time(NULL));
 	g_free(str);
 
 }


More information about the Commits mailing list