Mercurial > pidgin
annotate libpurple/protocols/msn/contact.c @ 31004:3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 05 Dec 2010 02:40:39 +0000 |
parents | 05b3fa3725a1 |
children | 388ca4797d7b |
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 |
28070
7921a53b94b3
Oops, Elliott correctly pointed out this was wrong...
Paul Aurich <paul@darkrain42.org>
parents:
28049
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
20394
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 |
30758
230caecf5435
Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
masca@cpw.pidgin.im
parents:
30745
diff
changeset
|
27 #include "internal.h" |
30742
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
30732
diff
changeset
|
28 #include "debug.h" |
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
30732
diff
changeset
|
29 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
30 #include "contact.h" |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
31 #include "xmlnode.h" |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
32 #include "group.h" |
30745
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30742
diff
changeset
|
33 #include "msnutils.h" |
23507
711773577380
Clean up some MSN SOAP stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23478
diff
changeset
|
34 #include "soap.h" |
23445
b70f30dd4753
Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21833
diff
changeset
|
35 #include "nexus.h" |
30732
767fd05c434d
Oops, this one needed to be changed too.
masca@cpw.pidgin.im
parents:
28957
diff
changeset
|
36 #include "user.h" |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
37 |
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
|
38 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
|
39 { |
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
|
40 "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
|
41 "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
|
42 "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
|
43 "ContactMsgrAPI", |
30986
5c2af6c30e52
The PartnerScenario in the ABContactUpdate SOAP request should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
44 "BlockUnblock", |
5c2af6c30e52
The PartnerScenario in the ABContactUpdate SOAP request should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
45 "Timer" |
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
|
46 }; |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
47 |
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
|
48 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
|
49 { |
ff4ae9dde291
Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents:
20484
diff
changeset
|
50 "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
|
51 "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
|
52 "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
|
53 "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
|
54 "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
|
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 |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
57 typedef struct { |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
58 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
|
59 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
|
60 } 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
|
61 |
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
|
62 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
|
63 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
|
64 { |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
65 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
|
66 |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
67 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
|
68 |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
69 return state; |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
70 } |
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
|
71 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
72 MsnCallbackState * |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
73 msn_callback_state_dup(MsnCallbackState *state) |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
74 { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
75 MsnCallbackState *new_state = g_new0(MsnCallbackState, 1); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
76 |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
77 new_state->session = state->session; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
78 new_state->who = g_strdup(state->who); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
79 new_state->uid = g_strdup(state->uid); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
80 new_state->old_group_name = g_strdup(state->old_group_name); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
81 new_state->new_group_name = g_strdup(state->new_group_name); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
82 new_state->guid = g_strdup(state->guid); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
83 /* The rest should be made new */ |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
84 |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
85 return new_state; |
23507
711773577380
Clean up some MSN SOAP stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23478
diff
changeset
|
86 } |
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
|
87 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
88 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
|
89 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
|
90 { |
20501
f6dff814d95f
cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents:
20495
diff
changeset
|
91 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
|
92 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
|
93 |
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
|
94 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
|
95 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
|
96 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
|
97 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
|
98 g_free(state->guid); |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
99 xmlnode_free(state->body); |
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
|
100 |
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
|
101 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
|
102 } |
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
|
103 |
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 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
|
105 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
|
106 { |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
107 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
|
108 |
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
|
109 g_free(state->who); |
20991
c8f99cb61dc9
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20855
diff
changeset
|
110 state->who = g_strdup(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
|
111 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
112 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
113 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
|
114 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
|
115 { |
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
|
116 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
|
117 |
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); |
20991
c8f99cb61dc9
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20855
diff
changeset
|
119 state->uid = g_strdup(uid); |
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 { |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
125 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
|
126 |
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
|
127 g_free(state->old_group_name); |
20991
c8f99cb61dc9
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20855
diff
changeset
|
128 state->old_group_name = g_strdup(old_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
|
129 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
130 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and 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 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
|
132 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
|
133 { |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and 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 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
|
135 |
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
|
136 g_free(state->new_group_name); |
20991
c8f99cb61dc9
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20855
diff
changeset
|
137 state->new_group_name = g_strdup(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
|
138 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
139 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
140 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
|
141 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
|
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 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
|
144 |
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
|
145 g_free(state->guid); |
20991
c8f99cb61dc9
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20855
diff
changeset
|
146 state->guid = g_strdup(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
|
147 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
148 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
149 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
150 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
|
151 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
|
152 { |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and 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 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
|
154 |
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
|
155 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
|
156 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and 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 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and 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 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
|
159 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
|
160 { |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and 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 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
|
162 |
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
|
163 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
|
164 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
165 |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
166 /*************************************************************** |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
167 * General SOAP handling |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
168 ***************************************************************/ |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
169 |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
170 static const char * |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
171 msn_contact_operation_str(MsnCallbackAction action) |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
172 { |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
173 /* Make sure this is large enough when adding more */ |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
174 static char buf[BUF_LEN]; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
175 buf[0] = '\0'; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
176 |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
177 if (action & MSN_ADD_BUDDY) |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
178 strcat(buf, "Adding Buddy,"); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
179 if (action & MSN_MOVE_BUDDY) |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
180 strcat(buf, "Moving Buddy,"); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
181 if (action & MSN_ACCEPTED_BUDDY) |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
182 strcat(buf, "Accepted Buddy,"); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
183 if (action & MSN_DENIED_BUDDY) |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
184 strcat(buf, "Denied Buddy,"); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
185 if (action & MSN_ADD_GROUP) |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
186 strcat(buf, "Adding Group,"); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
187 if (action & MSN_DEL_GROUP) |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
188 strcat(buf, "Deleting Group,"); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
189 if (action & MSN_RENAME_GROUP) |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
190 strcat(buf, "Renaming Group,"); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
191 if (action & MSN_UPDATE_INFO) |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
192 strcat(buf, "Updating Contact Info,"); |
31004
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
193 if (action & MSN_ANNOTATE_USER) |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
194 strcat(buf, "Annotating Contact,"); |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
195 |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
196 return buf; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
197 } |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
198 |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
199 static gboolean msn_contact_request(MsnCallbackState *state); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
200 |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
201 static void |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
202 msn_contact_request_cb(MsnSoapMessage *req, MsnSoapMessage *resp, |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
203 gpointer data) |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
204 { |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
205 MsnCallbackState *state = data; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
206 xmlnode *fault; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
207 char *faultcode_str; |
25458
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
208 xmlnode *cachekey; |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
209 char *changed; |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
210 |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
211 if (resp == NULL) { |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
212 purple_debug_error("msn", |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
213 "Operation {%s} failed. No response received from server.\n", |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
214 msn_contact_operation_str(state->action)); |
25491
c729cdeb88c8
Set an error if you're unable to connect to the contact server, or are not
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25458
diff
changeset
|
215 msn_session_set_error(state->session, MSN_ERROR_BAD_BLIST, NULL); |
28349
203839bc0f7c
Fix a leak, and a series of typos.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28318
diff
changeset
|
216 msn_callback_state_free(state); |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
217 return; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
218 } |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
219 |
25458
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
220 /* Update CacheKey if necessary */ |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
221 cachekey = xmlnode_get_child(resp->xml, "Header/ServiceHeader/CacheKeyChanged"); |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
222 if (cachekey != NULL) { |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
223 changed = xmlnode_get_data(cachekey); |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
224 if (changed && !strcmp(changed, "true")) { |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
225 cachekey = xmlnode_get_child(resp->xml, "Header/ServiceHeader/CacheKey"); |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
226 g_free(state->session->abch_cachekey); |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
227 state->session->abch_cachekey = xmlnode_get_data(cachekey); |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
228 purple_debug_info("msn", "Updated CacheKey for %s to '%s'.\n", |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
229 purple_account_get_username(state->session->account), |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
230 state->session->abch_cachekey); |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
231 } |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
232 g_free(changed); |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
233 } |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
234 |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
235 fault = xmlnode_get_child(resp->xml, "Body/Fault"); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
236 |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
237 if (fault == NULL) { |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
238 /* No errors */ |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
239 if (state->cb) |
25455
8387f195c4af
This casting is no longer necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25397
diff
changeset
|
240 state->cb(req, resp, data); |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
241 msn_callback_state_free(state); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
242 return; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
243 } |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
244 |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
245 faultcode_str = xmlnode_get_data(xmlnode_get_child(fault, "faultcode")); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
246 |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
247 if (faultcode_str && g_str_equal(faultcode_str, "q0:BadContextToken")) { |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
248 purple_debug_info("msn", |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
249 "Contact Operation {%s} failed because of bad token." |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
250 " Updating token now and retrying operation.\n", |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
251 msn_contact_operation_str(state->action)); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
252 /* Token has expired, so renew it, and try again later */ |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
253 msn_nexus_update_token(state->session->nexus, MSN_AUTH_CONTACTS, |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
254 (GSourceFunc)msn_contact_request, data); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
255 } |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
256 else |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
257 { |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
258 if (state->cb) { |
25455
8387f195c4af
This casting is no longer necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25397
diff
changeset
|
259 state->cb(req, resp, data); |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
260 } else { |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
261 /* We don't know how to respond to this faultcode, so log it */ |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
262 char *str = xmlnode_to_str(fault, NULL); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
263 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
264 msn_contact_operation_str(state->action), str); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
265 g_free(str); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
266 } |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
267 msn_callback_state_free(state); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
268 } |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
269 |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
270 g_free(faultcode_str); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
271 } |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
272 |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
273 static gboolean |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
274 msn_contact_request(MsnCallbackState *state) |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
275 { |
25458
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
276 xmlnode *cachekey = xmlnode_get_child(state->body, |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
277 "Header/ABApplicationHeader/CacheKey"); |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
278 if (cachekey != NULL) |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
279 xmlnode_free(cachekey); |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
280 if (state->session->abch_cachekey != NULL) { |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
281 cachekey = xmlnode_new_child(xmlnode_get_child(state->body, "Header/ABApplicationHeader"), "CacheKey"); |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
282 xmlnode_insert_data(cachekey, state->session->abch_cachekey, -1); |
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25455
diff
changeset
|
283 } |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
284 if (state->token == NULL) |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
285 state->token = xmlnode_get_child(state->body, |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
286 "Header/ABAuthHeader/TicketToken"); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
287 /* delete old & replace with new token */ |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
288 xmlnode_free(state->token->child); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
289 xmlnode_insert_data(state->token, |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
290 msn_nexus_get_token_str(state->session->nexus, MSN_AUTH_CONTACTS), -1); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
291 msn_soap_message_send(state->session, |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
292 msn_soap_message_new(state->post_action, xmlnode_copy(state->body)), |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
293 MSN_CONTACT_SERVER, state->post_url, FALSE, |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
294 msn_contact_request_cb, state); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
295 return FALSE; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
296 } |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
297 |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
298 /*************************************************************** |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
299 * Address Book and Membership List Operations |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
300 ***************************************************************/ |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
301 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
302 /*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
|
303 static MsnListId |
20789 | 304 msn_get_memberrole(const char *role) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
305 { |
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
|
306 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
|
307 |
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
|
308 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
|
309 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
|
310 } 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
|
311 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
|
312 } 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
|
313 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
|
314 } 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
|
315 return MSN_LIST_PL; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
316 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
317 return 0; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
318 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
319 |
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
|
320 /* 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
|
321 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
|
322 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
|
323 { |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
324 MsnCallbackState *state = data; |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23447
diff
changeset
|
325 if (resp && xmlnode_get_child(resp->xml, "Body/Fault") == NULL) { |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
326 purple_debug_info("msn", "Address Book successfully created!\n"); |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
327 msn_get_address_book(state->session, MSN_PS_INITIAL, NULL, NULL); |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
328 } else { |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
329 purple_debug_info("msn", "Address Book creation failed!\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
|
330 } |
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
|
331 } |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
332 |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
333 static void |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
334 msn_create_address_book(MsnSession *session) |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
335 { |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
336 gchar *body; |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
337 MsnCallbackState *state; |
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
|
338 |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
339 g_return_if_fail(session != NULL); |
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
340 g_return_if_fail(session->user != NULL); |
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
341 g_return_if_fail(session->user->passport != NULL); |
20481
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
342 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
343 purple_debug_info("msn", "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
|
344 |
23735
35f7b7c62995
Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23734
diff
changeset
|
345 body = g_strdup_printf(MSN_ADD_ADDRESSBOOK_TEMPLATE, |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
346 session->user->passport); |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
347 |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
348 state = msn_callback_state_new(session); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
349 state->body = xmlnode_from_str(body, -1); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
350 state->post_action = MSN_ADD_ADDRESSBOOK_SOAP_ACTION; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
351 state->post_url = MSN_ADDRESS_BOOK_POST_URL; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
352 state->cb = msn_create_address_cb; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
353 msn_contact_request(state); |
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
|
354 |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
355 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
|
356 } |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
357 |
90fd0826c6ce
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 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
|
359 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
|
360 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
|
361 { |
27845
975fc5f64438
Ignore buddies with invalid emails in the membership list or address book,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27488
diff
changeset
|
362 char *passport; |
975fc5f64438
Ignore buddies with invalid emails in the membership list or address book,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27488
diff
changeset
|
363 char *type; |
975fc5f64438
Ignore buddies with invalid emails in the membership list or address book,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27488
diff
changeset
|
364 char *member_id; |
975fc5f64438
Ignore buddies with invalid emails in the membership list or address book,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27488
diff
changeset
|
365 MsnUser *user; |
28369
d213c8ad89da
Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28349
diff
changeset
|
366 xmlnode *annotation, *display; |
24722
daabf16bd511
When getting the privacy lists, set the default network to unknown. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24525
diff
changeset
|
367 guint nid = MSN_NETWORK_UNKNOWN; |
26909
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
368 char *invite = NULL; |
28369
d213c8ad89da
Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28349
diff
changeset
|
369 char *display_text; |
20538
90fd0826c6ce
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 |
27845
975fc5f64438
Ignore buddies with invalid emails in the membership list or address book,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27488
diff
changeset
|
371 passport = xmlnode_get_data(xmlnode_get_child(member, node)); |
28418
c3f79073c9be
The MSN servers are a bit more strict about what's allowed in emails than
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28369
diff
changeset
|
372 if (!msn_email_is_valid(passport)) { |
27845
975fc5f64438
Ignore buddies with invalid emails in the membership list or address book,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27488
diff
changeset
|
373 g_free(passport); |
975fc5f64438
Ignore buddies with invalid emails in the membership list or address book,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27488
diff
changeset
|
374 return; |
975fc5f64438
Ignore buddies with invalid emails in the membership list or address book,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27488
diff
changeset
|
375 } |
975fc5f64438
Ignore buddies with invalid emails in the membership list or address book,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27488
diff
changeset
|
376 |
975fc5f64438
Ignore buddies with invalid emails in the membership list or address book,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27488
diff
changeset
|
377 type = xmlnode_get_data(xmlnode_get_child(member, "Type")); |
975fc5f64438
Ignore buddies with invalid emails in the membership list or address book,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27488
diff
changeset
|
378 member_id = xmlnode_get_data(xmlnode_get_child(member, "MembershipId")); |
28369
d213c8ad89da
Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28349
diff
changeset
|
379 if ((display = xmlnode_get_child(member, "DisplayName"))) { |
d213c8ad89da
Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28349
diff
changeset
|
380 display_text = xmlnode_get_data(display); |
d213c8ad89da
Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28349
diff
changeset
|
381 } else { |
d213c8ad89da
Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28349
diff
changeset
|
382 display_text = NULL; |
d213c8ad89da
Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28349
diff
changeset
|
383 } |
d213c8ad89da
Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28349
diff
changeset
|
384 |
d213c8ad89da
Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28349
diff
changeset
|
385 user = msn_userlist_find_add_user(session->userlist, passport, display_text); |
27845
975fc5f64438
Ignore buddies with invalid emails in the membership list or address book,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27488
diff
changeset
|
386 |
26909
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
387 for (annotation = xmlnode_get_child(member, "Annotations/Annotation"); |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
388 annotation; |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
389 annotation = xmlnode_get_next_twin(annotation)) { |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
390 char *name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
391 char *value = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
392 if (name && value) { |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
393 if (!strcmp(name, "MSN.IM.BuddyType")) { |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
394 nid = strtoul(value, NULL, 10); |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
395 } |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
396 else if (!strcmp(name, "MSN.IM.InviteMessage")) { |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
397 invite = value; |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
398 value = NULL; |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
399 } |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
400 } |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
401 g_free(name); |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
402 g_free(value); |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
403 } |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
404 |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
405 /* For EmailMembers, the network must be found in the annotations, above. |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
406 Otherwise, PassportMembers are on the Passport network. */ |
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
407 if (!strcmp(node, "PassportName")) |
24722
daabf16bd511
When getting the privacy lists, set the default network to unknown. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24525
diff
changeset
|
408 nid = MSN_NETWORK_PASSPORT; |
25395
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
409 |
24515
f1936abe1616
Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24514
diff
changeset
|
410 purple_debug_info("msn", "CL: %s name: %s, Type: %s, MembershipID: %s, NetworkID: %u\n", |
f1936abe1616
Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24514
diff
changeset
|
411 node, passport, type, member_id == NULL ? "(null)" : member_id, nid); |
f1936abe1616
Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24514
diff
changeset
|
412 |
f1936abe1616
Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24514
diff
changeset
|
413 msn_user_set_network(user, nid); |
26909
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
414 msn_user_set_invite_message(user, invite); |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
415 |
28957
452043d200f0
Replace guint membership_id[5] with guint member_id_on_pending_list in
Mark Doliner <mark@kingant.net>
parents:
28668
diff
changeset
|
416 if (list == MSN_LIST_PL && member_id) { |
452043d200f0
Replace guint membership_id[5] with guint member_id_on_pending_list in
Mark Doliner <mark@kingant.net>
parents:
28668
diff
changeset
|
417 user->member_id_on_pending_list = atoi(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
|
418 } |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
419 |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
420 msn_got_lst_user(session, user, 1 << list, 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
|
421 |
90fd0826c6ce
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 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
|
423 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
|
424 g_free(member_id); |
26909
2a95e8bd9b80
Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26906
diff
changeset
|
425 g_free(invite); |
28369
d213c8ad89da
Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28349
diff
changeset
|
426 g_free(display_text); |
20538
90fd0826c6ce
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 } |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
428 |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
429 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
|
430 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
|
431 { |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
432 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
|
433 |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23447
diff
changeset
|
434 if ((type = xmlnode_get_child(service, "Info/Handle/Type"))) { |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
435 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
|
436 |
90fd0826c6ce
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 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
|
438 /* 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
|
439 } 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
|
440 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
|
441 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
|
442 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
|
443 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
444 purple_debug_info("msn", "CL last change: %s\n", lastchange_str); |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
445 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
|
446 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
|
447 |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23447
diff
changeset
|
448 for (membership = xmlnode_get_child(service, |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
449 "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
|
450 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
|
451 |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
452 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
|
453 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
|
454 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
|
455 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
|
456 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
457 purple_debug_info("msn", "CL MemberRole role: %s, list: %d\n", |
23767 | 458 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
|
459 |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23447
diff
changeset
|
460 for (member = xmlnode_get_child(membership, "Members/Member"); |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
461 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
|
462 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
|
463 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
|
464 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
|
465 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
|
466 } 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
|
467 |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
468 } 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
|
469 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
|
470 } |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
471 } |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
472 |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
473 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
|
474 } |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
475 |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
476 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
|
477 } |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
478 |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
479 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
|
480 } |
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
|
481 } |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
482 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
483 /*parse contact list*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
484 static void |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
485 msn_parse_contact_list(MsnSession *session, xmlnode *node) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
486 { |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
487 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
|
488 |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
489 /* 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
|
490 * |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
491 * <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
|
492 * 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
|
493 * |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
494 * 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
|
495 */ |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23447
diff
changeset
|
496 if ((fault = xmlnode_get_child(node, "Body/Fault"))) { |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
497 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
|
498 char *faultstring = xmlnode_get_data(faultnode); |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
499 purple_debug_info("msn", "Retrieving contact list failed: %s\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
|
500 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
|
501 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
|
502 } |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23447
diff
changeset
|
503 if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) { |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
504 char *errorcode = xmlnode_get_data(faultnode); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
505 |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
506 if (g_str_equal(errorcode, "ABDoesNotExist")) { |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
507 msn_create_address_book(session); |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
508 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
|
509 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
|
510 } |
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
|
511 |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
512 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
|
513 } |
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
|
514 |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
515 msn_get_contact_list(session, MSN_PS_INITIAL, NULL); |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
516 } 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
|
517 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
|
518 |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23447
diff
changeset
|
519 for (service = xmlnode_get_child(node, "Body/FindMembershipResponse/" |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
520 "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
|
521 service; service = xmlnode_get_next_twin(service)) { |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
522 msn_parse_each_service(session, service); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
523 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
524 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
525 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
526 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
527 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
|
528 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
|
529 gpointer data) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
530 { |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
531 MsnCallbackState *state = data; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
532 MsnSession *session = state->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
|
533 |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
534 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
|
535 |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
536 if (resp != NULL) { |
30430
351d07aefb09
Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30425
diff
changeset
|
537 #ifdef MSN_PARTIAL_LISTS |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
538 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
|
539 const char *dynamicItemLastChange; |
30430
351d07aefb09
Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30425
diff
changeset
|
540 #endif |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
541 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
542 purple_debug_misc("msn", "Got the contact list!\n"); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
543 |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
544 msn_parse_contact_list(session, resp->xml); |
30430
351d07aefb09
Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30425
diff
changeset
|
545 #ifdef MSN_PARTIAL_LISTS |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
546 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
|
547 "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
|
548 dynamicItemLastChange = purple_account_get_string(session->account, |
30407
f7ba0e314fc8
This code is disabled, but in case we ever want to enable it then
Mark Doliner <mark@kingant.net>
parents:
28957
diff
changeset
|
549 "DynamicItemLastChanged", NULL); |
30430
351d07aefb09
Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30425
diff
changeset
|
550 #endif |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
551 |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
552 if (state->partner_scenario == MSN_PS_INITIAL) { |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
553 #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
|
554 /* 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
|
555 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
|
556 list to detect sync issues */ |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
557 msn_get_address_book(session, MSN_PS_INITIAL, abLastChange, dynamicItemLastChange); |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
558 #else |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
559 msn_get_address_book(session, MSN_PS_INITIAL, NULL, NULL); |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
560 #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
|
561 } |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
562 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
563 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
564 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
565 /*SOAP get contact list*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
566 void |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
567 msn_get_contact_list(MsnSession *session, |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
568 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
|
569 { |
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
|
570 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
|
571 gchar *update_str = NULL; |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
572 MsnCallbackState *state; |
20486
ff4ae9dde291
Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents:
20484
diff
changeset
|
573 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
|
574 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
575 purple_debug_misc("msn", "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
|
576 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
577 if (update_time != NULL) { |
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
578 purple_debug_info("msn", "CL Last update time: %s\n", update_time); |
23735
35f7b7c62995
Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23734
diff
changeset
|
579 update_str = g_strdup_printf(MSN_GET_CONTACT_UPDATE_XML, update_time); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
580 } |
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
|
581 |
23735
35f7b7c62995
Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23734
diff
changeset
|
582 body = g_strdup_printf(MSN_GET_CONTACT_TEMPLATE, partner_scenario_str, |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
583 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
|
584 |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
585 state = msn_callback_state_new(session); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
586 state->partner_scenario = partner_scenario; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
587 state->body = xmlnode_from_str(body, -1); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
588 state->post_action = MSN_GET_CONTACT_SOAP_ACTION; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
589 state->post_url = MSN_GET_CONTACT_POST_URL; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
590 state->cb = msn_get_contact_list_cb; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
591 msn_contact_request(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
|
592 |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
593 g_free(update_str); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
594 g_free(body); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
595 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
596 |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
597 static void |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
598 msn_parse_addressbook_groups(MsnSession *session, xmlnode *node) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
599 { |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
600 xmlnode *group; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
601 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
602 purple_debug_info("msn", "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
|
603 |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
604 for(group = xmlnode_get_child(node, "Group"); group; |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
605 group = xmlnode_get_next_twin(group)){ |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
606 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
|
607 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
|
608 |
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
|
609 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
|
610 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
|
611 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
|
612 group_name = xmlnode_get_data(groupname); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
613 |
24512
9a3ed3b7ac4b
Check for NULL group_id before calling msn_group_new since that function will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24451
diff
changeset
|
614 if (group_id == NULL) { |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
615 /* 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
|
616 g_free(group_name); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
617 continue; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
618 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
619 |
24512
9a3ed3b7ac4b
Check for NULL group_id before calling msn_group_new since that function will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24451
diff
changeset
|
620 msn_group_new(session->userlist, group_id, group_name); |
9a3ed3b7ac4b
Check for NULL group_id before calling msn_group_new since that function will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24451
diff
changeset
|
621 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
622 purple_debug_info("msn", "AB group_id: %s, name: %s\n", group_id, group_name ? group_name : "(null)"); |
24512
9a3ed3b7ac4b
Check for NULL group_id before calling msn_group_new since that function will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24451
diff
changeset
|
623 if ((purple_find_group(group_name)) == NULL) { |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
624 PurpleGroup *g = purple_group_new(group_name); |
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
625 purple_blist_add_group(g, NULL); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
626 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
627 g_free(group_id); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
628 g_free(group_name); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
629 } |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
630 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
631 |
22569
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
632 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
|
633 msn_parse_addressbook_mobile(xmlnode *contactInfo, char **inout_mobile_number) |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
634 { |
22569
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
635 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
|
636 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
|
637 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
|
638 |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
639 *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
|
640 |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
641 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
|
642 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
|
643 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
|
644 |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
645 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
|
646 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
|
647 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
|
648 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
|
649 |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
650 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
|
651 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
|
652 continue; |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
653 |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
654 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
|
655 |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
656 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
|
657 xmlnode *number; |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
658 |
22569
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
659 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
|
660 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
|
661 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
|
662 |
22829
3c98c25b076b
Fix incorrect freeing in my previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22828
diff
changeset
|
663 g_free(mobile_number); |
22569
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
664 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
|
665 |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
666 if (mobile_number && |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
667 (messenger_enabled = xmlnode_get_child(contact_phone, "isMessengerEnabled")) |
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
668 && (is_messenger_enabled = xmlnode_get_data(messenger_enabled)) |
22828
7d3b2c023ad8
This is the way we plug the leaks, plug the leaks, plug the leaks...
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22571
diff
changeset
|
669 && !strcmp(is_messenger_enabled, "true")) |
22569
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
670 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
|
671 |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
672 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
|
673 } |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
674 } |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
675 |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
676 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
|
677 } |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
678 } |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
679 |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
680 *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
|
681 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
|
682 } |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
683 |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
684 static void |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
685 msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
686 { |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
687 xmlnode *contactNode; |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
688 char *passport = NULL, *Name = NULL, *uid = NULL, *type = NULL, *mobile_number = NULL, *alias = NULL; |
22569
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
689 gboolean mobile = FALSE; |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
690 PurpleConnection *pc = purple_account_get_connection(session->account); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
691 |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
692 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
|
693 contactNode = xmlnode_get_next_twin(contactNode)) { |
25395
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
694 xmlnode *contactId, *contactInfo, *contactType, *passportName, *displayName, *guid, *groupIds; |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
695 xmlnode *annotation; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
696 MsnUser *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
|
697 |
30411
cd022bd83677
I think this might be a leak. But probably only if the server changed
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28957
diff
changeset
|
698 g_free(passport); |
cd022bd83677
I think this might be a leak. But probably only if the server changed
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28957
diff
changeset
|
699 g_free(Name); |
cd022bd83677
I think this might be a leak. But probably only if the server changed
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28957
diff
changeset
|
700 g_free(uid); |
cd022bd83677
I think this might be a leak. But probably only if the server changed
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28957
diff
changeset
|
701 g_free(type); |
cd022bd83677
I think this might be a leak. But probably only if the server changed
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28957
diff
changeset
|
702 g_free(mobile_number); |
cd022bd83677
I think this might be a leak. But probably only if the server changed
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28957
diff
changeset
|
703 g_free(alias); |
cd022bd83677
I think this might be a leak. But probably only if the server changed
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28957
diff
changeset
|
704 passport = Name = uid = type = mobile_number = alias = NULL; |
cd022bd83677
I think this might be a leak. But probably only if the server changed
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28957
diff
changeset
|
705 mobile = FALSE; |
cd022bd83677
I think this might be a leak. But probably only if the server changed
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28957
diff
changeset
|
706 |
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
|
707 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
|
708 || !(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
|
709 || !(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
|
710 continue; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
711 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
712 uid = xmlnode_get_data(contactId); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
713 type = xmlnode_get_data(contactType); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
714 |
30990
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
715 /* Find out our settings */ |
28668
23f6f80f45ed
Due to a server change, the friendly name on MSN was being changed to the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28419
diff
changeset
|
716 if (type && !strcmp(type, "Me")) { |
30990
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
717 /* setup the Display Name */ |
28668
23f6f80f45ed
Due to a server change, the friendly name on MSN was being changed to the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28419
diff
changeset
|
718 if (purple_connection_get_display_name(pc) == NULL) { |
23f6f80f45ed
Due to a server change, the friendly name on MSN was being changed to the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28419
diff
changeset
|
719 char *friendly = NULL; |
23f6f80f45ed
Due to a server change, the friendly name on MSN was being changed to the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28419
diff
changeset
|
720 if ((displayName = xmlnode_get_child(contactInfo, "displayName"))) |
23f6f80f45ed
Due to a server change, the friendly name on MSN was being changed to the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28419
diff
changeset
|
721 friendly = xmlnode_get_data(displayName); |
23f6f80f45ed
Due to a server change, the friendly name on MSN was being changed to the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28419
diff
changeset
|
722 purple_connection_set_display_name(pc, |
23f6f80f45ed
Due to a server change, the friendly name on MSN was being changed to the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28419
diff
changeset
|
723 friendly ? purple_url_decode(friendly) : NULL); |
23f6f80f45ed
Due to a server change, the friendly name on MSN was being changed to the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28419
diff
changeset
|
724 g_free(friendly); |
23f6f80f45ed
Due to a server change, the friendly name on MSN was being changed to the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28419
diff
changeset
|
725 } |
30990
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
726 |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
727 for (annotation = xmlnode_get_child(contactInfo, "annotations/Annotation"); |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
728 annotation; |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
729 annotation = xmlnode_get_next_twin(annotation)) { |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
730 char *name, *value; |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
731 name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
732 value = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
733 if (!strcmp(name, "MSN.IM.MPOP")) { |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
734 if (!value || atoi(value) != 0) |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
735 purple_account_set_bool(session->account, "mpop", TRUE); |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
736 else |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
737 purple_account_set_bool(session->account, "mpop", FALSE); |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
738 } |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
739 g_free(name); |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
740 g_free(value); |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
741 } |
05b3fa3725a1
Read the MPOP setting from the AB.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30986
diff
changeset
|
742 |
20403
599b5a4aebab
The last of the merge fix-ups.
Richard Laager <rlaager@wiktel.com>
parents:
20401
diff
changeset
|
743 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
|
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 |
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 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
|
747 if (passportName == NULL) { |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
748 xmlnode *emailsNode, *contactEmailNode, *emailNode; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
749 xmlnode *messengerEnabledNode; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
750 char *msnEnabled; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
751 |
25395
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
752 /*TODO: add it to the non-instant Messenger group and recognize as email Membership*/ |
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
753 /* Yahoo/Federated 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
|
754 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
|
755 if (emailsNode == NULL) { |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
756 /*TODO: need to support the Mobile type*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
757 continue; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
758 } |
25582
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
759 for (contactEmailNode = xmlnode_get_child(emailsNode, "ContactEmail"); |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
760 contactEmailNode; |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
761 contactEmailNode = xmlnode_get_next_twin(contactEmailNode)) { |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
762 if ((messengerEnabledNode = xmlnode_get_child(contactEmailNode, "isMessengerEnabled"))) { |
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
|
763 |
25582
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
764 msnEnabled = xmlnode_get_data(messengerEnabledNode); |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
765 |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
766 if (msnEnabled && !strcmp(msnEnabled, "true")) { |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
767 if ((emailNode = xmlnode_get_child(contactEmailNode, "email"))) |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
768 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
|
769 |
25582
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
770 /* Messenger enabled, Get the Passport*/ |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
771 purple_debug_info("msn", "AB Yahoo/Federated User %s\n", passport ? passport : "(null)"); |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
772 g_free(msnEnabled); |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
773 break; |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
774 } |
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
|
775 |
20495
7f5564ebde7f
Fix some memory leaks. Free xmlnodes properly using xmlnode_free instead of
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20494
diff
changeset
|
776 g_free(msnEnabled); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
777 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
778 } |
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
|
779 } else { |
25395
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
780 xmlnode *messenger_user; |
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
781 /* ignore non-messenger contacts */ |
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
782 if ((messenger_user = xmlnode_get_child(contactInfo, "isMessengerUser"))) { |
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
783 char *is_messenger_user = xmlnode_get_data(messenger_user); |
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
784 |
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
785 if (is_messenger_user && !strcmp(is_messenger_user, "false")) { |
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
786 g_free(is_messenger_user); |
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
787 continue; |
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
788 } |
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
789 |
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
790 g_free(is_messenger_user); |
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
791 } |
89670ae028bd
The MSN AddressBook can contain contacts with global isMessengerUser=false,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25387
diff
changeset
|
792 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
793 passport = xmlnode_get_data(passportName); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
794 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
795 |
26906
6db0d455813b
This line is redundant.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26265
diff
changeset
|
796 /* Couldn't find anything */ |
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
|
797 if (passport == NULL) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
798 continue; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
799 |
28418
c3f79073c9be
The MSN servers are a bit more strict about what's allowed in emails than
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28369
diff
changeset
|
800 if (!msn_email_is_valid(passport)) |
27845
975fc5f64438
Ignore buddies with invalid emails in the membership list or address book,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27488
diff
changeset
|
801 continue; |
975fc5f64438
Ignore buddies with invalid emails in the membership list or address book,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27488
diff
changeset
|
802 |
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
|
803 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
|
804 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
|
805 else |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
806 Name = g_strdup(passport); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
807 |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
808 for (annotation = xmlnode_get_child(contactInfo, "annotations/Annotation"); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
809 annotation; annotation = xmlnode_get_next_twin(annotation)) { |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
810 char *name; |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
811 name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
812 if (!strcmp(name, "AB.NickName")) |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
813 alias = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); |
24514
e88f30b437ad
Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24513
diff
changeset
|
814 else if (!strcmp(name, "MSN.IM.HasSharedFolder")) |
e88f30b437ad
Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24513
diff
changeset
|
815 ; /* Do nothing yet... */ |
e88f30b437ad
Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24513
diff
changeset
|
816 else if (!strcmp(name, "AB.Spouse")) |
e88f30b437ad
Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24513
diff
changeset
|
817 ; /* Do nothing yet... */ |
e88f30b437ad
Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24513
diff
changeset
|
818 else if (!strcmp(name, "MSN.Mobile.ContactId")) |
e88f30b437ad
Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24513
diff
changeset
|
819 ; /* Do nothing yet... */ |
e88f30b437ad
Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24513
diff
changeset
|
820 else |
e88f30b437ad
Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24513
diff
changeset
|
821 purple_debug_info("msn", |
e88f30b437ad
Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24513
diff
changeset
|
822 "Unknown AB contact annotation: %s\n", name); |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
823 g_free(name); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
824 } |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
825 |
22569
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
826 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
|
827 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
828 purple_debug_misc("msn", "AB passport:{%s} uid:{%s} display:{%s} alias: {%s} mobile:{%s} mobile number:{%s}\n", |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
829 passport, uid ? uid : "(null)", Name ? Name : "(null)", alias ? alias : "(null)", |
22569
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
830 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
|
831 |
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
|
832 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
|
833 msn_user_set_uid(user, uid); |
22569
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
834 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
|
835 |
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
|
836 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
|
837 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
|
838 for (guid = xmlnode_get_child(groupIds, "guid"); guid; |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
839 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
|
840 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
|
841 msn_user_add_group_id(user, group_id); |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
842 purple_debug_misc("msn", "AB 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
|
843 g_free(group_id); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
844 } |
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
|
845 } 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
|
846 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
|
847 /*not in any group,Then set default group*/ |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
848 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
|
849 } |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
850 |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
851 msn_got_lst_user(session, user, MSN_LIST_FL_OP, NULL); |
22569
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
852 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
853 if (mobile && user) |
22569
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
854 { |
207f51e16b50
another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@hxbc.us>
parents:
21833
diff
changeset
|
855 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
|
856 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
|
857 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
|
858 } |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
859 if (alias) |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
860 purple_serv_got_private_alias(pc, passport, alias); |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
861 } |
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
|
862 |
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
|
863 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
|
864 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
|
865 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
|
866 g_free(type); |
22832
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22829
diff
changeset
|
867 g_free(mobile_number); |
30411
cd022bd83677
I think this might be a leak. But probably only if the server changed
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28957
diff
changeset
|
868 g_free(alias); |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
869 } |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
870 |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
871 static gboolean |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
872 msn_parse_addressbook(MsnSession *session, xmlnode *node) |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
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 xmlnode *result; |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
875 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
|
876 xmlnode *contacts; |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
877 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
|
878 xmlnode *fault; |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
879 |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23447
diff
changeset
|
880 if ((fault = xmlnode_get_child(node, "Body/Fault"))) { |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
881 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
|
882 |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
883 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
|
884 gchar *faultstring = xmlnode_get_data(faultnode); |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
885 purple_debug_info("msn", "AB Faultstring: %s\n", faultstring); |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
886 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
|
887 } |
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
|
888 |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23447
diff
changeset
|
889 if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) { |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
890 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
|
891 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
892 purple_debug_info("msn", "AB Error Code: %s\n", errorcode); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
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 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
|
895 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
|
896 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
|
897 } |
22828
7d3b2c023ad8
This is the way we plug the leaks, plug the leaks, plug the leaks...
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22571
diff
changeset
|
898 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
|
899 } |
90fd0826c6ce
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 |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
901 return FALSE; |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
902 } |
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
|
903 |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23447
diff
changeset
|
904 result = xmlnode_get_child(node, "Body/ABFindAllResponse/ABFindAllResult"); |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
905 if (result == NULL) { |
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
906 purple_debug_misc("msn", "Received no address book update\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
|
907 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
|
908 } |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
909 |
20538
90fd0826c6ce
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 /* 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
|
911 if they are really there, and update msnpiki */ |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
912 /*Process Group List*/ |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
913 groups = xmlnode_get_child(result, "groups"); |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
914 if (groups != NULL) { |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
915 msn_parse_addressbook_groups(session, groups); |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
916 } |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
917 |
30408
9a203ff977f6
Improve these comments? I was having a hard time trying to figure out what
Mark Doliner <mark@kingant.net>
parents:
30407
diff
changeset
|
918 /* Add an "Other Contacts" group for buddies who aren't in a group */ |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
919 msn_group_new(session->userlist, MSN_INDIVIDUALS_GROUP_ID, |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
920 MSN_INDIVIDUALS_GROUP_NAME); |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
921 purple_debug_misc("msn", "AB group_id:%s name:%s\n", |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
922 MSN_INDIVIDUALS_GROUP_ID, MSN_INDIVIDUALS_GROUP_NAME); |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
923 if ((purple_find_group(MSN_INDIVIDUALS_GROUP_NAME)) == NULL){ |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
924 PurpleGroup *g = purple_group_new(MSN_INDIVIDUALS_GROUP_NAME); |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
925 purple_blist_add_group(g, NULL); |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
926 } |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
927 |
30408
9a203ff977f6
Improve these comments? I was having a hard time trying to figure out what
Mark Doliner <mark@kingant.net>
parents:
30407
diff
changeset
|
928 /* Add a "Non-IM Contacts" group */ |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
929 msn_group_new(session->userlist, MSN_NON_IM_GROUP_ID, MSN_NON_IM_GROUP_NAME); |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
930 purple_debug_misc("msn", "AB group_id:%s name:%s\n", MSN_NON_IM_GROUP_ID, MSN_NON_IM_GROUP_NAME); |
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
931 if ((purple_find_group(MSN_NON_IM_GROUP_NAME)) == NULL) { |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
932 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
|
933 purple_blist_add_group(g, NULL); |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
934 } |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
935 |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
936 /*Process contact List*/ |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
937 purple_debug_info("msn", "Process contact list...\n"); |
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
938 contacts = xmlnode_get_child(result, "contacts"); |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
939 if (contacts != NULL) { |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
940 msn_parse_addressbook_contacts(session, contacts); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
941 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
942 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
943 abNode = xmlnode_get_child(result, "ab"); |
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
944 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
|
945 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
|
946 char *tmp = NULL; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
947 |
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
|
948 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
|
949 tmp = xmlnode_get_data(node2); |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
950 purple_debug_info("msn", "AB 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
|
951 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
|
952 |
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
|
953 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
|
954 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
|
955 tmp = xmlnode_get_data(node2); |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
956 purple_debug_info("msn", "AB DynamicItemLastChanged :{%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
|
957 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
|
958 g_free(tmp); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
959 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
960 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
961 return TRUE; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
962 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
963 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
964 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
|
965 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
|
966 { |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
967 MsnCallbackState *state = data; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
968 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
|
969 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
970 g_return_if_fail(session != NULL); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
971 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
972 purple_debug_misc("msn", "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
|
973 |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
974 if (msn_parse_addressbook(session, resp->xml)) { |
23529
4162ac08c775
On MSN, always send the privacy settings and contact list after parsing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23521
diff
changeset
|
975 msn_send_privacy(session->account->gc); |
4162ac08c775
On MSN, always send the privacy settings and contact list after parsing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23521
diff
changeset
|
976 msn_notification_dump_contact(session); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
977 } 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
|
978 /* 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
|
979 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
|
980 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
|
981 */ |
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
982 /* |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
983 msn_get_address_book(session, NULL, NULL); |
20477
9a2a4a0c0003
Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents:
20471
diff
changeset
|
984 */ |
25491
c729cdeb88c8
Set an error if you're unable to connect to the contact server, or are not
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25458
diff
changeset
|
985 msn_session_set_error(session, MSN_ERROR_BAD_BLIST, NULL); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
986 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
987 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
988 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
989 /*get the address book*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
990 void |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
991 msn_get_address_book(MsnSession *session, |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
992 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
|
993 const char *dynamicItemLastChange) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
994 { |
21109
e64e6fbd1351
merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
diff
changeset
|
995 char *body, *update_str = NULL; |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
996 MsnCallbackState *state; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
997 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
998 purple_debug_misc("msn", "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
|
999 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1000 /*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
|
1001 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
|
1002 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
|
1003 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
|
1004 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
|
1005 |
23735
35f7b7c62995
Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23734
diff
changeset
|
1006 body = g_strdup_printf(MSN_GET_ADDRESS_TEMPLATE, |
23447
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23446
diff
changeset
|
1007 MsnSoapPartnerScenarioText[partner_scenario], |
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23446
diff
changeset
|
1008 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
|
1009 |
25396
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
1010 state = msn_callback_state_new(session); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
1011 state->body = xmlnode_from_str(body, -1); |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
1012 state->post_action = MSN_GET_ADDRESS_SOAP_ACTION; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
1013 state->post_url = MSN_ADDRESS_BOOK_POST_URL; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
1014 state->cb = msn_get_address_cb; |
06a802d32d71
I incorrectly assumed that the FindMembership and ABFindAll SOAP requests
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25395
diff
changeset
|
1015 msn_contact_request(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
|
1016 |
21109
e64e6fbd1351
merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
diff
changeset
|
1017 g_free(update_str); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1018 g_free(body); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1019 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1020 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1021 /*************************************************************** |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1022 * Contact Operations |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1023 ***************************************************************/ |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1024 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1025 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
|
1026 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
|
1027 gpointer data) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1028 { |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1029 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
|
1030 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
|
1031 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1032 MsnUserList *userlist; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1033 MsnUser *user; |
24222
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1034 xmlnode *guid; |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1035 |
24517
2b4c909b40c4
Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24516
diff
changeset
|
1036 xmlnode *fault; |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1037 |
24522
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1038 g_return_if_fail(session != NULL); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1039 userlist = session->userlist; |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1040 |
24517
2b4c909b40c4
Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24516
diff
changeset
|
1041 fault = xmlnode_get_child(resp->xml, "Body/Fault"); |
2b4c909b40c4
Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24516
diff
changeset
|
1042 if (fault != NULL) { |
2b4c909b40c4
Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24516
diff
changeset
|
1043 char *errorcode = xmlnode_get_data(xmlnode_get_child(fault, "detail/errorcode")); |
2b4c909b40c4
Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24516
diff
changeset
|
1044 if (errorcode && !strcmp(errorcode, "EmailDomainIsFederated")) { |
2b4c909b40c4
Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24516
diff
changeset
|
1045 /* Do something special! */ |
2b4c909b40c4
Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24516
diff
changeset
|
1046 purple_debug_error("msn", "Contact is from a federated domain, but don't know what to do yet!\n"); |
24522
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1047 |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1048 } else if (errorcode && !strcmp(errorcode, "InvalidPassportUser")) { |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1049 PurpleBuddy *buddy = purple_find_buddy(session->account, state->who); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1050 char *str = g_strdup_printf(_("Unable to add \"%s\"."), state->who); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1051 purple_notify_error(state->session, _("Buddy Add error"), str, |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1052 _("The username specified does not exist.")); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1053 g_free(str); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1054 msn_userlist_rem_buddy(userlist, state->who); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1055 if (buddy != NULL) |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1056 purple_blist_remove_buddy(buddy); |
24517
2b4c909b40c4
Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24516
diff
changeset
|
1057 |
24522
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1058 } else { |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1059 /* We don't know how to respond to this faultcode, so log it */ |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1060 char *fault_str = xmlnode_to_str(fault, NULL); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1061 if (fault_str != NULL) { |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1062 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1063 msn_contact_operation_str(state->action), fault_str); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1064 g_free(fault_str); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1065 } |
24517
2b4c909b40c4
Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24516
diff
changeset
|
1066 } |
24522
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1067 return; |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1068 } |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1069 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1070 purple_debug_info("msn", "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
|
1071 |
24525
98afd76647bd
Updates for federated/Yahoo buddies:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24524
diff
changeset
|
1072 msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL); |
98afd76647bd
Updates for federated/Yahoo buddies:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24524
diff
changeset
|
1073 msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL); |
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
|
1074 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1075 user = msn_userlist_find_add_user(userlist, state->who, state->who); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1076 msn_user_add_group_id(user, state->guid); |
24222
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1077 |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1078 guid = xmlnode_get_child(resp->xml, |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1079 "Body/ABContactAddResponse/ABContactAddResult/guid"); |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1080 if (guid != NULL) { |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1081 char *uid = xmlnode_get_data(guid); |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1082 msn_user_set_uid(user, uid); |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1083 purple_debug_info("msn", "Set %s guid to %s.\n", state->who, uid); |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1084 g_free(uid); |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1085 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1086 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1087 |
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
|
1088 /* 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
|
1089 void |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1090 msn_add_contact(MsnSession *session, MsnCallbackState *state, const char *passport) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1091 { |
24524
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1092 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
|
1093 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
|
1094 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
|
1095 |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1096 #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
|
1097 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
|
1098 |
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
|
1099 |
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
|
1100 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
|
1101 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
|
1102 } 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
|
1103 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
|
1104 } |
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
|
1105 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
|
1106 #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
|
1107 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1108 purple_debug_info("msn", "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
|
1109 |
24524
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1110 user = msn_userlist_find_user(session->userlist, passport); |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1111 if (user == NULL) { |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1112 purple_debug_warning("msn", "Unable to retrieve user %s from the userlist!\n", passport); |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1113 return; /* guess this never happened! */ |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1114 } |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1115 |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1116 if (user->networkid != MSN_NETWORK_PASSPORT) { |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1117 contact_xml = g_strdup_printf(MSN_CONTACT_EMAIL_XML, |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1118 user->networkid == MSN_NETWORK_YAHOO ? |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1119 "Messenger2" : |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1120 "Messenger3", |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1121 passport, 0); |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1122 } else { |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1123 contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport); |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1124 } |
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
|
1125 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
|
1126 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1127 state->body = xmlnode_from_str(body, -1); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1128 state->post_action = MSN_CONTACT_ADD_SOAP_ACTION; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1129 state->post_url = MSN_ADDRESS_BOOK_POST_URL; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1130 state->cb = msn_add_contact_read_cb; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1131 msn_contact_request(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
|
1132 |
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
|
1133 g_free(contact_xml); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1134 g_free(body); |
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 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1137 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
|
1138 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
|
1139 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
|
1140 { |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1141 MsnCallbackState *state = data; |
24522
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1142 MsnSession *session = state->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
|
1143 MsnUserList *userlist; |
24520
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1144 xmlnode *fault; |
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
|
1145 |
24522
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1146 g_return_if_fail(session != NULL); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1147 userlist = session->userlist; |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1148 |
24520
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1149 fault = xmlnode_get_child(resp->xml, "Body/Fault"); |
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1150 if (fault != NULL) { |
24522
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1151 char *errorcode = xmlnode_get_data(xmlnode_get_child(fault, "detail/errorcode")); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1152 if (errorcode && !strcmp(errorcode, "EmailDomainIsFederated")) { |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1153 /* Do something special! */ |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1154 purple_debug_error("msn", "Contact is from a federated domain, but don't know what to do yet!\n"); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1155 |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1156 } else if (errorcode && !strcmp(errorcode, "InvalidPassportUser")) { |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1157 PurpleBuddy *buddy = purple_find_buddy(session->account, state->who); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1158 char *str = g_strdup_printf(_("Unable to add \"%s\"."), state->who); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1159 purple_notify_error(session, _("Buddy Add error"), str, |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1160 _("The username specified does not exist.")); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1161 g_free(str); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1162 msn_userlist_rem_buddy(userlist, state->who); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1163 if (buddy != NULL) |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1164 purple_blist_remove_buddy(buddy); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1165 |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1166 } else { |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1167 /* We don't know how to respond to this faultcode, so log it */ |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1168 char *fault_str = xmlnode_to_str(fault, NULL); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1169 if (fault_str != NULL) { |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1170 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1171 msn_contact_operation_str(state->action), fault_str); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1172 g_free(fault_str); |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1173 } |
692c34bf98d8
Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24521
diff
changeset
|
1174 } |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1175 return; |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1176 } |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1177 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1178 if (msn_userlist_add_buddy_to_group(userlist, state->who, |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1179 state->new_group_name)) { |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1180 purple_debug_info("msn", "Contact %s added to group %s successfully!\n", state->who, state->new_group_name); |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1181 } else { |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1182 purple_debug_info("msn", "Contact %s added to group %s successfully on server, but failed in the local list\n", state->who, state->new_group_name); |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1183 } |
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
|
1184 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1185 if (state->action & MSN_ADD_BUDDY) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1186 MsnUser *user = msn_userlist_find_user(userlist, state->who); |
24222
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1187 xmlnode *guid = xmlnode_get_child(resp->xml, |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1188 "Body/ABGroupContactAddResponse/ABGroupContactAddResult/guid"); |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1189 |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1190 if (guid != NULL) { |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1191 char *uid = xmlnode_get_data(guid); |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1192 msn_user_set_uid(user, uid); |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1193 purple_debug_info("msn", "Set %s guid to %s.\n", state->who, uid); |
7ec9a1ae93d7
Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24206
diff
changeset
|
1194 g_free(uid); |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1195 } |
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
|
1196 |
24525
98afd76647bd
Updates for federated/Yahoo buddies:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24524
diff
changeset
|
1197 msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL); |
98afd76647bd
Updates for federated/Yahoo buddies:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24524
diff
changeset
|
1198 msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL); |
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
|
1199 |
30732
767fd05c434d
Oops, this one needed to be changed too.
masca@cpw.pidgin.im
parents:
28957
diff
changeset
|
1200 if (msn_user_is_in_list(user, MSN_LIST_PL)) { |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1201 msn_del_contact_from_list(state->session, NULL, state->who, MSN_LIST_PL); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1202 return; |
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
|
1203 } |
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
|
1204 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1205 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1206 if (state->action & MSN_MOVE_BUDDY) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1207 msn_del_contact_from_group(state->session, state->who, state->old_group_name); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1208 } |
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
|
1209 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1210 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1211 void |
23464
1ac5faa72c8d
explicit merge of '9d90ebdb7e38fdd77bb504bc3302a083616360d9'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
1212 msn_add_contact_to_group(MsnSession *session, MsnCallbackState *state, |
20481
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1213 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
|
1214 { |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1215 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
|
1216 MsnUser *user; |
27488
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1217 gchar *body = NULL, *contact_xml, *invite; |
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
|
1218 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1219 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
|
1220 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
|
1221 |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1222 g_return_if_fail(session != NULL); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1223 |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1224 userlist = session->userlist; |
20484
98613886411a
Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents:
20481
diff
changeset
|
1225 |
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
|
1226 if (!strcmp(groupId, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(groupId, MSN_NON_IM_GROUP_ID)) { |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1227 |
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
|
1228 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
|
1229 |
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
|
1230 if (state->action & MSN_ADD_BUDDY) { |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1231 msn_add_contact(session, state, passport); |
20484
98613886411a
Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents:
20481
diff
changeset
|
1232 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
|
1233 } |
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
|
1234 |
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
|
1235 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
|
1236 msn_user_add_group_id(user, groupId); |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1237 msn_del_contact_from_group(session, passport, state->old_group_name); |
20484
98613886411a
Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents:
20481
diff
changeset
|
1238 } |
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
|
1239 |
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
|
1240 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
|
1241 } |
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
|
1242 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1243 purple_debug_info("msn", "Adding user %s to group %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
|
1244 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
|
1245 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1246 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
|
1247 if (user == NULL) { |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1248 purple_debug_warning("msn", "Unable to retrieve user %s from the userlist!\n", passport); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1249 msn_callback_state_free(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
|
1250 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
|
1251 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1252 |
24524
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1253 if (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
|
1254 contact_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid); |
24524
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1255 } else if (user->networkid != MSN_NETWORK_PASSPORT) { |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1256 contact_xml = g_strdup_printf(MSN_CONTACT_EMAIL_XML, |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1257 user->networkid == MSN_NETWORK_YAHOO ? |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1258 "Messenger2" : |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1259 "Messenger3", |
2b6847646817
Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24522
diff
changeset
|
1260 passport, 0); |
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
|
1261 } 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
|
1262 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
|
1263 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1264 |
27488
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1265 if (user->invite_message) { |
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1266 char *tmp; |
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1267 body = g_markup_escape_text(user->invite_message, -1); |
28419
9aa7f4801549
The connection display name can be NULL, so make sure we don't try to use
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28418
diff
changeset
|
1268 |
9aa7f4801549
The connection display name can be NULL, so make sure we don't try to use
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28418
diff
changeset
|
1269 /* Ignore the cast, we treat it as const anyway. */ |
9aa7f4801549
The connection display name can be NULL, so make sure we don't try to use
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28418
diff
changeset
|
1270 tmp = (char *)purple_connection_get_display_name(session->account->gc); |
9aa7f4801549
The connection display name can be NULL, so make sure we don't try to use
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28418
diff
changeset
|
1271 tmp = tmp ? g_markup_escape_text(tmp, -1) : g_strdup(""); |
9aa7f4801549
The connection display name can be NULL, so make sure we don't try to use
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28418
diff
changeset
|
1272 |
27488
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1273 invite = g_strdup_printf(MSN_CONTACT_INVITE_MESSAGE_XML, body, tmp); |
28419
9aa7f4801549
The connection display name can be NULL, so make sure we don't try to use
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28418
diff
changeset
|
1274 |
27488
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1275 g_free(body); |
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1276 g_free(tmp); |
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1277 |
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1278 /* We can free this now */ |
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1279 g_free(user->invite_message); |
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1280 user->invite_message = NULL; |
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1281 |
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1282 } else { |
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1283 invite = g_strdup(""); |
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1284 } |
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1285 |
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1286 body = g_strdup_printf(MSN_ADD_CONTACT_GROUP_TEMPLATE, groupId, contact_xml, invite); |
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
|
1287 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1288 state->body = xmlnode_from_str(body, -1); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1289 state->post_action = MSN_ADD_CONTACT_GROUP_SOAP_ACTION; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1290 state->post_url = MSN_ADDRESS_BOOK_POST_URL; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1291 state->cb = msn_add_contact_to_group_read_cb; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1292 msn_contact_request(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
|
1293 |
27488
3698c7f4d803
On MSN, pop up an "invite message" request similar to oscar, and send that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
1294 g_free(invite); |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1295 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
|
1296 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
|
1297 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1298 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1299 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
|
1300 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
|
1301 gpointer data) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1302 { |
21109
e64e6fbd1351
merge_into_workspace of c0e79d15a4fe4c5b0129fcae5060754b25f72a56 and
Ka-Hing Cheung <khc@hxbc.us>
diff
changeset
|
1303 MsnCallbackState *state = data; |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1304 MsnUserList *userlist = state->session->userlist; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1305 MsnUser *user = msn_userlist_find_user_with_id(userlist, state->uid); |
24520
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1306 xmlnode *fault; |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1307 |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1308 /* We don't know how to respond to this faultcode, so log it */ |
24520
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1309 fault = xmlnode_get_child(resp->xml, "Body/Fault"); |
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1310 if (fault != NULL) { |
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1311 char *fault_str = xmlnode_to_str(fault, NULL); |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1312 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1313 msn_contact_operation_str(state->action), fault_str); |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1314 g_free(fault_str); |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1315 return; |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1316 } |
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
|
1317 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1318 purple_debug_info("msn", "Delete contact successful\n"); |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1319 |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1320 if (user != NULL) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1321 msn_userlist_remove_user(userlist, user); |
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
|
1322 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1323 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1324 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1325 /*delete a Contact*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1326 void |
24206
f54e7398f733
Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23735
diff
changeset
|
1327 msn_delete_contact(MsnSession *session, MsnUser *user) |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
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 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
|
1330 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
|
1331 MsnCallbackState *state; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1332 |
24206
f54e7398f733
Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23735
diff
changeset
|
1333 if (user->uid != NULL) { |
f54e7398f733
Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23735
diff
changeset
|
1334 contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid); |
f54e7398f733
Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23735
diff
changeset
|
1335 purple_debug_info("msn", "Deleting contact with contactId: %s\n", user->uid); |
f54e7398f733
Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23735
diff
changeset
|
1336 } else { |
24519
3915331092b2
Deleting a contact without a ContactId doesn't work, so don't bother the server
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24518
diff
changeset
|
1337 purple_debug_info("msn", "Unable to delete contact %s without a ContactId\n", user->passport); |
3915331092b2
Deleting a contact without a ContactId doesn't work, so don't bother the server
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24518
diff
changeset
|
1338 return; |
24206
f54e7398f733
Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23735
diff
changeset
|
1339 } |
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
|
1340 |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1341 state = msn_callback_state_new(session); |
24206
f54e7398f733
Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23735
diff
changeset
|
1342 msn_callback_state_set_uid(state, user->uid); |
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
|
1343 |
20481
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1344 /* 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
|
1345 body = g_strdup_printf(MSN_DEL_CONTACT_TEMPLATE, contact_id_xml); |
23447
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23446
diff
changeset
|
1346 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1347 state->body = xmlnode_from_str(body, -1); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1348 state->post_action = MSN_CONTACT_DEL_SOAP_ACTION; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1349 state->post_url = MSN_ADDRESS_BOOK_POST_URL; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1350 state->cb = msn_delete_contact_read_cb; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1351 msn_contact_request(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
|
1352 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and 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 g_free(contact_id_xml); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1354 g_free(body); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1355 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1356 |
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
|
1357 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
|
1358 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
|
1359 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
|
1360 { |
20538
90fd0826c6ce
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 MsnCallbackState *state = data; |
24520
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1362 xmlnode *fault; |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1363 |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1364 /* We don't know how to respond to this faultcode, so log it */ |
24520
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1365 fault = xmlnode_get_child(resp->xml, "Body/Fault"); |
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1366 if (fault != NULL) { |
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1367 char *fault_str = xmlnode_to_str(fault, NULL); |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1368 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1369 msn_contact_operation_str(state->action), fault_str); |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1370 g_free(fault_str); |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1371 return; |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1372 } |
20501
f6dff814d95f
cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents:
20495
diff
changeset
|
1373 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1374 if (msn_userlist_rem_buddy_from_group(state->session->userlist, |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1375 state->who, state->old_group_name)) { |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1376 purple_debug_info("msn", "Contact %s deleted successfully from group %s\n", state->who, state->old_group_name); |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1377 } else { |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1378 purple_debug_info("msn", "Contact %s deleted successfully from group %s in the server, but failed in the local list\n", state->who, state->old_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
|
1379 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1380 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1381 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1382 void |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1383 msn_del_contact_from_group(MsnSession *session, const char *passport, const char *group_name) |
20481
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
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 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
|
1386 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
|
1387 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
|
1388 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
|
1389 const gchar *groupId; |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1390 |
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
|
1391 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
|
1392 g_return_if_fail(group_name != NULL); |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1393 g_return_if_fail(session != NULL); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1394 |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1395 userlist = session->userlist; |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1396 |
20481
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1397 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
|
1398 if (groupId != NULL) { |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1399 purple_debug_info("msn", "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
|
1400 } else { |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1401 purple_debug_warning("msn", "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
|
1402 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
|
1403 } |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1404 |
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
|
1405 user = msn_userlist_find_user(userlist, passport); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1406 |
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
|
1407 if (user == NULL) { |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1408 purple_debug_warning("msn", "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
|
1409 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
|
1410 } |
20484
98613886411a
Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents:
20481
diff
changeset
|
1411 |
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
|
1412 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
|
1413 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
|
1414 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
|
1415 } |
98613886411a
Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents:
20481
diff
changeset
|
1416 |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1417 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
|
1418 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
|
1419 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
|
1420 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
|
1421 |
24206
f54e7398f733
Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23735
diff
changeset
|
1422 if (user->uid != NULL) |
f54e7398f733
Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23735
diff
changeset
|
1423 contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid); |
f54e7398f733
Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23735
diff
changeset
|
1424 else |
f54e7398f733
Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23735
diff
changeset
|
1425 contact_id_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
|
1426 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
|
1427 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1428 state->body = xmlnode_from_str(body, -1); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1429 state->post_action = MSN_CONTACT_DEL_GROUP_SOAP_ACTION; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1430 state->post_url = MSN_ADDRESS_BOOK_POST_URL; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1431 state->cb = msn_del_contact_from_group_read_cb; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1432 msn_contact_request(state); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1433 |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1434 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
|
1435 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
|
1436 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and 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 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and 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 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1439 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
|
1440 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
|
1441 gpointer data) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1442 { |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1443 MsnCallbackState *state = (MsnCallbackState *)data; |
24520
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1444 xmlnode *fault; |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1445 |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1446 /* We don't know how to respond to this faultcode, so log it */ |
24520
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1447 fault = xmlnode_get_child(resp->xml, "Body/Fault"); |
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1448 if (fault != NULL) { |
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1449 char *fault_str = xmlnode_to_str(fault, NULL); |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1450 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1451 msn_contact_operation_str(state->action), fault_str); |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1452 g_free(fault_str); |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1453 return; |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1454 } |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1455 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1456 purple_debug_info("msn", "Contact updated successfully\n"); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1457 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1458 |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1459 /* Update a contact's info */ |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1460 void |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1461 msn_update_contact(MsnSession *session, const char *passport, MsnContactUpdateType type, const char* value) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1462 { |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1463 MsnCallbackState *state; |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1464 xmlnode *contact; |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1465 xmlnode *contact_info; |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1466 xmlnode *changes; |
28318
534ff54568eb
Don't attempt to change the alias on the server if the contact is not (yet)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28317
diff
changeset
|
1467 MsnUser *user = NULL; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1468 |
28317
97856e3452d0
Don't crash is passport is NULL on Windows. I don't know why this would
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28070
diff
changeset
|
1469 purple_debug_info("msn", "Update contact information for %s with new %s: %s\n", |
97856e3452d0
Don't crash is passport is NULL on Windows. I don't know why this would
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28070
diff
changeset
|
1470 passport ? passport : "(null)", |
25387
b4b76f6a2b27
Don't crash on Windows when removing an alias for an MSN buddy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24722
diff
changeset
|
1471 type == MSN_UPDATE_DISPLAY ? "display name" : "alias", |
b4b76f6a2b27
Don't crash on Windows when removing an alias for an MSN buddy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24722
diff
changeset
|
1472 value ? value : "(null)"); |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1473 g_return_if_fail(passport != NULL); |
28317
97856e3452d0
Don't crash is passport is NULL on Windows. I don't know why this would
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28070
diff
changeset
|
1474 |
28318
534ff54568eb
Don't attempt to change the alias on the server if the contact is not (yet)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28317
diff
changeset
|
1475 if (strcmp(passport, "Me") != 0) { |
534ff54568eb
Don't attempt to change the alias on the server if the contact is not (yet)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28317
diff
changeset
|
1476 user = msn_userlist_find_user(session->userlist, passport); |
534ff54568eb
Don't attempt to change the alias on the server if the contact is not (yet)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28317
diff
changeset
|
1477 if (!user) |
534ff54568eb
Don't attempt to change the alias on the server if the contact is not (yet)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28317
diff
changeset
|
1478 return; |
534ff54568eb
Don't attempt to change the alias on the server if the contact is not (yet)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28317
diff
changeset
|
1479 } |
534ff54568eb
Don't attempt to change the alias on the server if the contact is not (yet)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28317
diff
changeset
|
1480 |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1481 contact_info = xmlnode_new("contactInfo"); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1482 changes = xmlnode_new("propertiesChanged"); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1483 |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1484 switch (type) { |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1485 xmlnode *annotations; |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1486 xmlnode *display; |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1487 xmlnode *a, *n, *v; |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1488 case MSN_UPDATE_DISPLAY: |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1489 display = xmlnode_new_child(contact_info, "displayName"); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1490 xmlnode_insert_data(display, value, -1); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1491 xmlnode_insert_data(changes, "DisplayName", -1); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1492 break; |
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
|
1493 |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1494 case MSN_UPDATE_ALIAS: |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1495 annotations = xmlnode_new_child(contact_info, "annotations"); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1496 xmlnode_insert_data(changes, "Annotation ", -1); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1497 |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1498 a = xmlnode_new_child(annotations, "Annotation"); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1499 n = xmlnode_new_child(a, "Name"); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1500 xmlnode_insert_data(n, "AB.NickName", -1); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1501 v = xmlnode_new_child(a, "Value"); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1502 xmlnode_insert_data(v, value, -1); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1503 break; |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1504 |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1505 default: |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1506 g_return_if_reached(); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1507 } |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1508 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1509 state = msn_callback_state_new(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
|
1510 |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1511 state->body = xmlnode_from_str(MSN_CONTACT_UPDATE_TEMPLATE, -1); |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1512 state->action = MSN_UPDATE_INFO; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1513 state->post_action = MSN_CONTACT_UPDATE_SOAP_ACTION; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1514 state->post_url = MSN_ADDRESS_BOOK_POST_URL; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1515 state->cb = msn_update_contact_read_cb; |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1516 |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1517 contact = xmlnode_get_child(state->body, "Body/ABContactUpdate/contacts/Contact"); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1518 xmlnode_insert_child(contact, contact_info); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1519 xmlnode_insert_child(contact, changes); |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1520 |
30986
5c2af6c30e52
The PartnerScenario in the ABContactUpdate SOAP request should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
1521 xmlnode_insert_data(xmlnode_get_child(state->body, |
5c2af6c30e52
The PartnerScenario in the ABContactUpdate SOAP request should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
1522 "Header/ABApplicationHeader/PartnerScenario"), |
5c2af6c30e52
The PartnerScenario in the ABContactUpdate SOAP request should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
1523 MsnSoapPartnerScenarioText[MSN_PS_SAVE_CONTACT], -1); |
5c2af6c30e52
The PartnerScenario in the ABContactUpdate SOAP request should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
1524 |
28318
534ff54568eb
Don't attempt to change the alias on the server if the contact is not (yet)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28317
diff
changeset
|
1525 if (user) { |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1526 xmlnode *contactId = xmlnode_new_child(contact, "contactId"); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1527 msn_callback_state_set_uid(state, user->uid); |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1528 xmlnode_insert_data(contactId, state->uid, -1); |
28318
534ff54568eb
Don't attempt to change the alias on the server if the contact is not (yet)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28317
diff
changeset
|
1529 } else { |
534ff54568eb
Don't attempt to change the alias on the server if the contact is not (yet)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28317
diff
changeset
|
1530 xmlnode *contactType = xmlnode_new_child(contact_info, "contactType"); |
534ff54568eb
Don't attempt to change the alias on the server if the contact is not (yet)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28317
diff
changeset
|
1531 xmlnode_insert_data(contactType, "Me", -1); |
23472
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1532 } |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1533 |
70de4e2246ec
Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23470
diff
changeset
|
1534 msn_contact_request(state); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1535 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1536 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1537 static void |
31004
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1538 msn_annotate_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1539 gpointer data) |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1540 { |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1541 MsnCallbackState *state = (MsnCallbackState *)data; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1542 xmlnode *fault; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1543 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1544 /* We don't know how to respond to this faultcode, so log it */ |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1545 fault = xmlnode_get_child(resp->xml, "Body/Fault"); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1546 if (fault != NULL) { |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1547 char *fault_str = xmlnode_to_str(fault, NULL); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1548 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1549 msn_contact_operation_str(state->action), fault_str); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1550 g_free(fault_str); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1551 return; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1552 } |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1553 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1554 purple_debug_info("msn", "Contact annotated successfully\n"); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1555 } |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1556 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1557 /* Update a contact's annotations */ |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1558 void |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1559 msn_annotate_contact(MsnSession *session, const char *passport, ...) |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1560 { |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1561 va_list params; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1562 MsnCallbackState *state; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1563 xmlnode *contact; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1564 xmlnode *contact_info; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1565 xmlnode *annotations; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1566 MsnUser *user = NULL; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1567 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1568 g_return_if_fail(passport != NULL); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1569 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1570 if (strcmp(passport, "Me") != 0) { |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1571 user = msn_userlist_find_user(session->userlist, passport); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1572 if (!user) |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1573 return; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1574 } |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1575 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1576 contact_info = xmlnode_new("contactInfo"); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1577 annotations = xmlnode_new_child(contact_info, "annotations"); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1578 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1579 va_start(params, passport); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1580 while (TRUE) { |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1581 const char *name; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1582 const char *value; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1583 xmlnode *a, *n, *v; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1584 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1585 name = va_arg(params, const char *); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1586 if (!name) |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1587 break; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1588 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1589 value = va_arg(params, const char *); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1590 if (!value) |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1591 break; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1592 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1593 a = xmlnode_new_child(annotations, "Annotation"); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1594 n = xmlnode_new_child(a, "Name"); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1595 xmlnode_insert_data(n, name, -1); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1596 v = xmlnode_new_child(a, "Value"); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1597 xmlnode_insert_data(v, value, -1); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1598 } |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1599 va_end(params); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1600 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1601 state = msn_callback_state_new(session); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1602 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1603 state->body = xmlnode_from_str(MSN_CONTACT_ANNOTATE_TEMPLATE, -1); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1604 state->action = MSN_ANNOTATE_USER; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1605 state->post_action = MSN_CONTACT_ANNOTATE_SOAP_ACTION; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1606 state->post_url = MSN_ADDRESS_BOOK_POST_URL; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1607 state->cb = msn_annotate_contact_read_cb; |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1608 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1609 xmlnode_insert_data(xmlnode_get_child(state->body, |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1610 "Header/ABApplicationHeader/PartnerScenario"), |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1611 MsnSoapPartnerScenarioText[MSN_PS_SAVE_CONTACT], -1); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1612 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1613 contact = xmlnode_get_child(state->body, "Body/ABContactUpdate/contacts/Contact"); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1614 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1615 if (user) { |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1616 xmlnode *contactId = xmlnode_new_child(contact, "contactId"); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1617 msn_callback_state_set_uid(state, user->uid); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1618 xmlnode_insert_data(contactId, state->uid, -1); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1619 } else { |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1620 xmlnode *contactType = xmlnode_new_child(contact_info, "contactType"); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1621 xmlnode_insert_data(contactType, "Me", -1); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1622 } |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1623 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1624 msn_contact_request(state); |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1625 } |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1626 |
3cff7a5e0351
Add a function that allows annotating a contact through a SOAP call.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30990
diff
changeset
|
1627 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
|
1628 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
|
1629 gpointer data) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1630 { |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1631 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
|
1632 MsnSession *session = state->session; |
24520
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1633 xmlnode *fault; |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1634 |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1635 /* We don't know how to respond to this faultcode, so log it */ |
24520
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1636 fault = xmlnode_get_child(resp->xml, "Body/Fault"); |
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1637 if (fault != NULL) { |
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1638 char *fault_str = xmlnode_to_str(fault, NULL); |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1639 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1640 msn_contact_operation_str(state->action), fault_str); |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1641 g_free(fault_str); |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1642 return; |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1643 } |
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
|
1644 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1645 purple_debug_info("msn", "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
|
1646 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1647 if (state->list_id == MSN_LIST_PL) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1648 MsnUser *user = msn_userlist_find_user(session->userlist, state->who); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1649 MsnCallbackState *new_state = msn_callback_state_dup(state); |
20773
dcb28d9939ee
Keep MsnUser->list_op in sync.
Carlos Silva <typ0@pidgin.im>
parents:
20772
diff
changeset
|
1650 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1651 if (user != NULL) |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1652 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
|
1653 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1654 msn_add_contact_to_list(session, new_state, state->who, MSN_LIST_RL); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1655 return; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1656 } else if (state->list_id == MSN_LIST_AL) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1657 purple_privacy_permit_remove(session->account, state->who, TRUE); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1658 msn_add_contact_to_list(session, NULL, state->who, MSN_LIST_BL); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1659 } else if (state->list_id == MSN_LIST_BL) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1660 purple_privacy_deny_remove(session->account, state->who, TRUE); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1661 msn_add_contact_to_list(session, NULL, state->who, MSN_LIST_AL); |
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
|
1662 } |
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
|
1663 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1664 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1665 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1666 void |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1667 msn_del_contact_from_list(MsnSession *session, MsnCallbackState *state, |
20486
ff4ae9dde291
Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents:
20484
diff
changeset
|
1668 const gchar *passport, const MsnListId list) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1669 { |
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
|
1670 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
|
1671 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
|
1672 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
|
1673 |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1674 g_return_if_fail(session != NULL); |
24525
98afd76647bd
Updates for federated/Yahoo buddies:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24524
diff
changeset
|
1675 g_return_if_fail(session->userlist != NULL); |
20486
ff4ae9dde291
Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents:
20484
diff
changeset
|
1676 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
|
1677 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
|
1678 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1679 purple_debug_info("msn", "Deleting contact %s from %s list\n", passport, MsnMemberRole[list]); |
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
|
1680 |
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
|
1681 if (state == NULL) { |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1682 state = msn_callback_state_new(session); |
20486
ff4ae9dde291
Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents:
20484
diff
changeset
|
1683 } |
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
|
1684 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
|
1685 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
|
1686 |
24525
98afd76647bd
Updates for federated/Yahoo buddies:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24524
diff
changeset
|
1687 user = msn_userlist_find_user(session->userlist, passport); |
98afd76647bd
Updates for federated/Yahoo buddies:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24524
diff
changeset
|
1688 |
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
|
1689 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
|
1690 partner_scenario = MSN_PS_CONTACT_API; |
30425
f60a1a80036f
user should never be NULL here.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30416
diff
changeset
|
1691 if (user->networkid != MSN_NETWORK_PASSPORT) |
25582
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1692 member = g_strdup_printf(MSN_MEMBER_MEMBERSHIPID_XML, |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1693 "EmailMember", "Email", |
28957
452043d200f0
Replace guint membership_id[5] with guint member_id_on_pending_list in
Mark Doliner <mark@kingant.net>
parents:
28668
diff
changeset
|
1694 user->member_id_on_pending_list); |
25582
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1695 else |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1696 member = g_strdup_printf(MSN_MEMBER_MEMBERSHIPID_XML, |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1697 "PassportMember", "Passport", |
28957
452043d200f0
Replace guint membership_id[5] with guint member_id_on_pending_list in
Mark Doliner <mark@kingant.net>
parents:
28668
diff
changeset
|
1698 user->member_id_on_pending_list); |
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
|
1699 } 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
|
1700 /* 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
|
1701 partner_scenario = MSN_PS_BLOCK_UNBLOCK; |
25582
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1702 if (user && user->networkid != MSN_NETWORK_PASSPORT) |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1703 member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1704 "EmailMember", "Email", |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1705 "Email", passport, "Email"); |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1706 else |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1707 member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1708 "PassportMember", "Passport", |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1709 "PassportName", passport, "PassportName"); |
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
|
1710 } |
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
|
1711 |
24521
e63483708bd7
Fix a typo in a name.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24520
diff
changeset
|
1712 body = g_strdup_printf(MSN_CONTACT_DELETE_FROM_LIST_TEMPLATE, |
23447
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23446
diff
changeset
|
1713 MsnSoapPartnerScenarioText[partner_scenario], |
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23446
diff
changeset
|
1714 MsnMemberRole[list], member); |
20486
ff4ae9dde291
Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents:
20484
diff
changeset
|
1715 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1716 state->body = xmlnode_from_str(body, -1); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1717 state->post_action = MSN_DELETE_MEMBER_FROM_LIST_SOAP_ACTION; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1718 state->post_url = MSN_SHARE_POST_URL; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1719 state->cb = msn_del_contact_from_list_read_cb; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1720 msn_contact_request(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
|
1721 |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1722 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
|
1723 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
|
1724 } |
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
|
1725 |
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
|
1726 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
|
1727 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
|
1728 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
|
1729 { |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1730 MsnCallbackState *state = data; |
24520
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1731 xmlnode *fault; |
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
|
1732 |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1733 /* We don't know how to respond to this faultcode, so log it */ |
24520
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1734 fault = xmlnode_get_child(resp->xml, "Body/Fault"); |
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1735 if (fault != NULL) { |
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1736 char *fault_str = xmlnode_to_str(fault, NULL); |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1737 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1738 msn_contact_operation_str(state->action), fault_str); |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1739 g_free(fault_str); |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1740 return; |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1741 } |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1742 |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1743 g_return_if_fail(state->session != NULL); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1744 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1745 purple_debug_info("msn", "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
|
1746 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1747 if (state->list_id == MSN_LIST_RL) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1748 MsnUser *user = msn_userlist_find_user(state->session->userlist, state->who); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1749 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1750 if (user != NULL) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1751 msn_user_set_op(user, MSN_LIST_RL_OP); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1752 } |
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
|
1753 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1754 if (state->action & MSN_DENIED_BUDDY) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1755 msn_add_contact_to_list(state->session, NULL, state->who, MSN_LIST_BL); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1756 } else if (state->list_id == MSN_LIST_AL) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1757 purple_privacy_permit_add(state->session->account, state->who, TRUE); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1758 } else if (state->list_id == MSN_LIST_BL) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1759 purple_privacy_deny_add(state->session->account, state->who, TRUE); |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1760 } |
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
|
1761 } |
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
|
1762 } |
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
|
1763 |
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
|
1764 void |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1765 msn_add_contact_to_list(MsnSession *session, MsnCallbackState *state, |
20486
ff4ae9dde291
Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents:
20484
diff
changeset
|
1766 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
|
1767 { |
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
|
1768 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
|
1769 MsnSoapPartnerScenario partner_scenario; |
24525
98afd76647bd
Updates for federated/Yahoo buddies:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24524
diff
changeset
|
1770 MsnUser *user; |
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
|
1771 |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1772 g_return_if_fail(session != NULL); |
20486
ff4ae9dde291
Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents:
20484
diff
changeset
|
1773 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
|
1774 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
|
1775 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1776 purple_debug_info("msn", "Adding contact %s to %s list\n", passport, MsnMemberRole[list]); |
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
|
1777 |
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
|
1778 if (state == NULL) { |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1779 state = msn_callback_state_new(session); |
20486
ff4ae9dde291
Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents:
20484
diff
changeset
|
1780 } |
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
|
1781 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
|
1782 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
|
1783 |
24525
98afd76647bd
Updates for federated/Yahoo buddies:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24524
diff
changeset
|
1784 user = msn_userlist_find_user(session->userlist, passport); |
20486
ff4ae9dde291
Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents:
20484
diff
changeset
|
1785 |
24525
98afd76647bd
Updates for federated/Yahoo buddies:
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24524
diff
changeset
|
1786 partner_scenario = (list == MSN_LIST_RL) ? MSN_PS_CONTACT_API : MSN_PS_BLOCK_UNBLOCK; |
25582
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1787 if (user && user->networkid != MSN_NETWORK_PASSPORT) |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1788 member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1789 "EmailMember", "Email", |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1790 "Email", state->who, "Email"); |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1791 else |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1792 member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1793 "PassportMember", "Passport", |
7ea04b53f553
Pluck the MSN bug fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25491
diff
changeset
|
1794 "PassportName", state->who, "PassportName"); |
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
|
1795 |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1796 body = g_strdup_printf(MSN_CONTACT_ADD_TO_LIST_TEMPLATE, |
23447
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23446
diff
changeset
|
1797 MsnSoapPartnerScenarioText[partner_scenario], |
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23446
diff
changeset
|
1798 MsnMemberRole[list], member); |
20486
ff4ae9dde291
Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents:
20484
diff
changeset
|
1799 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1800 state->body = xmlnode_from_str(body, -1); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1801 state->post_action = MSN_ADD_MEMBER_TO_LIST_SOAP_ACTION; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1802 state->post_url = MSN_SHARE_POST_URL; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1803 state->cb = msn_add_contact_to_list_read_cb; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1804 msn_contact_request(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
|
1805 |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1806 g_free(member); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1807 g_free(body); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1808 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1809 |
20427
059cc0bf6c91
Fix a compile warning by #if 0'ing out some unused code
Stu Tomlinson <stu@nosnilmot.com>
parents:
20403
diff
changeset
|
1810 #if 0 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1811 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
|
1812 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
|
1813 { |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1814 purple_debug_info("msn", "Gleams read done\n"); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1815 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1816 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1817 /*get the gleams info*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1818 void |
23459
69af5301e1a7
killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@hxbc.us>
parents:
23453
diff
changeset
|
1819 msn_get_gleams(MsnSession *session) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1820 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1821 MsnSoapReq *soap_request; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1822 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1823 purple_debug_info("msn", "msn get gleams info...\n"); |
23464
1ac5faa72c8d
explicit merge of '9d90ebdb7e38fdd77bb504bc3302a083616360d9'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
1824 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1825 state = msn_callback_state_new(session); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1826 state->body = xmlnode_from_str(MSN_GLEAMS_TEMPLATE, -1); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1827 state->post_action = MSN_GET_GLEAMS_SOAP_ACTION; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1828 state->post_url = MSN_ADDRESS_BOOK_POST_URL; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1829 state->cb = msn_gleams_read_cb; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1830 msn_contact_request(state); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1831 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1832 #endif |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1833 |
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
|
1834 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1835 /*************************************************************** |
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
|
1836 * Group Operations |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1837 ***************************************************************/ |
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
|
1838 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1839 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
|
1840 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
|
1841 { |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1842 MsnCallbackState *state = data; |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1843 MsnSession *session; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1844 MsnUserList *userlist; |
24520
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1845 xmlnode *fault; |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1846 |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1847 /* We don't know how to respond to this faultcode, so log it */ |
24520
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1848 fault = xmlnode_get_child(resp->xml, "Body/Fault"); |
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1849 if (fault != NULL) { |
d39ed4032dc9
Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24519
diff
changeset
|
1850 char *fault_str = xmlnode_to_str(fault, NULL); |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1851 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1852 msn_contact_operation_str(state->action), fault_str); |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1853 g_free(fault_str); |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1854 return; |
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
1855 } |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1856 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1857 purple_debug_info("msn", "Group request successful.\n"); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1858 |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1859 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
|
1860 g_return_if_fail(state->session->userlist != NULL); |
20501
f6dff814d95f
cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents:
20495
diff
changeset
|
1861 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1862 session = state->session; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1863 userlist = session->userlist; |
20501
f6dff814d95f
cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents:
20495
diff
changeset
|
1864 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1865 if (state->action & MSN_RENAME_GROUP) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1866 msn_userlist_rename_group_id(session->userlist, |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1867 state->guid, |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1868 state->new_group_name); |
20501
f6dff814d95f
cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents:
20495
diff
changeset
|
1869 } |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1870 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1871 if (state->action & MSN_ADD_GROUP) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1872 /* the response is taken from |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1873 http://telepathy.freedesktop.org/wiki/Pymsn/MSNP/ContactListActions |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1874 should copy it to msnpiki some day */ |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1875 xmlnode *guid_node = xmlnode_get_child(resp->xml, |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1876 "Body/ABGroupAddResponse/ABGroupAddResult/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
|
1877 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1878 if (guid_node) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1879 char *guid = xmlnode_get_data(guid_node); |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1880 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1881 /* create and add the new group to the userlist */ |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1882 purple_debug_info("msn", "Adding group %s with guid = %s to the userlist\n", state->new_group_name, guid); |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1883 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
|
1884 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1885 if (state->action & MSN_ADD_BUDDY) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1886 msn_userlist_add_buddy(session->userlist, |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1887 state->who, |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1888 state->new_group_name); |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1889 } else if (state->action & MSN_MOVE_BUDDY) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1890 /* This will be freed when the add contact callback fires */ |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1891 MsnCallbackState *new_state = msn_callback_state_dup(state); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1892 msn_add_contact_to_group(session, new_state, state->who, guid); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1893 g_free(guid); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1894 return; |
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
|
1895 } |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1896 g_free(guid); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1897 } else { |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1898 purple_debug_info("msn", "Adding group %s failed\n", |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1899 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
|
1900 } |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1901 } |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1902 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1903 if (state->action & MSN_DEL_GROUP) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1904 GList *l; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1905 |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1906 msn_userlist_remove_group_id(session->userlist, state->guid); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1907 for (l = userlist->users; l != NULL; l = l->next) { |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1908 msn_user_remove_group_id( (MsnUser *)l->data, 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
|
1909 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1910 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1911 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1912 |
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
|
1913 /* 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
|
1914 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
|
1915 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
|
1916 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1917 char *body = NULL; |
23446
f1f5efd679a4
Patch 4 from Qulogic, this one fixes a group name escape bug introduced by
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23445
diff
changeset
|
1918 char *escaped_group_name = NULL; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1919 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1920 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
|
1921 g_return_if_fail(group_name != NULL); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1922 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1923 purple_debug_info("msn", "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
|
1924 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1925 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
|
1926 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
|
1927 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1928 |
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
|
1929 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
|
1930 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
|
1931 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1932 /* 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
|
1933 * 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
|
1934 */ |
23446
f1f5efd679a4
Patch 4 from Qulogic, this one fixes a group name escape bug introduced by
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23445
diff
changeset
|
1935 escaped_group_name = g_markup_escape_text(group_name, -1); |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1936 body = g_strdup_printf(MSN_GROUP_ADD_TEMPLATE, escaped_group_name); |
20481
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1937 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1938 state->body = xmlnode_from_str(body, -1); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1939 state->post_action = MSN_GROUP_ADD_SOAP_ACTION; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1940 state->post_url = MSN_ADDRESS_BOOK_POST_URL; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1941 state->cb = msn_group_read_cb; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1942 msn_contact_request(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
|
1943 |
23447
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23446
diff
changeset
|
1944 g_free(escaped_group_name); |
20481
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1945 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
|
1946 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1947 |
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
|
1948 /* 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
|
1949 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
|
1950 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
|
1951 { |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1952 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
|
1953 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
|
1954 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
|
1955 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1956 g_return_if_fail(session != NULL); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1957 |
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
|
1958 g_return_if_fail(group_name != NULL); |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1959 purple_debug_info("msn", "Deleting group %s from contact list\n", group_name); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1960 |
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
|
1961 guid = msn_userlist_find_group_id(session->userlist, group_name); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1962 |
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1963 /* if group uid we need to del is 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
|
1964 * 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
|
1965 */ |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1966 if (guid == NULL) { |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
1967 purple_debug_info("msn", "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
|
1968 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
|
1969 } |
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
|
1970 |
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
|
1971 if ( !strcmp(guid, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(guid, MSN_NON_IM_GROUP_ID) ) { |
23521
a0e957b7b923
Take care of more cleanup in the MSN code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23519
diff
changeset
|
1972 /* 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
|
1973 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
|
1974 } |
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
|
1975 |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1976 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
|
1977 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
|
1978 msn_callback_state_set_guid(state, guid); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1979 |
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
|
1980 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
|
1981 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1982 state->body = xmlnode_from_str(body, -1); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1983 state->post_action = MSN_GROUP_DEL_SOAP_ACTION; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1984 state->post_url = MSN_ADDRESS_BOOK_POST_URL; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1985 state->cb = msn_group_read_cb; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
1986 msn_contact_request(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
|
1987 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1988 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
|
1989 } |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1990 |
eb93710aec4d
Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents:
20479
diff
changeset
|
1991 /* 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
|
1992 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
|
1993 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
|
1994 { |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
1995 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
|
1996 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
|
1997 MsnCallbackState *state; |
23446
f1f5efd679a4
Patch 4 from Qulogic, this one fixes a group name escape bug introduced by
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23445
diff
changeset
|
1998 char *escaped_group_name; |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
1999 |
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
|
2000 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
|
2001 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
|
2002 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
|
2003 g_return_if_fail(new_group_name != NULL); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
2004 |
23519
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23507
diff
changeset
|
2005 purple_debug_info("msn", "Renaming group %s to %s.\n", old_group_name, new_group_name); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
2006 |
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
|
2007 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
|
2008 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
|
2009 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
|
2010 |
20538
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
2011 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
|
2012 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
|
2013 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
|
2014 |
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
|
2015 if ( !strcmp(guid, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(guid, MSN_NON_IM_GROUP_ID) ) { |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
2016 MsnCallbackState *new_state = msn_callback_state_dup(state); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
2017 msn_add_group(session, new_state, new_group_name); |
23521
a0e957b7b923
Take care of more cleanup in the MSN code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23519
diff
changeset
|
2018 /* XXX move every buddy there (we probably need to fix concurrent SOAP reqs first) */ |
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
|
2019 } |
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
|
2020 |
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
|
2021 msn_callback_state_set_action(state, MSN_RENAME_GROUP); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
2022 |
23446
f1f5efd679a4
Patch 4 from Qulogic, this one fixes a group name escape bug introduced by
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23445
diff
changeset
|
2023 escaped_group_name = g_markup_escape_text(new_group_name, -1); |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
2024 body = g_strdup_printf(MSN_GROUP_RENAME_TEMPLATE, guid, escaped_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
|
2025 |
23470
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
2026 state->body = xmlnode_from_str(body, -1); |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
2027 state->post_action = MSN_GROUP_RENAME_SOAP_ACTION; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
2028 state->post_url = MSN_ADDRESS_BOOK_POST_URL; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
2029 state->cb = msn_group_read_cb; |
eb8bd060b987
Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
2030 msn_contact_request(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
|
2031 |
23447
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23446
diff
changeset
|
2032 g_free(escaped_group_name); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
2033 g_free(body); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
2034 } |
24516
ff275531cbf2
Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24515
diff
changeset
|
2035 |