changeset 29898:71fe96932a8e

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.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Tue, 11 May 2010 04:40:07 +0000
parents cb9afb16cc3d
children 7c59fb762fc1
files libpurple/protocols/msn/msg.c
diffstat 1 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/msg.c	Tue May 11 01:21:49 2010 +0000
+++ b/libpurple/protocols/msn/msg.c	Tue May 11 04:40:07 2010 +0000
@@ -939,8 +939,11 @@
 	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 @@
 	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 @@
 				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);
 
 }