annotate libpurple/protocols/msn/contact.c @ 22804:7d3b2c023ad8

This is the way we plug the leaks, plug the leaks, plug the leaks...
author Daniel Atallah <daniel.atallah@gmail.com>
date Sat, 03 May 2008 17:56:04 +0000
parents 8041c74e36d7
children 3c98c25b076b
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"
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
32
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
33 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
34 {
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
35 "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
36 "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
37 "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
38 "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
39 "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
40 };
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
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
42 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
43 {
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 "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
45 "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
46 "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
47 "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
48 "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
49 };
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
50
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
51 typedef struct {
90fd0826c6ce 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 MsnContact *contact;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
53 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
54 } 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
55
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
56 /* new a contact */
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
57 MsnContact *
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
58 msn_contact_new(MsnSession *session)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
59 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
60 MsnContact *contact;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
61
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
62 contact = g_new0(MsnContact, 1);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
63 contact->session = session;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
64
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
65 return contact;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
66 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
67
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
68 /* destroy the contact */
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
69 void
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
70 msn_contact_destroy(MsnContact *contact)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
71 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
72 g_free(contact);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
73 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
74
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
75 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
76 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
77 {
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
78 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
79
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
80 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
81
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
82 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
83 }
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
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
85 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
86 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
87 {
20501
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
88 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
89 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
90
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
91 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
92 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
93 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
94 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
95 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
96
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
97 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
98 }
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
99
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
100 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
101 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
102 {
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
103 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
104 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
105
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
106 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
107 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
108 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
109 }
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
110
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
111 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
112 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
113 {
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
114 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
115 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
116
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
117 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
118 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
119 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
120 }
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
121
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
122 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
123 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
124 {
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
125 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
126 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
127
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
128 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
129 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
130 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
131 }
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
132
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
133 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
134 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
135 {
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
136 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
137 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
138
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
139 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
140 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
141 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
142 }
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
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 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
145 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
146 {
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
147 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
148 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
149
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
150 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
151 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
152 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
153 }
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
154
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
155
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
156 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
157 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
158 {
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
159 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
160
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
161 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
162 }
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
163
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 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
165 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
166 {
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
167 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
168
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
169 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
170 }
20394
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 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
173 static MsnListId
20789
6736c1168c50 Leak fix.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20774
diff changeset
174 msn_get_memberrole(const char *role)
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(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
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(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
179 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
180 } 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
181 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
182 } 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
183 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
184 } 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
185 return MSN_LIST_PL;
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 return 0;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
188 }
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 /*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
191 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
192 msn_get_user_type(char *type)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
193 {
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
194 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
195
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
196 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
197 return MSN_USER_TYPE_PASSPORT;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
198 }
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
199 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
200 return MSN_USER_TYPE_PASSPORT;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
201 }
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
202 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
203 return MSN_USER_TYPE_PASSPORT;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
204 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
205
20442
a1c6206f0205 Make the MsnUser type an enum so we have fewer magic numbers
Stu Tomlinson <stu@nosnilmot.com>
parents: 20440
diff changeset
206 return MSN_USER_TYPE_UNKNOWN;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
207 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
208
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
209 /* 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
210 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
211 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
212 {
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
213 if (resp && msn_soap_xml_get(resp->xml, "Body/Fault") == 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
214 purple_debug_info("msnab", "Address Book successfully created!\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
215 msn_get_address_book((MsnContact *)data, MSN_PS_INITIAL, NULL, 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
216 } 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
217 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
218 }
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
219 }
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
220
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
221 static void
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
222 msn_create_address_book(MsnContact * contact)
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 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
225
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
226 g_return_if_fail(contact != 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
227 g_return_if_fail(contact->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
228 g_return_if_fail(contact->session->user != 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
229 g_return_if_fail(contact->session->user->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
230
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
231 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
232
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
233 body = g_strdup_printf(MSN_ADD_ADDRESSBOOK_TEMPLATE, contact->session->user->passport);
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
234
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
235 msn_soap_message_send(contact->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
236 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
237 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
238 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL, msn_create_address_cb,
90fd0826c6ce 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 contact);
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
240
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
241 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
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
90fd0826c6ce 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 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
245 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
246 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
247 {
90fd0826c6ce 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 char *passport = xmlnode_get_data(xmlnode_get_child(member, node));
21127
d0676f639d5a Fix some typos
Carlos Silva <typ0@pidgin.im>
parents: 21115
diff changeset
249 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
250 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
251 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
252
21127
d0676f639d5a Fix some typos
Carlos Silva <typ0@pidgin.im>
parents: 21115
diff changeset
253 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
254 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
255
90fd0826c6ce 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 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
257 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
258 }
90fd0826c6ce 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
90fd0826c6ce 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 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
261
90fd0826c6ce 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 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
263 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
264 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
265 }
90fd0826c6ce 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
90fd0826c6ce 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 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
268 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
269 {
90fd0826c6ce 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 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
271
90fd0826c6ce 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 if ((type = msn_soap_xml_get(service, "Info/Handle/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
273 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
274
90fd0826c6ce 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 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
276 /* 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
277 } 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
278 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
279 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
280 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
281
90fd0826c6ce 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 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
283 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
284 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
285
90fd0826c6ce 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 for (membership = msn_soap_xml_get(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
287 "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
288 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
289
90fd0826c6ce 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 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
291 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
292 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
293 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
294
90fd0826c6ce 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 purple_debug_info("msncl", "MemberRole role: %s, list: %d\n",
21127
d0676f639d5a Fix some typos
Carlos Silva <typ0@pidgin.im>
parents: 21115
diff changeset
296 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
297
90fd0826c6ce 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 for (member = msn_soap_xml_get(membership, "Members/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
299 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
300 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
301 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
302 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
303 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
304 } 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
305
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
306 } 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
307 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
308 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
309 }
90fd0826c6ce 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
90fd0826c6ce 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 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
312 }
90fd0826c6ce 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
90fd0826c6ce 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 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
315 }
90fd0826c6ce 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
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
317 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
318 }
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
319 }
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
320
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
321 /*parse contact list*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
322 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
323 msn_parse_contact_list(MsnContact *contact, xmlnode *node)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
324 {
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 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
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 /* 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
328 *
90fd0826c6ce 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 * <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
330 * 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
331 *
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
332 * 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
333 */
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
334 if ((fault = msn_soap_xml_get(node, "Body/Fault"))) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
335 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
336 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
337 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
338 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
339 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
340 }
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 if ((faultnode = msn_soap_xml_get(fault, "detail/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
342 char *errorcode = xmlnode_get_data(faultnode);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
343
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
344 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
345 msn_create_address_book(contact);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
346 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
347 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
348 }
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
349
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
350 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
351 }
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
352
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
353 msn_get_contact_list(contact, MSN_PS_INITIAL, 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
354 } 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
355 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
356
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
357 for (service = msn_soap_xml_get(node, "Body/FindMembershipResponse/"
90fd0826c6ce 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 "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
359 service; service = xmlnode_get_next_twin(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
360 msn_parse_each_service(contact->session, service);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
361 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
362 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
363 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
364
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
365 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
366 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
367 gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
368 {
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
369 GetContactListCbData *cb_data = 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
370 MsnContact *contact = cb_data->contact;
90fd0826c6ce 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 MsnSession *session = contact->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
372
90fd0826c6ce 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 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
374
90fd0826c6ce 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 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
376 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
377 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
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 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
380
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
381 msn_parse_contact_list(cb_data->contact, resp->xml);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
382 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
383 "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
384 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
385 "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
386
90fd0826c6ce 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 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
388 #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
389 /* 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
390 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
391 list to detect sync issues */
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
392 msn_get_address_book(contact, MSN_PS_INITIAL, abLastChange, 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
393 #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
394 msn_get_address_book(contact, MSN_PS_INITIAL, NULL, 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
395 #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
396 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
397 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
398
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
399 g_free(cb_data);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
400 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
401
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
402 /*SOAP get contact list*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
403 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
404 msn_get_contact_list(MsnContact * contact,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
405 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
406 {
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
407 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
408 gchar *update_str = 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
409 GetContactListCbData cb_data = { contact, 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
410 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
411
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
412 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
413
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
414 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
415 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
416 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
417 }
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
418
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
419 body = g_strdup_printf(MSN_GET_CONTACT_TEMPLATE, partner_scenario_str, 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
420
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
421 msn_soap_message_send(contact->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
422 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
423 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
424 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
425 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
426
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
427 g_free(update_str);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
428 g_free(body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
429 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
430
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
431 static void
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
432 msn_parse_addressbook_groups(MsnContact *contact, xmlnode *node)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
433 {
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
434 MsnSession *session = contact->session;
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
435 xmlnode *group;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
436
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
437 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
438
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
439 for(group = xmlnode_get_child(node, "Group"); group;
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
440 group = xmlnode_get_next_twin(group)){
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
441 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
442 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
443
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
444 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
445 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
446 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
447 group_name = xmlnode_get_data(groupname);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
448
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
449 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
450
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
451 if (group_id == NULL){
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
452 /* 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
453 g_free(group_name);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
454 continue;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
455 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
456
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
457 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
458 if ((purple_find_group(group_name)) == NULL){
4ddc27c18781 Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents: 20394
diff changeset
459 PurpleGroup *g = purple_group_new(group_name);
4ddc27c18781 Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents: 20394
diff changeset
460 purple_blist_add_group(g, NULL);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
461 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
462 g_free(group_id);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
463 g_free(group_name);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
464 }
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
465 }
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
466
22552
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
467 static gboolean
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
468 msn_parse_addressbook_mobile(xmlnode *contactInfo, char **inout_mobile_number)
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
469 {
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
470 xmlnode *phones;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
471 char *mobile_number = NULL;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
472 gboolean mobile = FALSE;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
473
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
474 *inout_mobile_number = NULL;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
475
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
476 if ((phones = xmlnode_get_child(contactInfo, "phones"))) {
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
477 xmlnode *contact_phone;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
478 char *phone_type = NULL;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
479
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
480 for (contact_phone = xmlnode_get_child(phones, "ContactPhone");
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
481 contact_phone;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
482 contact_phone = xmlnode_get_next_twin(contact_phone)) {
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
483 xmlnode *contact_phone_type;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
484
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
485 if (!(contact_phone_type =
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
486 xmlnode_get_child(contact_phone, "contactPhoneType")))
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
487 continue;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
488
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
489 phone_type = xmlnode_get_data(contact_phone_type);
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
490
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
491 if (phone_type && !strcmp(phone_type, "ContactPhoneMobile")) {
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
492 xmlnode *number;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
493
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
494 if ((number = xmlnode_get_child(contact_phone, "number"))) {
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
495 xmlnode *messenger_enabled;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
496 char *is_messenger_enabled = NULL;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
497
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
498 mobile_number = xmlnode_get_data(number);
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
499
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
500 if (mobile_number &&
22804
7d3b2c023ad8 This is the way we plug the leaks, plug the leaks, plug the leaks...
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22554
diff changeset
501 (messenger_enabled = xmlnode_get_child(contact_phone, "isMessengerEnabled"))
7d3b2c023ad8 This is the way we plug the leaks, plug the leaks, plug the leaks...
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22554
diff changeset
502 && (is_messenger_enabled = xmlnode_get_data(messenger_enabled))
7d3b2c023ad8 This is the way we plug the leaks, plug the leaks, plug the leaks...
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22554
diff changeset
503 && !strcmp(is_messenger_enabled, "true"))
22552
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
504 mobile = TRUE;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
505
22804
7d3b2c023ad8 This is the way we plug the leaks, plug the leaks, plug the leaks...
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22554
diff changeset
506 g_free(mobile_number);
22552
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
507 g_free(is_messenger_enabled);
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
508 }
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
509 }
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
510
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
511 g_free(phone_type);
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
512 }
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
513 }
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
514
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
515 *inout_mobile_number = mobile_number;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
516 return mobile;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
517 }
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
518
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
519 static void
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
520 msn_parse_addressbook_contacts(MsnContact *contact, xmlnode *node)
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
521 {
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
522 MsnSession *session = contact->session;
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
523 xmlnode *contactNode;
22552
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
524 char *passport = NULL, *Name = NULL, *uid = NULL, *type = NULL, *mobile_number = NULL;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
525 gboolean mobile = FALSE;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
526
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
527 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
528 contactNode = xmlnode_get_next_twin(contactNode)) {
22554
8041c74e36d7 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@hxbc.us>
parents: 22552
diff changeset
529 xmlnode *contactId, *contactInfo, *contactType, *passportName, *displayName, *guid, *groupIds, *messenger_user;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
530 MsnUser *user;
20447
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20442
diff changeset
531 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
532
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
533 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
534 || !(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
535 || !(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
536 continue;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
537
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
538 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
539 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
540 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
541 g_free(type);
22552
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
542 passport = Name = uid = type = mobile_number = NULL;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
543 mobile = FALSE;
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
544
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
545 uid = xmlnode_get_data(contactId);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
546 type = xmlnode_get_data(contactType);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
547
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
548 /*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
549 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
550 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
551 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
552 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
553 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
554 g_free(friendly);
20403
599b5a4aebab The last of the merge fix-ups.
Richard Laager <rlaager@wiktel.com>
parents: 20401
diff changeset
555 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
556 }
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
557
22554
8041c74e36d7 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@hxbc.us>
parents: 22552
diff changeset
558 /* ignore non-messenger contacts */
8041c74e36d7 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@hxbc.us>
parents: 22552
diff changeset
559 if((messenger_user = xmlnode_get_child(contactInfo, "isMessengerUser"))) {
8041c74e36d7 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@hxbc.us>
parents: 22552
diff changeset
560 char *is_messenger_user = xmlnode_get_data(messenger_user);
8041c74e36d7 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@hxbc.us>
parents: 22552
diff changeset
561
8041c74e36d7 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@hxbc.us>
parents: 22552
diff changeset
562 if(is_messenger_user && !strcmp(is_messenger_user, "false")) {
8041c74e36d7 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@hxbc.us>
parents: 22552
diff changeset
563 g_free(is_messenger_user);
8041c74e36d7 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@hxbc.us>
parents: 22552
diff changeset
564 continue;
8041c74e36d7 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@hxbc.us>
parents: 22552
diff changeset
565 }
8041c74e36d7 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@hxbc.us>
parents: 22552
diff changeset
566
8041c74e36d7 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@hxbc.us>
parents: 22552
diff changeset
567 g_free(is_messenger_user);
8041c74e36d7 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@hxbc.us>
parents: 22552
diff changeset
568 }
8041c74e36d7 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@hxbc.us>
parents: 22552
diff changeset
569
20447
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20442
diff changeset
570 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
571 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
572 if (passportName == NULL) {
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
573 xmlnode *emailsNode, *contactEmailNode, *emailNode;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
574 xmlnode *messengerEnabledNode;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
575 char *msnEnabled;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
576
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
577 /*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
578 /*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
579 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
580 if (emailsNode == NULL) {
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
581 /*TODO: need to support the Mobile type*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
582 continue;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
583 }
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
584 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
585 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
586 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
587 /* 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
588 break;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
589 }
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
590
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
591 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
592
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
593 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
594 g_free(passport);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
595 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
596 }
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
597
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
598 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
599 /*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
600 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
601 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
602 g_free(msnEnabled);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
603 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
604 } else {
20401
4ddc27c18781 Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents: 20394
diff changeset
605 /*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
606 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
607 }
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
608
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
609 g_free(msnEnabled);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
610 }
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
611 } else {
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
612 passport = xmlnode_get_data(passportName);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
613 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
614
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
615 if (passport == NULL)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
616 continue;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
617
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
618 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
619 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
620 else
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
621 Name = g_strdup(passport);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
622
22552
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
623 mobile = msn_parse_addressbook_mobile(contactInfo, &mobile_number);
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
624
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
625 purple_debug_misc("MsnAB","passport:{%s} uid:{%s} display:{%s} mobile:{%s} mobile number:{%s}\n",
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
626 passport, uid ? uid : "(null)", Name ? Name : "(null)",
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
627 mobile ? "true" : "false", mobile_number ? mobile_number : "(null)");
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
628
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
629 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
630 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
631 msn_user_set_type(user, usertype);
22552
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
632 msn_user_set_mobile_phone(user, mobile_number);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
633
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
634 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
635 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
636 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
637 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
638 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
639 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
640 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
641 g_free(group_id);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
642 }
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
643 } 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
644 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
645 /*not in any group,Then set default group*/
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
646 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
647 }
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
648
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
649 msn_got_lst_user(session, user, MSN_LIST_FL_OP, NULL);
22552
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
650
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
651 if(mobile && user)
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
652 {
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
653 user->mobile = TRUE;
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
654 purple_prpl_got_user_status(session->account, user->passport, "mobile", NULL);
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
655 purple_prpl_got_user_status(session->account, user->passport, "available", NULL);
207f51e16b50 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents: 21833
diff changeset
656 }
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
657 }
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
658
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
659 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
660 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
661 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
662 g_free(type);
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
663 }
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
664
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
665 static gboolean
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
666 msn_parse_addressbook(MsnContact * contact, xmlnode *node)
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
667 {
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
668 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
669 xmlnode *result;
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
670 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
671 xmlnode *contacts;
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
672 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
673 xmlnode *fault;
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
674
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
675 session = contact->session;
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
676
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
677 if ((fault = msn_soap_xml_get(node, "Body/Fault"))) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
678 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
679
90fd0826c6ce 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 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
681 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
682 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
683 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
684 }
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
685
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
686 if ((faultnode = msn_soap_xml_get(fault, "detail/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
687 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
688
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
689 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
690
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
691 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
692 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
693 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
694 }
22804
7d3b2c023ad8 This is the way we plug the leaks, plug the leaks, plug the leaks...
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22554
diff changeset
695 g_free(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
696 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
697
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
698 return FALSE;
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
699 }
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
700
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
701 result = msn_soap_xml_get(node, "Body/ABFindAllResponse/ABFindAllResult");
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
702 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
703 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
704 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
705 }
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
706
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
707 /* 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
708 if they are really there, and update msnpiki */
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
709 /*Process Group List*/
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
710 groups = xmlnode_get_child(result,"groups");
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
711 if (groups != NULL) {
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
712 msn_parse_addressbook_groups(contact, groups);
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
713 }
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
714
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
715 /*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
716 msn_group_new(session->userlist, MSN_INDIVIDUALS_GROUP_ID,
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
717 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
718 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
719 MSN_INDIVIDUALS_GROUP_ID, MSN_INDIVIDUALS_GROUP_NAME);
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
720 if ((purple_find_group(MSN_INDIVIDUALS_GROUP_NAME)) == NULL){
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
721 PurpleGroup *g = purple_group_new(MSN_INDIVIDUALS_GROUP_NAME);
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
722 purple_blist_add_group(g, NULL);
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
723 }
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
724
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
725 /*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
726 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
727 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
728 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
729 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
730 purple_blist_add_group(g, NULL);
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
731 }
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
732
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
733 /*Process contact List*/
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
734 purple_debug_info("MSNAB","process contact list...\n");
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
735 contacts =xmlnode_get_child(result,"contacts");
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
736 if (contacts != NULL) {
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20432
diff changeset
737 msn_parse_addressbook_contacts(contact, contacts);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
738 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
739
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
740 abNode =xmlnode_get_child(result,"ab");
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
741 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
742 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
743 char *tmp = NULL;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
744
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
745 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
746 tmp = xmlnode_get_data(node2);
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
747 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
748 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
749
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
750 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
751 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
752 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
753 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
754 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
755 g_free(tmp);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
756 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
757
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
758 return TRUE;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
759 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
760
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
761 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
762 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
763 {
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
764 MsnContact *contact = data;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
765 MsnSession *session;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
766
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
767 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
768 return;
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
769
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
770 g_return_if_fail(contact != 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
771 session = contact->session;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
772 g_return_if_fail(session != NULL);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
773
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
774 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
775
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
776 if (msn_parse_addressbook(contact, 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
777 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
778 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
779 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
780 }
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
781 } 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
782 /* 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
783 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
784 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
785 */
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
786 /*
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
787 msn_get_address_book(contact, 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
788 */
9a2a4a0c0003 Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20471
diff changeset
789 msn_session_disconnect(session);
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20892
diff changeset
790 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
791 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
792 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
793
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
794 /*get the address book*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
795 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
796 msn_get_address_book(MsnContact *contact,
90fd0826c6ce 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 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
798 const char *dynamicItemLastChange)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
799 {
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
800 char *body, *update_str = NULL;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
801
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
802 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
803
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
804 /*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
805 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
806 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
807 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
808 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
809
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
810 body = g_strdup_printf(MSN_GET_ADDRESS_TEMPLATE, MsnSoapPartnerScenarioText[partner_scenario], 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
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 msn_soap_message_send(contact->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
813 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
814 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
815 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL, msn_get_address_cb,
90fd0826c6ce 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 contact);
90fd0826c6ce 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
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
818 g_free(update_str);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
819 g_free(body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
820 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
821
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
822 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
823 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
824 gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
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 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
827 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
828
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
829 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
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 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
832 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
833 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
834
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
835 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
836
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
837 // 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
838 // 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
839 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
840 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
841 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
842 }
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
843
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
844 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
845
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
846 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
847 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
848 }
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
849
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
850 msn_callback_state_free(state);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
851 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
852
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
853 /* 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
854 void
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 msn_add_contact(MsnContact *contact, MsnCallbackState *state, const char *passport)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
856 {
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
857 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
858 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
859
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
860 #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
861 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
862
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
863
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
864 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
865 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
866 } 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
867 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
868 }
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
869 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
870 #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
871
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
872 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
873
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
874 contact_xml = g_strdup_printf(MSN_CONTACT_XML, 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
875 body = g_strdup_printf(MSN_ADD_CONTACT_TEMPLATE, contact_xml);
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
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
877 msn_soap_message_send(contact->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
878 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
879 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
880 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
881 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
882
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
883 g_free(contact_xml);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
884 g_free(body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
885 }
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
886
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 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
888 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
889 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
890 {
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
891 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
892 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
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_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
895
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
896 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
897
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
898 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
899 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
900 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
901 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
902 } 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
903 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
904 }
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
905
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
906 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
907 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
908
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
909 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
910
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
911 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
912 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
913 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
914 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
915
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
916 if (msn_userlist_user_is_in_list(user, MSN_LIST_PL)) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
917 msn_del_contact_from_list(state->session->contact, NULL, state->who, MSN_LIST_PL);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
918 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
919 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
920 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
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
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
923 if (state->action & MSN_MOVE_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
924 msn_del_contact_from_group(state->session->contact, 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
925 }
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
926 }
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
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
928 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
929 }
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
930
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
931 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
932 msn_add_contact_to_group(MsnContact *contact, 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
933 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
934 {
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
935 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
936 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
937 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
938
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
939 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
940 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
941
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
942 g_return_if_fail(contact != 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
943 g_return_if_fail(contact->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
944 g_return_if_fail(contact->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
945
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
946 userlist = contact->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
947
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
948 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
949
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
950 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
951
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
952 if (state->action & MSN_ADD_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
953 msn_add_contact(contact, state, 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
954 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
955 }
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
956
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
957 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
958 msn_user_add_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
959 msn_del_contact_from_group(contact, passport, state->old_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
960 } 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
961 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
962 }
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
963
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
964 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
965 }
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
966
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
967 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
968 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
969
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 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
971 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
972 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
973 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
974 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
975 }
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
20855
cfaf74ec93dc Prevent null pointer deref to fix CID 322.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20789
diff changeset
977 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
978 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
979 } 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
980 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
981 }
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
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
983 body = g_strdup_printf(MSN_ADD_CONTACT_GROUP_TEMPLATE, groupId, contact_xml);
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
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 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
986 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
987 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
988 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
989 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
990
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
991 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
992 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
993 }
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
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
995 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
996 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
997 gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
998 {
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
999 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
1000
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1001 if (resp != NULL) {
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1002 MsnUserList *userlist = state->session->userlist;
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1003 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
1004
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1005 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
1006
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1007 if (user != NULL) {
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1008 msn_userlist_remove_user(userlist, user);
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1009 }
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
1010 }
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
1011
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
1012 msn_callback_state_free(state);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1013 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1014
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1015 /*delete a Contact*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1016 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
1017 msn_delete_contact(MsnContact *contact, const char *contactId)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1018 {
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
1019 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
1020 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
1021 MsnCallbackState *state;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1022
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1023 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
1024 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
1025
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1026 state = msn_callback_state_new(contact->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
1027 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
1028
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
1029 /* 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
1030 purple_debug_info("MSNCL","Deleting contact with contactId: %s\n", 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
1031 body = g_strdup_printf(MSN_DEL_CONTACT_TEMPLATE, contact_id_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
1032 msn_soap_message_send(contact->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
1033 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
1034 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
1035 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
1036 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
1037
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 g_free(contact_id_xml);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1039 g_free(body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1040 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1041
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
1042 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
1043 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
1044 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
1045 {
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
1046 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
1047
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
1048 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
1049 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
1050 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
1051 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
1052 } 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
1053 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
1054 }
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
1055 }
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
1056
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
1057 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
1058 }
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
1059
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
1060 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
1061 msn_del_contact_from_group(MsnContact *contact, const char *passport, const char *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
1062 {
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
1063 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
1064 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
1065 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
1066 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
1067 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
1068
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
1069 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
1070 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
1071 g_return_if_fail(contact != 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
1072 g_return_if_fail(contact->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
1073 g_return_if_fail(contact->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
1074
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
1075 userlist = contact->session->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
1076
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
1077 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
1078 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
1079 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
1080 } 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
1081 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
1082 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
1083 }
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
1084
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
1085 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
1086
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
1087 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
1088 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
1089 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
1090 }
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
1091
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
1092 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
1093 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
1094 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
1095 }
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
1096
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
1097 state = msn_callback_state_new(contact->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
1098 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
1099 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
1100 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
1101
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
1102 contact_id_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
1103 body = g_strdup_printf(MSN_CONTACT_DEL_GROUP_TEMPLATE, 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
1104
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1105 msn_soap_message_send(contact->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
1106 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
1107 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
1108 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
1109 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
1110
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
1111 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
1112 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
1113 }
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
1114
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
1115
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1116 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
1117 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
1118 gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1119 {
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
1120 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
1121 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
1122 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
1123 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
1124 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1125
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
1126 /* Update a contact's nickname */
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1127 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
1128 msn_update_contact(MsnContact *contact, const char* nickname)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1129 {
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
1130 gchar *body = NULL, *escaped_nickname;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1131
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
1132 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
1133
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
1134 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
1135
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
1136 body = g_strdup_printf(MSN_CONTACT_UPDATE_TEMPLATE, 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
1137
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1138 msn_soap_message_send(contact->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
1139 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
1140 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
1141 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
1142 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
1143
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
1144 g_free(escaped_nickname);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1145 g_free(body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1146 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1147
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1148 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
1149 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
1150 gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1151 {
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
1152 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
1153 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
1154
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1155 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
1156 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
1157
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
1158 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
1159 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
1160
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1161 if (user != NULL)
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1162 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
1163
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
1164 msn_add_contact_to_list(session->contact, 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
1165 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
1166 } 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
1167 purple_privacy_permit_remove(session->account, state->who, 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
1168 msn_add_contact_to_list(session->contact, NULL, state->who, 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
1169 } 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
1170 purple_privacy_deny_remove(session->account, state->who, 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
1171 msn_add_contact_to_list(session->contact, NULL, 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
1172 }
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
1173 }
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
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
1175 msn_callback_state_free(state);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1176 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1177
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1178 void
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
1179 msn_del_contact_from_list(MsnContact *contact, MsnCallbackState *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
1180 const gchar *passport, const MsnListId list)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1181 {
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
1182 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
1183 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
1184 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
1185
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 g_return_if_fail(contact != 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
1187 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
1188 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
1189
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 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
1191
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
1192 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
1193 state = msn_callback_state_new(contact->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
1194 }
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 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
1196 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
1197
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
1198 if (list == 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
1199 g_return_if_fail(contact->session != 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
1200 g_return_if_fail(contact->session->userlist != 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
1201
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
1202 user = msn_userlist_find_user(contact->session->userlist, 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
1203
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
1204 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
1205 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
1206 } 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
1207 /* 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
1208 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
1209
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
1210 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
1211 }
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
1212
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
1213 body = g_strdup_printf( MSN_CONTACT_DELECT_FROM_LIST_TEMPLATE,
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
1214 MsnSoapPartnerScenarioText[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
1215 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
1216 member);
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
1217
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
1218 msn_soap_message_send(contact->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
1219 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
1220 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
1221 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
1222 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
1223
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
1224 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
1225 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
1226 }
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
1227
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
1228 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
1229 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
1230 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
1231 {
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
1232 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
1233
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
1234 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
1235 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
1236 g_return_if_fail(state->session->contact != 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
1237
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
1238 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
1239 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
1240
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1241 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
1242 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
1243
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1244 if (user != NULL) {
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1245 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
1246 }
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
1247
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1248 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
1249
21109
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1250 msn_add_contact_to_list(state->session->contact, NULL, state->who, MSN_LIST_BL);
e64e6fbd1351 merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
parents: 20774 20538
diff changeset
1251 } 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
1252 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
1253 } 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
1254 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
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 }
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
1257 }
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
1258
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
1259 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
1260 }
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
1261
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
1262 void
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
1263 msn_add_contact_to_list(MsnContact *contact, MsnCallbackState *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
1264 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
1265 {
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
1266 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
1267 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
1268
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
1269 g_return_if_fail(contact != 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
1270 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
1271 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
1272
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
1273 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
1274
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
1275 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
1276 state = msn_callback_state_new(contact->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
1277 }
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
1278 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
1279 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
1280
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
1281 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
1282
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
1283 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
1284
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
1285 body = g_strdup_printf(MSN_CONTACT_ADD_TO_LIST_TEMPLATE,
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
1286 MsnSoapPartnerScenarioText[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
1287 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
1288 member);
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
1289
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
1290 msn_soap_message_send(contact->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
1291 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
1292 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
1293 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
1294 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
1295
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
1296 g_free(member);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1297 g_free(body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1298 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1299
20427
059cc0bf6c91 Fix a compile warning by #if 0'ing out some unused code
Stu Tomlinson <stu@nosnilmot.com>
parents: 20403
diff changeset
1300 #if 0
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1301 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
1302 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
1303 {
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
1304 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
1305 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
1306 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
1307 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
1308 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1309
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1310 /*get the gleams info*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1311 void
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1312 msn_get_gleams(MsnContact *contact)
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 MsnSoapReq *soap_request;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1315
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
1316 purple_debug_info("MSNP14","msn get gleams info...\n");
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
1317 msn_soap_message_send(contact->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
1318 msn_soap_message_new(MSN_GET_GLEAMS_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
1319 xmlnode_from_str(MSN_GLEAMS_TEMPLATE, -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
1320 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
1321 msn_gleams_read_cb, NULL);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1322 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1323 #endif
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1324
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
1325
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1326 /***************************************************************
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
1327 * Group Operations
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1328 ***************************************************************/
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
1329
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1330 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
1331 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
1332 {
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
1333 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
1334
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
1335 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
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 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
1338 g_return_if_fail(state->session->userlist != 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
1339 g_return_if_fail(state->session->contact != 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
1340
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
1341 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
1342 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
1343 return;
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
1344 }
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
1345
20501
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20495
diff changeset
1346 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
1347 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
1348 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
1349
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 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
1351 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
1352 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
1353 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
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
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 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
1357 /* 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
1358 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
1359 should copy it to msnpiki some day */
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1360 xmlnode *guid_node = msn_soap_xml_get(resp->xml,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1361 "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
1362
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1363 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
1364 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
1365
90fd0826c6ce 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 /* 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
1367 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
1368 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
1369
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
1370 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
1371 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
1372 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
1373 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
1374 } else if (state->action & MSN_MOVE_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
1375 msn_add_contact_to_group(session->contact, 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
1376 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
1377 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
1378 }
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
1379 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
1380 } 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
1381 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
1382 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
1383 }
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
1384 }
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
1385
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
1386 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
1387 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
1388
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
1389 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
1390 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
1391 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
1392 }
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 }
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
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 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
1396 }
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1397 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1398
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
1399 /* 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
1400 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
1401 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
1402 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1403 char *body = NULL;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1404
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1405 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
1406 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
1407
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
1408 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
1409
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 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
1411 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
1412 }
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1413
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
1414 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
1415 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
1416
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
1417 /* 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
1418 * 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
1419 */
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
1420 body = g_markup_printf_escaped(MSN_GROUP_ADD_TEMPLATE, 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
1421
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
1422 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
1423 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
1424 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
1425 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
1426 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
1427
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
1428 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
1429 }
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1430
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
1431 /* 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
1432 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
1433 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
1434 {
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
1435 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
1436 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
1437 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
1438
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
1439 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
1440
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
1441 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
1442 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
1443
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
1444 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
1445
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
1446 /* 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
1447 * 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
1448 */
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
1449 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
1450 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
1451 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
1452 }
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
1453
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
1454 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
1455 // 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
1456 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
1457 }
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
1458
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
1459 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
1460 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
1461 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
1462
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
1463 body = g_strdup_printf(MSN_GROUP_DEL_TEMPLATE, 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
1464
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1465 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
1466 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
1467 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
1468 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
1469 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
1470
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
1471 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
1472 }
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
1473
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
1474 /* 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
1475 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
1476 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
1477 {
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
1478 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
1479 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
1480 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
1481
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
1482 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
1483 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
1484 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
1485 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
1486
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
1487 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
1488
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
1489 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
1490 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
1491 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
1492
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
1493 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
1494 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
1495 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
1496
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
1497 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
1498 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
1499 // 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
1500 }
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
1501
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
1502 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
1503
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
1504 body = g_markup_printf_escaped(MSN_GROUP_RENAME_TEMPLATE,
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
1505 guid, 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
1506
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
1507 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
1508 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
1509 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
1510 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
1511 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
1512
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1513 g_free(body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1514 }