annotate libpurple/protocols/msn/contact.c @ 23459:69af5301e1a7

killing MsnContact which just wraps MsnSession
author Ka-Hing Cheung <khc@hxbc.us>
date Sun, 09 Mar 2008 23:55:27 +0000
parents bca58b00afab
children d756a0477c06
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1 /**
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
2 * @file contact.c
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
3 * get MSN contacts via SOAP request
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
4 * created by MaYuan<mayuan2006@gmail.com>
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
5 *
20401
4ddc27c18781 Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents: 20394
diff changeset
6 * purple
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
7 *
20401
4ddc27c18781 Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents: 20394
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
10 * source distribution.
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
11 *
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
15 * (at your option) any later version.
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
16 *
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
20 * GNU General Public License for more details.
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
21 *
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
25 */
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
26
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
27 #include "msn.h"
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
28 #include "contact.h"
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
29 #include "xmlnode.h"
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
30 #include "group.h"
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
31 #include "soap2.h"
23445
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
32 #include "nexus.h"
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
33
20484
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
34 const char *MsnSoapPartnerScenarioText[] =
20481
eb93710aec4d 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: 20479
diff changeset
35 {
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
36 "Initial",
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
37 "ContactSave",
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
38 "MessengerPendingList",
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
39 "ContactMsgrAPI",
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
40 "BlockUnblock"
20481
eb93710aec4d 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: 20479
diff changeset
41 };
eb93710aec4d 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: 20479
diff changeset
42
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
43 const char *MsnMemberRole[] =
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
44 {
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
45 "Forward",
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
46 "Allow",
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
47 "Block",
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
48 "Reverse",
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
49 "Pending"
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
50 };
20481
eb93710aec4d 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: 20479
diff changeset
51
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
52 typedef struct {
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
53 MsnSession *session;
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
54 MsnSoapPartnerScenario which;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
55 } GetContactListCbData;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
56
20481
eb93710aec4d 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: 20479
diff changeset
57 MsnCallbackState *
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
58 msn_callback_state_new(MsnSession *session)
20481
eb93710aec4d 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: 20479
diff changeset
59 {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
60 MsnCallbackState *state = g_new0(MsnCallbackState, 1);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
61
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
62 state->session = session;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
63
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
64 return state;
20481
eb93710aec4d 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: 20479
diff changeset
65 }
eb93710aec4d 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: 20479
diff changeset
66
eb93710aec4d 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: 20479
diff changeset
67 void
eb93710aec4d 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: 20479
diff changeset
68 msn_callback_state_free(MsnCallbackState *state)
eb93710aec4d 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: 20479
diff changeset
69 {
20501
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
70 if (state == NULL)
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
71 return;
20539
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
72
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
73 g_free(state->who);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
74 g_free(state->uid);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
75 g_free(state->old_group_name);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
76 g_free(state->new_group_name);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
77 g_free(state->guid);
20539
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
78
20481
eb93710aec4d 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: 20479
diff changeset
79 g_free(state);
eb93710aec4d 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: 20479
diff changeset
80 }
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
81
20481
eb93710aec4d 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: 20479
diff changeset
82 void
eb93710aec4d 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: 20479
diff changeset
83 msn_callback_state_set_who(MsnCallbackState *state, const gchar *who)
eb93710aec4d 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: 20479
diff changeset
84 {
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
85 gchar *nval;
20481
eb93710aec4d 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: 20479
diff changeset
86 g_return_if_fail(state != NULL);
20489
321d25932f5e Fix a bug where we were g_strdup'ing a previously freed pointer. Thanks to khc for the debugging.
Carlos Silva <typ0@pidgin.im>
parents: 20486
diff changeset
87
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
88 nval = g_strdup(who);
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
89 g_free(state->who);
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
90 state->who = nval;
20481
eb93710aec4d 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: 20479
diff changeset
91 }
eb93710aec4d 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: 20479
diff changeset
92
eb93710aec4d 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: 20479
diff changeset
93 void
20539
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
94 msn_callback_state_set_uid(MsnCallbackState *state, const gchar *uid)
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
95 {
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
96 gchar *nval;
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
97 g_return_if_fail(state != NULL);
20539
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
98
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
99 nval = g_strdup(uid);
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
100 g_free(state->uid);
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
101 state->uid = nval;
20539
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
102 }
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
103
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
104 void
20481
eb93710aec4d 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: 20479
diff changeset
105 msn_callback_state_set_old_group_name(MsnCallbackState *state, const gchar *old_group_name)
eb93710aec4d 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: 20479
diff changeset
106 {
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
107 gchar *nval;
20481
eb93710aec4d 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: 20479
diff changeset
108 g_return_if_fail(state != NULL);
20489
321d25932f5e Fix a bug where we were g_strdup'ing a previously freed pointer. Thanks to khc for the debugging.
Carlos Silva <typ0@pidgin.im>
parents: 20486
diff changeset
109
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
110 nval = g_strdup(old_group_name);
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
111 g_free(state->old_group_name);
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
112 state->old_group_name = nval;
20481
eb93710aec4d 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: 20479
diff changeset
113 }
eb93710aec4d 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: 20479
diff changeset
114
eb93710aec4d 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: 20479
diff changeset
115 void
eb93710aec4d 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: 20479
diff changeset
116 msn_callback_state_set_new_group_name(MsnCallbackState *state, const gchar *new_group_name)
eb93710aec4d 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: 20479
diff changeset
117 {
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
118 gchar *nval;
20481
eb93710aec4d 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: 20479
diff changeset
119 g_return_if_fail(state != NULL);
20489
321d25932f5e Fix a bug where we were g_strdup'ing a previously freed pointer. Thanks to khc for the debugging.
Carlos Silva <typ0@pidgin.im>
parents: 20486
diff changeset
120
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
121 nval = g_strdup(new_group_name);
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
122 g_free(state->new_group_name);
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
123 state->new_group_name = nval;
20481
eb93710aec4d 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: 20479
diff changeset
124 }
eb93710aec4d 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: 20479
diff changeset
125
eb93710aec4d 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: 20479
diff changeset
126 void
eb93710aec4d 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: 20479
diff changeset
127 msn_callback_state_set_guid(MsnCallbackState *state, const gchar *guid)
eb93710aec4d 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: 20479
diff changeset
128 {
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
129 gchar *nval;
20481
eb93710aec4d 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: 20479
diff changeset
130 g_return_if_fail(state != NULL);
20489
321d25932f5e Fix a bug where we were g_strdup'ing a previously freed pointer. Thanks to khc for the debugging.
Carlos Silva <typ0@pidgin.im>
parents: 20486
diff changeset
131
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
132 nval = g_strdup(guid);
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
133 g_free(state->guid);
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
134 state->guid = nval;
20481
eb93710aec4d 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: 20479
diff changeset
135 }
eb93710aec4d 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: 20479
diff changeset
136
eb93710aec4d 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: 20479
diff changeset
137
eb93710aec4d 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: 20479
diff changeset
138 void
eb93710aec4d 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: 20479
diff changeset
139 msn_callback_state_set_list_id(MsnCallbackState *state, MsnListId list_id)
eb93710aec4d 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: 20479
diff changeset
140 {
eb93710aec4d 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: 20479
diff changeset
141 g_return_if_fail(state != NULL);
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
142
20481
eb93710aec4d 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: 20479
diff changeset
143 state->list_id = list_id;
eb93710aec4d 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: 20479
diff changeset
144 }
eb93710aec4d 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: 20479
diff changeset
145
eb93710aec4d 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: 20479
diff changeset
146 void
eb93710aec4d 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: 20479
diff changeset
147 msn_callback_state_set_action(MsnCallbackState *state, MsnCallbackAction action)
eb93710aec4d 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: 20479
diff changeset
148 {
eb93710aec4d 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: 20479
diff changeset
149 g_return_if_fail(state != NULL);
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
150
20481
eb93710aec4d 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: 20479
diff changeset
151 state->action |= action;
eb93710aec4d 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: 20479
diff changeset
152 }
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
153
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
154 /*get MSN member role utility*/
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
155 static MsnListId
20789
6736c1168c50 Leak fix.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20774
diff changeset
156 msn_get_memberrole(const char *role)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
157 {
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
158 g_return_val_if_fail(role != NULL, 0);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
159
20481
eb93710aec4d 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: 20479
diff changeset
160 if (!strcmp(role,"Allow")) {
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
161 return MSN_LIST_AL;
20481
eb93710aec4d 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: 20479
diff changeset
162 } else if (!strcmp(role,"Block")) {
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
163 return MSN_LIST_BL;
20481
eb93710aec4d 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: 20479
diff changeset
164 } else if (!strcmp(role,"Reverse")) {
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
165 return MSN_LIST_RL;
20481
eb93710aec4d 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: 20479
diff changeset
166 } else if (!strcmp(role,"Pending")) {
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
167 return MSN_LIST_PL;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
168 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
169 return 0;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
170 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
171
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
172 /*get User Type*/
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
173 static int
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
174 msn_get_user_type(char *type)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
175 {
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
176 g_return_val_if_fail(type != NULL, 0);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
177
20481
eb93710aec4d 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: 20479
diff changeset
178 if (!strcmp(type,"Regular")) {
20442
a1c6206f0205 Make the MsnUser type an enum so we have fewer magic numbers
Stu Tomlinson <stu@nosnilmot.com>
parents: 20440
diff changeset
179 return MSN_USER_TYPE_PASSPORT;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
180 }
20481
eb93710aec4d 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: 20479
diff changeset
181 if (!strcmp(type,"Live")) {
20442
a1c6206f0205 Make the MsnUser type an enum so we have fewer magic numbers
Stu Tomlinson <stu@nosnilmot.com>
parents: 20440
diff changeset
182 return MSN_USER_TYPE_PASSPORT;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
183 }
20481
eb93710aec4d 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: 20479
diff changeset
184 if (!strcmp(type,"LivePending")) {
20442
a1c6206f0205 Make the MsnUser type an enum so we have fewer magic numbers
Stu Tomlinson <stu@nosnilmot.com>
parents: 20440
diff changeset
185 return MSN_USER_TYPE_PASSPORT;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
186 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
187
20442
a1c6206f0205 Make the MsnUser type an enum so we have fewer magic numbers
Stu Tomlinson <stu@nosnilmot.com>
parents: 20440
diff changeset
188 return MSN_USER_TYPE_UNKNOWN;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
189 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
190
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
191 /* Create the AddressBook in the server, if we don't have one */
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
192 static void
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
193 msn_create_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data)
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
194 {
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23447
diff changeset
195 if (resp && xmlnode_get_child(resp->xml, "Body/Fault") == NULL) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
196 purple_debug_info("msnab", "Address Book successfully created!\n");
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
197 msn_get_address_book((MsnSession *)data, MSN_PS_INITIAL, NULL, NULL);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
198 } else {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
199 purple_debug_info("msnab", "Address Book creation failed!\n");
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
200 }
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
201 }
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
202
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
203 static void
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
204 msn_create_address_book(MsnSession *session)
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
205 {
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
206 gchar *body;
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
207
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
208 g_return_if_fail(session != NULL);
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
209 g_return_if_fail(session->user != NULL);
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
210 g_return_if_fail(session->user->passport != NULL);
20481
eb93710aec4d 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: 20479
diff changeset
211
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
212 purple_debug_info("msnab","Creating an Address Book.\n");
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
213
23445
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
214 body = g_strdup_printf(MSN_ADD_ADDRESSBOOK_TEMPLATE,
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
215 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
216 session->user->passport);
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
217
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
218 msn_soap_message_send(session,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
219 msn_soap_message_new(MSN_ADD_ADDRESSBOOK_SOAP_ACTION,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
220 xmlnode_from_str(body, -1)),
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
221 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL, msn_create_address_cb,
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
222 session);
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
223
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
224 g_free(body);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
225 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
226
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
227 static void
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
228 msn_parse_each_member(MsnSession *session, xmlnode *member, const char *node,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
229 MsnListId list)
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
230 {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
231 char *passport = xmlnode_get_data(xmlnode_get_child(member, node));
21127
d0676f639d5a Fix some typos
Carlos Silva <typ0@pidgin.im>
parents: 21115
diff changeset
232 char *type = xmlnode_get_data(xmlnode_get_child(member, "Type"));
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
233 char *member_id = xmlnode_get_data(xmlnode_get_child(member, "MembershipId"));
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
234 MsnUser *user = msn_userlist_find_add_user(session->userlist, passport, NULL);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
235
21127
d0676f639d5a Fix some typos
Carlos Silva <typ0@pidgin.im>
parents: 21115
diff changeset
236 purple_debug_info("msncl","%s name: %s, Type: %s, MembershipID: %s\n",
d0676f639d5a Fix some typos
Carlos Silva <typ0@pidgin.im>
parents: 21115
diff changeset
237 node, passport, type, member_id == NULL ? "(null)" : member_id);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
238
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
239 if (member_id) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
240 user->membership_id[list] = atoi(member_id);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
241 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
242
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
243 msn_got_lst_user(session, user, 1 << list, NULL);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
244
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
245 g_free(passport);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
246 g_free(type);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
247 g_free(member_id);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
248 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
249
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
250 static void
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
251 msn_parse_each_service(MsnSession *session, xmlnode *service)
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
252 {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
253 xmlnode *type;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
254
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23447
diff changeset
255 if ((type = xmlnode_get_child(service, "Info/Handle/Type"))) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
256 char *type_str = xmlnode_get_data(type);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
257
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
258 if (g_str_equal(type_str, "Profile")) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
259 /* Process Windows Live 'Messenger Roaming Identity' */
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
260 } else if (g_str_equal(type_str, "Messenger")) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
261 xmlnode *lastchange = xmlnode_get_child(service, "LastChange");
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
262 char *lastchange_str = xmlnode_get_data(lastchange);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
263 xmlnode *membership;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
264
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
265 purple_debug_info("msncl","last change: %s\n", lastchange_str);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
266 purple_account_set_string(session->account, "CLLastChange",
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
267 lastchange_str);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
268
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23447
diff changeset
269 for (membership = xmlnode_get_child(service,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
270 "Memberships/Membership");
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
271 membership; membership = xmlnode_get_next_twin(membership)) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
272
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
273 xmlnode *role = xmlnode_get_child(membership, "MemberRole");
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
274 char *role_str = xmlnode_get_data(role);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
275 MsnListId list = msn_get_memberrole(role_str);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
276 xmlnode *member;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
277
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
278 purple_debug_info("msncl", "MemberRole role: %s, list: %d\n",
21127
d0676f639d5a Fix some typos
Carlos Silva <typ0@pidgin.im>
parents: 21115
diff changeset
279 role_str, list);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
280
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23447
diff changeset
281 for (member = xmlnode_get_child(membership, "Members/Member");
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
282 member; member = xmlnode_get_next_twin(member)) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
283 const char *member_type = xmlnode_get_attrib(member, "type");
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
284 if (g_str_equal(member_type, "PassportMember")) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
285 msn_parse_each_member(session, member, "PassportName",
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
286 list);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
287 } else if (g_str_equal(member_type, "PhoneMember")) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
288
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
289 } else if (g_str_equal(member_type, "EmailMember")) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
290 msn_parse_each_member(session, member, "Email", list);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
291 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
292 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
293
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
294 g_free(role_str);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
295 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
296
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
297 g_free(lastchange_str);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
298 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
299
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
300 g_free(type_str);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
301 }
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
302 }
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
303
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
304 /*parse contact list*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
305 static void
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
306 msn_parse_contact_list(MsnSession *session, xmlnode *node)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
307 {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
308 xmlnode *fault, *faultnode;
20467
86da6ab1f612 Correctly process an additional <Service> with type Profile and name 'Messenger Roaming Identity' sent with the contact list using a recently registered WLM account, that was causing the initial ADL command to be sent malformed, and our presence status not being forwarded to our buddies
Carlos Silva <typ0@pidgin.im>
parents: 20466
diff changeset
309
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
310 /* we may get a response if our cache data is too old:
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
311 *
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
312 * <faultstring>Need to do full sync. Can't sync deltas Client
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
313 * has too old a copy for us to do a delta sync</faultstring>
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
314 *
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
315 * this is not handled yet
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
316 */
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23447
diff changeset
317 if ((fault = xmlnode_get_child(node, "Body/Fault"))) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
318 if ((faultnode = xmlnode_get_child(fault, "faultstring"))) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
319 char *faultstring = xmlnode_get_data(faultnode);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
320 purple_debug_info("msncl", "Retrieving contact list failed: %s\n",
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
321 faultstring);
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
322 g_free(faultstring);
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
323 }
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23447
diff changeset
324 if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
325 char *errorcode = xmlnode_get_data(faultnode);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
326
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
327 if (g_str_equal(errorcode, "ABDoesNotExist")) {
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
328 msn_create_address_book(session);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
329 g_free(errorcode);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
330 return;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
331 }
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
332
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
333 g_free(errorcode);
20467
86da6ab1f612 Correctly process an additional <Service> with type Profile and name 'Messenger Roaming Identity' sent with the contact list using a recently registered WLM account, that was causing the initial ADL command to be sent malformed, and our presence status not being forwarded to our buddies
Carlos Silva <typ0@pidgin.im>
parents: 20466
diff changeset
334 }
86da6ab1f612 Correctly process an additional <Service> with type Profile and name 'Messenger Roaming Identity' sent with the contact list using a recently registered WLM account, that was causing the initial ADL command to be sent malformed, and our presence status not being forwarded to our buddies
Carlos Silva <typ0@pidgin.im>
parents: 20466
diff changeset
335
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
336 msn_get_contact_list(session, MSN_PS_INITIAL, NULL);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
337 } else {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
338 xmlnode *service;
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
339
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23447
diff changeset
340 for (service = xmlnode_get_child(node, "Body/FindMembershipResponse/"
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
341 "FindMembershipResult/Services/Service");
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
342 service; service = xmlnode_get_next_twin(service)) {
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
343 msn_parse_each_service(session, service);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
344 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
345 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
346 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
347
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
348 static void
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
349 msn_get_contact_list_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
350 gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
351 {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
352 GetContactListCbData *cb_data = data;
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
353 MsnSession *session = cb_data->session;
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
354
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
355 g_return_if_fail(session != NULL);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
356
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
357 if (resp != NULL) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
358 const char *abLastChange;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
359 const char *dynamicItemLastChange;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
360
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
361 purple_debug_misc("msncl","Got the contact list!\n");
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
362
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
363 msn_parse_contact_list(session, resp->xml);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
364 abLastChange = purple_account_get_string(session->account,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
365 "ablastChange", NULL);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
366 dynamicItemLastChange = purple_account_get_string(session->account,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
367 "dynamicItemLastChange", NULL);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
368
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
369 if (cb_data->which == MSN_PS_INITIAL) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
370 #ifdef MSN_PARTIAL_LISTS
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
371 /* XXX: this should be enabled when we can correctly do partial
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
372 syncs with the server. Currently we need to retrieve the whole
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
373 list to detect sync issues */
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
374 msn_get_address_book(session, MSN_PS_INITIAL, abLastChange, dynamicItemLastChange);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
375 #else
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
376 msn_get_address_book(session, MSN_PS_INITIAL, NULL, NULL);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
377 #endif
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
378 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
379 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
380
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
381 g_free(cb_data);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
382 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
383
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
384 /*SOAP get contact list*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
385 void
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
386 msn_get_contact_list(MsnSession *session,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
387 const MsnSoapPartnerScenario partner_scenario, const char *update_time)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
388 {
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
389 gchar *body = NULL;
20671
4dd60add6a7c 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 <daniel.atallah@gmail.com>
parents: 20666
diff changeset
390 gchar *update_str = NULL;
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
391 GetContactListCbData cb_data = { session, partner_scenario };
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
392 const gchar *partner_scenario_str = MsnSoapPartnerScenarioText[partner_scenario];
20467
86da6ab1f612 Correctly process an additional <Service> with type Profile and name 'Messenger Roaming Identity' sent with the contact list using a recently registered WLM account, that was causing the initial ADL command to be sent malformed, and our presence status not being forwarded to our buddies
Carlos Silva <typ0@pidgin.im>
parents: 20466
diff changeset
393
20479
6a8463be5b23 Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents: 20477
diff changeset
394 purple_debug_misc("MSNCL","Getting Contact List.\n");
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
395
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
396 if ( update_time != NULL ) {
20479
6a8463be5b23 Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents: 20477
diff changeset
397 purple_debug_info("MSNCL","Last update time: %s\n",update_time);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
398 update_str = g_strdup_printf(MSN_GET_CONTACT_UPDATE_XML,update_time);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
399 }
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
400
23445
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
401 body = g_strdup_printf(MSN_GET_CONTACT_TEMPLATE, partner_scenario_str,
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
402 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
403 update_str ? update_str : "");
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
404
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
405 msn_soap_message_send(session,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
406 msn_soap_message_new(MSN_GET_CONTACT_SOAP_ACTION,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
407 xmlnode_from_str(body, -1)),
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
408 MSN_CONTACT_SERVER, MSN_GET_CONTACT_POST_URL,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
409 msn_get_contact_list_cb, g_memdup(&cb_data, sizeof(cb_data)));
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
410
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
411 g_free(update_str);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
412 g_free(body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
413 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
414
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
415 static void
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
416 msn_parse_addressbook_groups(MsnSession *session, xmlnode *node)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
417 {
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
418 xmlnode *group;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
419
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
420 purple_debug_info("MSNAB","msn_parse_addressbook_groups()\n");
20467
86da6ab1f612 Correctly process an additional <Service> with type Profile and name 'Messenger Roaming Identity' sent with the contact list using a recently registered WLM account, that was causing the initial ADL command to be sent malformed, and our presence status not being forwarded to our buddies
Carlos Silva <typ0@pidgin.im>
parents: 20466
diff changeset
421
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
422 for(group = xmlnode_get_child(node, "Group"); group;
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
423 group = xmlnode_get_next_twin(group)){
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
424 xmlnode *groupId, *groupInfo, *groupname;
20671
4dd60add6a7c 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 <daniel.atallah@gmail.com>
parents: 20666
diff changeset
425 char *group_id = NULL, *group_name = NULL;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
426
20671
4dd60add6a7c 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 <daniel.atallah@gmail.com>
parents: 20666
diff changeset
427 if ((groupId = xmlnode_get_child(group, "groupId")))
4dd60add6a7c 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 <daniel.atallah@gmail.com>
parents: 20666
diff changeset
428 group_id = xmlnode_get_data(groupId);
4dd60add6a7c 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 <daniel.atallah@gmail.com>
parents: 20666
diff changeset
429 if ((groupInfo = xmlnode_get_child(group, "groupInfo")) && (groupname = xmlnode_get_child(groupInfo, "name")))
4dd60add6a7c 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 <daniel.atallah@gmail.com>
parents: 20666
diff changeset
430 group_name = xmlnode_get_data(groupname);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
431
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
432 msn_group_new(session->userlist, group_id, group_name);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
433
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
434 if (group_id == NULL){
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
435 /* Group of ungroupped buddies */
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
436 g_free(group_name);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
437 continue;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
438 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
439
20671
4dd60add6a7c 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 <daniel.atallah@gmail.com>
parents: 20666
diff changeset
440 purple_debug_info("MsnAB","group_id: %s, name: %s\n", group_id, group_name ? group_name : "(null)");
20401
4ddc27c18781 Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents: 20394
diff changeset
441 if ((purple_find_group(group_name)) == NULL){
4ddc27c18781 Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents: 20394
diff changeset
442 PurpleGroup *g = purple_group_new(group_name);
4ddc27c18781 Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents: 20394
diff changeset
443 purple_blist_add_group(g, NULL);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
444 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
445 g_free(group_id);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
446 g_free(group_name);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
447 }
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
448 }
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
449
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
450 static void
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
451 msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node)
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
452 {
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
453 xmlnode *contactNode;
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
454 char *passport = NULL, *Name = NULL, *uid = NULL, *type = NULL;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
455
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
456 for(contactNode = xmlnode_get_child(node, "Contact"); contactNode;
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
457 contactNode = xmlnode_get_next_twin(contactNode)) {
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
458 xmlnode *contactId, *contactInfo, *contactType, *passportName, *displayName, *guid, *groupIds;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
459 MsnUser *user;
20447
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20442
diff changeset
460 MsnUserType usertype;
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
461
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
462 if (!(contactId = xmlnode_get_child(contactNode,"contactId"))
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
463 || !(contactInfo = xmlnode_get_child(contactNode, "contactInfo"))
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
464 || !(contactType = xmlnode_get_child(contactInfo, "contactType")))
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
465 continue;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
466
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
467 g_free(passport);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
468 g_free(Name);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
469 g_free(uid);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
470 g_free(type);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
471 passport = Name = uid = type = NULL;
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
472
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
473 uid = xmlnode_get_data(contactId);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
474 type = xmlnode_get_data(contactType);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
475
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
476 /*setup the Display Name*/
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
477 if (type && !strcmp(type, "Me")){
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
478 char *friendly = NULL;
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
479 if ((displayName = xmlnode_get_child(contactInfo, "displayName")))
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
480 friendly = xmlnode_get_data(displayName);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
481 purple_connection_set_display_name(session->account->gc, friendly ? purple_url_decode(friendly) : NULL);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
482 g_free(friendly);
20403
599b5a4aebab The last of the merge fix-ups.
Richard Laager <rlaager@wiktel.com>
parents: 20401
diff changeset
483 continue; /* Not adding own account as buddy to buddylist */
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
484 }
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
485
20447
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20442
diff changeset
486 usertype = msn_get_user_type(type);
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
487 passportName = xmlnode_get_child(contactInfo, "passportName");
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
488 if (passportName == NULL) {
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
489 xmlnode *emailsNode, *contactEmailNode, *emailNode;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
490 xmlnode *messengerEnabledNode;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
491 char *msnEnabled;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
492
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
493 /*TODO: add it to the none-instant Messenger group and recognize as email Membership*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
494 /*Yahoo User?*/
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
495 emailsNode = xmlnode_get_child(contactInfo, "emails");
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
496 if (emailsNode == NULL) {
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
497 /*TODO: need to support the Mobile type*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
498 continue;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
499 }
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
500 for(contactEmailNode = xmlnode_get_child(emailsNode, "ContactEmail"); contactEmailNode;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
501 contactEmailNode = xmlnode_get_next_twin(contactEmailNode) ){
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
502 if (!(messengerEnabledNode = xmlnode_get_child(contactEmailNode, "isMessengerEnabled"))) {
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
503 /* XXX: Should this be a continue instead of a break? It seems like it'd cause unpredictable results otherwise. */
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
504 break;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
505 }
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
506
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
507 msnEnabled = xmlnode_get_data(messengerEnabledNode);
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
508
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
509 if ((emailNode = xmlnode_get_child(contactEmailNode, "email"))) {
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
510 g_free(passport);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
511 passport = xmlnode_get_data(emailNode);
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
512 }
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
513
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
514 if(msnEnabled && !strcmp(msnEnabled, "true")) {
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
515 /*Messenger enabled, Get the Passport*/
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
516 purple_debug_info("MsnAB", "Yahoo User %s\n", passport ? passport : "(null)");
20447
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20442
diff changeset
517 usertype = MSN_USER_TYPE_YAHOO;
20495
7f5564ebde7f Fix some memory leaks. Free xmlnodes properly using xmlnode_free instead of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20494
diff changeset
518 g_free(msnEnabled);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
519 break;
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
520 } else {
20401
4ddc27c18781 Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents: 20394
diff changeset
521 /*TODO maybe we can just ignore it in Purple?*/
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
522 purple_debug_info("MSNAB", "Other type user\n");
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
523 }
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
524
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
525 g_free(msnEnabled);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
526 }
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
527 } else {
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
528 passport = xmlnode_get_data(passportName);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
529 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
530
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
531 if (passport == NULL)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
532 continue;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
533
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
534 if ((displayName = xmlnode_get_child(contactInfo, "displayName")))
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
535 Name = xmlnode_get_data(displayName);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
536 else
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
537 Name = g_strdup(passport);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
538
20401
4ddc27c18781 Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents: 20394
diff changeset
539 purple_debug_misc("MsnAB","passport:{%s} uid:{%s} display:{%s}\n",
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
540 passport, uid ? uid : "(null)", Name ? Name : "(null)");
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
541
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
542 user = msn_userlist_find_add_user(session->userlist, passport, Name);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
543 msn_user_set_uid(user, uid);
20447
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20442
diff changeset
544 msn_user_set_type(user, usertype);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
545
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
546 groupIds = xmlnode_get_child(contactInfo, "groupIds");
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
547 if (groupIds) {
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
548 for (guid = xmlnode_get_child(groupIds, "guid"); guid;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
549 guid = xmlnode_get_next_twin(guid)){
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
550 char *group_id = xmlnode_get_data(guid);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
551 msn_user_add_group_id(user, group_id);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
552 purple_debug_misc("MsnAB", "guid:%s\n", group_id ? group_id : "(null)");
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
553 g_free(group_id);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
554 }
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
555 } else {
20671
4dd60add6a7c 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 <daniel.atallah@gmail.com>
parents: 20666
diff changeset
556 purple_debug_info("msn", "User not in any groups, adding to default group.\n");
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
557 /*not in any group,Then set default group*/
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
558 msn_user_add_group_id(user, MSN_INDIVIDUALS_GROUP_ID);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
559 }
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
560
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
561 msn_got_lst_user(session, user, MSN_LIST_FL_OP, NULL);
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
562 }
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
563
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
564 g_free(passport);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
565 g_free(Name);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
566 g_free(uid);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
567 g_free(type);
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
568 }
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
569
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
570 static gboolean
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
571 msn_parse_addressbook(MsnSession *session, xmlnode *node)
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
572 {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
573 xmlnode *result;
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
574 xmlnode *groups;
20671
4dd60add6a7c 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 <daniel.atallah@gmail.com>
parents: 20666
diff changeset
575 xmlnode *contacts;
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
576 xmlnode *abNode;
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
577 xmlnode *fault;
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
578
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23447
diff changeset
579 if ((fault = xmlnode_get_child(node, "Body/Fault"))) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
580 xmlnode *faultnode;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
581
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
582 if ((faultnode = xmlnode_get_child(fault, "faultstring"))) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
583 gchar *faultstring = xmlnode_get_data(faultnode);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
584 purple_debug_info("MSNAB","Faultstring: %s\n", faultstring);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
585 g_free(faultstring);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
586 }
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
587
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23447
diff changeset
588 if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
589 gchar *errorcode = xmlnode_get_data(faultnode);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
590
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
591 purple_debug_info("MSNAB", "Error Code: %s\n", errorcode);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
592
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
593 if (g_str_equal(errorcode, "ABDoesNotExist")) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
594 g_free(errorcode);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
595 return TRUE;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
596 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
597 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
598
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
599 return FALSE;
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
600 }
20471
530a92d50c5e Misc cleanups, better error handling, and print the Address Book received from the server in a human readable way.
Carlos Silva <typ0@pidgin.im>
parents: 20467
diff changeset
601
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23447
diff changeset
602 result = xmlnode_get_child(node, "Body/ABFindAllResponse/ABFindAllResult");
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
603 if(result == NULL){
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
604 purple_debug_misc("MSNAB","receive no address book update\n");
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
605 return TRUE;
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
606 }
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
607
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
608 /* I don't see this "groups" tag documented on msnpiki, need to find out
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
609 if they are really there, and update msnpiki */
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
610 /*Process Group List*/
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
611 groups = xmlnode_get_child(result,"groups");
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
612 if (groups != NULL) {
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
613 msn_parse_addressbook_groups(session, groups);
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
614 }
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
615
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
616 /*add a default No group to set up the no group Membership*/
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
617 msn_group_new(session->userlist, MSN_INDIVIDUALS_GROUP_ID,
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
618 MSN_INDIVIDUALS_GROUP_NAME);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
619 purple_debug_misc("MSNAB","group_id:%s name:%s\n",
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
620 MSN_INDIVIDUALS_GROUP_ID, MSN_INDIVIDUALS_GROUP_NAME);
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
621 if ((purple_find_group(MSN_INDIVIDUALS_GROUP_NAME)) == NULL){
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
622 PurpleGroup *g = purple_group_new(MSN_INDIVIDUALS_GROUP_NAME);
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
623 purple_blist_add_group(g, NULL);
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
624 }
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
625
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
626 /*add a default No group to set up the no group Membership*/
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
627 msn_group_new(session->userlist, MSN_NON_IM_GROUP_ID, MSN_NON_IM_GROUP_NAME);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
628 purple_debug_misc("MSNAB","group_id:%s name:%s\n", MSN_NON_IM_GROUP_ID, MSN_NON_IM_GROUP_NAME);
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
629 if ((purple_find_group(MSN_NON_IM_GROUP_NAME)) == NULL){
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
630 PurpleGroup *g = purple_group_new(MSN_NON_IM_GROUP_NAME);
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
631 purple_blist_add_group(g, NULL);
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
632 }
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
633
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
634 /*Process contact List*/
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
635 purple_debug_info("MSNAB","process contact list...\n");
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
636 contacts =xmlnode_get_child(result,"contacts");
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
637 if (contacts != NULL) {
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
638 msn_parse_addressbook_contacts(session, contacts);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
639 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
640
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
641 abNode =xmlnode_get_child(result,"ab");
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
642 if(abNode != NULL){
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
643 xmlnode *node2;
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
644 char *tmp = NULL;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
645
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
646 if ((node2 = xmlnode_get_child(abNode, "lastChange")))
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
647 tmp = xmlnode_get_data(node2);
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
648 purple_debug_info("MSNAB"," lastchanged Time:{%s}\n", tmp ? tmp : "(null)");
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
649 purple_account_set_string(session->account, "ablastChange", tmp);
20432
703fc3437ab5 Store account specific settings in the account, not in some random blist
Stu Tomlinson <stu@nosnilmot.com>
parents: 20427
diff changeset
650
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
651 g_free(tmp); tmp = NULL;
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
652 if ((node2 = xmlnode_get_child(abNode, "DynamicItemLastChanged")))
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
653 tmp = xmlnode_get_data(node2);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
654 purple_debug_info("MsnAB"," DynamicItemLastChanged :{%s}\n", tmp ? tmp : "(null)");
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
655 purple_account_set_string(session->account, "DynamicItemLastChanged", tmp);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
656 g_free(tmp);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
657 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
658
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
659 return TRUE;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
660 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
661
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
662 static void
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
663 msn_get_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
664 {
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
665 MsnSession *session = data;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
666
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
667 if (resp == NULL)
20501
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
668 return;
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
669
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
670 g_return_if_fail(session != NULL);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
671
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
672 purple_debug_misc("MSNAB", "Got the Address Book!\n");
20479
6a8463be5b23 Improve MSN_SOAP_DEBUG and workaround a Win32 bug which would case Pidgin to consume insane amounts of memory when printing a large string to the Debug Window.
Carlos Silva <typ0@pidgin.im>
parents: 20477
diff changeset
673
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
674 if (msn_parse_addressbook(session, resp->xml)) {
20481
eb93710aec4d 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: 20479
diff changeset
675 if (!session->logged_in) {
eb93710aec4d 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: 20479
diff changeset
676 msn_send_privacy(session->account->gc);
eb93710aec4d 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: 20479
diff changeset
677 msn_notification_dump_contact(session);
eb93710aec4d 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: 20479
diff changeset
678 }
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
679 } else {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
680 /* This is making us loop infinitely when we fail to parse the
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
681 address book, disable for now (we should re-enable when we
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
682 send timestamps)
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
683 */
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
684 /*
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
685 msn_get_address_book(session, NULL, NULL);
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
686 */
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
687 msn_session_disconnect(session);
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20892
diff changeset
688 purple_connection_error_reason(session->account->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to retrieve MSN Address Book"));
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
689 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
690 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
691
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
692 /*get the address book*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
693 void
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
694 msn_get_address_book(MsnSession *session,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
695 MsnSoapPartnerScenario partner_scenario, const char *LastChanged,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
696 const char *dynamicItemLastChange)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
697 {
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
698 char *body, *update_str = NULL;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
699
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
700 purple_debug_misc("MSNAB","Getting Address Book\n");
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
701
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
702 /*build SOAP and POST it*/
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
703 if (dynamicItemLastChange != NULL)
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
704 update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML, dynamicItemLastChange);
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
705 else if (LastChanged != NULL)
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
706 update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML, LastChanged);
20481
eb93710aec4d 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: 20479
diff changeset
707
23445
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
708 body = g_strdup_printf(MSN_GET_ADDRESS_TEMPLATE,
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
709 MsnSoapPartnerScenarioText[partner_scenario],
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
710 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
711 update_str ? update_str : "");
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
712
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
713 msn_soap_message_send(session,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
714 msn_soap_message_new(MSN_GET_ADDRESS_SOAP_ACTION,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
715 xmlnode_from_str(body, -1)),
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
716 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL, msn_get_address_cb,
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
717 session);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
718
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
719 g_free(update_str);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
720 g_free(body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
721 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
722
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
723 static void
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
724 msn_add_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
725 gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
726 {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
727 MsnCallbackState *state = data;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
728 MsnSession *session = state->session;
20501
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
729
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
730 g_return_if_fail(session != NULL);
20501
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
731
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
732 if (resp != NULL) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
733 MsnUserList *userlist = session->userlist;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
734 MsnUser *user;
20481
eb93710aec4d 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: 20479
diff changeset
735
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
736 purple_debug_info("MSNCL","Contact added successfully\n");
20481
eb93710aec4d 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: 20479
diff changeset
737
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
738 // the code this block is replacing didn't send ADL for yahoo contacts,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
739 // but i haven't confirmed this is WLM's behaviour wrt yahoo contacts
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
740 if ( !msn_user_is_yahoo(session->account, state->who) ) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
741 msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
742 msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
743 }
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
744
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
745 msn_notification_send_fqy(session, state->who);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
746
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
747 user = msn_userlist_find_add_user(userlist, state->who, state->who);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
748 msn_user_add_group_id(user, state->guid);
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
749 }
20481
eb93710aec4d 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: 20479
diff changeset
750
20484
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
751 msn_callback_state_free(state);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
752 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
753
20484
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
754 /* add a Contact in MSN_INDIVIDUALS_GROUP */
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
755 void
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
756 msn_add_contact(MsnSession *session, MsnCallbackState *state, const char *passport)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
757 {
20481
eb93710aec4d 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: 20479
diff changeset
758 gchar *body = NULL;
eb93710aec4d 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: 20479
diff changeset
759 gchar *contact_xml = NULL;
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
760
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
761 #if 0
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
762 gchar *escaped_displayname;
20484
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
763
20481
eb93710aec4d 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: 20479
diff changeset
764
20484
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
765 if (displayname != NULL) {
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
766 escaped_displayname = g_markup_decode_text(displayname, -1);
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
767 } else {
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
768 escaped_displayname = passport;
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
769 }
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
770 contact_xml = g_strdup_printf(MSN_XML_ADD_CONTACT, escaped_displayname, passport);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
771 #endif
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
772
20481
eb93710aec4d 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: 20479
diff changeset
773 purple_debug_info("MSNCL","Adding contact %s to contact list\n", passport);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
774
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
775 contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport);
23445
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
776 body = g_strdup_printf(MSN_ADD_CONTACT_TEMPLATE,
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
777 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
778 contact_xml);
20481
eb93710aec4d 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: 20479
diff changeset
779
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
780 msn_soap_message_send(session,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
781 msn_soap_message_new(MSN_CONTACT_ADD_SOAP_ACTION,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
782 xmlnode_from_str(body, -1)),
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
783 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
784 msn_add_contact_read_cb, state);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
785
20481
eb93710aec4d 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: 20479
diff changeset
786 g_free(contact_xml);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
787 g_free(body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
788 }
20481
eb93710aec4d 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: 20479
diff changeset
789
eb93710aec4d 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: 20479
diff changeset
790 static void
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
791 msn_add_contact_to_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
792 gpointer data)
20481
eb93710aec4d 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: 20479
diff changeset
793 {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
794 MsnCallbackState *state = data;
20481
eb93710aec4d 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: 20479
diff changeset
795 MsnUserList *userlist;
eb93710aec4d 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: 20479
diff changeset
796
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
797 g_return_if_fail(data != NULL);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
798
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
799 userlist = state->session->userlist;
20481
eb93710aec4d 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: 20479
diff changeset
800
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
801 if (resp != NULL) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
802 if (msn_userlist_add_buddy_to_group(userlist, state->who,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
803 state->new_group_name)) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
804 purple_debug_info("MSNCL", "Contact %s added to group %s successfully!\n", state->who, state->new_group_name);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
805 } else {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
806 purple_debug_info("MSNCL","Contact %s added to group %s successfully on server, but failed in the local list\n", state->who, state->new_group_name);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
807 }
20481
eb93710aec4d 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: 20479
diff changeset
808
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
809 if (state->action & MSN_ADD_BUDDY) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
810 MsnUser *user = msn_userlist_find_user(userlist, state->who);
20481
eb93710aec4d 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: 20479
diff changeset
811
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
812 if ( !msn_user_is_yahoo(state->session->account, state->who) ) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
813
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
814 msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
815 msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
816 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
817 msn_notification_send_fqy(state->session, state->who);
20481
eb93710aec4d 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: 20479
diff changeset
818
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
819 if (msn_userlist_user_is_in_list(user, MSN_LIST_PL)) {
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
820 msn_del_contact_from_list(state->session, NULL, state->who, MSN_LIST_PL);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
821 msn_callback_state_free(state);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
822 return;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
823 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
824 }
20481
eb93710aec4d 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: 20479
diff changeset
825
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
826 if (state->action & MSN_MOVE_BUDDY) {
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
827 msn_del_contact_from_group(state->session, state->who, state->old_group_name);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
828 }
20481
eb93710aec4d 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: 20479
diff changeset
829 }
eb93710aec4d 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: 20479
diff changeset
830
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
831 msn_callback_state_free(state);
20481
eb93710aec4d 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: 20479
diff changeset
832 }
eb93710aec4d 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: 20479
diff changeset
833
eb93710aec4d 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: 20479
diff changeset
834 void
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
835 msn_add_contact_to_group(MsnSession *session, MsnCallbackState *state,
20481
eb93710aec4d 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: 20479
diff changeset
836 const char *passport, const char *groupId)
eb93710aec4d 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: 20479
diff changeset
837 {
eb93710aec4d 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: 20479
diff changeset
838 MsnUserList *userlist;
eb93710aec4d 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: 20479
diff changeset
839 MsnUser *user;
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
840 gchar *body = NULL, *contact_xml;
20481
eb93710aec4d 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: 20479
diff changeset
841
eb93710aec4d 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: 20479
diff changeset
842 g_return_if_fail(passport != NULL);
eb93710aec4d 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: 20479
diff changeset
843 g_return_if_fail(groupId != NULL);
eb93710aec4d 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: 20479
diff changeset
844
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
845 g_return_if_fail(session != NULL);
20481
eb93710aec4d 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: 20479
diff changeset
846
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
847 userlist = session->userlist;
20484
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
848
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
849 if (!strcmp(groupId, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(groupId, MSN_NON_IM_GROUP_ID)) {
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
850
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
851 user = msn_userlist_find_add_user(userlist, passport, passport);
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
852
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
853 if (state->action & MSN_ADD_BUDDY) {
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
854 msn_add_contact(session, state, passport);
20484
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
855 return;
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
856 }
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
857
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
858 if (state->action & MSN_MOVE_BUDDY) {
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
859 msn_user_add_group_id(user, groupId);
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
860 msn_del_contact_from_group(session, passport, state->old_group_name);
20484
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
861 } else {
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
862 msn_callback_state_free(state);
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
863 }
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
864
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
865 return;
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
866 }
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
867
20481
eb93710aec4d 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: 20479
diff changeset
868 purple_debug_info("MSNCL", "Adding user %s to group %s\n", passport,
eb93710aec4d 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: 20479
diff changeset
869 msn_userlist_find_group_name(userlist, groupId));
eb93710aec4d 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: 20479
diff changeset
870
eb93710aec4d 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: 20479
diff changeset
871 user = msn_userlist_find_user(userlist, passport);
eb93710aec4d 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: 20479
diff changeset
872 if (user == NULL) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
873 purple_debug_warning("MSNCL", "Unable to retrieve user %s from the userlist!\n", passport);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
874 msn_callback_state_free(state);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
875 return; /* guess this never happened! */
20481
eb93710aec4d 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: 20479
diff changeset
876 }
eb93710aec4d 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: 20479
diff changeset
877
20855
cfaf74ec93dc Prevent null pointer deref to fix CID 322.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20789
diff changeset
878 if (user != NULL && user->uid != NULL) {
20481
eb93710aec4d 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: 20479
diff changeset
879 contact_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid);
eb93710aec4d 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: 20479
diff changeset
880 } else {
eb93710aec4d 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: 20479
diff changeset
881 contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport);
eb93710aec4d 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: 20479
diff changeset
882 }
eb93710aec4d 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: 20479
diff changeset
883
23445
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
884 body = g_strdup_printf(MSN_ADD_CONTACT_GROUP_TEMPLATE,
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
885 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
886 groupId, contact_xml);
20481
eb93710aec4d 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: 20479
diff changeset
887
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
888 msn_soap_message_send(state->session,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
889 msn_soap_message_new(MSN_ADD_CONTACT_GROUP_SOAP_ACTION,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
890 xmlnode_from_str(body, -1)),
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
891 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
892 msn_add_contact_to_group_read_cb, state);
20481
eb93710aec4d 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: 20479
diff changeset
893
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
894 g_free(contact_xml);
20481
eb93710aec4d 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: 20479
diff changeset
895 g_free(body);
eb93710aec4d 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: 20479
diff changeset
896 }
eb93710aec4d 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: 20479
diff changeset
897
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
898 static void
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
899 msn_delete_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
900 gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
901 {
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
902 MsnCallbackState *state = data;
20539
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
903
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
904 if (resp != NULL) {
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
905 MsnUserList *userlist = state->session->userlist;
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
906 MsnUser *user = msn_userlist_find_user_with_id(userlist, state->uid);
20501
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
907
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
908 purple_debug_info("MSNCL","Delete contact successful\n");
20539
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
909
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
910 if (user != NULL) {
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
911 msn_userlist_remove_user(userlist, user);
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
912 }
20539
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
913 }
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
914
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
915 msn_callback_state_free(state);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
916 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
917
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
918 /*delete a Contact*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
919 void
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
920 msn_delete_contact(MsnSession *session, const char *contactId)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
921 {
20481
eb93710aec4d 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: 20479
diff changeset
922 gchar *body = NULL;
eb93710aec4d 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: 20479
diff changeset
923 gchar *contact_id_xml = NULL ;
20539
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
924 MsnCallbackState *state;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
925
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
926 g_return_if_fail(contactId != NULL);
20481
eb93710aec4d 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: 20479
diff changeset
927 contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, contactId);
eb93710aec4d 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: 20479
diff changeset
928
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
929 state = msn_callback_state_new(session);
20539
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
930 msn_callback_state_set_uid(state, contactId);
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20501
diff changeset
931
20481
eb93710aec4d 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: 20479
diff changeset
932 /* build SOAP request */
eb93710aec4d 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: 20479
diff changeset
933 purple_debug_info("MSNCL","Deleting contact with contactId: %s\n", contactId);
23445
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
934 body = g_strdup_printf(MSN_DEL_CONTACT_TEMPLATE,
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
935 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
936 contact_id_xml);
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
937
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
938 msn_soap_message_send(session,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
939 msn_soap_message_new(MSN_CONTACT_DEL_SOAP_ACTION,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
940 xmlnode_from_str(body, -1)),
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
941 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL,
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
942 msn_delete_contact_read_cb, state);
20481
eb93710aec4d 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: 20479
diff changeset
943
eb93710aec4d 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: 20479
diff changeset
944 g_free(contact_id_xml);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
945 g_free(body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
946 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
947
20481
eb93710aec4d 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: 20479
diff changeset
948 static void
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
949 msn_del_contact_from_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
950 gpointer data)
20481
eb93710aec4d 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: 20479
diff changeset
951 {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
952 MsnCallbackState *state = data;
20501
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
953
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
954 if (resp != NULL) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
955 if (msn_userlist_rem_buddy_from_group(state->session->userlist,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
956 state->who, state->old_group_name)) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
957 purple_debug_info("MSNCL", "Contact %s deleted successfully from group %s\n", state->who, state->old_group_name);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
958 } else {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
959 purple_debug_info("MSNCL", "Contact %s deleted successfully from group %s in the server, but failed in the local list\n", state->who, state->old_group_name);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
960 }
20481
eb93710aec4d 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: 20479
diff changeset
961 }
eb93710aec4d 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: 20479
diff changeset
962
eb93710aec4d 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: 20479
diff changeset
963 msn_callback_state_free(state);
eb93710aec4d 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: 20479
diff changeset
964 }
eb93710aec4d 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: 20479
diff changeset
965
eb93710aec4d 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: 20479
diff changeset
966 void
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
967 msn_del_contact_from_group(MsnSession *session, const char *passport, const char *group_name)
20481
eb93710aec4d 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: 20479
diff changeset
968 {
eb93710aec4d 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: 20479
diff changeset
969 MsnUserList * userlist;
eb93710aec4d 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: 20479
diff changeset
970 MsnUser *user;
eb93710aec4d 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: 20479
diff changeset
971 MsnCallbackState *state;
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
972 gchar *body, *contact_id_xml;
20481
eb93710aec4d 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: 20479
diff changeset
973 const gchar *groupId;
eb93710aec4d 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: 20479
diff changeset
974
eb93710aec4d 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: 20479
diff changeset
975 g_return_if_fail(passport != NULL);
eb93710aec4d 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: 20479
diff changeset
976 g_return_if_fail(group_name != NULL);
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
977 g_return_if_fail(session != NULL);
20481
eb93710aec4d 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: 20479
diff changeset
978
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
979 userlist = session->userlist;
20481
eb93710aec4d 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: 20479
diff changeset
980
eb93710aec4d 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: 20479
diff changeset
981 groupId = msn_userlist_find_group_id(userlist, group_name);
eb93710aec4d 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: 20479
diff changeset
982 if (groupId != NULL) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
983 purple_debug_info("MSNCL", "Deleting user %s from group %s\n", passport, group_name);
20481
eb93710aec4d 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: 20479
diff changeset
984 } else {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
985 purple_debug_warning("MSNCL", "Unable to retrieve group id from group %s !\n", group_name);
20481
eb93710aec4d 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: 20479
diff changeset
986 return;
eb93710aec4d 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: 20479
diff changeset
987 }
eb93710aec4d 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: 20479
diff changeset
988
eb93710aec4d 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: 20479
diff changeset
989 user = msn_userlist_find_user(userlist, passport);
eb93710aec4d 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: 20479
diff changeset
990
eb93710aec4d 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: 20479
diff changeset
991 if (user == NULL) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
992 purple_debug_warning("MSNCL", "Unable to retrieve user from passport %s!\n", passport);
20481
eb93710aec4d 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: 20479
diff changeset
993 return;
eb93710aec4d 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: 20479
diff changeset
994 }
20484
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
995
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
996 if ( !strcmp(groupId, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(groupId, MSN_NON_IM_GROUP_ID)) {
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
997 msn_user_remove_group_id(user, groupId);
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
998 return;
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
999 }
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
1000
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1001 state = msn_callback_state_new(session);
20481
eb93710aec4d 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: 20479
diff changeset
1002 msn_callback_state_set_who(state, passport);
eb93710aec4d 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: 20479
diff changeset
1003 msn_callback_state_set_guid(state, groupId);
eb93710aec4d 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: 20479
diff changeset
1004 msn_callback_state_set_old_group_name(state, group_name);
20666
0e1bc5c51030 A few leak plugs, some unnecessary allocation prevention, null pointer deref fixes and general robustness fixes. I'm sure there is more to do here, I got tired... Fixes #3308
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20539
diff changeset
1005
20481
eb93710aec4d 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: 20479
diff changeset
1006 contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid);
23445
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
1007 body = g_strdup_printf(MSN_CONTACT_DEL_GROUP_TEMPLATE,
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1008 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1009 contact_id_xml, groupId);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1010
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1011 msn_soap_message_send(session,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1012 msn_soap_message_new(MSN_CONTACT_DEL_GROUP_SOAP_ACTION,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1013 xmlnode_from_str(body, -1)),
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1014 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1015 msn_del_contact_from_group_read_cb, state);
20481
eb93710aec4d 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: 20479
diff changeset
1016
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1017 g_free(contact_id_xml);
20481
eb93710aec4d 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: 20479
diff changeset
1018 g_free(body);
eb93710aec4d 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: 20479
diff changeset
1019 }
eb93710aec4d 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: 20479
diff changeset
1020
eb93710aec4d 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: 20479
diff changeset
1021
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1022 static void
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1023 msn_update_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1024 gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1025 {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1026 if (resp)
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1027 purple_debug_info("MSN CL","Contact updated successfully\n");
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1028 else
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1029 purple_debug_info("MSN CL","Contact updated successfully\n");
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1030 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1031
20481
eb93710aec4d 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: 20479
diff changeset
1032 /* Update a contact's nickname */
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1033 void
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1034 msn_update_contact(MsnSession *session, const char* nickname)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1035 {
20481
eb93710aec4d 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: 20479
diff changeset
1036 gchar *body = NULL, *escaped_nickname;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1037
20481
eb93710aec4d 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: 20479
diff changeset
1038 purple_debug_info("MSN CL","Update contact information with new friendly name: %s\n", nickname);
20671
4dd60add6a7c 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 <daniel.atallah@gmail.com>
parents: 20666
diff changeset
1039
20481
eb93710aec4d 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: 20479
diff changeset
1040 escaped_nickname = g_markup_escape_text(nickname, -1);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1041
23445
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
1042 body = g_strdup_printf(MSN_CONTACT_UPDATE_TEMPLATE,
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1043 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1044 escaped_nickname);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1045
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1046 msn_soap_message_send(session,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1047 msn_soap_message_new(MSN_CONTACT_UPDATE_SOAP_ACTION,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1048 xmlnode_from_str(body, -1)),
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1049 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1050 msn_update_contact_read_cb, NULL);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1051
20481
eb93710aec4d 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: 20479
diff changeset
1052 g_free(escaped_nickname);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1053 g_free(body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1054 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1055
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1056 static void
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1057 msn_del_contact_from_list_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1058 gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1059 {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1060 MsnCallbackState *state = data;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1061 MsnSession *session = state->session;
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1062
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1063 if (resp != NULL) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1064 purple_debug_info("MSN CL", "Contact %s deleted successfully from %s list on server!\n", state->who, MsnMemberRole[state->list_id]);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1065
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1066 if (state->list_id == MSN_LIST_PL) {
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1067 MsnUser *user = msn_userlist_find_user(session->userlist, state->who);
20773
dcb28d9939ee Keep MsnUser->list_op in sync.
Carlos Silva <typ0@pidgin.im>
parents: 20772
diff changeset
1068
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1069 if (user != NULL)
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1070 msn_user_unset_op(user, MSN_LIST_PL_OP);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1071
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1072 msn_add_contact_to_list(session, state, state->who, MSN_LIST_RL);
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
1073 return;
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1074 } else if (state->list_id == MSN_LIST_AL) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1075 purple_privacy_permit_remove(session->account, state->who, TRUE);
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1076 msn_add_contact_to_list(session, NULL, state->who, MSN_LIST_BL);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1077 } else if (state->list_id == MSN_LIST_BL) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1078 purple_privacy_deny_remove(session->account, state->who, TRUE);
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1079 msn_add_contact_to_list(session, NULL, state->who, MSN_LIST_AL);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1080 }
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1081 }
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1082
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1083 msn_callback_state_free(state);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1084 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1085
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1086 void
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1087 msn_del_contact_from_list(MsnSession *session, MsnCallbackState *state,
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1088 const gchar *passport, const MsnListId list)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1089 {
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1090 gchar *body = NULL, *member = NULL;
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1091 MsnSoapPartnerScenario partner_scenario;
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1092 MsnUser *user;
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1093
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1094 g_return_if_fail(session != NULL);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1095 g_return_if_fail(passport != NULL);
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1096 g_return_if_fail(list < 5);
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1097
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1098 purple_debug_info("MSN CL", "Deleting contact %s from %s list\n", passport, MsnMemberRole[list]);
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1099
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1100 if (state == NULL) {
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1101 state = msn_callback_state_new(session);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1102 }
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1103 msn_callback_state_set_list_id(state, list);
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1104 msn_callback_state_set_who(state, passport);
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1105
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1106 if (list == MSN_LIST_PL) {
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1107 g_return_if_fail(session->userlist != NULL);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1108
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1109 user = msn_userlist_find_user(session->userlist, passport);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1110
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1111 partner_scenario = MSN_PS_CONTACT_API;
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1112 member = g_strdup_printf(MSN_MEMBER_MEMBERSHIPID_XML, user->membership_id[MSN_LIST_PL]);
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1113 } else {
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1114 /* list == MSN_LIST_AL || list == MSN_LIST_BL */
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1115 partner_scenario = MSN_PS_BLOCK_UNBLOCK;
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1116
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1117 member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, passport);
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1118 }
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1119
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1120 body = g_strdup_printf( MSN_CONTACT_DELECT_FROM_LIST_TEMPLATE,
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1121 MsnSoapPartnerScenarioText[partner_scenario],
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1122 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1123 MsnMemberRole[list], member);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1124
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1125 msn_soap_message_send(session,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1126 msn_soap_message_new(MSN_DELETE_MEMBER_FROM_LIST_SOAP_ACTION,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1127 xmlnode_from_str(body, -1)),
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1128 MSN_CONTACT_SERVER, MSN_SHARE_POST_URL,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1129 msn_del_contact_from_list_read_cb, state);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1130
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1131 g_free(member);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1132 g_free(body);
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1133 }
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1134
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1135 static void
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1136 msn_add_contact_to_list_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1137 gpointer data)
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1138 {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1139 MsnCallbackState *state = data;
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1140
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1141 g_return_if_fail(state != NULL);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1142 g_return_if_fail(state->session != NULL);
20501
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
1143
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1144 if (resp != NULL) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1145 purple_debug_info("MSN CL", "Contact %s added successfully to %s list on server!\n", state->who, MsnMemberRole[state->list_id]);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1146
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1147 if (state->list_id == MSN_LIST_RL) {
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1148 MsnUser *user = msn_userlist_find_user(state->session->userlist, state->who);
20773
dcb28d9939ee Keep MsnUser->list_op in sync.
Carlos Silva <typ0@pidgin.im>
parents: 20772
diff changeset
1149
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1150 if (user != NULL) {
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1151 msn_user_set_op(user, MSN_LIST_RL_OP);
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1152 }
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1153
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1154 if (state->action & MSN_DENIED_BUDDY) {
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1155
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1156 msn_add_contact_to_list(state->session, NULL, state->who, MSN_LIST_BL);
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1157 } else if (state->list_id == MSN_LIST_AL) {
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1158 purple_privacy_permit_add(state->session->account, state->who, TRUE);
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1159 } else if (state->list_id == MSN_LIST_BL) {
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1160 purple_privacy_deny_add(state->session->account, state->who, TRUE);
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1161 }
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1162 }
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1163 }
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1164
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1165 msn_callback_state_free(state);
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1166 }
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1167
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1168 void
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1169 msn_add_contact_to_list(MsnSession *session, MsnCallbackState *state,
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1170 const gchar *passport, const MsnListId list)
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1171 {
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1172 gchar *body = NULL, *member = NULL;
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1173 MsnSoapPartnerScenario partner_scenario;
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1174
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1175 g_return_if_fail(session != NULL);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1176 g_return_if_fail(passport != NULL);
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1177 g_return_if_fail(list < 5);
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1178
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1179 purple_debug_info("MSN CL", "Adding contact %s to %s list\n", passport, MsnMemberRole[list]);
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1180
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1181 if (state == NULL) {
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1182 state = msn_callback_state_new(session);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1183 }
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1184 msn_callback_state_set_list_id(state, list);
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1185 msn_callback_state_set_who(state, passport);
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1186
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1187 partner_scenario = (list == MSN_LIST_RL) ? MSN_PS_CONTACT_API : MSN_PS_BLOCK_UNBLOCK;
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1188
21134
abc18354ef66 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@hxbc.us>
parents: 21127
diff changeset
1189 member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, state->who);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1190
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1191 body = g_strdup_printf(MSN_CONTACT_ADD_TO_LIST_TEMPLATE,
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1192 MsnSoapPartnerScenarioText[partner_scenario],
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1193 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1194 MsnMemberRole[list], member);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1195
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1196 msn_soap_message_send(session,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1197 msn_soap_message_new(MSN_ADD_MEMBER_TO_LIST_SOAP_ACTION,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1198 xmlnode_from_str(body, -1)),
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1199 MSN_CONTACT_SERVER, MSN_SHARE_POST_URL,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1200 msn_add_contact_to_list_read_cb, state);
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1201
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1202 g_free(member);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1203 g_free(body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1204 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1205
20427
059cc0bf6c91 Fix a compile warning by #if 0'ing out some unused code
Stu Tomlinson <stu@nosnilmot.com>
parents: 20403
diff changeset
1206 #if 0
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1207 static void
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1208 msn_gleams_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1209 {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1210 if (resp != NULL)
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1211 purple_debug_info("MSNP14","Gleams read done\n");
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1212 else
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1213 purple_debug_info("MSNP14","Gleams read failed\n");
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1214 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1215
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1216 /*get the gleams info*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1217 void
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1218 msn_get_gleams(MsnSession *session)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1219 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1220 MsnSoapReq *soap_request;
23445
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
1221 gchar *body = NULL;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1222
20471
530a92d50c5e Misc cleanups, better error handling, and print the Address Book received from the server in a human readable way.
Carlos Silva <typ0@pidgin.im>
parents: 20467
diff changeset
1223 purple_debug_info("MSNP14","msn get gleams info...\n");
23445
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
1224
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
1225 body = g_strdup_printf(MSN_GLEAMS_TEMPLATE,
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1226 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS));
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1227
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1228 msn_soap_message_send(session,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1229 msn_soap_message_new(MSN_GET_GLEAMS_SOAP_ACTION,
23445
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
1230 xmlnode_from_str(body, -1)),
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1231 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1232 msn_gleams_read_cb, NULL);
23445
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
1233 g_free(body);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1234 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1235 #endif
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1236
20481
eb93710aec4d 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: 20479
diff changeset
1237
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1238 /***************************************************************
20481
eb93710aec4d 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: 20479
diff changeset
1239 * Group Operations
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1240 ***************************************************************/
20481
eb93710aec4d 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: 20479
diff changeset
1241
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1242 static void
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1243 msn_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1244 {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1245 MsnCallbackState *state = data;
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
1246
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1247 purple_debug_info("MSNCL", "Group request successful.\n");
20481
eb93710aec4d 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: 20479
diff changeset
1248
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1249 g_return_if_fail(state->session != NULL);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1250 g_return_if_fail(state->session->userlist != NULL);
20501
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
1251
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1252 if (resp == NULL) {
20501
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
1253 msn_callback_state_free(state);
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
1254 return;
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
1255 }
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1256
20501
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
1257 if (state) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1258 MsnSession *session = state->session;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1259 MsnUserList *userlist = session->userlist;
20481
eb93710aec4d 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: 20479
diff changeset
1260
eb93710aec4d 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: 20479
diff changeset
1261 if (state->action & MSN_RENAME_GROUP) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1262 msn_userlist_rename_group_id(session->userlist,
20481
eb93710aec4d 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: 20479
diff changeset
1263 state->guid,
eb93710aec4d 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: 20479
diff changeset
1264 state->new_group_name);
eb93710aec4d 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: 20479
diff changeset
1265 }
eb93710aec4d 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: 20479
diff changeset
1266
eb93710aec4d 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: 20479
diff changeset
1267 if (state->action & MSN_ADD_GROUP) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1268 /* the response is taken from
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1269 http://telepathy.freedesktop.org/wiki/Pymsn/MSNP/ContactListActions
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1270 should copy it to msnpiki some day */
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23447
diff changeset
1271 xmlnode *guid_node = xmlnode_get_child(resp->xml,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1272 "Body/ABGroupAddResponse/ABGroupAddResult/guid");
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1273
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1274 if (guid_node) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1275 char *guid = xmlnode_get_data(guid_node);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1276
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1277 /* create and add the new group to the userlist */
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1278 purple_debug_info("MSNCL", "Adding group %s with guid = %s to the userlist\n", state->new_group_name, guid);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1279 msn_group_new(session->userlist, guid, state->new_group_name);
20477
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
1280
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1281 if (state->action & MSN_ADD_BUDDY) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1282 msn_userlist_add_buddy(session->userlist,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1283 state->who,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1284 state->new_group_name);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1285 } else if (state->action & MSN_MOVE_BUDDY) {
23459
69af5301e1a7 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents: 23453
diff changeset
1286 msn_add_contact_to_group(session, state, state->who, guid);
21833
068b412ba385 part of the series of patches from QuLogic that fixes a use-after-free,
Ka-Hing Cheung <khc@hxbc.us>
parents: 21418
diff changeset
1287 g_free(guid);
21115
b95550f14549 initialize a variable to NULL, and not crash when you move a buddy to a new
Ka-Hing Cheung <khc@hxbc.us>
parents: 21114
diff changeset
1288 return;
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1289 }
21833
068b412ba385 part of the series of patches from QuLogic that fixes a use-after-free,
Ka-Hing Cheung <khc@hxbc.us>
parents: 21418
diff changeset
1290 g_free(guid);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1291 } else {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1292 purple_debug_info("MSNCL", "Adding group %s failed\n",
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1293 state->new_group_name);
20481
eb93710aec4d 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: 20479
diff changeset
1294 }
eb93710aec4d 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: 20479
diff changeset
1295 }
eb93710aec4d 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: 20479
diff changeset
1296
eb93710aec4d 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: 20479
diff changeset
1297 if (state->action & MSN_DEL_GROUP) {
eb93710aec4d 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: 20479
diff changeset
1298 GList *l;
eb93710aec4d 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: 20479
diff changeset
1299
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1300 msn_userlist_remove_group_id(session->userlist, state->guid);
20481
eb93710aec4d 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: 20479
diff changeset
1301 for (l = userlist->users; l != NULL; l = l->next) {
eb93710aec4d 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: 20479
diff changeset
1302 msn_user_remove_group_id( (MsnUser *)l->data, state->guid);
eb93710aec4d 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: 20479
diff changeset
1303 }
eb93710aec4d 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: 20479
diff changeset
1304 }
eb93710aec4d 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: 20479
diff changeset
1305
eb93710aec4d 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: 20479
diff changeset
1306 msn_callback_state_free(state);
eb93710aec4d 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: 20479
diff changeset
1307 }
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1308 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1309
20481
eb93710aec4d 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: 20479
diff changeset
1310 /* add group */
eb93710aec4d 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: 20479
diff changeset
1311 void
eb93710aec4d 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: 20479
diff changeset
1312 msn_add_group(MsnSession *session, MsnCallbackState *state, const char* group_name)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1313 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1314 char *body = NULL;
23446
f1f5efd679a4 Patch 4 from Qulogic, this one fixes a group name escape bug introduced by
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23445
diff changeset
1315 char *escaped_group_name = NULL;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1316
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1317 g_return_if_fail(session != NULL);
20481
eb93710aec4d 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: 20479
diff changeset
1318 g_return_if_fail(group_name != NULL);
eb93710aec4d 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: 20479
diff changeset
1319
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1320 purple_debug_info("MSNCL","Adding group %s to contact list.\n", group_name);
20481
eb93710aec4d 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: 20479
diff changeset
1321
eb93710aec4d 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: 20479
diff changeset
1322 if (state == NULL) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1323 state = msn_callback_state_new(session);
20481
eb93710aec4d 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: 20479
diff changeset
1324 }
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1325
20481
eb93710aec4d 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: 20479
diff changeset
1326 msn_callback_state_set_action(state, MSN_ADD_GROUP);
eb93710aec4d 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: 20479
diff changeset
1327 msn_callback_state_set_new_group_name(state, group_name);
eb93710aec4d 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: 20479
diff changeset
1328
eb93710aec4d 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: 20479
diff changeset
1329 /* escape group name's html special chars so it can safely be sent
eb93710aec4d 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: 20479
diff changeset
1330 * in a XML SOAP request
eb93710aec4d 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: 20479
diff changeset
1331 */
23446
f1f5efd679a4 Patch 4 from Qulogic, this one fixes a group name escape bug introduced by
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23445
diff changeset
1332 escaped_group_name = g_markup_escape_text(group_name, -1);
f1f5efd679a4 Patch 4 from Qulogic, this one fixes a group name escape bug introduced by
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23445
diff changeset
1333 body = g_strdup_printf(MSN_GROUP_ADD_TEMPLATE,
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1334 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1335 escaped_group_name);
20481
eb93710aec4d 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: 20479
diff changeset
1336
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1337 msn_soap_message_send(session,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1338 msn_soap_message_new(MSN_GROUP_ADD_SOAP_ACTION,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1339 xmlnode_from_str(body, -1)),
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1340 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1341 msn_group_read_cb, state);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1342
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1343 g_free(escaped_group_name);
20481
eb93710aec4d 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: 20479
diff changeset
1344 g_free(body);
eb93710aec4d 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: 20479
diff changeset
1345 }
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1346
20481
eb93710aec4d 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: 20479
diff changeset
1347 /* delete group */
eb93710aec4d 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: 20479
diff changeset
1348 void
eb93710aec4d 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: 20479
diff changeset
1349 msn_del_group(MsnSession *session, const gchar *group_name)
eb93710aec4d 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: 20479
diff changeset
1350 {
eb93710aec4d 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: 20479
diff changeset
1351 MsnCallbackState *state;
eb93710aec4d 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: 20479
diff changeset
1352 char *body = NULL;
eb93710aec4d 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: 20479
diff changeset
1353 const gchar *guid;
eb93710aec4d 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: 20479
diff changeset
1354
eb93710aec4d 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: 20479
diff changeset
1355 g_return_if_fail(session != NULL);
eb93710aec4d 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: 20479
diff changeset
1356
eb93710aec4d 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: 20479
diff changeset
1357 g_return_if_fail(group_name != NULL);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1358 purple_debug_info("MSNCL","Deleting group %s from contact list\n", group_name);
20481
eb93710aec4d 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: 20479
diff changeset
1359
eb93710aec4d 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: 20479
diff changeset
1360 guid = msn_userlist_find_group_id(session->userlist, group_name);
eb93710aec4d 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: 20479
diff changeset
1361
eb93710aec4d 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: 20479
diff changeset
1362 /* if group uid we need to del is NULL,
eb93710aec4d 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: 20479
diff changeset
1363 * we need to delete nothing
eb93710aec4d 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: 20479
diff changeset
1364 */
eb93710aec4d 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: 20479
diff changeset
1365 if (guid == NULL) {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1366 purple_debug_info("MSNCL", "Group %s guid not found, returning.\n", group_name);
20481
eb93710aec4d 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: 20479
diff changeset
1367 return;
eb93710aec4d 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: 20479
diff changeset
1368 }
20484
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
1369
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
1370 if ( !strcmp(guid, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(guid, MSN_NON_IM_GROUP_ID) ) {
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20484
diff changeset
1371 // XXX add back PurpleGroup since it isn't really removed in the server?
20484
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
1372 return;
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
1373 }
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
1374
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1375 state = msn_callback_state_new(session);
20481
eb93710aec4d 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: 20479
diff changeset
1376 msn_callback_state_set_action(state, MSN_DEL_GROUP);
eb93710aec4d 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: 20479
diff changeset
1377 msn_callback_state_set_guid(state, guid);
eb93710aec4d 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: 20479
diff changeset
1378
23445
b70f30dd4753 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21833
diff changeset
1379 body = g_strdup_printf(MSN_GROUP_DEL_TEMPLATE,
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1380 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1381 guid);
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1382
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1383 msn_soap_message_send(session,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1384 msn_soap_message_new(MSN_GROUP_DEL_SOAP_ACTION,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1385 xmlnode_from_str(body, -1)),
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1386 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1387 msn_group_read_cb, state);
20481
eb93710aec4d 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: 20479
diff changeset
1388
eb93710aec4d 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: 20479
diff changeset
1389 g_free(body);
eb93710aec4d 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: 20479
diff changeset
1390 }
eb93710aec4d 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: 20479
diff changeset
1391
eb93710aec4d 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: 20479
diff changeset
1392 /* rename group */
eb93710aec4d 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: 20479
diff changeset
1393 void
eb93710aec4d 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: 20479
diff changeset
1394 msn_contact_rename_group(MsnSession *session, const char *old_group_name, const char *new_group_name)
eb93710aec4d 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: 20479
diff changeset
1395 {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1396 gchar *body = NULL;
20481
eb93710aec4d 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: 20479
diff changeset
1397 const gchar * guid;
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1398 MsnCallbackState *state;
23446
f1f5efd679a4 Patch 4 from Qulogic, this one fixes a group name escape bug introduced by
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23445
diff changeset
1399 char *escaped_group_name;
20481
eb93710aec4d 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: 20479
diff changeset
1400
eb93710aec4d 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: 20479
diff changeset
1401 g_return_if_fail(session != NULL);
eb93710aec4d 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: 20479
diff changeset
1402 g_return_if_fail(session->userlist != NULL);
eb93710aec4d 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: 20479
diff changeset
1403 g_return_if_fail(old_group_name != NULL);
eb93710aec4d 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: 20479
diff changeset
1404 g_return_if_fail(new_group_name != NULL);
eb93710aec4d 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: 20479
diff changeset
1405
eb93710aec4d 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: 20479
diff changeset
1406 purple_debug_info("MSN CL", "Renaming group %s to %s.\n", old_group_name, new_group_name);
eb93710aec4d 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: 20479
diff changeset
1407
eb93710aec4d 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: 20479
diff changeset
1408 guid = msn_userlist_find_group_id(session->userlist, old_group_name);
eb93710aec4d 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: 20479
diff changeset
1409 if (guid == NULL)
eb93710aec4d 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: 20479
diff changeset
1410 return;
20484
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
1411
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1412 state = msn_callback_state_new(session);
20481
eb93710aec4d 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: 20479
diff changeset
1413 msn_callback_state_set_guid(state, guid);
eb93710aec4d 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: 20479
diff changeset
1414 msn_callback_state_set_new_group_name(state, new_group_name);
20484
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
1415
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
1416 if ( !strcmp(guid, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(guid, MSN_NON_IM_GROUP_ID) ) {
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
1417 msn_add_group(session, state, new_group_name);
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
1418 // XXX move every buddy there (we probably need to fix concurrent SOAP reqs first)
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
1419 }
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
1420
98613886411a Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
1421 msn_callback_state_set_action(state, MSN_RENAME_GROUP);
20481
eb93710aec4d 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: 20479
diff changeset
1422
23446
f1f5efd679a4 Patch 4 from Qulogic, this one fixes a group name escape bug introduced by
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23445
diff changeset
1423 escaped_group_name = g_markup_escape_text(new_group_name, -1);
f1f5efd679a4 Patch 4 from Qulogic, this one fixes a group name escape bug introduced by
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23445
diff changeset
1424 body = g_strdup_printf(MSN_GROUP_RENAME_TEMPLATE,
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1425 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1426 guid, escaped_group_name);
20481
eb93710aec4d 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: 20479
diff changeset
1427
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1428 msn_soap_message_send(session,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1429 msn_soap_message_new(MSN_GROUP_RENAME_SOAP_ACTION,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1430 xmlnode_from_str(body, -1)),
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1431 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1432 msn_group_read_cb, state);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1433
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23446
diff changeset
1434 g_free(escaped_group_name);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1435 g_free(body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1436 }