im.pidgin.pidgin.khc.msnp15: 412db710b0ee4469fc530b2d75c495c1c08c0da4
khc at pidgin.im
khc at pidgin.im
Fri Dec 28 02:20:48 EST 2007
-----------------------------------------------------------------
Revision: 412db710b0ee4469fc530b2d75c495c1c08c0da4
Ancestor: 78fc36beaa7c63cb038a865fac92c7a90a3bc738
Author: khc at pidgin.im
Date: 2007-12-26T01:22:00
Branch: im.pidgin.pidgin.khc.msnp15
Modified files:
libpurple/protocols/msn/contact.c
libpurple/protocols/msn/nexus.c
libpurple/protocols/msn/nexus.h
libpurple/protocols/msn/oim.c libpurple/protocols/msn/oim.h
ChangeLog:
fix sending offline message in p15 by sending the correct token. In msnp14,
we send the main login token (I realize I may be making up some of the terms
here), in p15, we send the one for messengersecure.live.com
some refactoring also
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/contact.c ff9c30c35189924f99cafc72119a153874b3c4ed
+++ libpurple/protocols/msn/contact.c a06db8eb0537e22d8f9e9fa80da653bdf6f8229e
@@ -207,26 +207,6 @@ msn_get_user_type(char *type)
return MSN_USER_TYPE_UNKNOWN;
}
-/* Get a ticket token that's correctly formatted */
-static const char *
-msn_contact_get_token(MsnContact *contact)
-{
- GHashTable *token;
- char *msn_t;
- char *msn_p;
- static char token_str[BUF_LEN];
-
- token = msn_nexus_get_token(contact->session->nexus, MSN_AUTH_CONTACTS);
- msn_t = g_hash_table_lookup(token, "t");
- msn_p = g_hash_table_lookup(token, "p");
-
- g_sprintf(token_str, "t=%s&p=%s", msn_t, msn_p);
-
- g_hash_table_unref(token);
-
- return token_str;
-}
-
/* Create the AddressBook in the server, if we don't have one */
static void
msn_create_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data)
@@ -252,8 +232,8 @@ msn_create_address_book(MsnContact * con
purple_debug_info("msnab","Creating an Address Book.\n");
body = g_strdup_printf(MSN_ADD_ADDRESSBOOK_TEMPLATE,
- msn_contact_get_token(contact),
- contact->session->user->passport);
+ msn_nexus_get_token_str(contact->session->nexus, MSN_AUTH_CONTACTS),
+ contact->session->user->passport);
msn_soap_message_send(contact->session,
msn_soap_message_new(MSN_ADD_ADDRESSBOOK_SOAP_ACTION,
@@ -440,8 +420,8 @@ msn_get_contact_list(MsnContact * contac
}
body = g_strdup_printf(MSN_GET_CONTACT_TEMPLATE, partner_scenario_str,
- msn_contact_get_token(contact),
- update_str ? update_str : "");
+ msn_nexus_get_token_str(contact->session->nexus, MSN_AUTH_CONTACTS),
+ update_str ? update_str : "");
msn_soap_message_send(contact->session,
msn_soap_message_new(MSN_GET_CONTACT_SOAP_ACTION,
@@ -755,9 +735,9 @@ msn_get_address_book(MsnContact *contact
update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML, LastChanged);
body = g_strdup_printf(MSN_GET_ADDRESS_TEMPLATE,
- MsnSoapPartnerScenarioText[partner_scenario],
- msn_contact_get_token(contact),
- update_str ? update_str : "");
+ MsnSoapPartnerScenarioText[partner_scenario],
+ msn_nexus_get_token_str(contact->session->nexus, MSN_AUTH_CONTACTS),
+ update_str ? update_str : "");
msn_soap_message_send(contact->session,
msn_soap_message_new(MSN_GET_ADDRESS_SOAP_ACTION,
@@ -823,8 +803,8 @@ msn_add_contact(MsnContact *contact, Msn
contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport);
body = g_strdup_printf(MSN_ADD_CONTACT_TEMPLATE,
- msn_contact_get_token(contact),
- contact_xml);
+ msn_nexus_get_token_str(contact->session->nexus, MSN_AUTH_CONTACTS),
+ contact_xml);
msn_soap_message_send(contact->session,
msn_soap_message_new(MSN_CONTACT_ADD_SOAP_ACTION,
@@ -933,9 +913,8 @@ msn_add_contact_to_group(MsnContact *con
}
body = g_strdup_printf(MSN_ADD_CONTACT_GROUP_TEMPLATE,
- msn_contact_get_token(contact),
- groupId,
- contact_xml);
+ msn_nexus_get_token_str(contact->session->nexus, MSN_AUTH_CONTACTS),
+ groupId, contact_xml);
msn_soap_message_send(state->session,
msn_soap_message_new(MSN_ADD_CONTACT_GROUP_SOAP_ACTION,
@@ -984,8 +963,9 @@ msn_delete_contact(MsnContact *contact,
/* build SOAP request */
purple_debug_info("MSNCL","Deleting contact with contactId: %s\n", contactId);
body = g_strdup_printf(MSN_DEL_CONTACT_TEMPLATE,
- msn_contact_get_token(contact),
- contact_id_xml);
+ msn_nexus_get_token_str(contact->session->nexus, MSN_AUTH_CONTACTS),
+ contact_id_xml);
+
msn_soap_message_send(contact->session,
msn_soap_message_new(MSN_CONTACT_DEL_SOAP_ACTION,
xmlnode_from_str(body, -1)),
@@ -1058,9 +1038,8 @@ msn_del_contact_from_group(MsnContact *c
contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid);
body = g_strdup_printf(MSN_CONTACT_DEL_GROUP_TEMPLATE,
- msn_contact_get_token(contact),
- contact_id_xml,
- groupId);
+ msn_nexus_get_token_str(contact->session->nexus, MSN_AUTH_CONTACTS),
+ contact_id_xml, groupId);
msn_soap_message_send(contact->session,
msn_soap_message_new(MSN_CONTACT_DEL_GROUP_SOAP_ACTION,
@@ -1094,8 +1073,8 @@ msn_update_contact(MsnContact *contact,
escaped_nickname = g_markup_escape_text(nickname, -1);
body = g_strdup_printf(MSN_CONTACT_UPDATE_TEMPLATE,
- msn_contact_get_token(contact),
- escaped_nickname);
+ msn_nexus_get_token_str(contact->session->nexus, MSN_AUTH_CONTACTS),
+ escaped_nickname);
msn_soap_message_send(contact->session,
msn_soap_message_new(MSN_CONTACT_UPDATE_SOAP_ACTION,
@@ -1173,10 +1152,9 @@ msn_del_contact_from_list(MsnContact *co
}
body = g_strdup_printf( MSN_CONTACT_DELECT_FROM_LIST_TEMPLATE,
- MsnSoapPartnerScenarioText[partner_scenario],
- msn_contact_get_token(contact),
- MsnMemberRole[list],
- member);
+ MsnSoapPartnerScenarioText[partner_scenario],
+ msn_nexus_get_token_str(contact->session->nexus, MSN_AUTH_CONTACTS),
+ MsnMemberRole[list], member);
msn_soap_message_send(contact->session,
msn_soap_message_new(MSN_DELETE_MEMBER_FROM_LIST_SOAP_ACTION,
@@ -1246,10 +1224,9 @@ msn_add_contact_to_list(MsnContact *cont
member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, state->who);
body = g_strdup_printf(MSN_CONTACT_ADD_TO_LIST_TEMPLATE,
- MsnSoapPartnerScenarioText[partner_scenario],
- msn_contact_get_token(contact),
- MsnMemberRole[list],
- member);
+ MsnSoapPartnerScenarioText[partner_scenario],
+ msn_nexus_get_token_str(contact->session->nexus, MSN_AUTH_CONTACTS),
+ MsnMemberRole[list], member);
msn_soap_message_send(contact->session,
msn_soap_message_new(MSN_ADD_MEMBER_TO_LIST_SOAP_ACTION,
@@ -1281,7 +1258,8 @@ msn_get_gleams(MsnContact *contact)
purple_debug_info("MSNP14","msn get gleams info...\n");
body = g_strdup_printf(MSN_GLEAMS_TEMPLATE,
- msn_contact_get_token(contact))
+ msn_nexus_get_token_str(contact->session->nexus, MSN_AUTH_CONTACTS));
+
msn_soap_message_send(contact->session,
msn_soap_message_new(MSN_GET_GLEAMS_SOAP_ACTION,
xmlnode_from_str(body, -1)),
@@ -1389,9 +1367,8 @@ msn_add_group(MsnSession *session, MsnCa
*/
escaped_group_name = g_markup_escape_text(group_name, -1);
body = g_strdup_printf(MSN_GROUP_ADD_TEMPLATE,
- msn_contact_get_token(session->contact),
- escaped_group_name);
- g_free(escaped_group_name);
+ msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
+ escaped_group_name);
msn_soap_message_send(session,
msn_soap_message_new(MSN_GROUP_ADD_SOAP_ACTION,
@@ -1399,6 +1376,7 @@ msn_add_group(MsnSession *session, MsnCa
MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL,
msn_group_read_cb, state);
+ g_free(escaped_group_name);
g_free(body);
}
@@ -1435,8 +1413,8 @@ msn_del_group(MsnSession *session, const
msn_callback_state_set_guid(state, guid);
body = g_strdup_printf(MSN_GROUP_DEL_TEMPLATE,
- msn_contact_get_token(session->contact),
- guid);
+ msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
+ guid);
msn_soap_message_send(session,
msn_soap_message_new(MSN_GROUP_DEL_SOAP_ACTION,
@@ -1480,9 +1458,8 @@ msn_contact_rename_group(MsnSession *ses
escaped_group_name = g_markup_escape_text(new_group_name, -1);
body = g_strdup_printf(MSN_GROUP_RENAME_TEMPLATE,
- msn_contact_get_token(session->contact),
- guid, escaped_group_name);
- g_free(escaped_group_name);
+ msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
+ guid, escaped_group_name);
msn_soap_message_send(session,
msn_soap_message_new(MSN_GROUP_RENAME_SOAP_ACTION,
@@ -1490,5 +1467,6 @@ msn_contact_rename_group(MsnSession *ses
MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL,
msn_group_read_cb, state);
+ g_free(escaped_group_name);
g_free(body);
}
============================================================
--- libpurple/protocols/msn/nexus.c 3b601281b1115522e49740ab3136c1f05216ba6b
+++ libpurple/protocols/msn/nexus.c f347d0ebd6f1cbfa65663c257b30c09c16d38cdb
@@ -39,7 +39,7 @@ static char *ticket_domains[][2] = {
{"messengerclear.live.com", NULL}, /* Authentication for messenger. */
{"messenger.msn.com", "?id=507"}, /* Messenger website authentication. */
{"contacts.msn.com", "MBI"}, /* Authentication for the Contact server. */
- {"messengersecure.live.com", "MBI_SSL"}, /* Unknown */
+ {"messengersecure.live.com", "MBI_SSL"}, /* Used for messenger.live.com */
{"spaces.live.com", "MBI"}, /* Authentication for the Windows Live Spaces */
{"livecontacts.live.com", "MBI"}, /* Live Contacts API, a simplified version of the Contacts SOAP service */
{"storage.live.com", "MBI"}, /* Storage REST API */
@@ -416,23 +416,28 @@ msn_nexus_get_token(MsnNexus *nexus, Msn
if (time(NULL) > nexus->tokens[id].expiry)
msn_nexus_update_token(nexus, id);
- return g_hash_table_ref(nexus->tokens[id].token);
+ return nexus->tokens[id].token;
}
-char *
-msn_nexus_get_token_str(MsnNexus *session, MsnAuthDomains id)
+const char *
+msn_nexus_get_token_str(MsnNexus *nexus, MsnAuthDomains id)
{
-#if 0
+ static char buf[1024];
GHashTable *token = msn_nexus_get_token(nexus, id);
- GString *token_str;
+ const char *msn_t;
+ const char *msn_p;
+ gint ret;
g_return_val_if_fail(token != NULL, NULL);
- token_str = g_string_new(NULL);
- g_hash_table_foreach(token, GHFunc func, token_str);
+ msn_t = g_hash_table_lookup(token, "t");
+ msn_p = g_hash_table_lookup(token, "p");
- g_hash_table_unref (token);
-#endif
- return NULL;
-}
+ g_return_val_if_fail(msn_t != NULL, NULL);
+ g_return_val_if_fail(msn_p != NULL, NULL);
+ ret = g_snprintf(buf, sizeof(buf) - 1, "t=%s&p=%s", msn_t, msn_p);
+ g_return_val_if_fail(ret != -1, NULL);
+
+ return buf;
+}
============================================================
--- libpurple/protocols/msn/nexus.h 4856b18aba79e0f24a3053d02379e895107ec0e2
+++ libpurple/protocols/msn/nexus.h b51da3b8de3e628ce9ec161a8279dab55ea13486
@@ -32,7 +32,7 @@ typedef enum
MSN_AUTH_MESSENGER = 0,
MSN_AUTH_MESSENGER_WEB = 1,
MSN_AUTH_CONTACTS = 2,
- MSN_AUTH_LIVE_UNKNOWN = 3,
+ MSN_AUTH_LIVE_SECURE = 3,
MSN_AUTH_SPACES = 4,
MSN_AUTH_LIVE_CONTACTS = 5,
MSN_AUTH_STORAGE = 6
@@ -134,7 +134,7 @@ GHashTable *msn_nexus_get_token(MsnNexus
MsnNexus *msn_nexus_new(MsnSession *session);
void msn_nexus_destroy(MsnNexus *nexus);
GHashTable *msn_nexus_get_token(MsnNexus *session, MsnAuthDomains id);
-char *msn_nexus_get_token_str(MsnNexus *session, MsnAuthDomains id);
+const char *msn_nexus_get_token_str(MsnNexus *session, MsnAuthDomains id);
#endif /* _MSN_NEXUS_H_ */
============================================================
--- libpurple/protocols/msn/oim.c a2a5dd622dab1100c66ec242146641173fa29260
+++ libpurple/protocols/msn/oim.c 763bfb4189bbaffafc2a75e73f0fdb107db6818b
@@ -217,7 +217,7 @@ msn_oim_send_msg(MsnOim *oim)
msn_oim_send_msg(MsnOim *oim)
{
MsnOimSendReq *oim_request;
- char *soap_body,*mspauth;
+ char *soap_body;
char *msg_body;
g_return_if_fail(oim != NULL);
@@ -225,16 +225,12 @@ msn_oim_send_msg(MsnOim *oim)
g_return_if_fail(oim_request != NULL);
purple_debug_info("MSNP14","sending OIM: %s\n", oim_request->oim_msg);
- mspauth = g_strdup_printf("t=%s&p=%s",
- oim->session->passport_info.t,
- oim->session->passport_info.p
- );
/* if we got the challenge lock key, we compute it
* else we go for the SOAP fault and resend it.
*/
if(oim->challenge == NULL){
- purple_debug_info("MSNP14","no lock key challenge,wait for SOAP Fault and Resend\n");
+ purple_debug_info("MSNP14","no lock key challenge, wait for SOAP Fault and Resend\n");
}
msg_body = msn_oim_msg_to_str(oim, oim_request->oim_msg);
@@ -242,7 +238,7 @@ msn_oim_send_msg(MsnOim *oim)
oim_request->from_member,
oim_request->friendname,
oim_request->to_member,
- mspauth,
+ msn_nexus_get_token_str(oim->session->nexus, MSN_AUTH_LIVE_SECURE),
MSNP15_WLM_PRODUCT_ID,
oim->challenge ? oim->challenge : "",
oim->send_seq,
@@ -258,7 +254,6 @@ msn_oim_send_msg(MsnOim *oim)
oim->send_seq++;
}
- g_free(mspauth);
g_free(msg_body);
g_free(soap_body);
}
============================================================
--- libpurple/protocols/msn/oim.h 94d3c95e519fd6c01f264cb5a53afb94d5e9c8fc
+++ libpurple/protocols/msn/oim.h a1b35da8b51101307ea29a1f5e4be96e89c2e4e3
@@ -81,7 +81,7 @@
#define MSN_OIM_SEND_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\
"<soap:Header>"\
- "<From memberName=\"%s\" friendlyName=\"%s\" xml:lang=\"en-US\" proxy=\"MSNMSGR\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\" msnpVer=\"MSNP14\" buildVer=\"8.0.0792\"/>"\
+ "<From memberName=\"%s\" friendlyName=\"%s\" xml:lang=\"en-US\" proxy=\"MSNMSGR\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\" msnpVer=\"MSNP15\" buildVer=\"8.1.0178\"/>"\
"<To memberName=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>"\
"<Ticket passport=\"%s\" appid=\"%s\" lockkey=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>"\
"<Sequence xmlns=\"http://schemas.xmlsoap.org/ws/2003/03/rm\">"\
More information about the Commits
mailing list