pidgin: 45158d4d: Another patch from Maiku that improves t...

khc at pidgin.im khc at pidgin.im
Fri Mar 21 00:50:43 EDT 2008


-----------------------------------------------------------------
Revision: 45158d4d440a4f35058bdddaf71fb7b8a3b6ad14
Ancestor: d45e5de55917ad50d03c457b4a66aed2cabd1248
Author: khc at pidgin.im
Date: 2008-03-21T04:45:03
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/45158d4d440a4f35058bdddaf71fb7b8a3b6ad14

Modified files:
        libpurple/protocols/msn/msn.c
        libpurple/protocols/msn/notification.c
        libpurple/protocols/msn/switchboard.c
        libpurple/protocols/msn/transaction.h

ChangeLog: 

Another patch from Maiku that improves the way we send mobile messages, this
probably needs another patch before it's useful.

References #5232


-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msn.c	fb67f97a150122a78ff4877795ef9982659514b3
+++ libpurple/protocols/msn/msn.c	6ce042f757eef19bfda47427cb21f176131e14bd
@@ -236,7 +236,9 @@ send_to_mobile(PurpleConnection *gc, con
 	MsnSession *session;
 	MsnCmdProc *cmdproc;
 	MsnPage *page;
-	char *payload;
+	MsnUser *user;
+	char *payload = NULL;
+	const char *mobile_number = NULL;
 	size_t payload_len;
 
 	session = gc->proto_data;
@@ -247,7 +249,19 @@ send_to_mobile(PurpleConnection *gc, con
 
 	payload = msn_page_gen_payload(page, &payload_len);
 
-	trans = msn_transaction_new(cmdproc, "PGD", "%s 1 %d", who, payload_len);
+	if ((user = msn_userlist_find_user(session->userlist, who)) &&
+		(mobile_number = msn_user_get_mobile_phone(user)) &&
+		mobile_number[0] == '+') {
+		/* if msn_user_get_mobile_phone() has a + in front, it's a number
+		   that from the buddy's contact card */
+		trans = msn_transaction_new(cmdproc, "PGD", "tel:%s 1 %d",
+			mobile_number, payload_len);
+	} else {
+		/* otherwise we send to whatever phone number the buddy registered
+		   with msn */
+		trans = msn_transaction_new(cmdproc, "PGD", "%s 1 %d", who,
+			payload_len);
+	}
 
 	msn_transaction_set_payload(trans, payload, payload_len);
 	g_free(payload);
============================================================
--- libpurple/protocols/msn/notification.c	44e0c01437ae4d8a5b13690a504223d4483260cc
+++ libpurple/protocols/msn/notification.c	357d2a294b38728b6ddff119553d82fe155acaa7
@@ -461,7 +461,7 @@ ubm_cmd_post(MsnCmdProc *cmdproc, MsnCom
 	passport = msg->remote_user;
 
 	content_type = msn_message_get_content_type(msg);
-	purple_debug_info("MSNP14","type:%d\n",content_type);
+	purple_debug_info("MSNP14", "type:%s\n", content_type);
 	if(!strcmp(content_type,"text/plain")){
 		const char *value;
 		const char *body;
============================================================
--- libpurple/protocols/msn/switchboard.c	543cea9bdcf761eb30a64dd16e4f387120b2273c
+++ libpurple/protocols/msn/switchboard.c	61652dd677faa0d66c162565c8f7145c7091c106
@@ -1194,9 +1194,10 @@ xfr_error(MsnCmdProc *cmdproc, MsnTransa
 
 	swboard = trans->data;
 
-	purple_debug_info("msn", "xfr_error %i for %s: trans %x, command %s, reason %i\n",
-					error, (swboard->im_user ? swboard->im_user : "(null)"), trans,
-					(trans->command ? trans->command : "(null)"), reason);
+	purple_debug_info("msn",
+		"xfr_error %i for %s: trans %p, command %s, reason %i\n",
+		error, (swboard->im_user ? swboard->im_user : "(null)"), trans,
+		(trans->command ? trans->command : "(null)"), reason);
 
 	swboard_error_helper(swboard, reason, swboard->im_user);
 }
============================================================
--- libpurple/protocols/msn/transaction.h	66e57f331b13f074c254c7fcfca6cdd2dfbc99de
+++ libpurple/protocols/msn/transaction.h	bd555ceb102d86e853184ab822d2468a40976250
@@ -61,9 +61,8 @@ struct _MsnTransaction
 							   this transaction. */
 };
 
-MsnTransaction *msn_transaction_new(MsnCmdProc *cmdproc,
-									const char *command,
-									const char *format, ...);
+MsnTransaction *msn_transaction_new(MsnCmdProc *cmdproc, const char *command,
+ 	const char *format, ...) G_GNUC_PRINTF(3, 4);
 void msn_transaction_destroy(MsnTransaction *trans);
 
 char *msn_transaction_to_string(MsnTransaction *trans);


More information about the Commits mailing list