cpw.qulogic.msn: b5056147: Modifications to the MSN code for some s...
qulogic at pidgin.im
qulogic at pidgin.im
Sun Jun 15 04:26:11 EDT 2008
-----------------------------------------------------------------
Revision: b50561476118e3f815612952d2eb768a945bf0e2
Ancestor: 5cfe3cd23d4a1eb60980e0ad2098d8bf2ba831ce
Author: qulogic at pidgin.im
Date: 2008-06-15T08:08:22
Branch: im.pidgin.cpw.qulogic.msn
URL: http://d.pidgin.im/viewmtn/revision/info/b50561476118e3f815612952d2eb768a945bf0e2
Modified files:
libpurple/protocols/msn/contact.c
libpurple/protocols/msn/msn.h
libpurple/protocols/msn/notification.c
libpurple/protocols/msn/user.c
libpurple/protocols/msn/user.h
ChangeLog:
Modifications to the MSN code for some stuff I'll be doing in later
commits.
* Rename MsnUserType to MsnNetwork, because it's a really a Network
ID. Updated the list of networks based on msnpiki.
* Updated list of Client capabilities based on ZoRoNaX' blog:
http://zoronax.spaces.live.com/blog/cns!4A0B813054895814!156.entry
* Save the clientid of contacts.
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/contact.c 8ebee01ab8ed341a6c28f37bc881782748c8066d
+++ libpurple/protocols/msn/contact.c 6dcc210c613b957689a0c6463284759ba85406dd
@@ -176,23 +176,26 @@ msn_get_memberrole(const char *role)
return 0;
}
-/*get User Type*/
-static int
-msn_get_user_type(char *type)
+/* get Network */
+/* QuLogic: These names don't really refer to the MsnNetwork,
+ * but I haven't yet written the code to properly use them.
+ */
+static MsnNetwork
+msn_get_network(char *type)
{
g_return_val_if_fail(type != NULL, 0);
if (!strcmp(type,"Regular")) {
- return MSN_USER_TYPE_PASSPORT;
+ return MSN_NETWORK_PASSPORT;
}
if (!strcmp(type,"Live")) {
- return MSN_USER_TYPE_PASSPORT;
+ return MSN_NETWORK_PASSPORT;
}
if (!strcmp(type,"LivePending")) {
- return MSN_USER_TYPE_PASSPORT;
+ return MSN_NETWORK_PASSPORT;
}
- return MSN_USER_TYPE_UNKNOWN;
+ return MSN_NETWORK_UNKNOWN;
}
/* Create the AddressBook in the server, if we don't have one */
@@ -519,7 +522,7 @@ msn_parse_addressbook_contacts(MsnSessio
xmlnode *contactId, *contactInfo, *contactType, *passportName, *displayName, *guid, *groupIds, *messenger_user;
xmlnode *annotation;
MsnUser *user;
- MsnUserType usertype;
+ MsnNetwork networkId;
if (!(contactId = xmlnode_get_child(contactNode,"contactId"))
|| !(contactInfo = xmlnode_get_child(contactNode, "contactInfo"))
@@ -560,7 +563,7 @@ msn_parse_addressbook_contacts(MsnSessio
g_free(is_messenger_user);
}
- usertype = msn_get_user_type(type);
+ networkId = msn_get_network(type);
passportName = xmlnode_get_child(contactInfo, "passportName");
if (passportName == NULL) {
xmlnode *emailsNode, *contactEmailNode, *emailNode;
@@ -591,7 +594,7 @@ msn_parse_addressbook_contacts(MsnSessio
if(msnEnabled && !strcmp(msnEnabled, "true")) {
/*Messenger enabled, Get the Passport*/
purple_debug_info("MsnAB", "Yahoo User %s\n", passport ? passport : "(null)");
- usertype = MSN_USER_TYPE_YAHOO;
+ networkId = MSN_NETWORK_YAHOO;
g_free(msnEnabled);
break;
} else {
@@ -630,7 +633,7 @@ msn_parse_addressbook_contacts(MsnSessio
user = msn_userlist_find_add_user(session->userlist, passport, Name);
msn_user_set_uid(user, uid);
- msn_user_set_type(user, usertype);
+ msn_user_set_network(user, networkId);
msn_user_set_mobile_phone(user, mobile_number);
groupIds = xmlnode_get_child(contactInfo, "groupIds");
============================================================
--- libpurple/protocols/msn/msn.h f439804fe5b0b86f9c52cd47be59fea92d1f78e5
+++ libpurple/protocols/msn/msn.h c0faa85e58b26fb5c404e1697a11550abb944b32
@@ -105,18 +105,25 @@ typedef enum
typedef enum
{
- MSN_CLIENT_CAP_WIN_MOBILE = 0x00001,
- MSN_CLIENT_CAP_UNKNOWN_1 = 0x00002,
- MSN_CLIENT_CAP_INK_GIF = 0x00004,
- MSN_CLIENT_CAP_INK_ISF = 0x00008,
- MSN_CLIENT_CAP_VIDEO_CHAT = 0x00010,
- MSN_CLIENT_CAP_BASE = 0x00020,
- MSN_CLIENT_CAP_MSNMOBILE = 0x00040,
- MSN_CLIENT_CAP_MSNDIRECT = 0x00080,
- MSN_CLIENT_CAP_WEBMSGR = 0x00100,
- MSN_CLIENT_CAP_DIRECTIM = 0x04000,
- MSN_CLIENT_CAP_WINKS = 0x08000,
- MSN_CLIENT_CAP_SEARCH = 0x10000
+ MSN_CLIENT_CAP_WIN_MOBILE = 0x000001,
+ MSN_CLIENT_CAP_INK_GIF = 0x000004,
+ MSN_CLIENT_CAP_INK_ISF = 0x000008,
+ MSN_CLIENT_CAP_VIDEO_CHAT = 0x000010,
+ MSN_CLIENT_CAP_PACKET = 0x000020,
+ MSN_CLIENT_CAP_MSNMOBILE = 0x000040,
+ MSN_CLIENT_CAP_MSNDIRECT = 0x000080,
+ MSN_CLIENT_CAP_WEBMSGR = 0x000200,
+ MSN_CLIENT_CAP_TGW = 0x000800,
+ MSN_CLIENT_CAP_SPACE = 0x001000,
+ MSN_CLIENT_CAP_MCE = 0x002000,
+ MSN_CLIENT_CAP_DIRECTIM = 0x004000,
+ MSN_CLIENT_CAP_WINKS = 0x008000,
+ MSN_CLIENT_CAP_SEARCH = 0x010000,
+ MSN_CLIENT_CAP_BOT = 0x020000,
+ MSN_CLIENT_CAP_VOICEIM = 0x040000,
+ MSN_CLIENT_CAP_SCHANNEL = 0x080000,
+ MSN_CLIENT_CAP_SIP_INVITE = 0x100000,
+ MSN_CLIENT_CAP_SDRIVE = 0x400000
} MsnClientCaps;
@@ -127,19 +134,18 @@ typedef enum
MSN_CLIENT_VER_6_1 = 0x20, /* MSNC2 */
MSN_CLIENT_VER_6_2 = 0x30, /* MSNC3 */
MSN_CLIENT_VER_7_0 = 0x40, /* MSNC4 */
- MSN_CLIENT_VER_7_5 = 0x50 /* MSNC5 */
+ MSN_CLIENT_VER_7_5 = 0x50, /* MSNC5 */
+ MSN_CLIENT_VER_8_0 = 0x60, /* MSNC6 */
+ MSN_CLIENT_VER_8_1 = 0x70, /* MSNC7 */
+ MSN_CLIENT_VER_8_5 = 0x80 /* MSNC8 */
} MsnClientVerId;
#define MSN_CLIENT_ID_VERSION MSN_CLIENT_VER_7_0
-#define MSN_CLIENT_ID_RESERVED_1 0x00
-#define MSN_CLIENT_ID_RESERVED_2 0x00
-#define MSN_CLIENT_ID_CAPABILITIES MSN_CLIENT_CAP_BASE
+#define MSN_CLIENT_ID_CAPABILITIES MSN_CLIENT_CAP_PACKET
#define MSN_CLIENT_ID \
((MSN_CLIENT_ID_VERSION << 24) | \
- (MSN_CLIENT_ID_RESERVED_1 << 16) | \
- (MSN_CLIENT_ID_RESERVED_2 << 8) | \
(MSN_CLIENT_ID_CAPABILITIES))
void msn_act_id(PurpleConnection *gc, const char *entry);
============================================================
--- libpurple/protocols/msn/notification.c 5a6bfc91beddb8580feb738650620654ba90db2b
+++ libpurple/protocols/msn/notification.c 70ad836eef568b666503730aa6944ee76add41d7
@@ -556,7 +556,7 @@ static void
**************************************************************************/
/* add contact to xmlnode */
static void
-msn_add_contact_xml(MsnSession *session, xmlnode *mlNode,const char *passport, MsnListOp list_op, MsnUserType type)
+msn_add_contact_xml(MsnSession *session, xmlnode *mlNode,const char *passport, MsnListOp list_op, MsnNetwork networkId)
{
xmlnode *d_node,*c_node;
char **tokens;
@@ -565,7 +565,7 @@ msn_add_contact_xml(MsnSession *session,
g_return_if_fail(passport != NULL);
- purple_debug_info("MSNP14","Passport: %s, type: %d\n", passport, type);
+ purple_debug_info("MSNP14","Passport: %s, type: %d\n", passport, networkId);
tokens = g_strsplit(passport, "@", 2);
email = tokens[0];
domain = tokens[1];
@@ -603,12 +603,12 @@ msn_add_contact_xml(MsnSession *session,
g_snprintf(fmt_str, sizeof(fmt_str), "%d", list_op);
xmlnode_set_attrib(c_node, "l", fmt_str);
- if (type != MSN_USER_TYPE_UNKNOWN)
- g_snprintf(fmt_str, sizeof(fmt_str), "%d", type);
+ if (networkId != MSN_NETWORK_UNKNOWN)
+ g_snprintf(fmt_str, sizeof(fmt_str), "%d", networkId);
else if (msn_user_is_yahoo(session->account, passport))
- g_snprintf(fmt_str, sizeof(fmt_str), "%d", MSN_USER_TYPE_YAHOO);
+ g_snprintf(fmt_str, sizeof(fmt_str), "%d", MSN_NETWORK_YAHOO);
else
- g_snprintf(fmt_str, sizeof(fmt_str), "%d", MSN_USER_TYPE_PASSPORT);
+ g_snprintf(fmt_str, sizeof(fmt_str), "%d", MSN_NETWORK_PASSPORT);
/*mobile*/
//type_str = g_strdup_printf("4");
@@ -654,7 +654,7 @@ msn_notification_dump_contact(MsnSession
continue;
msn_add_contact_xml(session, adl_node, user->passport,
- user->list_op & MSN_LIST_OP_MASK, user->type);
+ user->list_op & MSN_LIST_OP_MASK, user->networkid);
/* each ADL command may contain up to 150 contacts */
if (++adl_count % 150 == 0 || l->next == NULL) {
@@ -1019,7 +1019,7 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand
MsnUser *user;
MsnObject *msnobj;
unsigned long clientid;
- int wlmclient;
+ int networkid;
const char *state, *passport, *friendly;
session = cmdproc->session;
@@ -1029,7 +1029,7 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand
state = cmd->params[1];
passport = cmd->params[2];
/*if a contact is actually on the WLM part or the yahoo part*/
- wlmclient = atoi(cmd->params[3]);
+ networkid = atoi(cmd->params[3]);
friendly = purple_url_decode(cmd->params[4]);
user = msn_userlist_find_user(session->userlist, passport);
@@ -1046,6 +1046,8 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand
clientid = strtoul(cmd->params[5], NULL, 10);
user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE) || (user->phone.mobile && user->phone.mobile[0] == '+');
+ msn_user_set_clientid(user, clientid);
+ msn_user_set_network(user, networkid);
msn_user_set_state(user, state);
msn_user_update(user);
@@ -1127,7 +1129,7 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand
MsnUser *user;
MsnObject *msnobj;
unsigned long clientid;
- int wlmclient;
+ int networkid;
const char *state, *passport, *friendly, *old_friendly;
session = cmdproc->session;
@@ -1136,7 +1138,7 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand
state = cmd->params[0];
passport = cmd->params[1];
- wlmclient = atoi(cmd->params[2]);
+ networkid = atoi(cmd->params[2]);
friendly = purple_url_decode(cmd->params[3]);
user = msn_userlist_find_user(session->userlist, passport);
@@ -1164,6 +1166,9 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand
clientid = strtoul(cmd->params[4], NULL, 10);
user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE) || (user->phone.mobile && user->phone.mobile[0] == '+');
+ msn_user_set_clientid(user, clientid);
+ msn_user_set_network(user, networkid);
+
msn_user_set_state(user, state);
msn_user_update(user);
}
@@ -2038,7 +2043,7 @@ msn_notification_add_buddy_to_list(MsnNo
adl_node->child = NULL;
msn_add_contact_xml(notification->session, adl_node, who, list_op,
- MSN_USER_TYPE_PASSPORT);
+ MSN_NETWORK_PASSPORT);
payload = xmlnode_to_str(adl_node,&payload_len);
xmlnode_free(adl_node);
@@ -2064,7 +2069,7 @@ msn_notification_rem_buddy_from_list(Msn
rml_node = xmlnode_new("ml");
rml_node->child = NULL;
- msn_add_contact_xml(notification->session, rml_node, who, list_op, MSN_USER_TYPE_PASSPORT);
+ msn_add_contact_xml(notification->session, rml_node, who, list_op, MSN_NETWORK_PASSPORT);
payload = xmlnode_to_str(rml_node, &payload_len);
xmlnode_free(rml_node);
============================================================
--- libpurple/protocols/msn/user.c 1935d7378235c0ef981cc9dcd70f54237df38352
+++ libpurple/protocols/msn/user.c e9e6f90f56daf7bdd8e996ba3983086800ea1865
@@ -198,14 +198,6 @@ void
}
void
-msn_user_set_type(MsnUser *user, MsnUserType type)
-{
- g_return_if_fail(user != NULL);
-
- user->type = type;
-}
-
-void
msn_user_set_op(MsnUser *user, int list_op)
{
g_return_if_fail(user != NULL);
@@ -308,7 +300,7 @@ msn_user_is_yahoo(PurpleAccount *account
if ((session != NULL) && (user = msn_userlist_find_user(session->userlist, name)) != NULL)
{
- return (user->type == MSN_USER_TYPE_YAHOO);
+ return (user->networkid == MSN_NETWORK_YAHOO);
}
return (strstr(name,"@yahoo.") != NULL);
}
@@ -358,6 +350,22 @@ void
}
void
+msn_user_set_clientid(MsnUser *user, guint clientid)
+{
+ g_return_if_fail(user != NULL);
+
+ user->clientid = clientid;
+}
+
+void
+msn_user_set_network(MsnUser *user, MsnNetwork network)
+{
+ g_return_if_fail(user != NULL);
+
+ user->networkid = network;
+}
+
+void
msn_user_set_object(MsnUser *user, MsnObject *obj)
{
g_return_if_fail(user != NULL);
@@ -423,6 +431,14 @@ msn_user_get_mobile_phone(const MsnUser
return user->phone.mobile;
}
+guint
+msn_user_get_clientid(const MsnUser *user)
+{
+ g_return_val_if_fail(user != NULL, 0);
+
+ return user->clientid;
+}
+
MsnObject *
msn_user_get_object(const MsnUser *user)
{
============================================================
--- libpurple/protocols/msn/user.h b8c757b0e86fcd7f0e3040adcc0e2f8b92789a0c
+++ libpurple/protocols/msn/user.h 444e18d26caee1e1627bf1d9ce88a017893958e3
@@ -33,14 +33,14 @@ typedef enum
typedef enum
{
- MSN_USER_TYPE_UNKNOWN = 0x00,
- MSN_USER_TYPE_PASSPORT = 0x01,
- MSN_USER_TYPE_UNKNOWN1 = 0x02,
- MSN_USER_TYPE_MOBILE = 0x04,
- MSN_USER_TYPE_UNKNOWN2 = 0x08,
- MSN_USER_TYPE_UNKNOWN3 = 0x10,
- MSN_USER_TYPE_YAHOO = 0x20
-} MsnUserType;
+ MSN_NETWORK_UNKNOWN = 0x00,
+ MSN_NETWORK_PASSPORT = 0x01,
+ MSN_NETWORK_COMMUNICATOR = 0x02,
+ MSN_NETWORK_MOBILE = 0x04,
+ MSN_NETWORK_MNI = 0x08,
+ MSN_NETWORK_SMTP = 0x10,
+ MSN_NETWORK_YAHOO = 0x20
+} MsnNetwork;
/**
* Current media.
@@ -87,8 +87,10 @@ struct _MsnUser
GHashTable *clientcaps; /**< The client's capabilities. */
- MsnUserType type; /**< The user type */
+ guint clientid; /**< The client's ID */
+ MsnNetwork networkid; /**< The user's network */
+
int list_op; /**< Which lists the user is in */
guint membership_id[5]; /**< The membershipId sent by the contacts server,
@@ -218,9 +220,24 @@ void msn_user_set_uid(MsnUser *user, con
void msn_user_set_work_phone(MsnUser *user, const char *number);
void msn_user_set_uid(MsnUser *user, const char *uid);
-void msn_user_set_type(MsnUser *user, MsnUserType type);
/**
+ * Sets the client id for a user.
+ *
+ * @param user The user.
+ * @param clientid The client id.
+ */
+void msn_user_set_clientid(MsnUser *user, guint clientid);
+
+/**
+ * Sets the network id for a user.
+ *
+ * @param user The user.
+ * @param network The network id.
+ */
+void msn_user_set_network(MsnUser *user, MsnNetwork network);
+
+/**
* Sets the mobile phone number for a user.
*
* @param user The user.
@@ -291,6 +308,24 @@ const char *msn_user_get_mobile_phone(co
const char *msn_user_get_mobile_phone(const MsnUser *user);
/**
+ * Returns the client id for a user.
+ *
+ * @param user The user.
+ *
+ * @return The user's client id.
+ */
+guint msn_user_get_clientid(const MsnUser *user);
+
+/**
+ * Returns the network id for a user.
+ *
+ * @param user The user.
+ *
+ * @return The user's network id.
+ */
+MsnNetwork msn_user_get_network(const MsnUser *user);
+
+/**
* Returns the MSNObject for a user.
*
* @param user The user.
More information about the Commits
mailing list