libpurple/protocols/msn/notification.c

Mon, 10 Feb 2014 00:56:22 +0530

author
Ankit Vani <a@nevitus.org>
date
Mon, 10 Feb 2014 00:56:22 +0530
branch
gtkdoc-conversion
changeset 35499
c4c5e0a670b1
parent 34955
854143116575
child 36049
bffbd724134d
permissions
-rw-r--r--

Fix namespaces issues in libpurple.
Renamed:
'empty_to_null' to 'purple_emptystr_to_null'
'null_to_empty' to 'purple_null_to_emptystr'
'DBUS_SERVICE_PURPLE' to 'PURPLE_DBUS_SERVICE'
'DBUS_PATH_PURPLE' to 'PURPLE_DBUS_PATH'
'DBUS_INTERFACE_PURPLE' to 'PURPLE_DBUS_INTERFACE'
'serv_*' to 'purple_serv_*'
'StunCallback' to 'PurpleStunCallback'
'PTFunc' to 'PurpleThemeFunc'
'UPnPMappingAddRemove' to 'PurpleUPnPMappingAddRemove'

5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file notification.c Notification server functions
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
4 * purple
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
9198
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9197
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9197
diff changeset
8 * source distribution.
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
9 *
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * (at your option) any later version.
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 *
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * GNU General Public License for more details.
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 *
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 18805
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 */
30945
b875cf477e19 Remove unnecesary includes from msn.h.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30929
diff changeset
24
30961
885064b16c54 Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30945
diff changeset
25 #include "internal.h"
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
26 #include "ciphers/md5hash.h"
29449
ebd102c14c0b Support sending different client types in PrivateEndpointData.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29448
diff changeset
27 #include "core.h"
30964
9d1d81d204fc Cleanup notification.c includes
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30961
diff changeset
28 #include "debug.h"
9d1d81d204fc Cleanup notification.c includes
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30961
diff changeset
29
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 #include "notification.h"
30964
9d1d81d204fc Cleanup notification.c includes
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30961
diff changeset
31
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23770
diff changeset
32 #include "contact.h"
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 #include "error.h"
20475
0b3826f0e687 The first msn-p13-merge-head.diff.gz from SF Patch #1621854 from Ka-Hing Cheung.
Richard Laager <rlaager@pidgin.im>
parents: 20474
diff changeset
34 #include "msnutils.h"
30964
9d1d81d204fc Cleanup notification.c includes
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30961
diff changeset
35 #include "state.h"
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
36 #include "userlist.h"
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
38 static MsnTable *cbs_table;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 /**************************************************************************
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
41 * Main
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
42 **************************************************************************/
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
43
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
44 static void
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
45 destroy_cb(MsnServConn *servconn)
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
46 {
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
47 MsnNotification *notification;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
48
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
49 notification = servconn->cmdproc->data;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
50 g_return_if_fail(notification != NULL);
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
51
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
52 msn_notification_destroy(notification);
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
53 }
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
54
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
55 MsnNotification *
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
56 msn_notification_new(MsnSession *session)
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
57 {
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
58 MsnNotification *notification;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
59 MsnServConn *servconn;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
60
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
61 g_return_val_if_fail(session != NULL, NULL);
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
62
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
63 notification = g_new0(MsnNotification, 1);
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
64
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
65 notification->session = session;
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
66 notification->servconn = servconn = msn_servconn_new(session, MSN_SERVCONN_NS);
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
67 msn_servconn_set_destroy_cb(servconn, destroy_cb);
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
68
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
69 notification->cmdproc = servconn->cmdproc;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
70 notification->cmdproc->data = notification;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
71 notification->cmdproc->cbs_table = cbs_table;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
72
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
73 return notification;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
74 }
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
75
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
76 void
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
77 msn_notification_destroy(MsnNotification *notification)
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
78 {
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
79 notification->cmdproc->data = NULL;
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
80
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
81 msn_servconn_set_destroy_cb(notification->servconn, NULL);
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
82
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
83 msn_servconn_destroy(notification->servconn);
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
84
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
85 g_free(notification);
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
86 }
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
87
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
88 /**************************************************************************
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
89 * Connect
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
90 **************************************************************************/
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
91
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
92 static void
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
93 connect_cb(MsnServConn *servconn)
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
94 {
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
95 MsnCmdProc *cmdproc;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
96 MsnSession *session;
30908
a56cb7eb6036 msn: Delete msn_cmdproc_send since it just have duplicated code from
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30900
diff changeset
97 MsnTransaction *trans;
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
98 GString *vers;
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
99 const char *ver_str;
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
100 int i;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
101
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
102 g_return_if_fail(servconn != NULL);
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
103
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
104 cmdproc = servconn->cmdproc;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
105 session = servconn->session;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
106
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
107 vers = g_string_new("");
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
108
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
109 for (i = WLM_MAX_PROTOCOL; i >= WLM_MIN_PROTOCOL; i--)
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
110 g_string_append_printf(vers, " MSNP%d", i);
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
111
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
112 g_string_append(vers, " CVR0");
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
113
10519
80801a34a246 [gaim-migrate @ 11833]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10514
diff changeset
114 if (session->login_step == MSN_LOGIN_STEP_START)
80801a34a246 [gaim-migrate @ 11833]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10514
diff changeset
115 msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE);
80801a34a246 [gaim-migrate @ 11833]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10514
diff changeset
116 else
80801a34a246 [gaim-migrate @ 11833]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10514
diff changeset
117 msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE2);
10514
3d6cb5d53e97 [gaim-migrate @ 11814]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10504
diff changeset
118
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
119 /* Skip the initial space */
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
120 ver_str = (vers->str + 1);
30908
a56cb7eb6036 msn: Delete msn_cmdproc_send since it just have duplicated code from
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30900
diff changeset
121 trans = msn_transaction_new(cmdproc, "VER", "%s", ver_str);
a56cb7eb6036 msn: Delete msn_cmdproc_send since it just have duplicated code from
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30900
diff changeset
122 msn_cmdproc_send_trans(cmdproc, trans);
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
123
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
124 g_string_free(vers, TRUE);
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
125 }
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
126
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
127 gboolean
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
128 msn_notification_connect(MsnNotification *notification, const char *host, int port)
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
129 {
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
130 MsnServConn *servconn;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
131
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
132 g_return_val_if_fail(notification != NULL, FALSE);
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
133
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
134 servconn = notification->servconn;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
135
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
136 msn_servconn_set_connect_cb(servconn, connect_cb);
23816
fd601d075bd0 Allow forcing an MSN HTTP connection to connect to a new server. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23814
diff changeset
137 notification->in_use = msn_servconn_connect(servconn, host, port, TRUE);
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
138
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
139 return notification->in_use;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
140 }
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
141
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
142 void
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
143 msn_notification_disconnect(MsnNotification *notification)
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
144 {
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
145 g_return_if_fail(notification != NULL);
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
146 g_return_if_fail(notification->in_use);
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
147
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
148 msn_servconn_disconnect(notification->servconn);
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
149
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
150 notification->in_use = FALSE;
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
151 }
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
152
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
153 /**************************************************************************
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154 * Login
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155 **************************************************************************/
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
156
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
157 void
23756
1569608cab71 Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23755
diff changeset
158 msn_got_login_params(MsnSession *session, const char *ticket, const char *response)
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
159 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
160 MsnCmdProc *cmdproc;
30908
a56cb7eb6036 msn: Delete msn_cmdproc_send since it just have duplicated code from
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30900
diff changeset
161 MsnTransaction *trans;
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
162
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
163 cmdproc = session->notification->cmdproc;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
164
10519
80801a34a246 [gaim-migrate @ 11833]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10514
diff changeset
165 msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_END);
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
166
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
167 trans = msn_transaction_new(cmdproc, "USR", "SSO S %s %s %s", ticket, response, session->guid);
30908
a56cb7eb6036 msn: Delete msn_cmdproc_send since it just have duplicated code from
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30900
diff changeset
168
a56cb7eb6036 msn: Delete msn_cmdproc_send since it just have duplicated code from
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30900
diff changeset
169 msn_cmdproc_send_trans(cmdproc, trans);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
170 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
171
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
172 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
173 cvr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
175 PurpleAccount *account;
30908
a56cb7eb6036 msn: Delete msn_cmdproc_send since it just have duplicated code from
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30900
diff changeset
176 MsnTransaction *trans;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
178 account = cmdproc->session->account;
23756
1569608cab71 Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23755
diff changeset
179
30908
a56cb7eb6036 msn: Delete msn_cmdproc_send since it just have duplicated code from
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30900
diff changeset
180 trans = msn_transaction_new(cmdproc, "USR", "SSO I %s", purple_account_get_username(account));
a56cb7eb6036 msn: Delete msn_cmdproc_send since it just have duplicated code from
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30900
diff changeset
181 msn_cmdproc_send_trans(cmdproc, trans);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
184 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
185 usr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 {
31106
d7a39e5eb4c1 Remove dead assignments in new MSN code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31076
diff changeset
187 MsnSession *session = cmdproc->session;
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
188
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
189 if (!g_ascii_strcasecmp(cmd->params[1], "OK"))
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
190 {
13853
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
191 /* authenticate OK */
10519
80801a34a246 [gaim-migrate @ 11833]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10514
diff changeset
192 msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 }
23756
1569608cab71 Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23755
diff changeset
194 else if (!g_ascii_strcasecmp(cmd->params[1], "SSO"))
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
195 {
23756
1569608cab71 Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23755
diff changeset
196 /* RPS authentication */
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
197
31985
7efe159c1242 Destroy the existing Nexus if we get a second USR SSO. This might
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31561
diff changeset
198 if (session->nexus)
7efe159c1242 Destroy the existing Nexus if we get a second USR SSO. This might
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31561
diff changeset
199 msn_nexus_destroy(session->nexus);
7efe159c1242 Destroy the existing Nexus if we get a second USR SSO. This might
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31561
diff changeset
200
8171
c3c43a25caec [gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8029
diff changeset
201 session->nexus = msn_nexus_new(session);
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
202
23756
1569608cab71 Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23755
diff changeset
203 session->nexus->policy = g_strdup(cmd->params[3]);
1569608cab71 Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23755
diff changeset
204 session->nexus->nonce = g_strdup(cmd->params[4]);
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
205
10519
80801a34a246 [gaim-migrate @ 11833]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10514
diff changeset
206 msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_START);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
208 msn_nexus_connect(session->nexus);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
212 static void
10568
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
213 usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
214 {
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
215 MsnErrorType msnerr = 0;
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
216
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
217 switch (error)
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
218 {
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
219 case 500:
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
220 case 601:
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
221 case 910:
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
222 case 921:
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
223 msnerr = MSN_ERROR_SERV_UNAVAILABLE;
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
224 break;
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
225 case 911:
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
226 msnerr = MSN_ERROR_AUTH;
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
227 break;
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
228 default:
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
229 return;
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
230 break;
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
231 }
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
232
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
233 msn_session_set_error(cmdproc->session, msnerr, NULL);
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
234 }
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
235
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
236 static void
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
237 ver_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
238 {
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
239 MsnSession *session;
30908
a56cb7eb6036 msn: Delete msn_cmdproc_send since it just have duplicated code from
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30900
diff changeset
240 MsnTransaction *trans;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
241 PurpleAccount *account;
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
242 gboolean protocol_supported = FALSE;
34304
faf0414a8b51 Fix most of libpurple warnings about -Wsign-compare
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33909
diff changeset
243 guint proto_ver;
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
244 size_t i;
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
245
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
246 session = cmdproc->session;
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
247 account = session->account;
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
248
29421
4259f9512ab4 Fix MSN protocol version detection to use the best version returned by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29420
diff changeset
249 session->protocol_ver = 0;
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
250 for (i = 1; i < cmd->param_count; i++)
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
251 {
34304
faf0414a8b51 Fix most of libpurple warnings about -Wsign-compare
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33909
diff changeset
252 if (sscanf(cmd->params[i], "MSNP%u", &proto_ver) == 1) {
29421
4259f9512ab4 Fix MSN protocol version detection to use the best version returned by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29420
diff changeset
253 if (proto_ver >= WLM_MIN_PROTOCOL
4259f9512ab4 Fix MSN protocol version detection to use the best version returned by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29420
diff changeset
254 && proto_ver <= WLM_MAX_PROTOCOL
4259f9512ab4 Fix MSN protocol version detection to use the best version returned by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29420
diff changeset
255 && proto_ver > session->protocol_ver) {
4259f9512ab4 Fix MSN protocol version detection to use the best version returned by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29420
diff changeset
256 protocol_supported = TRUE;
4259f9512ab4 Fix MSN protocol version detection to use the best version returned by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29420
diff changeset
257 session->protocol_ver = proto_ver;
4259f9512ab4 Fix MSN protocol version detection to use the best version returned by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29420
diff changeset
258 }
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
259 }
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
260 }
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
261
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
262 if (!protocol_supported)
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
263 {
10519
80801a34a246 [gaim-migrate @ 11833]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10514
diff changeset
264 msn_session_set_error(session, MSN_ERROR_UNSUPPORTED_PROTOCOL,
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
265 NULL);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
266 return;
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
267 }
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
268
29421
4259f9512ab4 Fix MSN protocol version detection to use the best version returned by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29420
diff changeset
269 purple_debug_info("msn", "Negotiated protocol version %d with the server.\n", session->protocol_ver);
4259f9512ab4 Fix MSN protocol version detection to use the best version returned by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29420
diff changeset
270
13853
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
271 /*
23776
7c9016406cf1 explicit merge of 'b99873683821d4c450ce32e4a93ba2831d7507cc'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23444 23773
diff changeset
272 * Windows Live Messenger 8.5
13853
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
273 * Notice :CVR String discriminate!
13856
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
274 * reference of http://www.microsoft.com/globaldev/reference/oslocversion.mspx
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
275 * to see the Local ID
13853
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
276 */
30908
a56cb7eb6036 msn: Delete msn_cmdproc_send since it just have duplicated code from
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30900
diff changeset
277 trans = msn_transaction_new(cmdproc, "CVR",
24405
426c92d923a3 Update MSN Client Version (CVR) string to match 8.5.1302.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24404
diff changeset
278 "0x0409 winnt 5.1 i386 MSNMSGR 8.5.1302 BC01 %s",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
279 purple_account_get_username(account));
30908
a56cb7eb6036 msn: Delete msn_cmdproc_send since it just have duplicated code from
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30900
diff changeset
280 msn_cmdproc_send_trans(cmdproc, trans);
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
281 }
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
282
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283 /**************************************************************************
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284 * Log out
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
285 **************************************************************************/
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
286
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
287 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
288 out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
289 {
23824
6dc2d641cfae When receiving an MSN OUT, don't try to dereference cmd->params when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23816
diff changeset
290 if (cmd->param_count == 0)
6dc2d641cfae When receiving an MSN OUT, don't try to dereference cmd->params when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23816
diff changeset
291 msn_session_set_error(cmdproc->session, -1, NULL);
6dc2d641cfae When receiving an MSN OUT, don't try to dereference cmd->params when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23816
diff changeset
292 else if (!g_ascii_strcasecmp(cmd->params[0], "OTH"))
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
293 msn_session_set_error(cmdproc->session, MSN_ERROR_SIGN_OTHER,
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
294 NULL);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
295 else if (!g_ascii_strcasecmp(cmd->params[0], "SSD"))
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
296 msn_session_set_error(cmdproc->session, MSN_ERROR_SERV_DOWN, NULL);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
297 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
299 void
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
300 msn_notification_close(MsnNotification *notification)
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
301 {
30909
db4b1876a304 msn: Remove msn_cmdproc_send_quick in favor of msn_cmdproc_send_trans
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30908
diff changeset
302 MsnTransaction *trans;
db4b1876a304 msn: Remove msn_cmdproc_send_quick in favor of msn_cmdproc_send_trans
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30908
diff changeset
303
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
304 g_return_if_fail(notification != NULL);
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
305
10568
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
306 if (!notification->in_use)
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
307 return;
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
308
30914
24c47e42518a Fix a few little things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30910
diff changeset
309 trans = msn_transaction_new(notification->cmdproc, "OUT", NULL);
30915
56295f0a8ade I don't really like this name.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30914
diff changeset
310 msn_transaction_set_saveable(trans, FALSE);
30909
db4b1876a304 msn: Remove msn_cmdproc_send_quick in favor of msn_cmdproc_send_trans
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30908
diff changeset
311 msn_cmdproc_send_trans(notification->cmdproc, trans);
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
312
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
313 msn_notification_disconnect(notification);
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
314 }
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
315
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316 /**************************************************************************
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
317 * Messages
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
318 **************************************************************************/
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
319
8646
74d0e7406e3b [gaim-migrate @ 9398]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8614
diff changeset
320 static void
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
321 msg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
322 size_t len)
8646
74d0e7406e3b [gaim-migrate @ 9398]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8614
diff changeset
323 {
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
324 MsnMessage *msg;
8646
74d0e7406e3b [gaim-migrate @ 9398]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8614
diff changeset
325
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
326 msg = msn_message_new_from_cmd(cmdproc->session, cmd);
8646
74d0e7406e3b [gaim-migrate @ 9398]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8614
diff changeset
327
23814
a35ff14f5fa7 Remove some MSN code duplication in processing messages from Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23810
diff changeset
328 msn_message_parse_payload(msg, payload, len, MSG_LINE_DEM, MSG_BODY_DEM);
27691
d77b2890043e Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27361
diff changeset
329 if (purple_debug_is_verbose())
d77b2890043e Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27361
diff changeset
330 msn_message_show_readable(msg, "Notification", TRUE);
8646
74d0e7406e3b [gaim-migrate @ 9398]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8614
diff changeset
331
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
332 msn_cmdproc_process_msg(cmdproc, msg);
8646
74d0e7406e3b [gaim-migrate @ 9398]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8614
diff changeset
333
31162
2c596217766b msn_message_destroy() calls msn_message_unref() if refcount>0. This is
Mark Doliner <markdoliner@pidgin.im>
parents: 31136
diff changeset
334 msn_message_unref(msg);
8646
74d0e7406e3b [gaim-migrate @ 9398]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8614
diff changeset
335 }
74d0e7406e3b [gaim-migrate @ 9398]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8614
diff changeset
336
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
337 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
338 msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
339 {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
340 purple_debug_info("msn", "Processing MSG... \n");
23826
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
341
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
342 /* NOTE: cmd is not always cmdproc->last_cmd, sometimes cmd is a queued
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
343 * command and we are processing it */
23814
a35ff14f5fa7 Remove some MSN code duplication in processing messages from Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23810
diff changeset
344 if (cmd->payload == NULL) {
27339
5f0b184b20ef Remove some cosmetic differences between msg_cmd() and ubm_cmd()
Mark Doliner <markdoliner@pidgin.im>
parents: 27302
diff changeset
345 cmdproc->last_cmd->payload_cb = msg_cmd_post;
23826
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
346 cmd->payload_len = atoi(cmd->params[2]);
23814
a35ff14f5fa7 Remove some MSN code duplication in processing messages from Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23810
diff changeset
347 } else {
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
348 g_return_if_fail(cmd->payload_cb != NULL);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
349
22981
b83a23981419 Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents: 22969
diff changeset
350 #if 0 /* glib on win32 doesn't correctly support precision modifiers for a string */
27339
5f0b184b20ef Remove some cosmetic differences between msg_cmd() and ubm_cmd()
Mark Doliner <markdoliner@pidgin.im>
parents: 27302
diff changeset
351 purple_debug_info("msn", "MSG payload:{%.*s}\n", (guint)cmd->payload_len, cmd->payload);
22981
b83a23981419 Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents: 22969
diff changeset
352 #endif
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
353 cmd->payload_cb(cmdproc, cmd, cmd->payload, cmd->payload_len);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
354 }
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
355 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
356
13870
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
357 /*send Message to Yahoo Messenger*/
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
358 void
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
359 msn_notification_send_uum(MsnSession *session, MsnMessage *msg)
13870
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
360 {
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
361 MsnCmdProc *cmdproc;
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
362 MsnTransaction *trans;
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
363 char *payload;
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
364 gsize payload_len;
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
365 int type;
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
366 MsnUser *user;
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
367 int network;
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
368
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
369 g_return_if_fail(msg != NULL);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 23085
diff changeset
370
13870
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
371 cmdproc = session->notification->cmdproc;
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
372
13870
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
373 payload = msn_message_gen_payload(msg, &payload_len);
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
374 type = msg->type;
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
375 user = msn_userlist_find_user(session->userlist, msg->remote_user);
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
376 if (user)
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
377 network = msn_user_get_network(user);
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
378 else
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
379 network = MSN_NETWORK_PASSPORT;
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
380
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
381 purple_debug_info("msn",
22969
51f5e7777915 This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22711
diff changeset
382 "send UUM, payload{%s}, strlen:%" G_GSIZE_FORMAT ", len:%" G_GSIZE_FORMAT "\n",
51f5e7777915 This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22711
diff changeset
383 payload, strlen(payload), payload_len);
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
384
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
385 trans = msn_transaction_new(cmdproc, "UUM", "%s %d %d %" G_GSIZE_FORMAT,
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
386 msg->remote_user, network, type, payload_len);
13887
fa2dcbed264d [gaim-migrate @ 16979]
Ma Yuan <mayuan2006@gmail.com>
parents: 13886
diff changeset
387 msn_transaction_set_payload(trans, payload, strlen(payload));
13870
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
388 msn_cmdproc_send_trans(cmdproc, trans);
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
389 }
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
390
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
391 /*Yahoo msg process*/
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
392 static void
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
393 ubm_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
394 {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
395 purple_debug_info("msn", "Processing UBM... \n");
23826
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
396
13870
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
397 /* NOTE: cmd is not always cmdproc->last_cmd, sometimes cmd is a queued
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
398 * command and we are processing it */
23826
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
399 if (cmd->payload == NULL) {
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
400 cmdproc->last_cmd->payload_cb = msg_cmd_post;
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
401 cmd->payload_len = atoi(cmd->params[5]);
23814
a35ff14f5fa7 Remove some MSN code duplication in processing messages from Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23810
diff changeset
402 } else {
13870
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
403 g_return_if_fail(cmd->payload_cb != NULL);
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
404
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
405 purple_debug_info("msn", "UBM payload:{%.*s}\n", (guint)(cmd->payload_len), cmd->payload);
23814
a35ff14f5fa7 Remove some MSN code duplication in processing messages from Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23810
diff changeset
406 msg_cmd_post(cmdproc, cmd, cmd->payload, cmd->payload_len);
13870
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
407 }
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
408 }
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
409
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
410 /**************************************************************************
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
411 * Challenges
20508
a8855578906a Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20505
diff changeset
412 * we use MD5 to caculate the Challenges
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
413 **************************************************************************/
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
414 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
415 chl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
416 {
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
417 MsnTransaction *trans;
9158
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
418 char buf[33];
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
419
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
420 msn_handle_chl(cmd->params[1], buf);
23755
6b2413139fae Patch 1 from Qulogic, this one mostly updates the version sent by pidgin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21905
diff changeset
421 trans = msn_transaction_new(cmdproc, "QRY", "%s 32", MSNP15_WLM_PRODUCT_ID);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
422
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
423 msn_transaction_set_payload(trans, buf, 32);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
424
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
425 msn_cmdproc_send_trans(cmdproc, trans);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
426 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
427
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
428 /**************************************************************************
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
429 * Buddy Lists
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
430 **************************************************************************/
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
431
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
432 typedef struct MsnFqyCbData {
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
433 MsnFqyCb cb;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
434 gpointer data;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
435 } MsnFqyCbData;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
436
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
437 /* add contact to PurpleXmlNode */
20530
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20529
diff changeset
438 static void
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
439 msn_add_contact_xml(PurpleXmlNode *mlNode, const char *passport, MsnListOp list_op, MsnNetwork networkId)
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
440 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
441 PurpleXmlNode *d_node,*c_node;
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
442 char **tokens;
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
443 const char *email,*domain;
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
444 char fmt_str[3];
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
445
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
446 g_return_if_fail(passport != NULL);
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
447
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
448 purple_debug_info("msn", "Passport: %s, type: %d\n", passport, networkId);
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
449 tokens = g_strsplit(passport, "@", 2);
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
450 email = tokens[0];
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
451 domain = tokens[1];
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
452
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
453 if (email == NULL || domain == NULL) {
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
454 purple_debug_error("msn", "Invalid passport (%s) specified to add to contact xml.\n", passport);
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
455 g_strfreev(tokens);
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
456 g_return_if_reached();
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
457 }
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
458
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
459 /*find a domain Node*/
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
460 for (d_node = purple_xmlnode_get_child(mlNode, "d"); d_node;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
461 d_node = purple_xmlnode_get_next_twin(d_node)) {
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
462 const char *attr = purple_xmlnode_get_attrib(d_node,"n");
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
463 if (attr == NULL)
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
464 continue;
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
465 if (!strcmp(attr, domain))
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
466 break;
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
467 }
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
468
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
469 if (d_node == NULL) {
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
470 /*domain not found, create a new domain Node*/
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20597
diff changeset
471 purple_debug_info("msn", "Didn't find existing domain node, adding one.\n");
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
472 d_node = purple_xmlnode_new("d");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
473 purple_xmlnode_set_attrib(d_node, "n", domain);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
474 purple_xmlnode_insert_child(mlNode, d_node);
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
475 }
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
476
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
477 /*create contact node*/
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
478 c_node = purple_xmlnode_new("c");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
479 purple_xmlnode_set_attrib(c_node, "n", email);
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
480
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
481 if (list_op != 0) {
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
482 purple_debug_info("msn", "list_op: %d\n", list_op);
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
483 g_snprintf(fmt_str, sizeof(fmt_str), "%d", list_op);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
484 purple_xmlnode_set_attrib(c_node, "l", fmt_str);
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
485 }
20530
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20529
diff changeset
486
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
487 if (networkId != MSN_NETWORK_UNKNOWN) {
23790
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23789
diff changeset
488 g_snprintf(fmt_str, sizeof(fmt_str), "%d", networkId);
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
489 /*mobile*/
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
490 /*type_str = g_strdup_printf("4");*/
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
491 purple_xmlnode_set_attrib(c_node, "t", fmt_str);
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
492 }
20530
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20529
diff changeset
493
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
494 purple_xmlnode_insert_child(d_node, c_node);
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
495
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
496 g_strfreev(tokens);
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
497 }
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
498
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
499 static void
20497
6dd1c3f1e2f8 fixes #971, we can only ADL 150 contacts at a time or the notification
Ka-Hing Cheung <khc@pidgin.im>
parents: 20493
diff changeset
500 msn_notification_post_adl(MsnCmdProc *cmdproc, const char *payload, int payload_len)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
501 {
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
502 MsnTransaction *trans;
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
503 purple_debug_info("msn", "Sending ADL with payload: %s\n", payload);
23777
cc39907f15b9 Fix up some merge errors in MSN's notification.c. Darn meld...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
504 trans = msn_transaction_new(cmdproc, "ADL", "%i", payload_len);
22981
b83a23981419 Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents: 22969
diff changeset
505 msn_transaction_set_payload(trans, payload, payload_len);
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
506 msn_cmdproc_send_trans(cmdproc, trans);
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
507 }
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
508
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
509 static void
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
510 msn_notification_post_rml(MsnCmdProc *cmdproc, const char *payload, int payload_len)
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
511 {
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
512 MsnTransaction *trans;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
513 purple_debug_info("msn", "Sending RML with payload: %s\n", payload);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
514 trans = msn_transaction_new(cmdproc, "RML", "%i", payload_len);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
515 msn_transaction_set_payload(trans, payload, payload_len);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
516 msn_cmdproc_send_trans(cmdproc, trans);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
517 }
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
518
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
519 void
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
520 msn_notification_send_fqy(MsnSession *session,
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
521 const char *payload, int payload_len,
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
522 MsnFqyCb cb,
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
523 gpointer cb_data)
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
524 {
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
525 MsnTransaction *trans;
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
526 MsnCmdProc *cmdproc;
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
527 MsnFqyCbData *data;
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
528
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
529 cmdproc = session->notification->cmdproc;
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
530
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
531 data = g_new(MsnFqyCbData, 1);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
532 data->cb = cb;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
533 data->data = cb_data;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
534
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
535 trans = msn_transaction_new(cmdproc, "FQY", "%d", payload_len);
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
536 msn_transaction_set_payload(trans, payload, payload_len);
28649
95d25c1e195d Allow setting a destroy-function for the data. Fixes a leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28641
diff changeset
537 msn_transaction_set_data(trans, data);
95d25c1e195d Allow setting a destroy-function for the data. Fixes a leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28641
diff changeset
538 msn_transaction_set_data_free(trans, g_free);
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
539 msn_cmdproc_send_trans(cmdproc, trans);
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
540 }
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
541
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
542 static void
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
543 update_contact_network(MsnSession *session, const char *passport, MsnNetwork network, gpointer unused)
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
544 {
25741
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
545 MsnUser *user;
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
546
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
547 if (network == MSN_NETWORK_UNKNOWN)
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
548 {
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
549 purple_debug_warning("msn",
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
550 "Ignoring user %s about which server knows nothing.\n",
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
551 passport);
25743
8b6fa5957edf Darnit, one more MSN fix:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25741
diff changeset
552 /* Decrement the count for unknown results so that we'll continue login.
8b6fa5957edf Darnit, one more MSN fix:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25741
diff changeset
553 Also, need to finish the login process here as well, because ADL OK
8b6fa5957edf Darnit, one more MSN fix:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25741
diff changeset
554 will not be called. */
28347
5504cd4ac580 This seems to not work every once in a while, so put in some code under the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28346
diff changeset
555 if (purple_debug_is_verbose())
5504cd4ac580 This seems to not work every once in a while, so put in some code under the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28346
diff changeset
556 purple_debug_info("msn", "ADL/FQY count is %d\n", session->adl_fqy);
25743
8b6fa5957edf Darnit, one more MSN fix:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25741
diff changeset
557 if (--session->adl_fqy == 0)
8b6fa5957edf Darnit, one more MSN fix:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25741
diff changeset
558 msn_session_finish_login(session);
25741
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
559 return;
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
560 }
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
561
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
562 /* TODO: Also figure out how to update membership lists */
25741
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
563 user = msn_userlist_find_user(session->userlist, passport);
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
564 if (user) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
565 PurpleXmlNode *adl_node;
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
566 char *payload;
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
567 int payload_len;
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
568
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
569 msn_user_set_network(user, network);
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
570
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
571 adl_node = purple_xmlnode_new("ml");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
572 purple_xmlnode_set_attrib(adl_node, "l", "1");
30526
257d8a4af49e The session parameter appears unused in msn_add_contact_xml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30405
diff changeset
573 msn_add_contact_xml(adl_node, passport,
257d8a4af49e The session parameter appears unused in msn_add_contact_xml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30405
diff changeset
574 user->list_op & MSN_LIST_OP_MASK, network);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
575 payload = purple_xmlnode_to_str(adl_node, &payload_len);
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
576 msn_notification_post_adl(session->notification->cmdproc, payload, payload_len);
28636
1e66cc34da0e Leak fix.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28347
diff changeset
577 g_free(payload);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
578 purple_xmlnode_free(adl_node);
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
579 } else {
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
580 purple_debug_error("msn",
25715
81cba419ddf8 applied changes from 70fa4cc384b7643ab1f296bdc2399bc208542a20
Ethan Blanton <elb@pidgin.im>
parents: 25680
diff changeset
581 "Got FQY update for unknown user %s on network %d.\n",
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
582 passport, network);
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
583 }
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
584 }
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
585
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
586 /*dump contact info to NS*/
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
587 void
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
588 msn_notification_dump_contact(MsnSession *session)
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
589 {
5457
586285a6ff22 [gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents: 5456
diff changeset
590 MsnUser *user;
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
591 GList *l;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
592 PurpleXmlNode *adl_node;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
593 PurpleXmlNode *fqy_node;
13856
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
594 char *payload;
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
595 int payload_len;
20497
6dd1c3f1e2f8 fixes #971, we can only ADL 150 contacts at a time or the notification
Ka-Hing Cheung <khc@pidgin.im>
parents: 20493
diff changeset
596 int adl_count = 0;
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
597 int fqy_count = 0;
30196
6a2c93988900 Implement [gs]et_public_alias in MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30045
diff changeset
598 PurpleConnection *pc;
20476
198222e01a7d The second msn-p13-merge-head.diff.gz from SF Patch #162854 from Ka-Hing Cheung.
Richard Laager <rlaager@pidgin.im>
parents: 20475
diff changeset
599 const char *display_name;
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
600
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
601 adl_node = purple_xmlnode_new("ml");
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
602 adl_node->child = NULL;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
603 purple_xmlnode_set_attrib(adl_node, "l", "1");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
604 fqy_node = purple_xmlnode_new("ml");
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20557
diff changeset
605
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
606 /*get the userlist*/
24381
88dab4cf9381 disapproval of revision 'af8f652c2701290deb59c2fa53e0decf168b815d'
Ka-Hing Cheung <khc@pidgin.im>
parents: 24380
diff changeset
607 for (l = session->userlist->users; l != NULL; l = l->next) {
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
608 user = l->data;
20530
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20529
diff changeset
609
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20529
diff changeset
610 /* skip RL & PL during initial dump */
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20529
diff changeset
611 if (!(user->list_op & MSN_LIST_OP_MASK))
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20529
diff changeset
612 continue;
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20529
diff changeset
613
24445
4f53fbf6f709 References #6907, wrap a NULL check
Ka-Hing Cheung <khc@pidgin.im>
parents: 24444
diff changeset
614 if (user->passport && !strcmp(user->passport, "messenger@microsoft.com"))
24381
88dab4cf9381 disapproval of revision 'af8f652c2701290deb59c2fa53e0decf168b815d'
Ka-Hing Cheung <khc@pidgin.im>
parents: 24380
diff changeset
615 continue;
88dab4cf9381 disapproval of revision 'af8f652c2701290deb59c2fa53e0decf168b815d'
Ka-Hing Cheung <khc@pidgin.im>
parents: 24380
diff changeset
616
25722
0890f9dce29e Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25715
diff changeset
617 if ((user->list_op & MSN_LIST_OP_MASK & ~MSN_LIST_FL_OP)
0890f9dce29e Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25715
diff changeset
618 == (MSN_LIST_AL_OP | MSN_LIST_BL_OP)) {
25621
3620b113e046 Buddies on both the Allow and Block list are now automatically removed from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25616
diff changeset
619 /* The server will complain if we send it a user on both the
3620b113e046 Buddies on both the Allow and Block list are now automatically removed from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25616
diff changeset
620 Allow and Block lists. So assume they're on the Block list
3620b113e046 Buddies on both the Allow and Block list are now automatically removed from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25616
diff changeset
621 and remove them from the Allow list in the membership lists to
3620b113e046 Buddies on both the Allow and Block list are now automatically removed from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25616
diff changeset
622 stop this from happening again. */
3620b113e046 Buddies on both the Allow and Block list are now automatically removed from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25616
diff changeset
623 purple_debug_warning("msn",
25722
0890f9dce29e Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25715
diff changeset
624 "User %s is on both Allow and Block list; "
25621
3620b113e046 Buddies on both the Allow and Block list are now automatically removed from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25616
diff changeset
625 "removing from Allow list.\n",
3620b113e046 Buddies on both the Allow and Block list are now automatically removed from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25616
diff changeset
626 user->passport);
28779
9fc118927dfc When restricting a buddy on both the Allow and Block lists to just one
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28776
diff changeset
627 msn_user_unset_op(user, MSN_LIST_AL_OP);
25621
3620b113e046 Buddies on both the Allow and Block list are now automatically removed from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25616
diff changeset
628 }
3620b113e046 Buddies on both the Allow and Block list are now automatically removed from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25616
diff changeset
629
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
630 if (user->networkid != MSN_NETWORK_UNKNOWN) {
30526
257d8a4af49e The session parameter appears unused in msn_add_contact_xml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30405
diff changeset
631 msn_add_contact_xml(adl_node, user->passport,
257d8a4af49e The session parameter appears unused in msn_add_contact_xml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30405
diff changeset
632 user->list_op & MSN_LIST_OP_MASK,
257d8a4af49e The session parameter appears unused in msn_add_contact_xml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30405
diff changeset
633 user->networkid);
20497
6dd1c3f1e2f8 fixes #971, we can only ADL 150 contacts at a time or the notification
Ka-Hing Cheung <khc@pidgin.im>
parents: 20493
diff changeset
634
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
635 /* each ADL command may contain up to 150 contacts */
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
636 if (++adl_count % 150 == 0) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
637 payload = purple_xmlnode_to_str(adl_node, &payload_len);
20497
6dd1c3f1e2f8 fixes #971, we can only ADL 150 contacts at a time or the notification
Ka-Hing Cheung <khc@pidgin.im>
parents: 20493
diff changeset
638
25715
81cba419ddf8 applied changes from 70fa4cc384b7643ab1f296bdc2399bc208542a20
Ethan Blanton <elb@pidgin.im>
parents: 25680
diff changeset
639 /* ADL's are returned all-together */
81cba419ddf8 applied changes from 70fa4cc384b7643ab1f296bdc2399bc208542a20
Ethan Blanton <elb@pidgin.im>
parents: 25680
diff changeset
640 session->adl_fqy++;
28347
5504cd4ac580 This seems to not work every once in a while, so put in some code under the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28346
diff changeset
641 if (purple_debug_is_verbose())
5504cd4ac580 This seems to not work every once in a while, so put in some code under the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28346
diff changeset
642 purple_debug_info("msn", "Posting ADL, count is %d\n",
5504cd4ac580 This seems to not work every once in a while, so put in some code under the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28346
diff changeset
643 session->adl_fqy);
25715
81cba419ddf8 applied changes from 70fa4cc384b7643ab1f296bdc2399bc208542a20
Ethan Blanton <elb@pidgin.im>
parents: 25680
diff changeset
644
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
645 msn_notification_post_adl(session->notification->cmdproc,
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
646 payload, payload_len);
20497
6dd1c3f1e2f8 fixes #971, we can only ADL 150 contacts at a time or the notification
Ka-Hing Cheung <khc@pidgin.im>
parents: 20493
diff changeset
647
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
648 g_free(payload);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
649 purple_xmlnode_free(adl_node);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
650
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
651 adl_node = purple_xmlnode_new("ml");
20497
6dd1c3f1e2f8 fixes #971, we can only ADL 150 contacts at a time or the notification
Ka-Hing Cheung <khc@pidgin.im>
parents: 20493
diff changeset
652 adl_node->child = NULL;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
653 purple_xmlnode_set_attrib(adl_node, "l", "1");
20497
6dd1c3f1e2f8 fixes #971, we can only ADL 150 contacts at a time or the notification
Ka-Hing Cheung <khc@pidgin.im>
parents: 20493
diff changeset
654 }
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
655 } else {
25715
81cba419ddf8 applied changes from 70fa4cc384b7643ab1f296bdc2399bc208542a20
Ethan Blanton <elb@pidgin.im>
parents: 25680
diff changeset
656 /* FQY's are returned one-at-a-time */
81cba419ddf8 applied changes from 70fa4cc384b7643ab1f296bdc2399bc208542a20
Ethan Blanton <elb@pidgin.im>
parents: 25680
diff changeset
657 session->adl_fqy++;
28347
5504cd4ac580 This seems to not work every once in a while, so put in some code under the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28346
diff changeset
658 if (purple_debug_is_verbose())
5504cd4ac580 This seems to not work every once in a while, so put in some code under the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28346
diff changeset
659 purple_debug_info("msn", "Adding FQY address, count is %d\n",
5504cd4ac580 This seems to not work every once in a while, so put in some code under the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28346
diff changeset
660 session->adl_fqy);
25715
81cba419ddf8 applied changes from 70fa4cc384b7643ab1f296bdc2399bc208542a20
Ethan Blanton <elb@pidgin.im>
parents: 25680
diff changeset
661
30526
257d8a4af49e The session parameter appears unused in msn_add_contact_xml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30405
diff changeset
662 msn_add_contact_xml(fqy_node, user->passport, 0, user->networkid);
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
663
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
664 /* each FQY command may contain up to 150 contacts, probably */
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
665 if (++fqy_count % 150 == 0) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
666 payload = purple_xmlnode_to_str(fqy_node, &payload_len);
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
667
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
668 msn_notification_send_fqy(session, payload, payload_len,
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
669 update_contact_network, NULL);
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
670
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
671 g_free(payload);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
672 purple_xmlnode_free(fqy_node);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
673 fqy_node = purple_xmlnode_new("ml");
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
674 }
20497
6dd1c3f1e2f8 fixes #971, we can only ADL 150 contacts at a time or the notification
Ka-Hing Cheung <khc@pidgin.im>
parents: 20493
diff changeset
675 }
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
676 }
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20560
diff changeset
677
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
678 /* Send the rest, or just an empty one to let the server set us online */
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
679 if (adl_count == 0 || adl_count % 150 != 0) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
680 payload = purple_xmlnode_to_str(adl_node, &payload_len);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20560
diff changeset
681
25715
81cba419ddf8 applied changes from 70fa4cc384b7643ab1f296bdc2399bc208542a20
Ethan Blanton <elb@pidgin.im>
parents: 25680
diff changeset
682 /* ADL's are returned all-together */
81cba419ddf8 applied changes from 70fa4cc384b7643ab1f296bdc2399bc208542a20
Ethan Blanton <elb@pidgin.im>
parents: 25680
diff changeset
683 session->adl_fqy++;
28347
5504cd4ac580 This seems to not work every once in a while, so put in some code under the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28346
diff changeset
684 if (purple_debug_is_verbose())
5504cd4ac580 This seems to not work every once in a while, so put in some code under the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28346
diff changeset
685 purple_debug_info("msn", "Posting ADL, count is %d\n",
5504cd4ac580 This seems to not work every once in a while, so put in some code under the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28346
diff changeset
686 session->adl_fqy);
25715
81cba419ddf8 applied changes from 70fa4cc384b7643ab1f296bdc2399bc208542a20
Ethan Blanton <elb@pidgin.im>
parents: 25680
diff changeset
687
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20560
diff changeset
688 msn_notification_post_adl(session->notification->cmdproc, payload, payload_len);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20560
diff changeset
689
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20560
diff changeset
690 g_free(payload);
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20557
diff changeset
691 }
20476
198222e01a7d The second msn-p13-merge-head.diff.gz from SF Patch #162854 from Ka-Hing Cheung.
Richard Laager <rlaager@pidgin.im>
parents: 20475
diff changeset
692
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
693 if (fqy_count % 150 != 0) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
694 payload = purple_xmlnode_to_str(fqy_node, &payload_len);
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
695
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
696 msn_notification_send_fqy(session, payload, payload_len,
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
697 update_contact_network, NULL);
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
698
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
699 g_free(payload);
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
700 }
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
701
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
702 purple_xmlnode_free(adl_node);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
703 purple_xmlnode_free(fqy_node);
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
704
30527
1f37f8bc501a Add a timeout which forces the login process to complete. This won't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30526
diff changeset
705 msn_session_activate_login_timeout(session);
1f37f8bc501a Add a timeout which forces the login process to complete. This won't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30526
diff changeset
706
30196
6a2c93988900 Implement [gs]et_public_alias in MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30045
diff changeset
707 pc = purple_account_get_connection(session->account);
6a2c93988900 Implement [gs]et_public_alias in MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30045
diff changeset
708 display_name = purple_connection_get_display_name(pc);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 23085
diff changeset
709 if (display_name
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 23085
diff changeset
710 && strcmp(display_name,
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20557
diff changeset
711 purple_account_get_username(session->account))) {
30196
6a2c93988900 Implement [gs]et_public_alias in MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30045
diff changeset
712 msn_set_public_alias(pc, display_name, NULL, NULL);
20476
198222e01a7d The second msn-p13-merge-head.diff.gz from SF Patch #162854 from Ka-Hing Cheung.
Richard Laager <rlaager@pidgin.im>
parents: 20475
diff changeset
713 }
198222e01a7d The second msn-p13-merge-head.diff.gz from SF Patch #162854 from Ka-Hing Cheung.
Richard Laager <rlaager@pidgin.im>
parents: 20475
diff changeset
714
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
715 }
5518
436fb9490b62 [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
716
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
717 static void
13856
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
718 blp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
719 {
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
720 }
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
721
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
722 static void
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
723 adl_cmd_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
724 size_t len)
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
725 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
726 PurpleXmlNode *root, *domain_node;
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
727
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
728 purple_debug_misc("msn", "Parsing received ADL XML data\n");
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
729
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
730 g_return_if_fail(payload != NULL);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 23085
diff changeset
731
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
732 root = purple_xmlnode_from_str(payload, (gssize) len);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 23085
diff changeset
733
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
734 if (root == NULL) {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
735 purple_debug_info("msn", "Invalid XML in ADL!\n");
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
736 return;
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
737 }
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
738 for (domain_node = purple_xmlnode_get_child(root, "d");
25741
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
739 domain_node;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
740 domain_node = purple_xmlnode_get_next_twin(domain_node)) {
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
741 PurpleXmlNode *contact_node = NULL;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
742
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
743 for (contact_node = purple_xmlnode_get_child(domain_node, "c");
25741
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
744 contact_node;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
745 contact_node = purple_xmlnode_get_next_twin(contact_node)) {
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
746 const gchar *list;
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
747 gint list_op = 0;
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
748
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
749 list = purple_xmlnode_get_attrib(contact_node, "l");
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
750 if (list != NULL) {
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
751 list_op = atoi(list);
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
752 }
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
753
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
754 if (list_op & MSN_LIST_RL_OP) {
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
755 /* someone is adding us */
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23770
diff changeset
756 msn_get_contact_list(cmdproc->session, MSN_PS_PENDING_LIST, NULL);
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
757 }
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
758 }
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
759 }
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
760
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
761 purple_xmlnode_free(root);
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
762 }
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
763
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
764 static void
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
765 adl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
766 {
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
767 MsnSession *session;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
768
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
769 g_return_if_fail(cmdproc != NULL);
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
770 g_return_if_fail(cmdproc->session != NULL);
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
771 g_return_if_fail(cmdproc->last_cmd != NULL);
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
772 g_return_if_fail(cmd != NULL);
5518
436fb9490b62 [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
773
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
774 session = cmdproc->session;
5457
586285a6ff22 [gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents: 5456
diff changeset
775
23826
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
776 if (!strcmp(cmd->params[1], "OK")) {
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
777 /* ADL ack */
28347
5504cd4ac580 This seems to not work every once in a while, so put in some code under the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28346
diff changeset
778 if (purple_debug_is_verbose())
5504cd4ac580 This seems to not work every once in a while, so put in some code under the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28346
diff changeset
779 purple_debug_info("msn", "ADL ACK, count is %d\n",
5504cd4ac580 This seems to not work every once in a while, so put in some code under the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28346
diff changeset
780 session->adl_fqy);
25715
81cba419ddf8 applied changes from 70fa4cc384b7643ab1f296bdc2399bc208542a20
Ethan Blanton <elb@pidgin.im>
parents: 25680
diff changeset
781 if (--session->adl_fqy == 0)
81cba419ddf8 applied changes from 70fa4cc384b7643ab1f296bdc2399bc208542a20
Ethan Blanton <elb@pidgin.im>
parents: 25680
diff changeset
782 msn_session_finish_login(session);
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
783 } else {
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
784 cmdproc->last_cmd->payload_cb = adl_cmd_parse;
23826
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
785 cmd->payload_len = atoi(cmd->params[1]);
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
786 }
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20557
diff changeset
787
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20557
diff changeset
788 return;
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
789 }
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
790
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
791 static void
24438
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
792 adl_error_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len)
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
793 {
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
794 MsnSession *session;
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
795 PurpleAccount *account;
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
796 PurpleConnection *gc;
28775
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
797 int error = GPOINTER_TO_INT(cmd->payload_cbdata);
24438
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
798
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
799 session = cmdproc->session;
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
800 account = session->account;
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
801 gc = purple_account_get_connection(account);
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
802
28775
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
803 if (error == 241) {
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
804 /* khc: some googling suggests that error 241 means the buddy is somehow
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
805 in the local list, but not the server list, and that we should add
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
806 those buddies to the addressbook. For now I will just notify the user
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
807 about the raw payload, because I am lazy */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
808 PurpleXmlNode *adl = purple_xmlnode_from_str(payload, len);
28775
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
809 GString *emails = g_string_new(NULL);
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
810
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
811 PurpleXmlNode *domain = purple_xmlnode_get_child(adl, "d");
28775
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
812 while (domain) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
813 const char *domain_str = purple_xmlnode_get_attrib(domain, "n");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
814 PurpleXmlNode *contact = purple_xmlnode_get_child(domain, "c");
28775
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
815 while (contact) {
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
816 g_string_append_printf(emails, "%s@%s\n",
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
817 purple_xmlnode_get_attrib(contact, "n"), domain_str);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
818 contact = purple_xmlnode_get_next_twin(contact);
28775
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
819 }
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
820 domain = purple_xmlnode_get_next_twin(domain);
28775
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
821 }
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
822
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
823 purple_notify_error(gc, NULL,
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
824 _("The following users are missing from your addressbook"),
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34304
diff changeset
825 emails->str, purple_request_cpar_from_connection(gc));
28775
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
826 g_string_free(emails, TRUE);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
827 purple_xmlnode_free(adl);
28775
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
828 }
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
829 else
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
830 {
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
831 char *adl = g_strndup(payload, len);
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
832 char *reason = g_strdup_printf(_("Unknown error (%d): %s"),
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
833 error, adl);
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
834 g_free(adl);
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
835
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34304
diff changeset
836 purple_notify_error(gc, NULL, _("Unable to add user"), reason,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34304
diff changeset
837 purple_request_cpar_from_connection(gc));
28775
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
838 g_free(reason);
c403db076fab Fold the ADL 241 error handler into the base ADL error handler since it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28672
diff changeset
839 }
24438
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
840 }
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
841
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
842 static void
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
843 adl_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
844 {
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
845 MsnSession *session;
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
846 PurpleAccount *account;
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
847 PurpleConnection *gc;
24438
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
848 MsnCommand *cmd = cmdproc->last_cmd;
5518
436fb9490b62 [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
849
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
850 session = cmdproc->session;
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
851 account = session->account;
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
852 gc = purple_account_get_connection(account);
5457
586285a6ff22 [gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents: 5456
diff changeset
853
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
854 purple_debug_error("msn", "ADL error\n");
24438
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
855 if (cmd->param_count > 1) {
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
856 cmd->payload_cb = adl_error_parse;
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
857 cmd->payload_len = atoi(cmd->params[1]);
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
858 cmd->payload_cbdata = GINT_TO_POINTER(error);
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
859 } else {
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
860 char *reason = g_strdup_printf(_("Unknown error (%d)"), error);
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34304
diff changeset
861 purple_notify_error(gc, NULL, _("Unable to add user"), reason,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34304
diff changeset
862 purple_request_cpar_from_connection(gc));
24438
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
863 g_free(reason);
f516df0c0926 Apply khc's patch for ADL error 205, with a few changes to get around
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24405
diff changeset
864 }
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
865 }
5457
586285a6ff22 [gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents: 5456
diff changeset
866
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
867 static void
28776
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
868 rml_error_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len)
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
869 {
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
870 MsnSession *session;
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
871 PurpleAccount *account;
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
872 PurpleConnection *gc;
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
873 char *adl, *reason;
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
874 int error = GPOINTER_TO_INT(cmd->payload_cbdata);
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
875
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
876 session = cmdproc->session;
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
877 account = session->account;
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
878 gc = purple_account_get_connection(account);
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
879
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
880 adl = g_strndup(payload, len);
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
881 reason = g_strdup_printf(_("Unknown error (%d): %s"),
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
882 error, adl);
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
883 g_free(adl);
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
884
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34304
diff changeset
885 purple_notify_error(gc, NULL, _("Unable to remove user"), reason,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34304
diff changeset
886 purple_request_cpar_from_connection(gc));
28776
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
887 g_free(reason);
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
888 }
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
889
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
890 static void
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
891 rml_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
892 {
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
893 MsnSession *session;
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
894 PurpleAccount *account;
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
895 PurpleConnection *gc;
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
896 MsnCommand *cmd = cmdproc->last_cmd;
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
897
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
898 session = cmdproc->session;
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
899 account = session->account;
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
900 gc = purple_account_get_connection(account);
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
901
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
902 purple_debug_error("msn", "RML error\n");
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
903 if (cmd->param_count > 1) {
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
904 cmd->payload_cb = rml_error_parse;
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
905 cmd->payload_len = atoi(cmd->params[1]);
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
906 cmd->payload_cbdata = GINT_TO_POINTER(error);
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
907 } else {
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
908 char *reason = g_strdup_printf(_("Unknown error (%d)"), error);
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34304
diff changeset
909 purple_notify_error(gc, NULL, _("Unable to remove user"),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34304
diff changeset
910 reason, purple_request_cpar_from_connection(gc));
28776
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
911 g_free(reason);
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
912 }
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
913 }
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
914
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
915 static void
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
916 fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
917 size_t len)
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
918 {
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
919 MsnSession *session;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
920 PurpleXmlNode *ml, *d, *c;
24779
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
921 const char *domain;
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
922 const char *local;
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
923 const char *type;
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
924 char *passport;
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
925 MsnNetwork network = MSN_NETWORK_PASSPORT;
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
926
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
927 session = cmdproc->session;
24779
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
928
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
929 /* FQY response:
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
930 <ml><d n="domain.com"><c n="local-node" t="network" /></d></ml> */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
931 ml = purple_xmlnode_from_str(payload, len);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
932 for (d = purple_xmlnode_get_child(ml, "d");
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
933 d != NULL;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
934 d = purple_xmlnode_get_next_twin(d)) {
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
935 domain = purple_xmlnode_get_attrib(d, "n");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
936 for (c = purple_xmlnode_get_child(d, "c");
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
937 c != NULL;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
938 c = purple_xmlnode_get_next_twin(c)) {
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
939 local = purple_xmlnode_get_attrib(c, "n");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
940 type = purple_xmlnode_get_attrib(c, "t");
24779
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
941
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
942 passport = g_strdup_printf("%s@%s", local, domain);
24779
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
943
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
944 if (g_ascii_isdigit(cmd->command[0]))
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
945 network = MSN_NETWORK_UNKNOWN;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
946 else if (type != NULL)
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
947 network = (MsnNetwork)strtoul(type, NULL, 10);
24779
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
948
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
949 purple_debug_info("msn", "FQY response says %s is from network %d\n",
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
950 passport, network);
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
951 if (cmd->trans->data) {
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
952 MsnFqyCbData *fqy_data = cmd->trans->data;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
953 fqy_data->cb(session, passport, network, fqy_data->data);
28651
e8658b4b5a4c Minor comment typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28649
diff changeset
954 /* Don't free fqy_data yet since the server responds to FQY multiple times.
28649
95d25c1e195d Allow setting a destroy-function for the data. Fixes a leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28641
diff changeset
955 It will be freed when cmd->trans is freed. */
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
956 }
25680
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
957
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
958 g_free(passport);
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
959 }
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
960 }
a193b015a9da Generalize the FQY command so it can be used by different callbacks based
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25621
diff changeset
961
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
962 purple_xmlnode_free(ml);
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
963 }
9197
3c9b907b45a7 [gaim-migrate @ 9992]
Christian Hammond <chipx86@chipx86.com>
parents: 9194
diff changeset
964
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
965 static void
25741
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
966 fqy_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
967 {
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
968 MsnCommand *cmd = cmdproc->last_cmd;
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
969
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
970 purple_debug_warning("msn", "FQY error %d\n", error);
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
971 if (cmd->param_count > 1) {
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
972 cmd->payload_cb = fqy_cmd_post;
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
973 cmd->payload_len = atoi(cmd->params[1]);
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
974 cmd->payload_cbdata = GINT_TO_POINTER(error);
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
975 }
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
976 #if 0
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
977 /* If the server didn't send us a corresponding email address for this
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
978 FQY error, it's probably going to disconnect us. So it isn't necessary
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
979 to tell the handler about it. */
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
980 else if (trans->data)
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
981 ((MsnFqyCb)trans->data)(session, NULL, MSN_NETWORK_UNKNOWN, NULL);
25741
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
982 #endif
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
983 }
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
984
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
985 static void
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
986 fqy_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
987 {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
988 purple_debug_info("msn", "Process FQY\n");
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20560
diff changeset
989 cmdproc->last_cmd->payload_cb = fqy_cmd_post;
23826
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
990 cmd->payload_len = atoi(cmd->params[1]);
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
991 }
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
992
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
993 static void
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
994 rml_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
995 size_t len)
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
996 {
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
997 if (payload != NULL)
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
998 purple_debug_info("msn", "Received RML:\n%s\n", payload);
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
999 }
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1000
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
1001 static void
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
1002 rml_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
1003 {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
1004 purple_debug_info("msn", "Process RML\n");
23826
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1005 cmd->payload_len = atoi(cmd->params[1]);
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1006 cmdproc->last_cmd->payload_cb = rml_cmd_post;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1007 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1008
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1009 static void
17202
32ab8bec7403 Periodically refresh the authentication info required to automatically log
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17178
diff changeset
1010 qng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
32ab8bec7403 Periodically refresh the authentication info required to automatically log
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17178
diff changeset
1011 {
23866
6926fed80ff1 Fixup MSN mailbox handling based on a patch from Felipe, plus various
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23840
diff changeset
1012 /* TODO: Call PNG after the timeout specified. */
17202
32ab8bec7403 Periodically refresh the authentication info required to automatically log
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17178
diff changeset
1013 }
32ab8bec7403 Periodically refresh the authentication info required to automatically log
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17178
diff changeset
1014
32ab8bec7403 Periodically refresh the authentication info required to automatically log
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17178
diff changeset
1015
32ab8bec7403 Periodically refresh the authentication info required to automatically log
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17178
diff changeset
1016 static void
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1017 fln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1018 {
10451
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10403
diff changeset
1019 MsnUser *user;
32103
4cf68eabd1dc *** Plucked rev a94299d1b48c77ebb3799a75fcc6a9a3480310ac (qulogic@pidgin.im):
Mark Doliner <markdoliner@pidgin.im>
parents: 32091
diff changeset
1020 char *passport;
4cf68eabd1dc *** Plucked rev a94299d1b48c77ebb3799a75fcc6a9a3480310ac (qulogic@pidgin.im):
Mark Doliner <markdoliner@pidgin.im>
parents: 32091
diff changeset
1021 int networkid;
10296
9badf1cedc6e [gaim-migrate @ 11476]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10284
diff changeset
1022
23448
5c570209a293 Add a few bits of documentation
Mark Doliner <markdoliner@pidgin.im>
parents: 23444
diff changeset
1023 /* Tell libpurple that the user has signed off */
32103
4cf68eabd1dc *** Plucked rev a94299d1b48c77ebb3799a75fcc6a9a3480310ac (qulogic@pidgin.im):
Mark Doliner <markdoliner@pidgin.im>
parents: 32091
diff changeset
1024 msn_parse_user(cmd->params[0], &passport, &networkid);
4cf68eabd1dc *** Plucked rev a94299d1b48c77ebb3799a75fcc6a9a3480310ac (qulogic@pidgin.im):
Mark Doliner <markdoliner@pidgin.im>
parents: 32091
diff changeset
1025 user = msn_userlist_find_user(cmdproc->session->userlist, passport);
23810
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23808
diff changeset
1026 msn_user_set_state(user, NULL);
10451
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10403
diff changeset
1027 msn_user_update(user);
32103
4cf68eabd1dc *** Plucked rev a94299d1b48c77ebb3799a75fcc6a9a3480310ac (qulogic@pidgin.im):
Mark Doliner <markdoliner@pidgin.im>
parents: 32091
diff changeset
1028
4cf68eabd1dc *** Plucked rev a94299d1b48c77ebb3799a75fcc6a9a3480310ac (qulogic@pidgin.im):
Mark Doliner <markdoliner@pidgin.im>
parents: 32091
diff changeset
1029 g_free(passport);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1030 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1031
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1032 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1033 iln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1034 {
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1035 MsnSession *session;
6800
8f99c220b503 [gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents: 6779
diff changeset
1036 MsnUser *user;
24143
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1037 MsnObject *msnobj = NULL;
29434
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1038 unsigned long clientid, extcaps;
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1039 char *extcap_str;
24143
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1040 int networkid = 0;
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1041 const char *state, *passport;
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1042 char *friendly;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1043
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1044 session = cmdproc->session;
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1045
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1046 state = cmd->params[1];
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1047 passport = cmd->params[2];
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1048
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1049 user = msn_userlist_find_user(session->userlist, passport);
24143
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1050 if (user == NULL)
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1051 /* Where'd this come from? */
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1052 return;
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1053
28780
cf0ea2b55d7b Parse online presence from yahoo buddies after going online on MSN.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28672
diff changeset
1054 if (cmd->param_count == 8) {
cf0ea2b55d7b Parse online presence from yahoo buddies after going online on MSN.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28672
diff changeset
1055 /* Yahoo! Buddy, looks like */
cf0ea2b55d7b Parse online presence from yahoo buddies after going online on MSN.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28672
diff changeset
1056 networkid = atoi(cmd->params[3]);
cf0ea2b55d7b Parse online presence from yahoo buddies after going online on MSN.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28672
diff changeset
1057 friendly = g_strdup(purple_url_decode(cmd->params[4]));
29434
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1058 clientid = strtoul(cmd->params[5], &extcap_str, 10);
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1059 if (extcap_str && *extcap_str)
29434
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1060 extcaps = strtoul(extcap_str+1, NULL, 10);
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1061 else
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1062 extcaps = 0;
28780
cf0ea2b55d7b Parse online presence from yahoo buddies after going online on MSN.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28672
diff changeset
1063
cf0ea2b55d7b Parse online presence from yahoo buddies after going online on MSN.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28672
diff changeset
1064 /* cmd->params[7] seems to be a URL to a Yahoo! icon:
cf0ea2b55d7b Parse online presence from yahoo buddies after going online on MSN.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28672
diff changeset
1065 https://sec.yimg.com/i/us/nt/b/purpley.1.0.png
cf0ea2b55d7b Parse online presence from yahoo buddies after going online on MSN.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28672
diff changeset
1066 ... and it's purple, HAH!
cf0ea2b55d7b Parse online presence from yahoo buddies after going online on MSN.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28672
diff changeset
1067 */
cf0ea2b55d7b Parse online presence from yahoo buddies after going online on MSN.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28672
diff changeset
1068 } else if (cmd->param_count == 7) {
24143
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1069 /* MSNP14+ with Display Picture object */
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1070 networkid = atoi(cmd->params[3]);
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1071 friendly = g_strdup(purple_url_decode(cmd->params[4]));
29434
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1072 clientid = strtoul(cmd->params[5], &extcap_str, 10);
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1073 if (extcap_str && *extcap_str)
29434
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1074 extcaps = strtoul(extcap_str+1, NULL, 10);
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1075 else
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1076 extcaps = 0;
24143
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1077 msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[6]));
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1078 } else if (cmd->param_count == 6) {
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1079 /* Yes, this is 5. The friendly name could start with a number,
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1080 but the display picture object can't... */
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1081 if (isdigit(cmd->params[5][0])) {
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1082 /* MSNP14 without Display Picture object */
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1083 networkid = atoi(cmd->params[3]);
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1084 friendly = g_strdup(purple_url_decode(cmd->params[4]));
29434
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1085 clientid = strtoul(cmd->params[5], &extcap_str, 10);
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1086 if (extcap_str && *extcap_str)
29434
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1087 extcaps = strtoul(extcap_str+1, NULL, 10);
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1088 else
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1089 extcaps = 0;
24143
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1090 } else {
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1091 /* MSNP8+ with Display Picture object */
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1092 friendly = g_strdup(purple_url_decode(cmd->params[3]));
29434
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1093 clientid = strtoul(cmd->params[4], &extcap_str, 10);
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1094 if (extcap_str && *extcap_str)
29434
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1095 extcaps = strtoul(extcap_str+1, NULL, 10);
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1096 else
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1097 extcaps = 0;
24143
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1098 msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[5]));
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1099 }
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1100 } else if (cmd->param_count == 5) {
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1101 /* MSNP8+ without Display Picture object */
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1102 friendly = g_strdup(purple_url_decode(cmd->params[3]));
29434
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1103 clientid = strtoul(cmd->params[4], &extcap_str, 10);
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1104 if (extcap_str && *extcap_str)
29434
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1105 extcaps = strtoul(extcap_str+1, NULL, 10);
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1106 else
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1107 extcaps = 0;
24143
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1108 } else {
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1109 purple_debug_warning("msn", "Received ILN with unknown number of parameters.\n");
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1110 return;
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1111 }
6858
a367cfd3e75f [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1112
25534
a2f044ce77b1 Update the Address Book when we recieve a new friendly name for a buddy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25533
diff changeset
1113 if (msn_user_set_friendly_name(user, friendly)) {
a2f044ce77b1 Update the Address Book when we recieve a new friendly name for a buddy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25533
diff changeset
1114 msn_update_contact(session, passport, MSN_UPDATE_DISPLAY, friendly);
a2f044ce77b1 Update the Address Book when we recieve a new friendly name for a buddy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25533
diff changeset
1115 }
24143
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1116 g_free(friendly);
6858
a367cfd3e75f [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1117
24143
0c8b37e7b0c1 Support some older versions of the ILN command. Apparently some IM
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24142
diff changeset
1118 msn_user_set_object(user, msnobj);
6800
8f99c220b503 [gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents: 6779
diff changeset
1119
31436
1f56689dc398 Updated client capabilities and networks from msnpsharp.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
1120 user->mobile = (clientid & MSN_CAP_MOBILE_ON) || (user->extinfo && user->extinfo->phone_mobile && user->extinfo->phone_mobile[0] == '+');
23790
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23789
diff changeset
1121 msn_user_set_clientid(user, clientid);
29434
9c5e5493e625 Also parse extended capabilities from ILN. Probably don't need to do so in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29432
diff changeset
1122 msn_user_set_extcaps(user, extcaps);
23790
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23789
diff changeset
1123 msn_user_set_network(user, networkid);
22711
16e50aae4932 some other mobile stuff that Maiku fixed, fixes #2359
Ka-Hing Cheung <khc@pidgin.im>
parents: 22671
diff changeset
1124
10451
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10403
diff changeset
1125 msn_user_set_state(user, state);
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10403
diff changeset
1126 msn_user_update(user);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1127 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1128
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1129 static void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1130 ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1131 {
22671
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1132 PurpleConnection *gc;
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1133 MsnUserList *userlist;
24404
dfdee4a5b58b Fix a possible xmlnode leak and an extra g_strdup when processing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24384
diff changeset
1134 const char *who = NULL;
dfdee4a5b58b Fix a possible xmlnode leak and an extra g_strdup when processing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24384
diff changeset
1135 char *text = NULL;
23874
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1136 const char *id = NULL;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1137 PurpleXmlNode *payloadNode, *from, *msg, *textNode;
22671
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1138
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
1139 purple_debug_misc("msn", "Incoming Page: {%s}\n", payload);
22671
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1140
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1141 userlist = cmdproc->session->userlist;
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1142 gc = purple_account_get_connection(cmdproc->session->account);
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1143
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1144 /* payload looks like this:
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1145 <?xml version="1.0"?>
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1146 <NOTIFICATION id="0" siteid="111100400" siteurl="http://mobile.msn.com/">
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1147 <TO name="passport@example.com">
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1148 <VIA agent="mobile"/>
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1149 </TO>
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1150 <FROM name="tel:+XXXXXXXXXXX"/>
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1151 <MSG pri="1" id="1">
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1152 <CAT Id="110110001"/>
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1153 <ACTION url="2wayIM.asp"/>
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1154 <SUBSCR url="2wayIM.asp"/>
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1155 <BODY lcid="1033">
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1156 <TEXT>Message was here</TEXT>
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1157 </BODY>
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1158 </MSG>
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1159 </NOTIFICATION>
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1160 */
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1161
23874
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1162 /* This is the payload if your message was too long:
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1163 <NOTIFICATION id="TrID" siteid="111100400" siteurl="http://mobile.msn.com/">
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1164 <TO name="passport@example.com">
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1165 <VIA agent="mobile"/>
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1166 </TO>
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1167 <FROM name="tel:+XXXXXXXXXXX"/>
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1168 <MSG pri="1" id="407">
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1169 <CAT Id="110110001"/>
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1170 <ACTION url="2wayIM.asp"/>
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1171 <SUBSCR url="2wayIM.asp"/>
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1172 <BODY lcid="1033">
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1173 <TEXT></TEXT>
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1174 </BODY>
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1175 </MSG>
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1176 </NOTIFICATION>
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1177 */
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1178
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1179 payloadNode = purple_xmlnode_from_str(payload, len);
24404
dfdee4a5b58b Fix a possible xmlnode leak and an extra g_strdup when processing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24384
diff changeset
1180 if (!payloadNode)
22671
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1181 return;
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1182
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1183 if (!(from = purple_xmlnode_get_child(payloadNode, "FROM")) ||
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1184 !(msg = purple_xmlnode_get_child(payloadNode, "MSG")) ||
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1185 !(textNode = purple_xmlnode_get_child(msg, "BODY/TEXT"))) {
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1186 purple_xmlnode_free(payloadNode);
24404
dfdee4a5b58b Fix a possible xmlnode leak and an extra g_strdup when processing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24384
diff changeset
1187 return;
dfdee4a5b58b Fix a possible xmlnode leak and an extra g_strdup when processing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24384
diff changeset
1188 }
dfdee4a5b58b Fix a possible xmlnode leak and an extra g_strdup when processing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24384
diff changeset
1189
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1190 who = purple_xmlnode_get_attrib(from, "name");
22671
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1191 if (!who) return;
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1192
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1193 text = purple_xmlnode_get_data(textNode);
22671
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1194
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1195 /* Match number to user's mobile number, FROM is a phone number if the
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1196 other side page you using your phone number */
23874
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1197 if (!strncmp(who, "tel:+", 5)) {
22671
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1198 MsnUser *user =
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1199 msn_userlist_find_user_with_mobile_phone(userlist, who + 4);
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1200
24404
dfdee4a5b58b Fix a possible xmlnode leak and an extra g_strdup when processing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24384
diff changeset
1201 if (user && user->passport)
dfdee4a5b58b Fix a possible xmlnode leak and an extra g_strdup when processing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24384
diff changeset
1202 who = user->passport;
22671
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1203 }
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1204
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1205 id = purple_xmlnode_get_attrib(msg, "id");
23874
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1206
31560
626e5d35fa5e Output an error if the notification id was not 1 instead of it's just
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31436
diff changeset
1207 if (id && strcmp(id, "1")) {
28346
1250dd4e9448 Display the full message when there are errors sending a MSN Mobile message
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27691
diff changeset
1208 PurpleConversation *conv
34636
cfbdf3297c99 Refactored msn protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
1209 = purple_conversations_find_with_account(who, purple_connection_get_account(gc));
28346
1250dd4e9448 Display the full message when there are errors sending a MSN Mobile message
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27691
diff changeset
1210 if (conv != NULL) {
31560
626e5d35fa5e Output an error if the notification id was not 1 instead of it's just
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31436
diff changeset
1211 const char *error;
626e5d35fa5e Output an error if the notification id was not 1 instead of it's just
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31436
diff changeset
1212 if (!strcmp(id, "407"))
626e5d35fa5e Output an error if the notification id was not 1 instead of it's just
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31436
diff changeset
1213 error = _("Mobile message was not sent because it was too long.");
626e5d35fa5e Output an error if the notification id was not 1 instead of it's just
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31436
diff changeset
1214 else
626e5d35fa5e Output an error if the notification id was not 1 instead of it's just
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31436
diff changeset
1215 error = _("Mobile message was not sent because an unknown error occurred.");
626e5d35fa5e Output an error if the notification id was not 1 instead of it's just
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31436
diff changeset
1216
626e5d35fa5e Output an error if the notification id was not 1 instead of it's just
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31436
diff changeset
1217 purple_conversation_write(conv, NULL, error,
28346
1250dd4e9448 Display the full message when there are errors sending a MSN Mobile message
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27691
diff changeset
1218 PURPLE_MESSAGE_ERROR, time(NULL));
1250dd4e9448 Display the full message when there are errors sending a MSN Mobile message
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27691
diff changeset
1219
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1220 if ((id = purple_xmlnode_get_attrib(payloadNode, "id")) != NULL) {
28346
1250dd4e9448 Display the full message when there are errors sending a MSN Mobile message
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27691
diff changeset
1221 unsigned int trId = atol(id);
1250dd4e9448 Display the full message when there are errors sending a MSN Mobile message
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27691
diff changeset
1222 MsnTransaction *trans;
23874
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1223
28346
1250dd4e9448 Display the full message when there are errors sending a MSN Mobile message
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27691
diff changeset
1224 trans = msn_history_find(cmdproc->history, trId);
31561
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1225 if (trans) {
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1226 MsnMessage *msg = (MsnMessage *)trans->data;
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1227
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1228 if (msg) {
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1229 char *body_str = msn_message_to_string(msg);
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1230 char *body_enc = g_markup_escape_text(body_str, -1);
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1231
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1232 purple_conversation_write(conv, NULL, body_enc,
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1233 PURPLE_MESSAGE_RAW, time(NULL));
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1234
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1235 g_free(body_str);
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1236 g_free(body_enc);
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1237 msn_message_unref(msg);
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1238 trans->data = NULL;
180f569cbb7d Make sure we don't crash if we can't find the transaction for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31560
diff changeset
1239 }
28346
1250dd4e9448 Display the full message when there are errors sending a MSN Mobile message
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27691
diff changeset
1240 }
1250dd4e9448 Display the full message when there are errors sending a MSN Mobile message
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27691
diff changeset
1241 }
1250dd4e9448 Display the full message when there are errors sending a MSN Mobile message
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27691
diff changeset
1242 }
23874
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1243 } else {
35499
c4c5e0a670b1 Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
1244 purple_serv_got_im(gc, who, text, 0, time(NULL));
23874
211838741c15 Report an error when an MSN Mobile message was not sent because it was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23866
diff changeset
1245 }
22671
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1246
1be93db097eb another patch from Maiku, this time handling IPG so we can receive paging.
Ka-Hing Cheung <khc@pidgin.im>
parents: 22670
diff changeset
1247 g_free(text);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1248 purple_xmlnode_free(payloadNode);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1249 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1250
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1251 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1252 ipg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
5960
cd797d042726 [gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents: 5933
diff changeset
1253 {
23826
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1254 cmd->payload_len = atoi(cmd->params[0]);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1255 cmdproc->last_cmd->payload_cb = ipg_cmd_post;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1256 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1257
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1258 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1259 nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1260 {
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1261 MsnSession *session;
6829
233441b74cf9 [gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents: 6828
diff changeset
1262 MsnUser *user;
233441b74cf9 [gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents: 6828
diff changeset
1263 MsnObject *msnobj;
29423
b96a7dc3fece Save extended capabilities of an MSN buddy when receiving NLN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29421
diff changeset
1264 unsigned long clientid, extcaps;
b96a7dc3fece Save extended capabilities of an MSN buddy when receiving NLN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29421
diff changeset
1265 char *extcap_str;
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1266 char *passport;
23790
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23789
diff changeset
1267 int networkid;
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1268 const char *state, *friendly;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1269
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1270 session = cmdproc->session;
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1271
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1272 state = cmd->params[0];
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1273 msn_parse_user(cmd->params[1], &passport, &networkid);
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1274 friendly = purple_url_decode(cmd->params[2]);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1275
31224
2a35f6749bb1 Add the session user to the userlist. This reduces the amount of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31223
diff changeset
1276 user = msn_userlist_find_user(session->userlist, passport);
24331
24bb08b3a018 don't crash if we get a NLN command from someone not on the blist
Ka-Hing Cheung <khc@pidgin.im>
parents: 24183
diff changeset
1277 if (user == NULL) return;
6858
a367cfd3e75f [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1278
31223
0517c95b5c57 Maybe I should actually put the fix in there too!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31210
diff changeset
1279 if (msn_user_set_friendly_name(user, friendly) && user != session->user)
14546
290281d3e65e [gaim-migrate @ 17203]
Richard Nelson <wabz@pidgin.im>
parents: 14254
diff changeset
1280 {
25534
a2f044ce77b1 Update the Address Book when we recieve a new friendly name for a buddy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25533
diff changeset
1281 msn_update_contact(session, passport, MSN_UPDATE_DISPLAY, friendly);
14546
290281d3e65e [gaim-migrate @ 17203]
Richard Nelson <wabz@pidgin.im>
parents: 14254
diff changeset
1282 }
6858
a367cfd3e75f [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1283
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1284 if (cmd->param_count == 5)
6829
233441b74cf9 [gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents: 6828
diff changeset
1285 {
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1286 msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[4]));
23793
b53a513626da Remove some checks for MSN protocol_ver < 15. Those versions are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23790
diff changeset
1287 msn_user_set_object(user, msnobj);
b53a513626da Remove some checks for MSN protocol_ver < 15. Those versions are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23790
diff changeset
1288 }
b53a513626da Remove some checks for MSN protocol_ver < 15. Those versions are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23790
diff changeset
1289 else
b53a513626da Remove some checks for MSN protocol_ver < 15. Those versions are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23790
diff changeset
1290 {
b53a513626da Remove some checks for MSN protocol_ver < 15. Those versions are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23790
diff changeset
1291 msn_user_set_object(user, NULL);
6829
233441b74cf9 [gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents: 6828
diff changeset
1292 }
233441b74cf9 [gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents: 6828
diff changeset
1293
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1294 clientid = strtoul(cmd->params[3], &extcap_str, 10);
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1295 if (extcap_str && *extcap_str)
29423
b96a7dc3fece Save extended capabilities of an MSN buddy when receiving NLN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29421
diff changeset
1296 extcaps = strtoul(extcap_str+1, NULL, 10);
b96a7dc3fece Save extended capabilities of an MSN buddy when receiving NLN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29421
diff changeset
1297 else
b96a7dc3fece Save extended capabilities of an MSN buddy when receiving NLN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29421
diff changeset
1298 extcaps = 0;
29455
507fafef57a4 propagate from branch 'im.pidgin.pidgin' (head fa3096fc03d96aab042c6f0c6d678564ba5aba7e)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29450 29300
diff changeset
1299
31436
1f56689dc398 Updated client capabilities and networks from msnpsharp.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
1300 user->mobile = (clientid & MSN_CAP_MOBILE_ON) || (user->extinfo && user->extinfo->phone_mobile && user->extinfo->phone_mobile[0] == '+');
11819
ed7eacf30277 [gaim-migrate @ 14110]
David Fiander
parents: 11321
diff changeset
1301
23790
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23789
diff changeset
1302 msn_user_set_clientid(user, clientid);
29423
b96a7dc3fece Save extended capabilities of an MSN buddy when receiving NLN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29421
diff changeset
1303 msn_user_set_extcaps(user, extcaps);
23790
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23789
diff changeset
1304 msn_user_set_network(user, networkid);
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23789
diff changeset
1305
10451
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10403
diff changeset
1306 msn_user_set_state(user, state);
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10403
diff changeset
1307 msn_user_update(user);
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1308
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1309 g_free(passport);
9158
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
1310 }
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
1311
11992
906176cc9b22 [gaim-migrate @ 14285]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11862
diff changeset
1312 #if 0
9158
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
1313 static void
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1314 chg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1315 {
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1316 char *state = cmd->params[1];
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1317 int state_id = 0;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1318
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1319 if (!strcmp(state, "NLN"))
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1320 state_id = MSN_ONLINE;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1321 else if (!strcmp(state, "BSY"))
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1322 state_id = MSN_BUSY;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1323 else if (!strcmp(state, "IDL"))
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1324 state_id = MSN_IDLE;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1325 else if (!strcmp(state, "BRB"))
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1326 state_id = MSN_BRB;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1327 else if (!strcmp(state, "AWY"))
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1328 state_id = MSN_AWAY;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1329 else if (!strcmp(state, "PHN"))
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1330 state_id = MSN_PHONE;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1331 else if (!strcmp(state, "LUN"))
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1332 state_id = MSN_LUNCH;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1333 else if (!strcmp(state, "HDN"))
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1334 state_id = MSN_HIDDEN;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1335
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1336 cmdproc->session->state = state_id;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1337 }
11992
906176cc9b22 [gaim-migrate @ 14285]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11862
diff changeset
1338 #endif
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1339
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1340
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1341 static void
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1342 not_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len)
9158
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
1343 {
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
1344 #if 0
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1345 MSN_SET_PARAMS("NOT %d\r\n%s", cmdproc->servconn->payload, payload);
24100
df97a93113c3 Turn off those MSN NOTification debug messages. It should work now, and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24008
diff changeset
1346 purple_debug_misc("msn", "Notification: {%s}\n", payload);
24008
8cbd0a6ea528 Correctly save the payload_len of a MSN notification command. Also,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24002
diff changeset
1347 #endif
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1348 }
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1349
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1350 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1351 not_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1352 {
24008
8cbd0a6ea528 Correctly save the payload_len of a MSN notification command. Also,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24002
diff changeset
1353 cmd->payload_len = atoi(cmd->params[0]);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1354 cmdproc->last_cmd->payload_cb = not_cmd_post;
5363
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1355 }
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1356
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1357 static void
10833
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1358 prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1359 {
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1360 MsnSession *session = cmdproc->session;
30196
6a2c93988900 Implement [gs]et_public_alias in MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30045
diff changeset
1361 const char *type, *value;
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20557
diff changeset
1362
10833
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1363 g_return_if_fail(cmd->param_count >= 3);
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1364
30196
6a2c93988900 Implement [gs]et_public_alias in MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30045
diff changeset
1365 type = cmd->params[2];
10833
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1366
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1367 if (cmd->param_count == 4)
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1368 {
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1369 value = cmd->params[3];
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1370 if (!strcmp(type, "PHH"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
1371 msn_user_set_home_phone(session->user, purple_url_decode(value));
10833
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1372 else if (!strcmp(type, "PHW"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
1373 msn_user_set_work_phone(session->user, purple_url_decode(value));
10833
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1374 else if (!strcmp(type, "PHM"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
1375 msn_user_set_mobile_phone(session->user, purple_url_decode(value));
10833
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1376 }
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1377 else
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1378 {
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1379 if (!strcmp(type, "PHH"))
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1380 msn_user_set_home_phone(session->user, NULL);
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1381 else if (!strcmp(type, "PHW"))
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1382 msn_user_set_work_phone(session->user, NULL);
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1383 else if (!strcmp(type, "PHM"))
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1384 msn_user_set_mobile_phone(session->user, NULL);
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1385 }
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1386 }
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
1387
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1388 /**************************************************************************
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1389 * Misc commands
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1390 **************************************************************************/
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
1391
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1392 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1393 url_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1394 {
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1395 MsnSession *session;
23866
6926fed80ff1 Fixup MSN mailbox handling based on a patch from Felipe, plus various
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23840
diff changeset
1396 PurpleConnection *gc;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
1397 PurpleAccount *account;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1398 const char *rru;
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1399 const char *url;
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
1400 PurpleHash *hash;
24001
c069392f646e Fix up the MSN Inbox URL. There was a typo that caused a use-after-free
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23924
diff changeset
1401 gchar creds[33];
11164
4396374c0cd9 [gaim-migrate @ 13265]
Mark Doliner <markdoliner@pidgin.im>
parents: 10833
diff changeset
1402 char *buf;
23866
6926fed80ff1 Fixup MSN mailbox handling based on a patch from Felipe, plus various
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23840
diff changeset
1403
6926fed80ff1 Fixup MSN mailbox handling based on a patch from Felipe, plus various
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23840
diff changeset
1404 gulong tmp_timestamp;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1405
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1406 session = cmdproc->session;
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1407 account = session->account;
32624
f957ad287bcc Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents: 32023
diff changeset
1408 gc = purple_account_get_connection(account);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1409
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1410 rru = cmd->params[1];
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1411 url = cmd->params[2];
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1412
23866
6926fed80ff1 Fixup MSN mailbox handling based on a patch from Felipe, plus various
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23840
diff changeset
1413 session->passport_info.mail_timestamp = time(NULL);
6926fed80ff1 Fixup MSN mailbox handling based on a patch from Felipe, plus various
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23840
diff changeset
1414 tmp_timestamp = session->passport_info.mail_timestamp - session->passport_info.sl;
6926fed80ff1 Fixup MSN mailbox handling based on a patch from Felipe, plus various
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23840
diff changeset
1415
11164
4396374c0cd9 [gaim-migrate @ 13265]
Mark Doliner <markdoliner@pidgin.im>
parents: 10833
diff changeset
1416 buf = g_strdup_printf("%s%lu%s",
24002
1998a5bb6e5d Some whitespace changes to make code from that previous commit look better.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24001
diff changeset
1417 session->passport_info.mspauth ? session->passport_info.mspauth : "BOGUS",
1998a5bb6e5d Some whitespace changes to make code from that previous commit look better.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24001
diff changeset
1418 tmp_timestamp,
1998a5bb6e5d Some whitespace changes to make code from that previous commit look better.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24001
diff changeset
1419 purple_connection_get_password(gc));
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1420
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
1421 hash = purple_md5_hash_new();
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
1422 purple_hash_append(hash, (const guchar *)buf, strlen(buf));
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
1423 purple_hash_digest_to_str(hash, creds, sizeof(creds));
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34557
diff changeset
1424 g_object_unref(hash);
11164
4396374c0cd9 [gaim-migrate @ 13265]
Mark Doliner <markdoliner@pidgin.im>
parents: 10833
diff changeset
1425 g_free(buf);
4396374c0cd9 [gaim-migrate @ 13265]
Mark Doliner <markdoliner@pidgin.im>
parents: 10833
diff changeset
1426
23924
1f8e75759bf3 Use a URL to open MSN Hotmail inbox instead of a temporary file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23923
diff changeset
1427 g_free(session->passport_info.mail_url);
24002
1998a5bb6e5d Some whitespace changes to make code from that previous commit look better.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24001
diff changeset
1428 session->passport_info.mail_url =
1998a5bb6e5d Some whitespace changes to make code from that previous commit look better.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24001
diff changeset
1429 g_strdup_printf("%s&auth=%s&creds=%s&sl=%ld&username=%s&mode=ttl&sid=%s&id=2&rru=%s&svc=mail&js=yes",
1998a5bb6e5d Some whitespace changes to make code from that previous commit look better.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24001
diff changeset
1430 url,
1998a5bb6e5d Some whitespace changes to make code from that previous commit look better.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24001
diff changeset
1431 session->passport_info.mspauth ? purple_url_encode(session->passport_info.mspauth) : "BOGUS",
1998a5bb6e5d Some whitespace changes to make code from that previous commit look better.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24001
diff changeset
1432 creds,
1998a5bb6e5d Some whitespace changes to make code from that previous commit look better.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24001
diff changeset
1433 tmp_timestamp,
1998a5bb6e5d Some whitespace changes to make code from that previous commit look better.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24001
diff changeset
1434 msn_user_get_passport(session->user),
1998a5bb6e5d Some whitespace changes to make code from that previous commit look better.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24001
diff changeset
1435 session->passport_info.sid,
1998a5bb6e5d Some whitespace changes to make code from that previous commit look better.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24001
diff changeset
1436 rru);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1437
23924
1f8e75759bf3 Use a URL to open MSN Hotmail inbox instead of a temporary file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23923
diff changeset
1438 /* The user wants to check his or her email */
1f8e75759bf3 Use a URL to open MSN Hotmail inbox instead of a temporary file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23923
diff changeset
1439 if (cmd->trans && cmd->trans->data)
1f8e75759bf3 Use a URL to open MSN Hotmail inbox instead of a temporary file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23923
diff changeset
1440 purple_notify_uri(purple_account_get_connection(account), session->passport_info.mail_url);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1441 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1442 /**************************************************************************
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1443 * Switchboards
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1444 **************************************************************************/
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
1445
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1446 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1447 rng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1448 {
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1449 MsnSession *session;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1450 MsnSwitchBoard *swboard;
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1451 const char *session_id;
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1452 char *host;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1453 int port;
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1454
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1455 session = cmdproc->session;
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1456 session_id = cmd->params[0];
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1457
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1458 msn_parse_socket(cmd->params[1], &host, &port);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1459
7288
486e8b44a14b [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7274
diff changeset
1460 if (session->http_method)
486e8b44a14b [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7274
diff changeset
1461 port = 80;
486e8b44a14b [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7274
diff changeset
1462
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1463 swboard = msn_switchboard_new(session);
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1464
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1465 msn_switchboard_set_invited(swboard, TRUE);
31106
d7a39e5eb4c1 Remove dead assignments in new MSN code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31076
diff changeset
1466 msn_switchboard_set_session_id(swboard, session_id);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1467 msn_switchboard_set_auth_key(swboard, cmd->params[3]);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1468 swboard->im_user = g_strdup(cmd->params[4]);
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1469 /* msn_switchboard_add_user(swboard, cmd->params[4]); */
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1470
10568
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
1471 if (!msn_switchboard_connect(swboard, host, port))
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
1472 msn_switchboard_destroy(swboard);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1473
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1474 g_free(host);
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1475 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1476
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1477 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1478 xfr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1479 {
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1480 char *host;
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1481 int port;
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1482
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1483 if (strcmp(cmd->params[1], "SB") && strcmp(cmd->params[1], "NS"))
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1484 {
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
1485 /* Maybe we can have a generic bad command error. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
1486 purple_debug_error("msn", "Bad XFR command (%s)\n", cmd->params[1]);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1487 return;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1488 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1489
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1490 msn_parse_socket(cmd->params[2], &host, &port);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1491
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1492 if (!strcmp(cmd->params[1], "SB"))
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1493 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
1494 purple_debug_error("msn", "This shouldn't be handled here.\n");
5385
12f55f3be43e [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1495 }
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1496 else if (!strcmp(cmd->params[1], "NS"))
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1497 {
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1498 MsnSession *session;
8646
74d0e7406e3b [gaim-migrate @ 9398]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8614
diff changeset
1499
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1500 session = cmdproc->session;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1501
10519
80801a34a246 [gaim-migrate @ 11833]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10514
diff changeset
1502 msn_session_set_login_step(session, MSN_LOGIN_STEP_TRANSFER);
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
1503
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1504 msn_notification_connect(session->notification, host, port);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1505 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1506
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1507 g_free(host);
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1508 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1509
13853
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
1510 static void
13867
98600e8943dd [gaim-migrate @ 16721]
Ma Yuan <mayuan2006@gmail.com>
parents: 13866
diff changeset
1511 gcf_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
98600e8943dd [gaim-migrate @ 16721]
Ma Yuan <mayuan2006@gmail.com>
parents: 13866
diff changeset
1512 size_t len)
98600e8943dd [gaim-migrate @ 16721]
Ma Yuan <mayuan2006@gmail.com>
parents: 13866
diff changeset
1513 {
23839
7351d841f0b5 Disable the MSN blocked text dialog for now because it doesn't always
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23833
diff changeset
1514 /* QuLogic: Disabled until confirmed correct. */
7351d841f0b5 Disable the MSN blocked text dialog for now because it doesn't always
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23833
diff changeset
1515 #if 0
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1516 PurpleXmlNode *root;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1517 PurpleXmlNode *policy;
20547
35cff3479def Print the policies sent by the server (GCF command) in a human-readable way.
Carlos Silva <typ0@pidgin.im>
parents: 20546
diff changeset
1518
35cff3479def Print the policies sent by the server (GCF command) in a human-readable way.
Carlos Silva <typ0@pidgin.im>
parents: 20546
diff changeset
1519 g_return_if_fail(cmd->payload != NULL);
35cff3479def Print the policies sent by the server (GCF command) in a human-readable way.
Carlos Silva <typ0@pidgin.im>
parents: 20546
diff changeset
1520
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1521 if ( (root = purple_xmlnode_from_str(cmd->payload, cmd->payload_len)) == NULL)
20547
35cff3479def Print the policies sent by the server (GCF command) in a human-readable way.
Carlos Silva <typ0@pidgin.im>
parents: 20546
diff changeset
1522 {
26474
69f112d09563 Add some missing newlines in debug messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26051
diff changeset
1523 purple_debug_error("msn", "Unable to parse GCF payload into a XML tree\n");
20547
35cff3479def Print the policies sent by the server (GCF command) in a human-readable way.
Carlos Silva <typ0@pidgin.im>
parents: 20546
diff changeset
1524 return;
35cff3479def Print the policies sent by the server (GCF command) in a human-readable way.
Carlos Silva <typ0@pidgin.im>
parents: 20546
diff changeset
1525 }
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 23085
diff changeset
1526
23789
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1527
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1528 g_free(cmdproc->session->blocked_text);
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1529 cmdproc->session->blocked_text = NULL;
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1530
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1531 /* We need a get_child with attrib... */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1532 policy = purple_xmlnode_get_child(root, "Policy");
23789
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1533 while (policy) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1534 if (g_str_equal(purple_xmlnode_get_attrib(policy, "type"), "SHIELDS"))
23789
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1535 break;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1536 policy = purple_xmlnode_get_next_twin(policy);
23789
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1537 }
20547
35cff3479def Print the policies sent by the server (GCF command) in a human-readable way.
Carlos Silva <typ0@pidgin.im>
parents: 20546
diff changeset
1538
23789
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1539 if (policy) {
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1540 GString *blocked = g_string_new(NULL);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1541 PurpleXmlNode *imtext = purple_xmlnode_get_child(policy,
23789
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1542 "config/block/regexp/imtext");
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1543 while (imtext) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1544 const char *value = purple_xmlnode_get_attrib(imtext, "value");
23789
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1545 g_string_append_printf(blocked, "%s<br/>\n",
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1546 purple_base64_decode(value, NULL));
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1547 imtext = purple_xmlnode_get_next_twin(imtext);
23789
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1548 }
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 23085
diff changeset
1549
23789
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1550 cmdproc->session->blocked_text = g_string_free(blocked, FALSE);
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1551 }
3ef57c5a8d9c Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23787
diff changeset
1552
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1553 purple_xmlnode_free(root);
23839
7351d841f0b5 Disable the MSN blocked text dialog for now because it doesn't always
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23833
diff changeset
1554 #endif
13867
98600e8943dd [gaim-migrate @ 16721]
Ma Yuan <mayuan2006@gmail.com>
parents: 13866
diff changeset
1555 }
98600e8943dd [gaim-migrate @ 16721]
Ma Yuan <mayuan2006@gmail.com>
parents: 13866
diff changeset
1556
98600e8943dd [gaim-migrate @ 16721]
Ma Yuan <mayuan2006@gmail.com>
parents: 13866
diff changeset
1557 static void
13853
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
1558 gcf_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
1559 {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
1560 purple_debug_info("msn", "Processing GCF command\n");
23826
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1561
13867
98600e8943dd [gaim-migrate @ 16721]
Ma Yuan <mayuan2006@gmail.com>
parents: 13866
diff changeset
1562 cmdproc->last_cmd->payload_cb = gcf_cmd_post;
23826
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1563 cmd->payload_len = atoi(cmd->params[1]);
13853
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
1564 }
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
1565
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
1566 static void
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
1567 sbs_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
1568 {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
1569 purple_debug_info("msn", "Processing SBS... \n");
13853
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
1570 /*get the payload content*/
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
1571 }
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
1572
29428
e2b31691fa92 Attempt to parse any EndpointData out of the UBX payload. This isn't really
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29426
diff changeset
1573 static void
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1574 parse_user_endpoints(MsnUser *user, PurpleXmlNode *payloadNode)
29428
e2b31691fa92 Attempt to parse any EndpointData out of the UBX payload. This isn't really
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29426
diff changeset
1575 {
31202
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1576 MsnSession *session;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1577 PurpleXmlNode *epNode, *capsNode;
29428
e2b31691fa92 Attempt to parse any EndpointData out of the UBX payload. This isn't really
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29426
diff changeset
1578 MsnUserEndpoint data;
e2b31691fa92 Attempt to parse any EndpointData out of the UBX payload. This isn't really
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29426
diff changeset
1579 const char *id;
e2b31691fa92 Attempt to parse any EndpointData out of the UBX payload. This isn't really
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29426
diff changeset
1580 char *caps, *tmp;
31202
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1581 gboolean is_me;
29428
e2b31691fa92 Attempt to parse any EndpointData out of the UBX payload. This isn't really
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29426
diff changeset
1582
29432
612e0bf74774 Add a minor debug log.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29431
diff changeset
1583 purple_debug_info("msn", "Get EndpointData\n");
612e0bf74774 Add a minor debug log.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29431
diff changeset
1584
31202
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1585 session = user->userlist->session;
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1586 is_me = (user == session->user);
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1587
31200
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31198
diff changeset
1588 msn_user_clear_endpoints(user);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1589 for (epNode = purple_xmlnode_get_child(payloadNode, "EndpointData");
29428
e2b31691fa92 Attempt to parse any EndpointData out of the UBX payload. This isn't really
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29426
diff changeset
1590 epNode;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1591 epNode = purple_xmlnode_get_next_twin(epNode)) {
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1592 id = purple_xmlnode_get_attrib(epNode, "id");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1593 capsNode = purple_xmlnode_get_child(epNode, "Capabilities");
29428
e2b31691fa92 Attempt to parse any EndpointData out of the UBX payload. This isn't really
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29426
diff changeset
1594
31202
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1595 /* Disconnect others, if MPOP is disabled */
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1596 if (is_me
31210
0aa08cb723ac Replace the mpop account setting with a session boolean, because I
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31202
diff changeset
1597 && !session->enable_mpop
33624
d286e078dcc1 Use g_ascii_str(n)casecmp.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32973
diff changeset
1598 && g_ascii_strncasecmp(id + 1, session->guid, 36) != 0) {
31202
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1599 purple_debug_info("msn", "Disconnecting Endpoint %s\n", id);
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1600
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1601 tmp = g_strdup_printf("%s;%s", user->passport, id);
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1602 msn_notification_send_uun(session, tmp, MSN_UNIFIED_NOTIFICATION_MPOP, "goawyplzthxbye");
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1603 g_free(tmp);
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1604 } else {
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1605 if (capsNode != NULL) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1606 caps = purple_xmlnode_get_data(capsNode);
31202
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1607
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1608 data.clientid = strtoul(caps, &tmp, 10);
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1609 if (tmp && *tmp)
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1610 data.extcaps = strtoul(tmp + 1, NULL, 10);
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1611 else
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1612 data.extcaps = 0;
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1613
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1614 g_free(caps);
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1615 } else {
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1616 data.clientid = 0;
29428
e2b31691fa92 Attempt to parse any EndpointData out of the UBX payload. This isn't really
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29426
diff changeset
1617 data.extcaps = 0;
31202
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1618 }
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1619
1eae12b8ae9f Disconnect other endpoints if the MPOP setting is disabled.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31200
diff changeset
1620 msn_user_set_endpoint_data(user, id, &data);
29428
e2b31691fa92 Attempt to parse any EndpointData out of the UBX payload. This isn't really
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29426
diff changeset
1621 }
e2b31691fa92 Attempt to parse any EndpointData out of the UBX payload. This isn't really
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29426
diff changeset
1622 }
29445
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1623
31210
0aa08cb723ac Replace the mpop account setting with a session boolean, because I
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31202
diff changeset
1624 if (is_me && session->enable_mpop) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1625 for (epNode = purple_xmlnode_get_child(payloadNode, "PrivateEndpointData");
29445
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1626 epNode;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1627 epNode = purple_xmlnode_get_next_twin(epNode)) {
29445
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1628 MsnUserEndpoint *ep;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1629 PurpleXmlNode *nameNode, *clientNode;
29445
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1630
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1631 /* <PrivateEndpointData id='{GUID}'>
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1632 <EpName>Endpoint Name</EpName>
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1633 <Idle>true/false</Idle>
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1634 <ClientType>1</ClientType>
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1635 <State>NLN</State>
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1636 </PrivateEndpointData>
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1637 */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1638 id = purple_xmlnode_get_attrib(epNode, "id");
29445
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1639 ep = msn_user_get_endpoint_data(user, id);
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1640
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1641 if (ep != NULL) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1642 nameNode = purple_xmlnode_get_child(epNode, "EpName");
29445
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1643 if (nameNode != NULL) {
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1644 g_free(ep->name);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1645 ep->name = purple_xmlnode_get_data(nameNode);
29445
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1646 }
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1647
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1648 clientNode = purple_xmlnode_get_child(epNode, "ClientType");
29445
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1649 if (clientNode != NULL) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1650 tmp = purple_xmlnode_get_data(clientNode);
29446
2a1030761e57 Fix a little argument swapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29445
diff changeset
1651 ep->type = strtoul(tmp, NULL, 10);
29445
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1652 g_free(tmp);
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1653 }
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1654 }
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1655 }
3ffef687de8a Save PrivateEndpointData that we've received. I think this only applies to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29434
diff changeset
1656 }
29428
e2b31691fa92 Attempt to parse any EndpointData out of the UBX payload. This isn't really
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29426
diff changeset
1657 }
e2b31691fa92 Attempt to parse any EndpointData out of the UBX payload. This isn't really
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29426
diff changeset
1658
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1659 static void parse_currentmedia(MsnUser *user, const char *cmedia)
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1660 {
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1661 char **cmedia_array;
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1662 int strings = 0;
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1663
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1664 if (!cmedia || cmedia[0] == '\0') {
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1665 purple_debug_info("msn", "No currentmedia string\n");
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1666 return;
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1667 }
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1668
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1669 purple_debug_info("msn", "Parsing currentmedia string: \"%s\"\n", cmedia);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1670
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1671 cmedia_array = g_strsplit(cmedia, "\\0", 0);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1672
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1673 /*
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1674 * 0: Application
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1675 * 1: 'Music'/'Games'/'Office'
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1676 * 2: '1' if enabled, '0' if not
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1677 * 3: Format (eg. {0} by {1})
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1678 * 4: Title
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1679 * If 'Music':
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1680 * 5: Artist
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1681 * 6: Album
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1682 * 7: ?
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1683 */
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1684 strings = g_strv_length(cmedia_array);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1685
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1686 if (strings >= 4 && !strcmp(cmedia_array[2], "1")) {
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1687 if (user->extinfo == NULL)
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1688 user->extinfo = g_new0(MsnUserExtendedInfo, 1);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1689 else {
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1690 g_free(user->extinfo->media_album);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1691 g_free(user->extinfo->media_artist);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1692 g_free(user->extinfo->media_title);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1693 }
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1694
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1695 if (!strcmp(cmedia_array[1], "Music"))
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1696 user->extinfo->media_type = CURRENT_MEDIA_MUSIC;
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1697 else if (!strcmp(cmedia_array[1], "Games"))
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1698 user->extinfo->media_type = CURRENT_MEDIA_GAMES;
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1699 else if (!strcmp(cmedia_array[1], "Office"))
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1700 user->extinfo->media_type = CURRENT_MEDIA_OFFICE;
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1701 else
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1702 user->extinfo->media_type = CURRENT_MEDIA_UNKNOWN;
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1703
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1704 user->extinfo->media_title = g_strdup(cmedia_array[strings == 4 ? 3 : 4]);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1705 user->extinfo->media_artist = strings > 5 ? g_strdup(cmedia_array[5]) : NULL;
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1706 user->extinfo->media_album = strings > 6 ? g_strdup(cmedia_array[6]) : NULL;
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1707 }
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1708
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1709 g_strfreev(cmedia_array);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1710 }
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1711
13888
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13887
diff changeset
1712 /*
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13887
diff changeset
1713 * Get the UBX's PSM info
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13887
diff changeset
1714 * Post it to the User status
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13887
diff changeset
1715 * Thanks for Chris <ukdrizzle@yahoo.co.uk>'s code
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13887
diff changeset
1716 */
13856
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
1717 static void
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
1718 ubx_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
1719 size_t len)
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
1720 {
13888
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13887
diff changeset
1721 MsnSession *session;
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13887
diff changeset
1722 MsnUser *user;
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1723 char *passport;
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1724 int network;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1725 PurpleXmlNode *payloadNode;
21193
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20597
diff changeset
1726 char *psm_str, *str;
13888
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13887
diff changeset
1727
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13887
diff changeset
1728 session = cmdproc->session;
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13887
diff changeset
1729
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1730 msn_parse_user(cmd->params[0], &passport, &network);
31224
2a35f6749bb1 Add the session user to the userlist. This reduces the amount of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31223
diff changeset
1731 user = msn_userlist_find_user(session->userlist, passport);
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1732
24183
8949a1157a43 prints out the payload to debug log in case we get an invalid UBX command,
Ka-Hing Cheung <khc@pidgin.im>
parents: 24143
diff changeset
1733 if (user == NULL) {
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1734 str = g_strndup(payload, len);
26474
69f112d09563 Add some missing newlines in debug messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26051
diff changeset
1735 purple_debug_info("msn", "unknown user %s, payload is %s\n",
24183
8949a1157a43 prints out the payload to debug log in case we get an invalid UBX command,
Ka-Hing Cheung <khc@pidgin.im>
parents: 24143
diff changeset
1736 passport, str);
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1737 g_free(passport);
24183
8949a1157a43 prints out the payload to debug log in case we get an invalid UBX command,
Ka-Hing Cheung <khc@pidgin.im>
parents: 24143
diff changeset
1738 g_free(str);
8949a1157a43 prints out the payload to debug log in case we get an invalid UBX command,
Ka-Hing Cheung <khc@pidgin.im>
parents: 24143
diff changeset
1739 return;
8949a1157a43 prints out the payload to debug log in case we get an invalid UBX command,
Ka-Hing Cheung <khc@pidgin.im>
parents: 24143
diff changeset
1740 }
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 23085
diff changeset
1741
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1742 g_free(passport);
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1743
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1744 /* Free any existing media info for this user */
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1745 if (user->extinfo) {
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1746 g_free(user->extinfo->media_album);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1747 g_free(user->extinfo->media_artist);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1748 g_free(user->extinfo->media_title);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1749 user->extinfo->media_album = NULL;
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1750 user->extinfo->media_artist = NULL;
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1751 user->extinfo->media_title = NULL;
30394
1f73e5b91bec Correctly reset and free user->extinfo when the buddy is not listening to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30393
diff changeset
1752 user->extinfo->media_type = CURRENT_MEDIA_UNKNOWN;
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1753 }
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1754
25616
7ffb51d133a4 Set a NULL statusline and CurrentMedia if the UBX returns an empty payload,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25540
diff changeset
1755 if (len != 0) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1756 payloadNode = purple_xmlnode_from_str(payload, len);
29426
60dc51885de1 Avoid calling xmlnode_from_str twice when parsing the UBX data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29424
diff changeset
1757 if (!payloadNode) {
60dc51885de1 Avoid calling xmlnode_from_str twice when parsing the UBX data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29424
diff changeset
1758 purple_debug_error("msn", "UBX XML parse Error!\n");
60dc51885de1 Avoid calling xmlnode_from_str twice when parsing the UBX data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29424
diff changeset
1759
60dc51885de1 Avoid calling xmlnode_from_str twice when parsing the UBX data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29424
diff changeset
1760 msn_user_set_statusline(user, NULL);
60dc51885de1 Avoid calling xmlnode_from_str twice when parsing the UBX data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29424
diff changeset
1761
60dc51885de1 Avoid calling xmlnode_from_str twice when parsing the UBX data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29424
diff changeset
1762 msn_user_update(user);
60dc51885de1 Avoid calling xmlnode_from_str twice when parsing the UBX data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29424
diff changeset
1763 return;
60dc51885de1 Avoid calling xmlnode_from_str twice when parsing the UBX data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29424
diff changeset
1764 }
60dc51885de1 Avoid calling xmlnode_from_str twice when parsing the UBX data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29424
diff changeset
1765
60dc51885de1 Avoid calling xmlnode_from_str twice when parsing the UBX data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29424
diff changeset
1766 psm_str = msn_get_psm(payloadNode);
25616
7ffb51d133a4 Set a NULL statusline and CurrentMedia if the UBX returns an empty payload,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25540
diff changeset
1767 msn_user_set_statusline(user, psm_str);
7ffb51d133a4 Set a NULL statusline and CurrentMedia if the UBX returns an empty payload,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25540
diff changeset
1768 g_free(psm_str);
21193
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20597
diff changeset
1769
29426
60dc51885de1 Avoid calling xmlnode_from_str twice when parsing the UBX data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29424
diff changeset
1770 str = msn_get_currentmedia(payloadNode);
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
1771 parse_currentmedia(user, str);
25616
7ffb51d133a4 Set a NULL statusline and CurrentMedia if the UBX returns an empty payload,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25540
diff changeset
1772 g_free(str);
7ffb51d133a4 Set a NULL statusline and CurrentMedia if the UBX returns an empty payload,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25540
diff changeset
1773
29428
e2b31691fa92 Attempt to parse any EndpointData out of the UBX payload. This isn't really
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29426
diff changeset
1774 parse_user_endpoints(user, payloadNode);
29431
1d74bbb134ac Call xmlnode_free in the correct location.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29430
diff changeset
1775
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1776 purple_xmlnode_free(payloadNode);
29431
1d74bbb134ac Call xmlnode_free in the correct location.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29430
diff changeset
1777
25616
7ffb51d133a4 Set a NULL statusline and CurrentMedia if the UBX returns an empty payload,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25540
diff changeset
1778 } else {
7ffb51d133a4 Set a NULL statusline and CurrentMedia if the UBX returns an empty payload,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25540
diff changeset
1779 msn_user_set_statusline(user, NULL);
7ffb51d133a4 Set a NULL statusline and CurrentMedia if the UBX returns an empty payload,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25540
diff changeset
1780 }
16183
92409c474659 Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@pidgin.im>
parents: 16124
diff changeset
1781
13888
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13887
diff changeset
1782 msn_user_update(user);
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
1783 }
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
1784
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
1785 static void
13856
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
1786 ubx_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
1787 {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
1788 purple_debug_misc("msn", "UBX received.\n");
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
1789 cmdproc->last_cmd->payload_cb = ubx_cmd_post;
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1790 cmd->payload_len = atoi(cmd->params[1]);
23826
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1791 }
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1792
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1793 static void
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1794 uux_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1795 size_t len)
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1796 {
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1797 /* Do Nothing, right now. */
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1798 if (payload != NULL)
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1799 purple_debug_info("msn", "UUX payload:\n%s\n", payload);
13856
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
1800 }
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
1801
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
1802 static void
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
1803 uux_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
1804 {
23826
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1805 purple_debug_misc("msn", "UUX received.\n");
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1806 cmdproc->last_cmd->payload_cb = uux_cmd_post;
3eeaac42358f Get rid of that whole msn_set_payload_len thing and correctly set the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23824
diff changeset
1807 cmd->payload_len = atoi(cmd->params[1]);
13856
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
1808 }
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
1809
29420
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1810 void
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1811 msn_notification_send_uux(MsnSession *session, const char *payload)
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1812 {
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1813 MsnTransaction *trans;
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1814 MsnCmdProc *cmdproc;
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1815 size_t len = strlen(payload);
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1816
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1817 cmdproc = session->notification->cmdproc;
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1818 purple_debug_misc("msn", "Sending UUX command with payload: %s\n", payload);
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1819 trans = msn_transaction_new(cmdproc, "UUX", "%" G_GSIZE_FORMAT, len);
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1820 msn_transaction_set_payload(trans, payload, len);
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1821 msn_cmdproc_send_trans(cmdproc, trans);
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1822 }
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1823
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1824 void msn_notification_send_uux_endpointdata(MsnSession *session)
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1825 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1826 PurpleXmlNode *epDataNode;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1827 PurpleXmlNode *capNode;
29420
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1828 char *caps;
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1829 char *payload;
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1830 int length;
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1831
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1832 epDataNode = purple_xmlnode_new("EndpointData");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1833
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1834 capNode = purple_xmlnode_new_child(epDataNode, "Capabilities");
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1835 caps = g_strdup_printf("%d:%02d", MSN_CLIENT_ID_CAPABILITIES, MSN_CLIENT_ID_EXT_CAPS);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1836 purple_xmlnode_insert_data(capNode, caps, -1);
29420
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1837 g_free(caps);
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1838
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1839 payload = purple_xmlnode_to_str(epDataNode, &length);
29420
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1840
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1841 msn_notification_send_uux(session, payload);
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1842
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1843 purple_xmlnode_free(epDataNode);
29420
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1844 g_free(payload);
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1845 }
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1846
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1847 void msn_notification_send_uux_private_endpointdata(MsnSession *session)
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1848 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1849 PurpleXmlNode *private;
29448
6796411135f1 Allow setting the name of the current location. The default is still Pidgin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29447
diff changeset
1850 const char *name;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1851 PurpleXmlNode *epname;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1852 PurpleXmlNode *idle;
29449
ebd102c14c0b Support sending different client types in PrivateEndpointData.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29448
diff changeset
1853 GHashTable *ui_info;
ebd102c14c0b Support sending different client types in PrivateEndpointData.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29448
diff changeset
1854 const gchar *ui_type;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1855 PurpleXmlNode *client_type;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1856 PurpleXmlNode *state;
29420
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1857 char *payload;
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1858 int length;
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1859
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1860 private = purple_xmlnode_new("PrivateEndpointData");
29420
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1861
29448
6796411135f1 Allow setting the name of the current location. The default is still Pidgin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29447
diff changeset
1862 name = purple_account_get_string(session->account, "endpoint-name", NULL);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1863 epname = purple_xmlnode_new_child(private, "EpName");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1864 purple_xmlnode_insert_data(epname, name, -1);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1865
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1866 idle = purple_xmlnode_new_child(private, "Idle");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1867 purple_xmlnode_insert_data(idle, "false", -1);
29420
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1868
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1869 /* ClientType info (from amsn guys):
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1870 0: None
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1871 1: Computer
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1872 2: Website
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1873 3: Mobile / none
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1874 4: Xbox / phone /mobile
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1875 9: MsnGroup
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1876 32: Email member, currently Yahoo!
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1877 */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1878 client_type = purple_xmlnode_new_child(private, "ClientType");
29449
ebd102c14c0b Support sending different client types in PrivateEndpointData.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29448
diff changeset
1879 ui_info = purple_core_get_ui_info();
ebd102c14c0b Support sending different client types in PrivateEndpointData.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29448
diff changeset
1880 ui_type = ui_info ? g_hash_table_lookup(ui_info, "client_type") : NULL;
ebd102c14c0b Support sending different client types in PrivateEndpointData.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29448
diff changeset
1881 if (ui_type) {
ebd102c14c0b Support sending different client types in PrivateEndpointData.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29448
diff changeset
1882 if (strcmp(ui_type, "pc") == 0)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1883 purple_xmlnode_insert_data(client_type, "1", -1);
29449
ebd102c14c0b Support sending different client types in PrivateEndpointData.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29448
diff changeset
1884 else if (strcmp(ui_type, "web") == 0)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1885 purple_xmlnode_insert_data(client_type, "2", -1);
29449
ebd102c14c0b Support sending different client types in PrivateEndpointData.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29448
diff changeset
1886 else if (strcmp(ui_type, "phone") == 0)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1887 purple_xmlnode_insert_data(client_type, "3", -1);
29449
ebd102c14c0b Support sending different client types in PrivateEndpointData.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29448
diff changeset
1888 else if (strcmp(ui_type, "handheld") == 0)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1889 purple_xmlnode_insert_data(client_type, "3", -1);
29449
ebd102c14c0b Support sending different client types in PrivateEndpointData.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29448
diff changeset
1890 else
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1891 purple_xmlnode_insert_data(client_type, "1", -1);
29449
ebd102c14c0b Support sending different client types in PrivateEndpointData.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29448
diff changeset
1892 }
ebd102c14c0b Support sending different client types in PrivateEndpointData.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29448
diff changeset
1893 else
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1894 purple_xmlnode_insert_data(client_type, "1", -1);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1895
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1896 state = purple_xmlnode_new_child(private, "State");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1897 purple_xmlnode_insert_data(state, msn_state_get_text(msn_state_from_account(session->account)), -1);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1898
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1899 payload = purple_xmlnode_to_str(private, &length);
29420
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1900
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1901 msn_notification_send_uux(session, payload);
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1902
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
1903 purple_xmlnode_free(private);
29420
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1904 g_free(payload);
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1905 }
c81c525111db Initial support for msnp16, based on patch by Masca.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29001
diff changeset
1906
29450
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1907 static void
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1908 ubn_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1909 size_t len)
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1910 {
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1911 /* Do Nothing, right now. */
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1912 if (payload != NULL)
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1913 purple_debug_info("msn", "UBN payload:\n%s\n", payload);
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1914 }
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1915
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1916 static void
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1917 ubn_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1918 {
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1919 purple_debug_misc("msn", "UBN received from %s.\n", cmd->params[0]);
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1920 cmdproc->last_cmd->payload_cb = ubn_cmd_post;
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1921 cmd->payload_len = atoi(cmd->params[2]);
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1922 }
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1923
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1924 static void
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1925 uun_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1926 size_t len)
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1927 {
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1928 /* Do Nothing, right now. */
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1929 if (payload != NULL)
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1930 purple_debug_info("msn", "UUN payload:\n%s\n", payload);
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1931 }
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1932
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1933 static void
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1934 uun_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1935 {
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1936 if (strcmp(cmd->params[1], "OK") != 0) {
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1937 purple_debug_misc("msn", "UUN received.\n");
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1938 cmdproc->last_cmd->payload_cb = uun_cmd_post;
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1939 cmd->payload_len = atoi(cmd->params[1]);
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1940 }
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1941 else
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1942 purple_debug_misc("msn", "UUN OK received.\n");
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1943 }
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1944
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1945 void
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1946 msn_notification_send_uun(MsnSession *session, const char *user,
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1947 MsnUnifiedNotificationType type, const char *payload)
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1948 {
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1949 MsnTransaction *trans;
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1950 MsnCmdProc *cmdproc;
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1951 size_t len = strlen(payload);
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1952
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1953 cmdproc = session->notification->cmdproc;
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1954 purple_debug_misc("msn", "Sending UUN command %d to %s with payload: %s\n",
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1955 type, user, payload);
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1956 trans = msn_transaction_new(cmdproc, "UUN", "%s %d %" G_GSIZE_FORMAT,
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1957 user, type, len);
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1958 msn_transaction_set_payload(trans, payload, len);
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1959 msn_cmdproc_send_trans(cmdproc, trans);
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1960 }
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
1961
32091
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1962 void
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1963 msn_notification_send_circle_auth(MsnSession *session, const char *ticket)
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1964 {
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1965 MsnTransaction *trans;
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1966 MsnCmdProc *cmdproc;
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1967 char *encoded;
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1968
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1969 cmdproc = session->notification->cmdproc;
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1970
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1971 encoded = purple_base64_encode((guchar *)ticket, strlen(ticket));
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1972 trans = msn_transaction_new(cmdproc, "USR", "SHA A %s", encoded);
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1973 msn_cmdproc_send_trans(cmdproc, trans);
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1974
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1975 g_free(encoded);
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1976 }
5061380d9fee Pluck all MSNP18 changes. This is pretty much to fix sending OIMs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32023
diff changeset
1977
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1978 /**************************************************************************
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1979 * Message Types
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1980 **************************************************************************/
10481
a5d6b8e1717d [gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10463
diff changeset
1981
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1982 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1983 profile_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1984 {
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1985 MsnSession *session;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1986 const char *value;
30706
612b36b49058 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30700
diff changeset
1987 #ifdef MSN_PARTIAL_LISTS
13910
fb8f57c2b934 [gaim-migrate @ 17481]
Ma Yuan <mayuan2006@gmail.com>
parents: 13902
diff changeset
1988 const char *clLastChange;
30706
612b36b49058 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30700
diff changeset
1989 #endif
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1990
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1991 session = cmdproc->session;
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1992
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
1993 if (strcmp(msg->remote_user, "Hotmail"))
5333
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
1994 /* This isn't an official message. */
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
1995 return;
5333
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
1996
29457
15f977c9ac76 Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <markdoliner@pidgin.im>
parents: 29455
diff changeset
1997 if ((value = msn_message_get_header_value(msg, "sid")) != NULL)
10284
257978b5df5b [gaim-migrate @ 11454]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10275
diff changeset
1998 {
16896
cadacef82ac3 Remove a bunch of unnecessary NULL checking for g_free()
Daniel Atallah <datallah@pidgin.im>
parents: 16895
diff changeset
1999 g_free(session->passport_info.sid);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2000 session->passport_info.sid = g_strdup(value);
10284
257978b5df5b [gaim-migrate @ 11454]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10275
diff changeset
2001 }
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2002
29457
15f977c9ac76 Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <markdoliner@pidgin.im>
parents: 29455
diff changeset
2003 if ((value = msn_message_get_header_value(msg, "MSPAuth")) != NULL)
10284
257978b5df5b [gaim-migrate @ 11454]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10275
diff changeset
2004 {
16896
cadacef82ac3 Remove a bunch of unnecessary NULL checking for g_free()
Daniel Atallah <datallah@pidgin.im>
parents: 16895
diff changeset
2005 g_free(session->passport_info.mspauth);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2006 session->passport_info.mspauth = g_strdup(value);
10284
257978b5df5b [gaim-migrate @ 11454]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10275
diff changeset
2007 }
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2008
29457
15f977c9ac76 Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <markdoliner@pidgin.im>
parents: 29455
diff changeset
2009 if ((value = msn_message_get_header_value(msg, "ClientIP")) != NULL)
10284
257978b5df5b [gaim-migrate @ 11454]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10275
diff changeset
2010 {
16896
cadacef82ac3 Remove a bunch of unnecessary NULL checking for g_free()
Daniel Atallah <datallah@pidgin.im>
parents: 16895
diff changeset
2011 g_free(session->passport_info.client_ip);
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2012 session->passport_info.client_ip = g_strdup(value);
10284
257978b5df5b [gaim-migrate @ 11454]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10275
diff changeset
2013 }
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2014
29457
15f977c9ac76 Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <markdoliner@pidgin.im>
parents: 29455
diff changeset
2015 if ((value = msn_message_get_header_value(msg, "ClientPort")) != NULL)
20482
a706f6c3c75c merge of '92409c474659cace8004653f67cb9eba62ef7f93'
Richard Laager <rlaager@pidgin.im>
parents: 16183 20481
diff changeset
2016 {
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2017 session->passport_info.client_port = ntohs(atoi(value));
16183
92409c474659 Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@pidgin.im>
parents: 16124
diff changeset
2018 }
10275
186d84a66cc3 [gaim-migrate @ 11428]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10269
diff changeset
2019
29457
15f977c9ac76 Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <markdoliner@pidgin.im>
parents: 29455
diff changeset
2020 if ((value = msn_message_get_header_value(msg, "LoginTime")) != NULL)
10275
186d84a66cc3 [gaim-migrate @ 11428]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10269
diff changeset
2021 session->passport_info.sl = atol(value);
13854
ab947cf0c2bb [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents: 13853
diff changeset
2022
29457
15f977c9ac76 Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <markdoliner@pidgin.im>
parents: 29455
diff changeset
2023 if ((value = msn_message_get_header_value(msg, "EmailEnabled")) != NULL)
23923
79bcb6763b5c Use "EmailEnabled" from the MSN profile message to determine whether
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23874
diff changeset
2024 session->passport_info.email_enabled = (gboolean)atol(value);
79bcb6763b5c Use "EmailEnabled" from the MSN profile message to determine whether
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23874
diff changeset
2025
30706
612b36b49058 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30700
diff changeset
2026 #ifdef MSN_PARTIAL_LISTS
13854
ab947cf0c2bb [gaim-migrate @ 16473]
Ma Yuan <mayuan2006@gmail.com>
parents: 13853
diff changeset
2027 /*starting retrieve the contact list*/
20523
b627a3a41970 Always get the full contact list too, as we need it for the reverse list
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20522
diff changeset
2028 clLastChange = purple_account_get_string(session->account, "CLLastChange", NULL);
b627a3a41970 Always get the full contact list too, as we need it for the reverse list
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20522
diff changeset
2029 /* msn_userlist_load defeats all attempts at trying to detect blist sync issues */
b627a3a41970 Always get the full contact list too, as we need it for the reverse list
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20522
diff changeset
2030 msn_userlist_load(session);
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23770
diff changeset
2031 msn_get_contact_list(session, MSN_PS_INITIAL, clLastChange);
20523
b627a3a41970 Always get the full contact list too, as we need it for the reverse list
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20522
diff changeset
2032 #else
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2033 /* always get the full list? */
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23770
diff changeset
2034 msn_get_contact_list(session, MSN_PS_INITIAL, NULL);
20523
b627a3a41970 Always get the full contact list too, as we need it for the reverse list
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20522
diff changeset
2035 #endif
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2036 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2037
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2038 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2039 initial_email_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2040 {
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2041 MsnSession *session;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
2042 PurpleConnection *gc;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2043 GHashTable *table;
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2044 const char *unread;
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2045
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2046 session = cmdproc->session;
32624
f957ad287bcc Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents: 32023
diff changeset
2047 gc = purple_account_get_connection(session->account);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2048
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2049 if (strcmp(msg->remote_user, "Hotmail"))
5333
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2050 /* This isn't an official message. */
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2051 return;
5333
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2052
23924
1f8e75759bf3 Use a URL to open MSN Hotmail inbox instead of a temporary file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23923
diff changeset
2053 if (session->passport_info.mail_url == NULL)
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2054 {
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2055 MsnTransaction *trans;
10225
0dfea1bc8695 [gaim-migrate @ 11357]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10203
diff changeset
2056 trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX");
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2057 msn_transaction_queue_cmd(trans, msg->cmd);
5506
b53a1acacefe [gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
2058
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2059 msn_cmdproc_send_trans(cmdproc, trans);
5506
b53a1acacefe [gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
2060
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2061 return;
5358
efa9128e93fe [gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents: 5353
diff changeset
2062 }
efa9128e93fe [gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents: 5353
diff changeset
2063
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
2064 if (!purple_account_get_check_mail(session->account))
11321
a93121c0ea16 [gaim-migrate @ 13525]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11183
diff changeset
2065 return;
a93121c0ea16 [gaim-migrate @ 13525]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11183
diff changeset
2066
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2067 table = msn_message_get_hashtable_from_body(msg);
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2068
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2069 unread = g_hash_table_lookup(table, "Inbox-Unread");
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2070
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2071 if (unread != NULL)
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2072 {
7190
53b81e545762 [gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents: 7188
diff changeset
2073 int count = atoi(unread);
53b81e545762 [gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents: 7188
diff changeset
2074
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2075 if (count > 0)
7190
53b81e545762 [gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents: 7188
diff changeset
2076 {
25746
e97bb5964b19 *** Plucked rev f9080d0b (khc@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 25743
diff changeset
2077 const char *passports[2] = { msn_user_get_passport(session->user) };
e97bb5964b19 *** Plucked rev f9080d0b (khc@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 25743
diff changeset
2078 const char *urls[2] = { session->passport_info.mail_url };
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2079
21886
be9880b42bd2 Don't show a 'you ain't got no new mail' notification.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21720
diff changeset
2080 purple_notify_emails(gc, count, FALSE, NULL, NULL,
25746
e97bb5964b19 *** Plucked rev f9080d0b (khc@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 25743
diff changeset
2081 passports, urls, NULL, NULL);
7190
53b81e545762 [gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents: 7188
diff changeset
2082 }
5520
d49ba63410e3 [gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
2083 }
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2084
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2085 g_hash_table_destroy(table);
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2086 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2087
13861
dc0021ad2b73 [gaim-migrate @ 16653]
Ma Yuan <mayuan2006@gmail.com>
parents: 13859
diff changeset
2088 /*offline Message notification process*/
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2089 static void
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
2090 initial_mdata_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
2091 {
13858
fe1fbb9cc42b [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 13857
diff changeset
2092 MsnSession *session;
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2093 PurpleConnection *gc;
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2094 GHashTable *table;
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2095 const char *mdata, *unread;
13858
fe1fbb9cc42b [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 13857
diff changeset
2096
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2097 session = cmdproc->session;
32624
f957ad287bcc Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents: 32023
diff changeset
2098 gc = purple_account_get_connection(session->account);
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2099
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2100 if (strcmp(msg->remote_user, "Hotmail"))
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2101 /* This isn't an official message. */
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2102 return;
13864
97babffb505d [gaim-migrate @ 16684]
Ma Yuan <mayuan2006@gmail.com>
parents: 13861
diff changeset
2103
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2104 table = msn_message_get_hashtable_from_body(msg);
13858
fe1fbb9cc42b [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 13857
diff changeset
2105
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2106 mdata = g_hash_table_lookup(table, "Mail-Data");
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2107
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2108 if (mdata != NULL)
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2109 msn_parse_oim_msg(session->oim, mdata);
13858
fe1fbb9cc42b [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 13857
diff changeset
2110
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2111 if (g_hash_table_lookup(table, "Inbox-URL") == NULL)
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2112 {
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2113 g_hash_table_destroy(table);
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2114 return;
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2115 }
13858
fe1fbb9cc42b [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 13857
diff changeset
2116
23924
1f8e75759bf3 Use a URL to open MSN Hotmail inbox instead of a temporary file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23923
diff changeset
2117 if (session->passport_info.mail_url == NULL)
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2118 {
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2119 MsnTransaction *trans;
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2120 trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX");
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2121 msn_transaction_queue_cmd(trans, msg->cmd);
13858
fe1fbb9cc42b [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 13857
diff changeset
2122
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2123 msn_cmdproc_send_trans(cmdproc, trans);
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2124
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2125 g_hash_table_destroy(table);
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2126 return;
13858
fe1fbb9cc42b [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 13857
diff changeset
2127 }
fe1fbb9cc42b [gaim-migrate @ 16600]
Ma Yuan <mayuan2006@gmail.com>
parents: 13857
diff changeset
2128
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2129 if (!purple_account_get_check_mail(session->account))
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2130 {
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2131 g_hash_table_destroy(table);
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2132 return;
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2133 }
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2134
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2135 unread = g_hash_table_lookup(table, "Inbox-Unread");
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2136
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2137 if (unread != NULL)
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2138 {
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2139 int count = atoi(unread);
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2140
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2141 if (count > 0)
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2142 {
25746
e97bb5964b19 *** Plucked rev f9080d0b (khc@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 25743
diff changeset
2143 const char *passports[2] = { msn_user_get_passport(session->user) };
e97bb5964b19 *** Plucked rev f9080d0b (khc@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 25743
diff changeset
2144 const char *urls[2] = { session->passport_info.mail_url };
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2145
21886
be9880b42bd2 Don't show a 'you ain't got no new mail' notification.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21720
diff changeset
2146 purple_notify_emails(gc, count, FALSE, NULL, NULL,
25746
e97bb5964b19 *** Plucked rev f9080d0b (khc@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 25743
diff changeset
2147 passports, urls, NULL, NULL);
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2148 }
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2149 }
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2150
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2151 g_hash_table_destroy(table);
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
2152 }
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
2153
13892
3cdfd486fa4f [gaim-migrate @ 17015]
Ma Yuan <mayuan2006@gmail.com>
parents: 13890
diff changeset
2154 /*offline Message Notification*/
3cdfd486fa4f [gaim-migrate @ 17015]
Ma Yuan <mayuan2006@gmail.com>
parents: 13890
diff changeset
2155 static void
3cdfd486fa4f [gaim-migrate @ 17015]
Ma Yuan <mayuan2006@gmail.com>
parents: 13890
diff changeset
2156 delete_oim_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
3cdfd486fa4f [gaim-migrate @ 17015]
Ma Yuan <mayuan2006@gmail.com>
parents: 13890
diff changeset
2157 {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23828
diff changeset
2158 purple_debug_misc("msn", "Delete OIM message.\n");
13892
3cdfd486fa4f [gaim-migrate @ 17015]
Ma Yuan <mayuan2006@gmail.com>
parents: 13890
diff changeset
2159 }
3cdfd486fa4f [gaim-migrate @ 17015]
Ma Yuan <mayuan2006@gmail.com>
parents: 13890
diff changeset
2160
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2161 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2162 email_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2163 {
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2164 MsnSession *session;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
2165 PurpleConnection *gc;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2166 GHashTable *table;
8657
82ce13f78d31 [gaim-migrate @ 9409]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8652
diff changeset
2167 char *from, *subject, *tmp;
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2168
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2169 session = cmdproc->session;
32624
f957ad287bcc Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents: 32023
diff changeset
2170 gc = purple_account_get_connection(session->account);
8657
82ce13f78d31 [gaim-migrate @ 9409]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8652
diff changeset
2171
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2172 if (strcmp(msg->remote_user, "Hotmail"))
5333
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2173 /* This isn't an official message. */
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2174 return;
5333
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2175
23924
1f8e75759bf3 Use a URL to open MSN Hotmail inbox instead of a temporary file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23923
diff changeset
2176 if (session->passport_info.mail_url == NULL)
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2177 {
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2178 MsnTransaction *trans;
10225
0dfea1bc8695 [gaim-migrate @ 11357]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10203
diff changeset
2179 trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX");
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2180 msn_transaction_queue_cmd(trans, msg->cmd);
5506
b53a1acacefe [gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
2181
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2182 msn_cmdproc_send_trans(cmdproc, trans);
5506
b53a1acacefe [gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
2183
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2184 return;
5358
efa9128e93fe [gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents: 5353
diff changeset
2185 }
efa9128e93fe [gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents: 5353
diff changeset
2186
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
2187 if (!purple_account_get_check_mail(session->account))
11321
a93121c0ea16 [gaim-migrate @ 13525]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11183
diff changeset
2188 return;
a93121c0ea16 [gaim-migrate @ 13525]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11183
diff changeset
2189
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2190 table = msn_message_get_hashtable_from_body(msg);
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2191
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2192 from = subject = NULL;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2193
8657
82ce13f78d31 [gaim-migrate @ 9409]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8652
diff changeset
2194 tmp = g_hash_table_lookup(table, "From");
82ce13f78d31 [gaim-migrate @ 9409]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8652
diff changeset
2195 if (tmp != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
2196 from = purple_mime_decode_field(tmp);
8657
82ce13f78d31 [gaim-migrate @ 9409]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8652
diff changeset
2197
82ce13f78d31 [gaim-migrate @ 9409]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8652
diff changeset
2198 tmp = g_hash_table_lookup(table, "Subject");
82ce13f78d31 [gaim-migrate @ 9409]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8652
diff changeset
2199 if (tmp != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
2200 subject = purple_mime_decode_field(tmp);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2201
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
2202 purple_notify_email(gc,
9158
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2203 (subject != NULL ? subject : ""),
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2204 (from != NULL ? from : ""),
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2205 msn_user_get_passport(session->user),
23924
1f8e75759bf3 Use a URL to open MSN Hotmail inbox instead of a temporary file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23923
diff changeset
2206 session->passport_info.mail_url, NULL, NULL);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2207
16896
cadacef82ac3 Remove a bunch of unnecessary NULL checking for g_free()
Daniel Atallah <datallah@pidgin.im>
parents: 16895
diff changeset
2208 g_free(from);
cadacef82ac3 Remove a bunch of unnecessary NULL checking for g_free()
Daniel Atallah <datallah@pidgin.im>
parents: 16895
diff changeset
2209 g_free(subject);
7817
2155f763ab5d [gaim-migrate @ 8464]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7699
diff changeset
2210
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2211 g_hash_table_destroy(table);
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2212 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2213
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2214 static void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2215 system_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
5333
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2216 {
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2217 GHashTable *table;
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2218 const char *type_s;
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2219
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2220 if (strcmp(msg->remote_user, "Hotmail"))
5333
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2221 /* This isn't an official message. */
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2222 return;
5333
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2223
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2224 table = msn_message_get_hashtable_from_body(msg);
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2225
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2226 if ((type_s = g_hash_table_lookup(table, "Type")) != NULL)
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2227 {
5333
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2228 int type = atoi(type_s);
30700
fb64f0e498b2 Fix possible garbage value.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30527
diff changeset
2229 char buf[MSN_BUF_LEN] = "";
6308
12d48b4e80db [gaim-migrate @ 6807]
Mark Doliner <markdoliner@pidgin.im>
parents: 5963
diff changeset
2230 int minutes;
5333
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2231
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2232 switch (type)
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2233 {
5333
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2234 case 1:
6308
12d48b4e80db [gaim-migrate @ 6807]
Mark Doliner <markdoliner@pidgin.im>
parents: 5963
diff changeset
2235 minutes = atoi(g_hash_table_lookup(table, "Arg1"));
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 23085
diff changeset
2236 g_snprintf(buf, sizeof(buf), dngettext(PACKAGE,
9158
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2237 "The MSN server will shut down for maintenance "
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2238 "in %d minute. You will automatically be "
10816
ba2657f4c157 [gaim-migrate @ 12471]
Luke Schierer <lschiere@pidgin.im>
parents: 10812
diff changeset
2239 "signed out at that time. Please finish any "
9158
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2240 "conversations in progress.\n\nAfter the "
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2241 "maintenance has been completed, you will be "
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2242 "able to successfully sign in.",
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2243 "The MSN server will shut down for maintenance "
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2244 "in %d minutes. You will automatically be "
10816
ba2657f4c157 [gaim-migrate @ 12471]
Luke Schierer <lschiere@pidgin.im>
parents: 10812
diff changeset
2245 "signed out at that time. Please finish any "
9158
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2246 "conversations in progress.\n\nAfter the "
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2247 "maintenance has been completed, you will be "
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2248 "able to successfully sign in.", minutes),
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2249 minutes);
5333
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2250 default:
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2251 break;
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2252 }
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2253
5436
a0e0bacaa196 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5406
diff changeset
2254 if (*buf != '\0')
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34304
diff changeset
2255 purple_notify_info(purple_account_get_connection(
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34304
diff changeset
2256 cmdproc->session->account),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34304
diff changeset
2257 NULL, buf, NULL, purple_request_cpar_from_account(
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34304
diff changeset
2258 cmdproc->session->account));
5333
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2259 }
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2260
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2261 g_hash_table_destroy(table);
e1ae88905e28 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2262 }
5793
28d84d5e5663 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2263
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2264 /**************************************************************************
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31242
diff changeset
2265 * Dispatch server list management
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2266 **************************************************************************/
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2267 typedef struct MsnAddRemoveListData {
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2268 MsnCmdProc *cmdproc;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2269 MsnUser *user;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2270 MsnListOp list_op;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2271 gboolean add;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2272 } MsnAddRemoveListData;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2273
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2274 static void
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2275 modify_unknown_buddy_on_list(MsnSession *session, const char *passport,
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2276 MsnNetwork network, gpointer data)
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2277 {
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2278 MsnAddRemoveListData *addrem = data;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2279 MsnCmdProc *cmdproc;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
2280 PurpleXmlNode *node;
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2281 char *payload;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2282 int payload_len;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2283
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2284 cmdproc = addrem->cmdproc;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2285
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2286 /* Update user first */
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2287 msn_user_set_network(addrem->user, network);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2288
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
2289 node = purple_xmlnode_new("ml");
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2290 node->child = NULL;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2291
30526
257d8a4af49e The session parameter appears unused in msn_add_contact_xml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30405
diff changeset
2292 msn_add_contact_xml(node, passport, addrem->list_op, network);
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2293
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
2294 payload = purple_xmlnode_to_str(node, &payload_len);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
2295 purple_xmlnode_free(node);
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2296
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2297 if (addrem->add)
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2298 msn_notification_post_adl(cmdproc, payload, payload_len);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2299 else
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2300 msn_notification_post_rml(cmdproc, payload, payload_len);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2301
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2302 g_free(payload);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2303 g_free(addrem);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2304 }
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2305
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2306 void
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20560
diff changeset
2307 msn_notification_add_buddy_to_list(MsnNotification *notification, MsnListId list_id,
25153
7e8bdb57a11f Make the add/remove buddy from list functions take a MsnUser* instead of the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24779
diff changeset
2308 MsnUser *user)
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2309 {
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2310 MsnAddRemoveListData *addrem;
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2311 MsnCmdProc *cmdproc;
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20560
diff changeset
2312 MsnListOp list_op = 1 << list_id;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
2313 PurpleXmlNode *adl_node;
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
2314 char *payload;
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
2315 int payload_len;
20571
712babe35f35 Some more cleanups
Carlos Silva <typ0@pidgin.im>
parents: 20569
diff changeset
2316
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2317 cmdproc = notification->servconn->cmdproc;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2318
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
2319 adl_node = purple_xmlnode_new("ml");
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
2320 adl_node->child = NULL;
9194
1ff43e1a77e5 [gaim-migrate @ 9989]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
2321
30526
257d8a4af49e The session parameter appears unused in msn_add_contact_xml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30405
diff changeset
2322 msn_add_contact_xml(adl_node, user->passport, list_op, user->networkid);
9194
1ff43e1a77e5 [gaim-migrate @ 9989]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
2323
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
2324 payload = purple_xmlnode_to_str(adl_node, &payload_len);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
2325 purple_xmlnode_free(adl_node);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 23085
diff changeset
2326
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2327 if (user->networkid != MSN_NETWORK_UNKNOWN) {
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2328 msn_notification_post_adl(cmdproc, payload, payload_len);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2329
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2330 } else {
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2331 addrem = g_new(MsnAddRemoveListData, 1);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2332 addrem->cmdproc = cmdproc;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2333 addrem->user = user;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2334 addrem->list_op = list_op;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2335 addrem->add = TRUE;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2336
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2337 msn_notification_send_fqy(notification->session, payload, payload_len,
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2338 modify_unknown_buddy_on_list, addrem);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2339 }
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2340
20582
edd27909081a Make the buddylist sync issue a little less worse.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20578
diff changeset
2341 g_free(payload);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2342 }
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2343
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2344 void
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20560
diff changeset
2345 msn_notification_rem_buddy_from_list(MsnNotification *notification, MsnListId list_id,
25153
7e8bdb57a11f Make the add/remove buddy from list functions take a MsnUser* instead of the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24779
diff changeset
2346 MsnUser *user)
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2347 {
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2348 MsnAddRemoveListData *addrem;
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2349 MsnCmdProc *cmdproc;
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20560
diff changeset
2350 MsnListOp list_op = 1 << list_id;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
2351 PurpleXmlNode *rml_node;
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
2352 char *payload;
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
2353 int payload_len;
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
2354
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2355 cmdproc = notification->servconn->cmdproc;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9158
diff changeset
2356
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
2357 rml_node = purple_xmlnode_new("ml");
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
2358 rml_node->child = NULL;
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
2359
30526
257d8a4af49e The session parameter appears unused in msn_add_contact_xml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30405
diff changeset
2360 msn_add_contact_xml(rml_node, user->passport, list_op, user->networkid);
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
2361
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
2362 payload = purple_xmlnode_to_str(rml_node, &payload_len);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
2363 purple_xmlnode_free(rml_node);
13866
b6a2c8d390ef [gaim-migrate @ 16716]
Ma Yuan <mayuan2006@gmail.com>
parents: 13865
diff changeset
2364
25773
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2365 if (user->networkid != MSN_NETWORK_UNKNOWN) {
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2366 msn_notification_post_rml(cmdproc, payload, payload_len);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2367
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2368 } else {
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2369 addrem = g_new(MsnAddRemoveListData, 1);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2370 addrem->cmdproc = cmdproc;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2371 addrem->user = user;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2372 addrem->list_op = list_op;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2373 addrem->add = FALSE;
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2374
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2375 msn_notification_send_fqy(notification->session, payload, payload_len,
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2376 modify_unknown_buddy_on_list, addrem);
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2377 }
81ed6eacab59 *** Plucked rev b932d4f94f9c771877b6a8a6a1d7dd3ea9c08005 (qulogic@pidgin.im):
Ka-Hing Cheung <khc@pidgin.im>
parents: 25746
diff changeset
2378
20582
edd27909081a Make the buddylist sync issue a little less worse.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20578
diff changeset
2379 g_free(payload);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2380 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2381
10463
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
2382 /**************************************************************************
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
2383 * Init
f2f97738b401 [gaim-migrate @ 11737]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10452
diff changeset
2384 **************************************************************************/
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2385 void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2386 msn_notification_init(void)
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2387 {
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2388 cbs_table = msn_table_new();
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2389
10310
9f797642432a [gaim-migrate @ 11504]
Mark Doliner <markdoliner@pidgin.im>
parents: 10296
diff changeset
2390 /* Synchronous */
11992
906176cc9b22 [gaim-migrate @ 14285]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11862
diff changeset
2391 msn_table_add_cmd(cbs_table, "CHG", "CHG", NULL);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2392 msn_table_add_cmd(cbs_table, "CHG", "ILN", iln_cmd);
13856
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
2393 msn_table_add_cmd(cbs_table, "ADL", "ILN", iln_cmd);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2394 msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd);
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2395 msn_table_add_cmd(cbs_table, "USR", "XFR", xfr_cmd);
13853
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
2396 msn_table_add_cmd(cbs_table, "USR", "GCF", gcf_cmd);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2397 msn_table_add_cmd(cbs_table, "CVR", "CVR", cvr_cmd);
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2398 msn_table_add_cmd(cbs_table, "VER", "VER", ver_cmd);
10833
62d8c516b51b [gaim-migrate @ 12503]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10816
diff changeset
2399 msn_table_add_cmd(cbs_table, "PRP", "PRP", prp_cmd);
13856
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
2400 msn_table_add_cmd(cbs_table, "BLP", "BLP", blp_cmd);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2401 msn_table_add_cmd(cbs_table, "XFR", "XFR", xfr_cmd);
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2402
10310
9f797642432a [gaim-migrate @ 11504]
Mark Doliner <markdoliner@pidgin.im>
parents: 10296
diff changeset
2403 /* Asynchronous */
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2404 msn_table_add_cmd(cbs_table, NULL, "IPG", ipg_cmd);
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2405 msn_table_add_cmd(cbs_table, NULL, "MSG", msg_cmd);
13870
258d48d6ab52 [gaim-migrate @ 16737]
Ma Yuan <mayuan2006@gmail.com>
parents: 13869
diff changeset
2406 msn_table_add_cmd(cbs_table, NULL, "UBM", ubm_cmd);
13853
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
2407 msn_table_add_cmd(cbs_table, NULL, "GCF", gcf_cmd);
cccd9dd599eb [gaim-migrate @ 16329]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
2408 msn_table_add_cmd(cbs_table, NULL, "SBS", sbs_cmd);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2409 msn_table_add_cmd(cbs_table, NULL, "NOT", not_cmd);
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2410
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2411 msn_table_add_cmd(cbs_table, NULL, "CHL", chl_cmd);
13865
ce1c14d05b5f [gaim-migrate @ 16685]
Ma Yuan <mayuan2006@gmail.com>
parents: 13864
diff changeset
2412 msn_table_add_cmd(cbs_table, NULL, "RML", rml_cmd);
13856
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
2413 msn_table_add_cmd(cbs_table, NULL, "ADL", adl_cmd);
13873
3c20f5d70d1d [gaim-migrate @ 16772]
Ma Yuan <mayuan2006@gmail.com>
parents: 13871
diff changeset
2414 msn_table_add_cmd(cbs_table, NULL, "FQY", fqy_cmd);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2415
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2416 msn_table_add_cmd(cbs_table, NULL, "QRY", NULL);
17202
32ab8bec7403 Periodically refresh the authentication info required to automatically log
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17178
diff changeset
2417 msn_table_add_cmd(cbs_table, NULL, "QNG", qng_cmd);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2418 msn_table_add_cmd(cbs_table, NULL, "FLN", fln_cmd);
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2419 msn_table_add_cmd(cbs_table, NULL, "NLN", nln_cmd);
8832
30eacd0f47fd [gaim-migrate @ 9596]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8808
diff changeset
2420 msn_table_add_cmd(cbs_table, NULL, "ILN", iln_cmd);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2421 msn_table_add_cmd(cbs_table, NULL, "OUT", out_cmd);
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2422 msn_table_add_cmd(cbs_table, NULL, "RNG", rng_cmd);
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2423
13856
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
2424 msn_table_add_cmd(cbs_table, NULL, "UBX", ubx_cmd);
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
2425 msn_table_add_cmd(cbs_table, NULL, "UUX", uux_cmd);
a6511183749e [gaim-migrate @ 16546]
Ma Yuan <mayuan2006@gmail.com>
parents: 13855
diff changeset
2426
29450
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
2427 msn_table_add_cmd(cbs_table, NULL, "UBN", ubn_cmd);
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
2428 msn_table_add_cmd(cbs_table, NULL, "UUN", uun_cmd);
9acb8d4f3da7 Support receiving UBN and sending UUN, which seem to have been added way
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29449
diff changeset
2429
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2430 msn_table_add_cmd(cbs_table, NULL, "URL", url_cmd);
9194
1ff43e1a77e5 [gaim-migrate @ 9989]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
2431
10043
4d4cc1ee9b69 [gaim-migrate @ 11002]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10010
diff changeset
2432 msn_table_add_cmd(cbs_table, "fallback", "XFR", xfr_cmd);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2433
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
2434 msn_table_add_error(cbs_table, "ADL", adl_error);
28776
0fbd5222f2a5 Add an error handler for the RML command as well.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28775
diff changeset
2435 msn_table_add_error(cbs_table, "RML", rml_error);
25741
b7a82e0ce3c1 More MSN fixes to go along with f0df27a299120baecf9ea88a9fb24ffe1dbe72fd:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25722
diff changeset
2436 msn_table_add_error(cbs_table, "FQY", fqy_error);
10568
15f02c0e7fc1 [gaim-migrate @ 11954]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10519
diff changeset
2437 msn_table_add_error(cbs_table, "USR", usr_error);
10403
4647a87ef73b [gaim-migrate @ 11648]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10345
diff changeset
2438
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2439 msn_table_add_msg_type(cbs_table,
9158
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2440 "text/x-msmsgsprofile",
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2441 profile_msg);
13861
dc0021ad2b73 [gaim-migrate @ 16653]
Ma Yuan <mayuan2006@gmail.com>
parents: 13859
diff changeset
2442 /*initial OIM notification*/
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2443 msn_table_add_msg_type(cbs_table,
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13854
diff changeset
2444 "text/x-msmsgsinitialmdatanotification",
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 23085
diff changeset
2445 initial_mdata_msg);
13861
dc0021ad2b73 [gaim-migrate @ 16653]
Ma Yuan <mayuan2006@gmail.com>
parents: 13859
diff changeset
2446 /*OIM notification when user online*/
dc0021ad2b73 [gaim-migrate @ 16653]
Ma Yuan <mayuan2006@gmail.com>
parents: 13859
diff changeset
2447 msn_table_add_msg_type(cbs_table,
dc0021ad2b73 [gaim-migrate @ 16653]
Ma Yuan <mayuan2006@gmail.com>
parents: 13859
diff changeset
2448 "text/x-msmsgsoimnotification",
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 23085
diff changeset
2449 initial_mdata_msg);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2450 msn_table_add_msg_type(cbs_table,
9158
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2451 "text/x-msmsgsinitialemailnotification",
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2452 initial_email_msg);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2453 msn_table_add_msg_type(cbs_table,
9158
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2454 "text/x-msmsgsemailnotification",
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2455 email_msg);
13892
3cdfd486fa4f [gaim-migrate @ 17015]
Ma Yuan <mayuan2006@gmail.com>
parents: 13890
diff changeset
2456 /*delete an offline Message notification*/
3cdfd486fa4f [gaim-migrate @ 17015]
Ma Yuan <mayuan2006@gmail.com>
parents: 13890
diff changeset
2457 msn_table_add_msg_type(cbs_table,
3cdfd486fa4f [gaim-migrate @ 17015]
Ma Yuan <mayuan2006@gmail.com>
parents: 13890
diff changeset
2458 "text/x-msmsgsactivemailnotification",
3cdfd486fa4f [gaim-migrate @ 17015]
Ma Yuan <mayuan2006@gmail.com>
parents: 13890
diff changeset
2459 delete_oim_msg);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2460 msn_table_add_msg_type(cbs_table,
9158
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2461 "application/x-msmsgssystemmessage",
f8dab42adeaf [gaim-migrate @ 9942]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8926
diff changeset
2462 system_msg);
25540
d924c53c522d Setup message handlers on the MSN Notification server so that messages from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25534
diff changeset
2463 /* generic message handlers */
d924c53c522d Setup message handlers on the MSN Notification server so that messages from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25534
diff changeset
2464 msn_table_add_msg_type(cbs_table, "text/plain",
d924c53c522d Setup message handlers on the MSN Notification server so that messages from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25534
diff changeset
2465 msn_plain_msg);
d924c53c522d Setup message handlers on the MSN Notification server so that messages from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25534
diff changeset
2466 msn_table_add_msg_type(cbs_table, "text/x-msmsgscontrol",
d924c53c522d Setup message handlers on the MSN Notification server so that messages from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25534
diff changeset
2467 msn_control_msg);
d924c53c522d Setup message handlers on the MSN Notification server so that messages from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25534
diff changeset
2468 msn_table_add_msg_type(cbs_table, "text/x-msnmsgr-datacast",
d924c53c522d Setup message handlers on the MSN Notification server so that messages from
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25534
diff changeset
2469 msn_datacast_msg);
8808
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2470 }
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2471
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2472 void
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2473 msn_notification_end(void)
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2474 {
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2475 msn_table_destroy(cbs_table);
1cb5ddf6b625 [gaim-migrate @ 9570]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8669
diff changeset
2476 }
13861
dc0021ad2b73 [gaim-migrate @ 16653]
Ma Yuan <mayuan2006@gmail.com>
parents: 13859
diff changeset
2477

mercurial