Mercurial > pidgin
changeset 22535:6aa076a2ea6f
Another patch from Maiku that improves the way we send mobile messages, this
probably needs another patch before it's useful.
References #5232
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Fri, 21 Mar 2008 04:45:03 +0000 |
parents | 63ffeb5c20a0 |
children | 575c4bda3b23 |
files | libpurple/protocols/msn/msn.c libpurple/protocols/msn/notification.c libpurple/protocols/msn/switchboard.c libpurple/protocols/msn/transaction.h |
diffstat | 4 files changed, 23 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c Fri Mar 21 03:17:36 2008 +0000 +++ b/libpurple/protocols/msn/msn.c Fri Mar 21 04:45:03 2008 +0000 @@ -236,7 +236,9 @@ 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 @@ 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);
--- a/libpurple/protocols/msn/notification.c Fri Mar 21 03:17:36 2008 +0000 +++ b/libpurple/protocols/msn/notification.c Fri Mar 21 04:45:03 2008 +0000 @@ -461,7 +461,7 @@ 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;
--- a/libpurple/protocols/msn/switchboard.c Fri Mar 21 03:17:36 2008 +0000 +++ b/libpurple/protocols/msn/switchboard.c Fri Mar 21 04:45:03 2008 +0000 @@ -1194,9 +1194,10 @@ 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); }
--- a/libpurple/protocols/msn/transaction.h Fri Mar 21 03:17:36 2008 +0000 +++ b/libpurple/protocols/msn/transaction.h Fri Mar 21 04:45:03 2008 +0000 @@ -61,9 +61,8 @@ 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);