cpw.qulogic.msn: 19c9dd8b: An MSN patch from Masca to check if ther...

qulogic at pidgin.im qulogic at pidgin.im
Sat Jun 21 04:00:55 EDT 2008


-----------------------------------------------------------------
Revision: 19c9dd8bd46b844b09dd206ec82e39a5da699623
Ancestor: 851bf31657ffba3893e7226392c57edf58d05fa9
Author: qulogic at pidgin.im
Date: 2008-06-20T04:58:20
Branch: im.pidgin.cpw.qulogic.msn
URL: http://d.pidgin.im/viewmtn/revision/info/19c9dd8bd46b844b09dd206ec82e39a5da699623

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

ChangeLog: 

An MSN patch from Masca to check if there's a SB available before 
sending OIM's.

References #4877.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msn.c	876fd0228060e69f106323a709d252d42e9bceaa
+++ libpurple/protocols/msn/msn.c	9f94b0e511809d19bd8d219bc597e9cd2e2b31d9
@@ -1095,6 +1095,8 @@ msn_send_im(PurpleConnection *gc, const 
 {
 	PurpleAccount *account;
 	PurpleBuddy *buddy = purple_find_buddy(gc->account, who);
+	MsnSession *session;
+	MsnSwitchBoard *swboard;
 	MsnMessage *msg;
 	char *msgformat;
 	char *msgtext;
@@ -1104,6 +1106,9 @@ msn_send_im(PurpleConnection *gc, const 
 	account = purple_connection_get_account(gc);
 	username = purple_account_get_username(account);
 
+	session = gc->proto_data;
+	swboard = msn_session_find_swboard(session, who);
+
 	if (buddy) {
 		PurplePresence *p = purple_buddy_get_presence(buddy);
 		if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) {
@@ -1115,13 +1120,12 @@ msn_send_im(PurpleConnection *gc, const 
 	}
 
 	msn_import_html(message, &msgformat, &msgtext);
-	/* this is incorrect, we should try to initiate a connection to the
-	   buddy first, and only falls back if that fails. Otherwise we can
-	   only send offline message to invisible buddies */
 	if (msn_user_is_online(account, who)||
-		msn_user_is_yahoo(account, who)){
-		/*User online,then send Online Instant Message*/
-
+		msn_user_is_yahoo(account, who) ||
+		swboard != NULL){
+		/*User online or have a swboard open because it's invisible
+		 * and sent us a message,then send Online Instant Message*/
+ 
 		if (strlen(msgtext) + strlen(msgformat) + strlen(VERSION) > 1564)
 		{
 			g_free(msgformat);
@@ -1140,13 +1144,10 @@ msn_send_im(PurpleConnection *gc, const 
 		purple_debug_info("MSNP14","prepare to send online Message\n");
 		if (g_ascii_strcasecmp(who, username))
 		{
-			MsnSession *session;
-			MsnSwitchBoard *swboard;
 			MsnEmoticon *smile;
 			GSList *smileys;
 			GString *emoticons = NULL;
 
-			session = gc->proto_data;
 			if(msn_user_is_yahoo(account,who)){
 				/*we send the online and offline Message to Yahoo User via UBM*/
 				purple_debug_info("MSNP14","send to Yahoo User\n");
@@ -1203,11 +1204,9 @@ msn_send_im(PurpleConnection *gc, const 
 		msn_message_destroy(msg);
 	} else {
 		/*send Offline Instant Message,only to MSN Passport User*/
-		MsnSession *session;
 		char *friendname;
 
 		purple_debug_info("MSNP14","prepare to send offline Message\n");
-		session = gc->proto_data;
 
 		friendname = msn_encode_mime(account->username);
 		msn_oim_prep_send_msg_info(session->oim,


More information about the Commits mailing list