libpurple/protocols/msn/contact.c

Mon, 08 Dec 2008 00:47:55 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Mon, 08 Dec 2008 00:47:55 +0000
changeset 24785
b0f31511b083
parent 24783
6361c7e41b97
child 24786
056ef71b0cef
permissions
-rw-r--r--

Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
get Messenger2 type, and the others get Messenger3. I don't know the difference
between them, but I'm going by empirical evidence (from many debug logs). I
also don't know what the Capability field is, but I set it to 0 for now. This
works in my limited testing with one Yahoo buddy.

References #6755.


References #3322.

20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1 /**
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
2 * @file contact.c
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
3 * get MSN contacts via SOAP request
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
4 * created by MaYuan<mayuan2006@gmail.com>
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
5 *
20484
4a410a579a80 Fix up some gaim -> purple issues.
Richard Laager <rlaager@pidgin.im>
parents: 20481
diff changeset
6 * purple
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
7 *
20484
4a410a579a80 Fix up some gaim -> purple issues.
Richard Laager <rlaager@pidgin.im>
parents: 20481
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
10 * source distribution.
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
11 *
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
15 * (at your option) any later version.
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
16 *
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
20 * GNU General Public License for more details.
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
21 *
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
25 */
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
26
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
27 #include "msn.h"
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
28 #include "contact.h"
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
29 #include "xmlnode.h"
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
30 #include "group.h"
23819
c3bbef4646b1 Clean up some MSN SOAP stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23790
diff changeset
31 #include "soap.h"
23757
bf5c8c3d6374 Patch 3 from Qulogic, this one updates contact list actions to use ticket
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21950
diff changeset
32 #include "nexus.h"
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
33
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
34 const char *MsnSoapPartnerScenarioText[] =
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
35 {
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
36 "Initial",
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
37 "ContactSave",
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
38 "MessengerPendingList",
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
39 "ContactMsgrAPI",
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
40 "BlockUnblock"
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
41 };
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
42
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
43 const char *MsnMemberRole[] =
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
44 {
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
45 "Forward",
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
46 "Allow",
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
47 "Block",
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
48 "Reverse",
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
49 "Pending"
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
50 };
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
51
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
52 typedef struct {
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
53 MsnSession *session;
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
54 MsnSoapPartnerScenario which;
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
55 } GetContactListCbData;
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
56
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
57 MsnCallbackState *
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
58 msn_callback_state_new(MsnSession *session)
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
59 {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
60 MsnCallbackState *state = g_new0(MsnCallbackState, 1);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
61
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
62 state->session = session;
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
63
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
64 return state;
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
65 }
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
66
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
67 MsnCallbackState *
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
68 msn_callback_state_dup(MsnCallbackState *state)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
69 {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
70 MsnCallbackState *new_state = g_new0(MsnCallbackState, 1);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
71
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
72 new_state->session = state->session;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
73 new_state->who = g_strdup(state->who);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
74 new_state->uid = g_strdup(state->uid);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
75 new_state->old_group_name = g_strdup(state->old_group_name);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
76 new_state->new_group_name = g_strdup(state->new_group_name);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
77 new_state->guid = g_strdup(state->guid);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
78 /* The rest should be made new */
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
79
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
80 return new_state;
23819
c3bbef4646b1 Clean up some MSN SOAP stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23790
diff changeset
81 }
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
82
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
83 void
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
84 msn_callback_state_free(MsnCallbackState *state)
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
85 {
20585
a82494142fe3 cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@pidgin.im>
parents: 20578
diff changeset
86 if (state == NULL)
a82494142fe3 cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@pidgin.im>
parents: 20578
diff changeset
87 return;
20609
b92d0b5ab89d 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: 20585
diff changeset
88
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
89 g_free(state->who);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
90 g_free(state->uid);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
91 g_free(state->old_group_name);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
92 g_free(state->new_group_name);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
93 g_free(state->guid);
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
94 xmlnode_free(state->body);
20609
b92d0b5ab89d 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: 20585
diff changeset
95
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
96 g_free(state);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
97 }
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
98
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
99 void
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
100 msn_callback_state_set_who(MsnCallbackState *state, const gchar *who)
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
101 {
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
102 g_return_if_fail(state != NULL);
20572
9145554836af 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: 20569
diff changeset
103
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
104 g_free(state->who);
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 20933
diff changeset
105 state->who = g_strdup(who);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
106 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
107
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
108 void
20609
b92d0b5ab89d 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: 20585
diff changeset
109 msn_callback_state_set_uid(MsnCallbackState *state, const gchar *uid)
b92d0b5ab89d 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: 20585
diff changeset
110 {
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
111 g_return_if_fail(state != NULL);
20609
b92d0b5ab89d 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: 20585
diff changeset
112
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
113 g_free(state->uid);
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 20933
diff changeset
114 state->uid = g_strdup(uid);
20609
b92d0b5ab89d 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: 20585
diff changeset
115 }
b92d0b5ab89d 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: 20585
diff changeset
116
b92d0b5ab89d 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: 20585
diff changeset
117 void
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
118 msn_callback_state_set_old_group_name(MsnCallbackState *state, const gchar *old_group_name)
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
119 {
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
120 g_return_if_fail(state != NULL);
20572
9145554836af 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: 20569
diff changeset
121
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
122 g_free(state->old_group_name);
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 20933
diff changeset
123 state->old_group_name = g_strdup(old_group_name);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
124 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
125
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
126 void
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
127 msn_callback_state_set_new_group_name(MsnCallbackState *state, const gchar *new_group_name)
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
128 {
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
129 g_return_if_fail(state != NULL);
20572
9145554836af 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: 20569
diff changeset
130
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
131 g_free(state->new_group_name);
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 20933
diff changeset
132 state->new_group_name = g_strdup(new_group_name);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
133 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
134
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
135 void
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
136 msn_callback_state_set_guid(MsnCallbackState *state, const gchar *guid)
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
137 {
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
138 g_return_if_fail(state != NULL);
20572
9145554836af 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: 20569
diff changeset
139
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
140 g_free(state->guid);
21067
97a745428ab0 Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents: 20933
diff changeset
141 state->guid = g_strdup(guid);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
142 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
143
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
144
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
145 void
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
146 msn_callback_state_set_list_id(MsnCallbackState *state, MsnListId list_id)
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
147 {
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
148 g_return_if_fail(state != NULL);
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
149
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
150 state->list_id = list_id;
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
151 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
152
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
153 void
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
154 msn_callback_state_set_action(MsnCallbackState *state, MsnCallbackAction action)
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
155 {
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
156 g_return_if_fail(state != NULL);
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
157
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
158 state->action |= action;
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
159 }
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
160
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
161 /*get MSN member role utility*/
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
162 static MsnListId
20878
b3bb6bde6289 Leak fix.
Daniel Atallah <datallah@pidgin.im>
parents: 20851
diff changeset
163 msn_get_memberrole(const char *role)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
164 {
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
165 g_return_val_if_fail(role != NULL, 0);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
166
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
167 if (!strcmp(role,"Allow")) {
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
168 return MSN_LIST_AL;
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
169 } else if (!strcmp(role,"Block")) {
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
170 return MSN_LIST_BL;
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
171 } else if (!strcmp(role,"Reverse")) {
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
172 return MSN_LIST_RL;
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
173 } else if (!strcmp(role,"Pending")) {
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
174 return MSN_LIST_PL;
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
175 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
176 return 0;
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
177 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
178
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
179 /* Create the AddressBook in the server, if we don't have one */
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
180 static void
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
181 msn_create_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data)
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
182 {
23765
8a43c0d4a095 References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23759
diff changeset
183 if (resp && xmlnode_get_child(resp->xml, "Body/Fault") == NULL) {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
184 purple_debug_info("msn", "Address Book successfully created!\n");
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
185 msn_get_address_book((MsnSession *)data, MSN_PS_INITIAL, NULL, NULL);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
186 } else {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
187 purple_debug_info("msn", "Address Book creation failed!\n");
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
188 }
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
189 }
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
190
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
191 static void
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
192 msn_create_address_book(MsnSession *session)
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
193 {
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
194 gchar *body;
24073
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
195 gchar *token_str;
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
196
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
197 g_return_if_fail(session != NULL);
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
198 g_return_if_fail(session->user != NULL);
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
199 g_return_if_fail(session->user->passport != NULL);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
200
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
201 purple_debug_info("msn", "Creating an Address Book.\n");
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
202
24073
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
203 token_str = g_markup_escape_text(
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
204 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS), -1);
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
205 body = g_strdup_printf(MSN_ADD_ADDRESSBOOK_TEMPLATE,
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
206 token_str, session->user->passport);
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
207 g_free(token_str);
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
208
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
209 msn_soap_message_send(session,
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
210 msn_soap_message_new(MSN_ADD_ADDRESSBOOK_SOAP_ACTION,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
211 xmlnode_from_str(body, -1)),
23925
aa38fbc30cfb Don't print SOAP messages to debug log for "secure" requests. This is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23841
diff changeset
212 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL, FALSE,
aa38fbc30cfb Don't print SOAP messages to debug log for "secure" requests. This is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23841
diff changeset
213 msn_create_address_cb, session);
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
214
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
215 g_free(body);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
216 }
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
217
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
218 static void
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
219 msn_parse_each_member(MsnSession *session, xmlnode *member, const char *node,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
220 MsnListId list)
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
221 {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
222 char *passport = xmlnode_get_data(xmlnode_get_child(member, node));
21371
2bc474f8c5d8 Fix some typos
Carlos Silva <typ0@pidgin.im>
parents: 21368
diff changeset
223 char *type = xmlnode_get_data(xmlnode_get_child(member, "Type"));
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
224 char *member_id = xmlnode_get_data(xmlnode_get_child(member, "MembershipId"));
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
225 MsnUser *user = msn_userlist_find_add_user(session->userlist, passport, NULL);
24776
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
226 xmlnode *annotation;
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
227 guint nid = MSN_NETWORK_PASSPORT;
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
228
24776
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
229 for (annotation = xmlnode_get_child(member, "Annotations/Annotation");
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
230 annotation;
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
231 annotation = xmlnode_get_next_twin(annotation)) {
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
232 char *name = xmlnode_get_data(xmlnode_get_child(annotation, "Name"));
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
233 if (name && !strcmp(name, "MSN.IM.BuddyType")) {
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
234 char *value = xmlnode_get_data(xmlnode_get_child(annotation, "Value"));
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
235 if (value != NULL)
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
236 nid = strtoul(value, NULL, 10);
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
237 g_free(value);
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
238 }
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
239 g_free(name);
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
240 }
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
241
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
242 purple_debug_info("msn", "CL: %s name: %s, Type: %s, MembershipID: %s, NetworkID: %u\n",
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
243 node, passport, type, member_id == NULL ? "(null)" : member_id, nid);
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
244
76b7382f4fbe Get the MSN buddy's network ID from the FindMembership response.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24775
diff changeset
245 msn_user_set_network(user, nid);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
246
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
247 if (member_id) {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
248 user->membership_id[list] = atoi(member_id);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
249 }
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
250
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
251 msn_got_lst_user(session, user, 1 << list, NULL);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
252
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
253 g_free(passport);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
254 g_free(type);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
255 g_free(member_id);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
256 }
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
257
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
258 static void
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
259 msn_parse_each_service(MsnSession *session, xmlnode *service)
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
260 {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
261 xmlnode *type;
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
262
23765
8a43c0d4a095 References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23759
diff changeset
263 if ((type = xmlnode_get_child(service, "Info/Handle/Type"))) {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
264 char *type_str = xmlnode_get_data(type);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
265
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
266 if (g_str_equal(type_str, "Profile")) {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
267 /* Process Windows Live 'Messenger Roaming Identity' */
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
268 } else if (g_str_equal(type_str, "Messenger")) {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
269 xmlnode *lastchange = xmlnode_get_child(service, "LastChange");
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
270 char *lastchange_str = xmlnode_get_data(lastchange);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
271 xmlnode *membership;
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
272
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
273 purple_debug_info("msn", "CL last change: %s\n", lastchange_str);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
274 purple_account_set_string(session->account, "CLLastChange",
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
275 lastchange_str);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
276
23765
8a43c0d4a095 References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23759
diff changeset
277 for (membership = xmlnode_get_child(service,
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
278 "Memberships/Membership");
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
279 membership; membership = xmlnode_get_next_twin(membership)) {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
280
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
281 xmlnode *role = xmlnode_get_child(membership, "MemberRole");
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
282 char *role_str = xmlnode_get_data(role);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
283 MsnListId list = msn_get_memberrole(role_str);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
284 xmlnode *member;
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
285
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
286 purple_debug_info("msn", "CL MemberRole role: %s, list: %d\n",
21371
2bc474f8c5d8 Fix some typos
Carlos Silva <typ0@pidgin.im>
parents: 21368
diff changeset
287 role_str, list);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
288
23765
8a43c0d4a095 References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23759
diff changeset
289 for (member = xmlnode_get_child(membership, "Members/Member");
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
290 member; member = xmlnode_get_next_twin(member)) {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
291 const char *member_type = xmlnode_get_attrib(member, "type");
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
292 if (g_str_equal(member_type, "PassportMember")) {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
293 msn_parse_each_member(session, member, "PassportName",
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
294 list);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
295 } else if (g_str_equal(member_type, "PhoneMember")) {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
296
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
297 } else if (g_str_equal(member_type, "EmailMember")) {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
298 msn_parse_each_member(session, member, "Email", list);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
299 }
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
300 }
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
301
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
302 g_free(role_str);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
303 }
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
304
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
305 g_free(lastchange_str);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
306 }
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
307
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
308 g_free(type_str);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
309 }
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
310 }
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
311
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
312 /*parse contact list*/
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
313 static void
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
314 msn_parse_contact_list(MsnSession *session, xmlnode *node)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
315 {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
316 xmlnode *fault, *faultnode;
20546
35d778ab0450 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: 20545
diff changeset
317
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
318 /* we may get a response if our cache data is too old:
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
319 *
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
320 * <faultstring>Need to do full sync. Can't sync deltas Client
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
321 * has too old a copy for us to do a delta sync</faultstring>
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
322 *
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
323 * this is not handled yet
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
324 */
23765
8a43c0d4a095 References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23759
diff changeset
325 if ((fault = xmlnode_get_child(node, "Body/Fault"))) {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
326 if ((faultnode = xmlnode_get_child(fault, "faultstring"))) {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
327 char *faultstring = xmlnode_get_data(faultnode);
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
328 purple_debug_info("msn", "Retrieving contact list failed: %s\n",
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
329 faultstring);
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
330 g_free(faultstring);
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
331 }
23765
8a43c0d4a095 References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23759
diff changeset
332 if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
333 char *errorcode = xmlnode_get_data(faultnode);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
334
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
335 if (g_str_equal(errorcode, "ABDoesNotExist")) {
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
336 msn_create_address_book(session);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
337 g_free(errorcode);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
338 return;
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
339 }
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
340
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
341 g_free(errorcode);
20546
35d778ab0450 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: 20545
diff changeset
342 }
35d778ab0450 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: 20545
diff changeset
343
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
344 msn_get_contact_list(session, MSN_PS_INITIAL, NULL);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
345 } else {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
346 xmlnode *service;
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
347
23765
8a43c0d4a095 References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23759
diff changeset
348 for (service = xmlnode_get_child(node, "Body/FindMembershipResponse/"
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
349 "FindMembershipResult/Services/Service");
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
350 service; service = xmlnode_get_next_twin(service)) {
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
351 msn_parse_each_service(session, service);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
352 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
353 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
354 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
355
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
356 static void
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
357 msn_get_contact_list_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
358 gpointer data)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
359 {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
360 GetContactListCbData *cb_data = data;
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
361 MsnSession *session = cb_data->session;
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
362
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
363 g_return_if_fail(session != NULL);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
364
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
365 if (resp != NULL) {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
366 const char *abLastChange;
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
367 const char *dynamicItemLastChange;
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
368
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
369 purple_debug_misc("msn", "Got the contact list!\n");
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
370
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
371 msn_parse_contact_list(session, resp->xml);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
372 abLastChange = purple_account_get_string(session->account,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
373 "ablastChange", NULL);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
374 dynamicItemLastChange = purple_account_get_string(session->account,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
375 "dynamicItemLastChange", NULL);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
376
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
377 if (cb_data->which == MSN_PS_INITIAL) {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
378 #ifdef MSN_PARTIAL_LISTS
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
379 /* XXX: this should be enabled when we can correctly do partial
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
380 syncs with the server. Currently we need to retrieve the whole
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
381 list to detect sync issues */
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
382 msn_get_address_book(session, MSN_PS_INITIAL, abLastChange, dynamicItemLastChange);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
383 #else
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
384 msn_get_address_book(session, MSN_PS_INITIAL, NULL, NULL);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
385 #endif
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
386 }
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
387 }
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
388
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
389 g_free(cb_data);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
390 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
391
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
392 /*SOAP get contact list*/
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
393 void
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
394 msn_get_contact_list(MsnSession *session,
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
395 const MsnSoapPartnerScenario partner_scenario, const char *update_time)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
396 {
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
397 gchar *body = NULL;
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20728
diff changeset
398 gchar *update_str = NULL;
24073
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
399 gchar *token_str;
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
400 GetContactListCbData cb_data = { session, partner_scenario };
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
401 const gchar *partner_scenario_str = MsnSoapPartnerScenarioText[partner_scenario];
20546
35d778ab0450 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: 20545
diff changeset
402
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
403 purple_debug_misc("msn", "Getting Contact List.\n");
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
404
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
405 if (update_time != NULL) {
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
406 purple_debug_info("msn", "CL Last update time: %s\n", update_time);
24073
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
407 update_str = g_strdup_printf(MSN_GET_CONTACT_UPDATE_XML, update_time);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
408 }
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
409
24073
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
410 token_str = g_markup_escape_text(
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
411 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS), -1);
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
412 body = g_strdup_printf(MSN_GET_CONTACT_TEMPLATE, partner_scenario_str,
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
413 token_str, update_str ? update_str : "");
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
414 g_free(token_str);
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
415
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
416 msn_soap_message_send(session,
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
417 msn_soap_message_new(MSN_GET_CONTACT_SOAP_ACTION,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
418 xmlnode_from_str(body, -1)),
23925
aa38fbc30cfb Don't print SOAP messages to debug log for "secure" requests. This is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23841
diff changeset
419 MSN_CONTACT_SERVER, MSN_GET_CONTACT_POST_URL, FALSE,
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
420 msn_get_contact_list_cb, g_memdup(&cb_data, sizeof(cb_data)));
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
421
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
422 g_free(update_str);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
423 g_free(body);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
424 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
425
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
426 static void
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
427 msn_parse_addressbook_groups(MsnSession *session, xmlnode *node)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
428 {
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
429 xmlnode *group;
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
430
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
431 purple_debug_info("msn", "msn_parse_addressbook_groups()\n");
20546
35d778ab0450 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: 20545
diff changeset
432
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
433 for(group = xmlnode_get_child(node, "Group"); group;
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
434 group = xmlnode_get_next_twin(group)){
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
435 xmlnode *groupId, *groupInfo, *groupname;
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20728
diff changeset
436 char *group_id = NULL, *group_name = NULL;
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
437
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20728
diff changeset
438 if ((groupId = xmlnode_get_child(group, "groupId")))
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20728
diff changeset
439 group_id = xmlnode_get_data(groupId);
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20728
diff changeset
440 if ((groupInfo = xmlnode_get_child(group, "groupInfo")) && (groupname = xmlnode_get_child(groupInfo, "name")))
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20728
diff changeset
441 group_name = xmlnode_get_data(groupname);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
442
24773
2241b9f2698f Check for NULL group_id before calling msn_group_new since that function will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24672
diff changeset
443 if (group_id == NULL) {
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
444 /* Group of ungroupped buddies */
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
445 g_free(group_name);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
446 continue;
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
447 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
448
24773
2241b9f2698f Check for NULL group_id before calling msn_group_new since that function will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24672
diff changeset
449 msn_group_new(session->userlist, group_id, group_name);
2241b9f2698f Check for NULL group_id before calling msn_group_new since that function will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24672
diff changeset
450
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
451 purple_debug_info("msn", "AB group_id: %s, name: %s\n", group_id, group_name ? group_name : "(null)");
24773
2241b9f2698f Check for NULL group_id before calling msn_group_new since that function will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24672
diff changeset
452 if ((purple_find_group(group_name)) == NULL) {
20484
4a410a579a80 Fix up some gaim -> purple issues.
Richard Laager <rlaager@pidgin.im>
parents: 20481
diff changeset
453 PurpleGroup *g = purple_group_new(group_name);
4a410a579a80 Fix up some gaim -> purple issues.
Richard Laager <rlaager@pidgin.im>
parents: 20481
diff changeset
454 purple_blist_add_group(g, NULL);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
455 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
456 g_free(group_id);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
457 g_free(group_name);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
458 }
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
459 }
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
460
22710
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
461 static gboolean
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
462 msn_parse_addressbook_mobile(xmlnode *contactInfo, char **inout_mobile_number)
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
463 {
22710
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
464 xmlnode *phones;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
465 char *mobile_number = NULL;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
466 gboolean mobile = FALSE;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
467
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
468 *inout_mobile_number = NULL;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
469
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
470 if ((phones = xmlnode_get_child(contactInfo, "phones"))) {
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
471 xmlnode *contact_phone;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
472 char *phone_type = NULL;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
473
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
474 for (contact_phone = xmlnode_get_child(phones, "ContactPhone");
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
475 contact_phone;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
476 contact_phone = xmlnode_get_next_twin(contact_phone)) {
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
477 xmlnode *contact_phone_type;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
478
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
479 if (!(contact_phone_type =
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
480 xmlnode_get_child(contact_phone, "contactPhoneType")))
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
481 continue;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
482
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
483 phone_type = xmlnode_get_data(contact_phone_type);
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
484
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
485 if (phone_type && !strcmp(phone_type, "ContactPhoneMobile")) {
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
486 xmlnode *number;
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
487
22710
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
488 if ((number = xmlnode_get_child(contact_phone, "number"))) {
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
489 xmlnode *messenger_enabled;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
490 char *is_messenger_enabled = NULL;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
491
22978
0dc637ac393b Fix incorrect freeing in my previous commit.
Daniel Atallah <datallah@pidgin.im>
parents: 22977
diff changeset
492 g_free(mobile_number);
22710
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
493 mobile_number = xmlnode_get_data(number);
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
494
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
495 if (mobile_number &&
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
496 (messenger_enabled = xmlnode_get_child(contact_phone, "isMessengerEnabled"))
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
497 && (is_messenger_enabled = xmlnode_get_data(messenger_enabled))
22977
619a2612bb92 This is the way we plug the leaks, plug the leaks, plug the leaks...
Daniel Atallah <datallah@pidgin.im>
parents: 22712
diff changeset
498 && !strcmp(is_messenger_enabled, "true"))
22710
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
499 mobile = TRUE;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
500
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
501 g_free(is_messenger_enabled);
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
502 }
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
503 }
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
504
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
505 g_free(phone_type);
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
506 }
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
507 }
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
508
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
509 *inout_mobile_number = mobile_number;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
510 return mobile;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
511 }
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
512
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
513 static void
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
514 msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node)
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
515 {
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
516 xmlnode *contactNode;
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
517 char *passport = NULL, *Name = NULL, *uid = NULL, *type = NULL, *mobile_number = NULL, *alias = NULL;
22710
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
518 gboolean mobile = FALSE;
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
519 PurpleConnection *pc = purple_account_get_connection(session->account);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
520
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
521 for(contactNode = xmlnode_get_child(node, "Contact"); contactNode;
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
522 contactNode = xmlnode_get_next_twin(contactNode)) {
22712
be4afaf92027 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@pidgin.im>
parents: 22710
diff changeset
523 xmlnode *contactId, *contactInfo, *contactType, *passportName, *displayName, *guid, *groupIds, *messenger_user;
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
524 xmlnode *annotation;
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
525 MsnUser *user;
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
526
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
527 if (!(contactId = xmlnode_get_child(contactNode,"contactId"))
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
528 || !(contactInfo = xmlnode_get_child(contactNode, "contactInfo"))
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
529 || !(contactType = xmlnode_get_child(contactInfo, "contactType")))
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
530 continue;
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
531
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
532 g_free(passport);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
533 g_free(Name);
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
534 g_free(alias);
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
535 g_free(uid);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
536 g_free(type);
22981
b83a23981419 Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents: 22978
diff changeset
537 g_free(mobile_number);
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
538 passport = Name = uid = type = mobile_number = alias = NULL;
22710
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
539 mobile = FALSE;
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
540
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
541 uid = xmlnode_get_data(contactId);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
542 type = xmlnode_get_data(contactType);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
543
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
544 /*setup the Display Name*/
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
545 if (type && !strcmp(type, "Me")){
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
546 char *friendly = NULL;
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
547 if ((displayName = xmlnode_get_child(contactInfo, "displayName")))
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
548 friendly = xmlnode_get_data(displayName);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
549 purple_connection_set_display_name(session->account->gc, friendly ? purple_url_decode(friendly) : NULL);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
550 g_free(friendly);
20486
26b9f3efe52d The last of the merge fix-ups.
Richard Laager <rlaager@pidgin.im>
parents: 20485
diff changeset
551 continue; /* Not adding own account as buddy to buddylist */
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
552 }
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
553
22712
be4afaf92027 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@pidgin.im>
parents: 22710
diff changeset
554 /* ignore non-messenger contacts */
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
555 if ((messenger_user = xmlnode_get_child(contactInfo, "isMessengerUser"))) {
22712
be4afaf92027 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@pidgin.im>
parents: 22710
diff changeset
556 char *is_messenger_user = xmlnode_get_data(messenger_user);
be4afaf92027 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@pidgin.im>
parents: 22710
diff changeset
557
be4afaf92027 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@pidgin.im>
parents: 22710
diff changeset
558 if(is_messenger_user && !strcmp(is_messenger_user, "false")) {
be4afaf92027 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@pidgin.im>
parents: 22710
diff changeset
559 g_free(is_messenger_user);
be4afaf92027 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@pidgin.im>
parents: 22710
diff changeset
560 continue;
be4afaf92027 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@pidgin.im>
parents: 22710
diff changeset
561 }
be4afaf92027 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@pidgin.im>
parents: 22710
diff changeset
562
be4afaf92027 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@pidgin.im>
parents: 22710
diff changeset
563 g_free(is_messenger_user);
be4afaf92027 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@pidgin.im>
parents: 22710
diff changeset
564 }
be4afaf92027 patch from Maiku to ignore non-messenger contacts, fixes #3305
Ka-Hing Cheung <khc@pidgin.im>
parents: 22710
diff changeset
565
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
566 passportName = xmlnode_get_child(contactInfo, "passportName");
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
567 if (passportName == NULL) {
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
568 xmlnode *emailsNode, *contactEmailNode, *emailNode;
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
569 xmlnode *messengerEnabledNode;
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
570 char *msnEnabled;
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
571
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
572 /*TODO: add it to the none-instant Messenger group and recognize as email Membership*/
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
573 /*Yahoo User?*/
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
574 emailsNode = xmlnode_get_child(contactInfo, "emails");
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
575 if (emailsNode == NULL) {
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
576 /*TODO: need to support the Mobile type*/
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
577 continue;
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
578 }
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
579 for (contactEmailNode = xmlnode_get_child(emailsNode, "ContactEmail"); contactEmailNode;
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
580 contactEmailNode = xmlnode_get_next_twin(contactEmailNode) ){
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
581 if (!(messengerEnabledNode = xmlnode_get_child(contactEmailNode, "isMessengerEnabled"))) {
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
582 /* XXX: Should this be a continue instead of a break? It seems like it'd cause unpredictable results otherwise. */
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
583 break;
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
584 }
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
585
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
586 msnEnabled = xmlnode_get_data(messengerEnabledNode);
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
587
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
588 if ((emailNode = xmlnode_get_child(contactEmailNode, "email"))) {
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
589 g_free(passport);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
590 passport = xmlnode_get_data(emailNode);
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
591 }
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
592
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
593 if (msnEnabled && !strcmp(msnEnabled, "true")) {
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
594 /*Messenger enabled, Get the Passport*/
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
595 purple_debug_info("msn", "AB Yahoo User %s\n", passport ? passport : "(null)");
20578
82571739414b Fix some memory leaks. Free xmlnodes properly using xmlnode_free instead of
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20577
diff changeset
596 g_free(msnEnabled);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
597 break;
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
598 } else {
20484
4a410a579a80 Fix up some gaim -> purple issues.
Richard Laager <rlaager@pidgin.im>
parents: 20481
diff changeset
599 /*TODO maybe we can just ignore it in Purple?*/
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
600 purple_debug_info("msn", "AB Other type user\n");
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
601 }
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
602
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
603 g_free(msnEnabled);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
604 }
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
605 } else {
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
606 passport = xmlnode_get_data(passportName);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
607 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
608
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
609 if (passport == NULL)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
610 continue;
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
611
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
612 if ((displayName = xmlnode_get_child(contactInfo, "displayName")))
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
613 Name = xmlnode_get_data(displayName);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
614 else
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
615 Name = g_strdup(passport);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
616
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
617 for (annotation = xmlnode_get_child(contactInfo, "annotations/Annotation");
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
618 annotation; annotation = xmlnode_get_next_twin(annotation)) {
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
619 char *name;
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
620 name = xmlnode_get_data(xmlnode_get_child(annotation, "Name"));
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
621 if (!strcmp(name, "AB.NickName"))
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
622 alias = xmlnode_get_data(xmlnode_get_child(annotation, "Value"));
24775
c238d3893049 Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24774
diff changeset
623 else if (!strcmp(name, "MSN.IM.HasSharedFolder"))
c238d3893049 Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24774
diff changeset
624 ; /* Do nothing yet... */
c238d3893049 Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24774
diff changeset
625 else if (!strcmp(name, "AB.Spouse"))
c238d3893049 Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24774
diff changeset
626 ; /* Do nothing yet... */
c238d3893049 Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24774
diff changeset
627 else if (!strcmp(name, "MSN.Mobile.ContactId"))
c238d3893049 Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24774
diff changeset
628 ; /* Do nothing yet... */
c238d3893049 Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24774
diff changeset
629 else
c238d3893049 Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24774
diff changeset
630 purple_debug_info("msn",
c238d3893049 Add tests for some known contact annotations. These don't do anything yet, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24774
diff changeset
631 "Unknown AB contact annotation: %s\n", name);
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
632 g_free(name);
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
633 }
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
634
22710
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
635 mobile = msn_parse_addressbook_mobile(contactInfo, &mobile_number);
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
636
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
637 purple_debug_misc("msn", "AB passport:{%s} uid:{%s} display:{%s} alias: {%s} mobile:{%s} mobile number:{%s}\n",
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
638 passport, uid ? uid : "(null)", Name ? Name : "(null)", alias ? alias : "(null)",
22710
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
639 mobile ? "true" : "false", mobile_number ? mobile_number : "(null)");
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
640
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
641 user = msn_userlist_find_add_user(session->userlist, passport, Name);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
642 msn_user_set_uid(user, uid);
22710
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
643 msn_user_set_mobile_phone(user, mobile_number);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
644
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
645 groupIds = xmlnode_get_child(contactInfo, "groupIds");
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
646 if (groupIds) {
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
647 for (guid = xmlnode_get_child(groupIds, "guid"); guid;
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
648 guid = xmlnode_get_next_twin(guid)) {
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
649 char *group_id = xmlnode_get_data(guid);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
650 msn_user_add_group_id(user, group_id);
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
651 purple_debug_misc("msn", "AB guid:%s\n", group_id ? group_id : "(null)");
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
652 g_free(group_id);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
653 }
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
654 } else {
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20728
diff changeset
655 purple_debug_info("msn", "User not in any groups, adding to default group.\n");
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
656 /*not in any group,Then set default group*/
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
657 msn_user_add_group_id(user, MSN_INDIVIDUALS_GROUP_ID);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
658 }
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
659
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
660 msn_got_lst_user(session, user, MSN_LIST_FL_OP, NULL);
22710
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
661
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
662 if (mobile && user)
22710
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
663 {
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
664 user->mobile = TRUE;
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
665 purple_prpl_got_user_status(session->account, user->passport, "mobile", NULL);
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
666 purple_prpl_got_user_status(session->account, user->passport, "available", NULL);
e911e17d75f0 another patch from Maiku that "Properly identifies users you have the mobile
Ka-Hing Cheung <khc@pidgin.im>
parents: 21950
diff changeset
667 }
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
668 if (alias)
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
669 purple_serv_got_private_alias(pc, passport, alias);
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
670 }
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
671
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
672 g_free(passport);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
673 g_free(Name);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
674 g_free(uid);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
675 g_free(type);
22981
b83a23981419 Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents: 22978
diff changeset
676 g_free(mobile_number);
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
677 }
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
678
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
679 static gboolean
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
680 msn_parse_addressbook(MsnSession *session, xmlnode *node)
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
681 {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
682 xmlnode *result;
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
683 xmlnode *groups;
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20728
diff changeset
684 xmlnode *contacts;
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
685 xmlnode *abNode;
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
686 xmlnode *fault;
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
687
23765
8a43c0d4a095 References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23759
diff changeset
688 if ((fault = xmlnode_get_child(node, "Body/Fault"))) {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
689 xmlnode *faultnode;
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
690
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
691 if ((faultnode = xmlnode_get_child(fault, "faultstring"))) {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
692 gchar *faultstring = xmlnode_get_data(faultnode);
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
693 purple_debug_info("msn", "AB Faultstring: %s\n", faultstring);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
694 g_free(faultstring);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
695 }
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
696
23765
8a43c0d4a095 References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23759
diff changeset
697 if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
698 gchar *errorcode = xmlnode_get_data(faultnode);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
699
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
700 purple_debug_info("msn", "AB Error Code: %s\n", errorcode);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
701
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
702 if (g_str_equal(errorcode, "ABDoesNotExist")) {
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
703 g_free(errorcode);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
704 return TRUE;
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
705 }
22977
619a2612bb92 This is the way we plug the leaks, plug the leaks, plug the leaks...
Daniel Atallah <datallah@pidgin.im>
parents: 22712
diff changeset
706 g_free(errorcode);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
707 }
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
708
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
709 return FALSE;
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
710 }
20550
af5abde0d99f 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: 20546
diff changeset
711
23765
8a43c0d4a095 References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23759
diff changeset
712 result = xmlnode_get_child(node, "Body/ABFindAllResponse/ABFindAllResult");
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
713 if (result == NULL) {
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
714 purple_debug_misc("msn", "Received no address book update\n");
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
715 return TRUE;
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
716 }
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
717
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
718 /* I don't see this "groups" tag documented on msnpiki, need to find out
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
719 if they are really there, and update msnpiki */
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
720 /*Process Group List*/
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
721 groups = xmlnode_get_child(result, "groups");
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
722 if (groups != NULL) {
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
723 msn_parse_addressbook_groups(session, groups);
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
724 }
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
725
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
726 /*add a default No group to set up the no group Membership*/
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
727 msn_group_new(session->userlist, MSN_INDIVIDUALS_GROUP_ID,
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
728 MSN_INDIVIDUALS_GROUP_NAME);
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
729 purple_debug_misc("msn", "AB group_id:%s name:%s\n",
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
730 MSN_INDIVIDUALS_GROUP_ID, MSN_INDIVIDUALS_GROUP_NAME);
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
731 if ((purple_find_group(MSN_INDIVIDUALS_GROUP_NAME)) == NULL){
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
732 PurpleGroup *g = purple_group_new(MSN_INDIVIDUALS_GROUP_NAME);
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
733 purple_blist_add_group(g, NULL);
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
734 }
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
735
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
736 /*add a default No group to set up the no group Membership*/
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
737 msn_group_new(session->userlist, MSN_NON_IM_GROUP_ID, MSN_NON_IM_GROUP_NAME);
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
738 purple_debug_misc("msn", "AB group_id:%s name:%s\n", MSN_NON_IM_GROUP_ID, MSN_NON_IM_GROUP_NAME);
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
739 if ((purple_find_group(MSN_NON_IM_GROUP_NAME)) == NULL) {
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
740 PurpleGroup *g = purple_group_new(MSN_NON_IM_GROUP_NAME);
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
741 purple_blist_add_group(g, NULL);
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
742 }
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
743
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
744 /*Process contact List*/
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
745 purple_debug_info("msn", "Process contact list...\n");
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
746 contacts = xmlnode_get_child(result, "contacts");
20522
177cad886d4c A bunch of MSNP14 stuff:
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20515
diff changeset
747 if (contacts != NULL) {
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
748 msn_parse_addressbook_contacts(session, contacts);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
749 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
750
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
751 abNode = xmlnode_get_child(result, "ab");
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
752 if (abNode != NULL) {
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
753 xmlnode *node2;
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
754 char *tmp = NULL;
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
755
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
756 if ((node2 = xmlnode_get_child(abNode, "lastChange")))
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
757 tmp = xmlnode_get_data(node2);
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
758 purple_debug_info("msn", "AB lastchanged Time:{%s}\n", tmp ? tmp : "(null)");
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
759 purple_account_set_string(session->account, "ablastChange", tmp);
20515
d21f4eae2c4c Store account specific settings in the account, not in some random blist
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20510
diff changeset
760
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
761 g_free(tmp); tmp = NULL;
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
762 if ((node2 = xmlnode_get_child(abNode, "DynamicItemLastChanged")))
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
763 tmp = xmlnode_get_data(node2);
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
764 purple_debug_info("msn", "AB DynamicItemLastChanged :{%s}\n", tmp ? tmp : "(null)");
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
765 purple_account_set_string(session->account, "DynamicItemLastChanged", tmp);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
766 g_free(tmp);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
767 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
768
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
769 return TRUE;
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
770 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
771
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
772 static void
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
773 msn_get_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
774 {
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
775 MsnSession *session = data;
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
776
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
777 if (resp == NULL)
20585
a82494142fe3 cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@pidgin.im>
parents: 20578
diff changeset
778 return;
a82494142fe3 cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@pidgin.im>
parents: 20578
diff changeset
779
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
780 g_return_if_fail(session != NULL);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
781
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
782 purple_debug_misc("msn", "Got the Address Book!\n");
20562
6ebd3000af51 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: 20560
diff changeset
783
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
784 if (msn_parse_addressbook(session, resp->xml)) {
23841
8b69edc386fe On MSN, always send the privacy settings and contact list after parsing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23833
diff changeset
785 msn_send_privacy(session->account->gc);
8b69edc386fe On MSN, always send the privacy settings and contact list after parsing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23833
diff changeset
786 msn_notification_dump_contact(session);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
787 } else {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
788 /* This is making us loop infinitely when we fail to parse the
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
789 address book, disable for now (we should re-enable when we
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
790 send timestamps)
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
791 */
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
792 /*
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
793 msn_get_address_book(session, NULL, NULL);
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
794 */
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
795 msn_session_disconnect(session);
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21160
diff changeset
796 purple_connection_error_reason(session->account->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to retrieve MSN Address Book"));
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
797 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
798 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
799
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
800 /*get the address book*/
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
801 void
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
802 msn_get_address_book(MsnSession *session,
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
803 MsnSoapPartnerScenario partner_scenario, const char *LastChanged,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
804 const char *dynamicItemLastChange)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
805 {
21376
e91c52220a41 merge_into_workspace of d270fe91b138cf35b88afe13ead7fe51a6f5f88e and
Ka-Hing Cheung <khc@pidgin.im>
parents: 20851 21368
diff changeset
806 char *body, *update_str = NULL;
24073
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
807 gchar *token_str;
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
808
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
809 purple_debug_misc("msn", "Getting Address Book\n");
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
810
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
811 /*build SOAP and POST it*/
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
812 if (dynamicItemLastChange != NULL)
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
813 update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML, dynamicItemLastChange);
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
814 else if (LastChanged != NULL)
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
815 update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML, LastChanged);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
816
24073
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
817 token_str = g_markup_escape_text(
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
818 msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS), -1);
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
819 body = g_strdup_printf(MSN_GET_ADDRESS_TEMPLATE,
23759
1abf46eeccec fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23758
diff changeset
820 MsnSoapPartnerScenarioText[partner_scenario],
24073
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
821 token_str,
23759
1abf46eeccec fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23758
diff changeset
822 update_str ? update_str : "");
24073
9c569eb69980 Remove calls to g_markup_escape_text. Not only does this help with old
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24072
diff changeset
823 g_free(token_str);
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
824
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
825 msn_soap_message_send(session,
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
826 msn_soap_message_new(MSN_GET_ADDRESS_SOAP_ACTION,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
827 xmlnode_from_str(body, -1)),
23925
aa38fbc30cfb Don't print SOAP messages to debug log for "secure" requests. This is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23841
diff changeset
828 MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL, FALSE,
aa38fbc30cfb Don't print SOAP messages to debug log for "secure" requests. This is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23841
diff changeset
829 msn_get_address_cb, session);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
830
21376
e91c52220a41 merge_into_workspace of d270fe91b138cf35b88afe13ead7fe51a6f5f88e and
Ka-Hing Cheung <khc@pidgin.im>
parents: 20851 21368
diff changeset
831 g_free(update_str);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
832 g_free(body);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
833 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
834
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
835 /***************************************************************
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
836 * Contact Operations
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
837 ***************************************************************/
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
838
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
839 static const char *
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
840 msn_contact_operation_str(MsnCallbackAction action)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
841 {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
842 /* Make sure this is large enough when adding more */
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
843 static char buf[BUF_LEN];
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
844 buf[0] = '\0';
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
845
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
846 if (action & MSN_ADD_BUDDY)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
847 strcat(buf, "Adding Buddy,");
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
848 if (action & MSN_MOVE_BUDDY)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
849 strcat(buf, "Moving Buddy,");
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
850 if (action & MSN_ACCEPTED_BUDDY)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
851 strcat(buf, "Accepted Buddy,");
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
852 if (action & MSN_DENIED_BUDDY)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
853 strcat(buf, "Denied Buddy,");
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
854 if (action & MSN_ADD_GROUP)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
855 strcat(buf, "Adding Group,");
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
856 if (action & MSN_DEL_GROUP)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
857 strcat(buf, "Deleting Group,");
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
858 if (action & MSN_RENAME_GROUP)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
859 strcat(buf, "Renaming Group,");
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
860 if (action & MSN_UPDATE_INFO)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
861 strcat(buf, "Updating Contact Info,");
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
862
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
863 return buf;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
864 }
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
865
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
866 static gboolean msn_contact_request(MsnCallbackState *state);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
867
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
868 static void
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
869 msn_contact_request_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
870 gpointer data)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
871 {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
872 MsnCallbackState *state = data;
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
873 xmlnode *fault;
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
874 char *faultcode_str;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
875
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
876 if (resp == NULL) {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
877 purple_debug_error("msn",
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
878 "Operation {%s} failed. No response received from server.\n",
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
879 msn_contact_operation_str(state->action));
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
880 return;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
881 }
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
882
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
883 fault = xmlnode_get_child(resp->xml, "Body/Fault");
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
884
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
885 if (fault == NULL) {
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
886 /* No errors */
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
887 if (state->cb)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
888 ((MsnSoapCallback)state->cb)(req, resp, data);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
889 msn_callback_state_free(state);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
890 return;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
891 }
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
892
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
893 faultcode_str = xmlnode_get_data(xmlnode_get_child(fault, "faultcode"));
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
894
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
895 if (faultcode_str && g_str_equal(faultcode_str, "q0:BadContextToken")) {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
896 purple_debug_info("msn",
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
897 "Contact Operation {%s} failed because of bad token."
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
898 " Updating token now and retrying operation.\n",
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
899 msn_contact_operation_str(state->action));
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
900 /* Token has expired, so renew it, and try again later */
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
901 msn_nexus_update_token(state->session->nexus, MSN_AUTH_CONTACTS,
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
902 (GSourceFunc)msn_contact_request, data);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
903 }
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
904 else
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
905 {
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
906 if (state->cb) {
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
907 ((MsnSoapCallback)state->cb)(req, resp, data);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
908 } else {
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
909 /* We don't know how to respond to this faultcode, so log it */
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
910 char *str = xmlnode_to_str(fault, NULL);
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
911 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n",
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
912 msn_contact_operation_str(state->action), str);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
913 g_free(str);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
914 }
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
915 msn_callback_state_free(state);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
916 }
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
917
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
918 g_free(faultcode_str);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
919 }
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
920
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
921 static gboolean
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
922 msn_contact_request(MsnCallbackState *state)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
923 {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
924 if (state->token == NULL)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
925 state->token = xmlnode_get_child(state->body,
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
926 "Header/ABAuthHeader/TicketToken");
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
927 /* delete old & replace with new token */
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
928 xmlnode_free(state->token->child);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
929 xmlnode_insert_data(state->token,
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
930 msn_nexus_get_token_str(state->session->nexus, MSN_AUTH_CONTACTS), -1);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
931 msn_soap_message_send(state->session,
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
932 msn_soap_message_new(state->post_action, xmlnode_copy(state->body)),
23925
aa38fbc30cfb Don't print SOAP messages to debug log for "secure" requests. This is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23841
diff changeset
933 MSN_CONTACT_SERVER, state->post_url, FALSE,
aa38fbc30cfb Don't print SOAP messages to debug log for "secure" requests. This is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23841
diff changeset
934 msn_contact_request_cb, state);
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
935 return FALSE;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
936 }
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
937
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
938 static void
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
939 msn_add_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
940 gpointer data)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
941 {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
942 MsnCallbackState *state = data;
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
943 MsnSession *session = state->session;
20585
a82494142fe3 cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@pidgin.im>
parents: 20578
diff changeset
944
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
945 MsnUserList *userlist;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
946 MsnUser *user;
24437
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
947 xmlnode *guid;
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
948
24778
f65c57af8698 Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24777
diff changeset
949 xmlnode *fault;
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
950
24783
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
951 g_return_if_fail(session != NULL);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
952 userlist = session->userlist;
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
953
24778
f65c57af8698 Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24777
diff changeset
954 fault = xmlnode_get_child(resp->xml, "Body/Fault");
f65c57af8698 Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24777
diff changeset
955 if (fault != NULL) {
f65c57af8698 Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24777
diff changeset
956 char *errorcode = xmlnode_get_data(xmlnode_get_child(fault, "detail/errorcode"));
f65c57af8698 Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24777
diff changeset
957 if (errorcode && !strcmp(errorcode, "EmailDomainIsFederated")) {
f65c57af8698 Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24777
diff changeset
958 /* Do something special! */
f65c57af8698 Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24777
diff changeset
959 purple_debug_error("msn", "Contact is from a federated domain, but don't know what to do yet!\n");
24783
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
960
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
961 } else if (errorcode && !strcmp(errorcode, "InvalidPassportUser")) {
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
962 PurpleBuddy *buddy = purple_find_buddy(session->account, state->who);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
963 char *str = g_strdup_printf(_("Unable to add \"%s\"."), state->who);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
964 purple_notify_error(state->session, _("Buddy Add error"), str,
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
965 _("The username specified does not exist."));
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
966 g_free(str);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
967 msn_userlist_rem_buddy(userlist, state->who);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
968 if (buddy != NULL)
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
969 purple_blist_remove_buddy(buddy);
24778
f65c57af8698 Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24777
diff changeset
970
24783
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
971 } else {
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
972 /* We don't know how to respond to this faultcode, so log it */
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
973 char *fault_str = xmlnode_to_str(fault, NULL);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
974 if (fault_str != NULL) {
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
975 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n",
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
976 msn_contact_operation_str(state->action), fault_str);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
977 g_free(fault_str);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
978 }
24778
f65c57af8698 Print a specific error to debug log about EmailDomainIsFederated error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24777
diff changeset
979 }
24783
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
980 return;
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
981 }
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
982
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
983 purple_debug_info("msn", "Contact added successfully\n");
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
984
23833
1a4c1d44858d Take care of more cleanup in the MSN code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23830
diff changeset
985 /* the code this block is replacing didn't send ADL for yahoo contacts,
1a4c1d44858d Take care of more cleanup in the MSN code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23830
diff changeset
986 * but i haven't confirmed this is WLM's behaviour wrt yahoo contacts
1a4c1d44858d Take care of more cleanup in the MSN code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23830
diff changeset
987 */
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
988 if ( !msn_user_is_yahoo(session->account, state->who) ) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
989 msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
990 msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL);
21376
e91c52220a41 merge_into_workspace of d270fe91b138cf35b88afe13ead7fe51a6f5f88e and
Ka-Hing Cheung <khc@pidgin.im>
parents: 20851 21368
diff changeset
991 }
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
992
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
993 user = msn_userlist_find_add_user(userlist, state->who, state->who);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
994 msn_user_add_group_id(user, state->guid);
24437
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
995
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
996 guid = xmlnode_get_child(resp->xml,
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
997 "Body/ABContactAddResponse/ABContactAddResult/guid");
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
998 if (guid != NULL) {
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
999 char *uid = xmlnode_get_data(guid);
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
1000 msn_user_set_uid(user, uid);
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
1001 purple_debug_info("msn", "Set %s guid to %s.\n", state->who, uid);
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
1002 g_free(uid);
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
1003 }
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1004 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1005
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1006 /* add a Contact in MSN_INDIVIDUALS_GROUP */
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1007 void
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1008 msn_add_contact(MsnSession *session, MsnCallbackState *state, const char *passport)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1009 {
24785
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1010 MsnUser *user;
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1011 gchar *body = NULL;
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1012 gchar *contact_xml = NULL;
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1013
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1014 #if 0
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1015 gchar *escaped_displayname;
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1016
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1017
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1018 if (displayname != NULL) {
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1019 escaped_displayname = g_markup_decode_text(displayname, -1);
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1020 } else {
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1021 escaped_displayname = passport;
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1022 }
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1023 contact_xml = g_strdup_printf(MSN_XML_ADD_CONTACT, escaped_displayname, passport);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1024 #endif
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1025
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1026 purple_debug_info("msn", "Adding contact %s to contact list\n", passport);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1027
24785
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1028 user = msn_userlist_find_user(session->userlist, passport);
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1029 if (user == NULL) {
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1030 purple_debug_warning("msn", "Unable to retrieve user %s from the userlist!\n", passport);
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1031 return; /* guess this never happened! */
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1032 }
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1033
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1034 if (user->networkid != MSN_NETWORK_PASSPORT) {
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1035 contact_xml = g_strdup_printf(MSN_CONTACT_EMAIL_XML,
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1036 user->networkid == MSN_NETWORK_YAHOO ?
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1037 "Messenger2" :
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1038 "Messenger3",
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1039 passport, 0);
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1040 } else {
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1041 contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport);
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1042 }
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1043 body = g_strdup_printf(MSN_ADD_CONTACT_TEMPLATE, contact_xml);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1044
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1045 state->body = xmlnode_from_str(body, -1);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1046 state->post_action = MSN_CONTACT_ADD_SOAP_ACTION;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1047 state->post_url = MSN_ADDRESS_BOOK_POST_URL;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1048 state->cb = msn_add_contact_read_cb;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1049 msn_contact_request(state);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1050
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1051 g_free(contact_xml);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1052 g_free(body);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1053 }
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1054
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1055 static void
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1056 msn_add_contact_to_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1057 gpointer data)
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1058 {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1059 MsnCallbackState *state = data;
24783
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1060 MsnSession *session = state->session;
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1061 MsnUserList *userlist;
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1062 xmlnode *fault;
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1063
24783
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1064 g_return_if_fail(session != NULL);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1065 userlist = session->userlist;
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1066
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1067 fault = xmlnode_get_child(resp->xml, "Body/Fault");
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1068 if (fault != NULL) {
24783
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1069 char *errorcode = xmlnode_get_data(xmlnode_get_child(fault, "detail/errorcode"));
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1070 if (errorcode && !strcmp(errorcode, "EmailDomainIsFederated")) {
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1071 /* Do something special! */
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1072 purple_debug_error("msn", "Contact is from a federated domain, but don't know what to do yet!\n");
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1073
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1074 } else if (errorcode && !strcmp(errorcode, "InvalidPassportUser")) {
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1075 PurpleBuddy *buddy = purple_find_buddy(session->account, state->who);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1076 char *str = g_strdup_printf(_("Unable to add \"%s\"."), state->who);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1077 purple_notify_error(session, _("Buddy Add error"), str,
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1078 _("The username specified does not exist."));
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1079 g_free(str);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1080 msn_userlist_rem_buddy(userlist, state->who);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1081 if (buddy != NULL)
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1082 purple_blist_remove_buddy(buddy);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1083
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1084 } else {
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1085 /* We don't know how to respond to this faultcode, so log it */
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1086 char *fault_str = xmlnode_to_str(fault, NULL);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1087 if (fault_str != NULL) {
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1088 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n",
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1089 msn_contact_operation_str(state->action), fault_str);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1090 g_free(fault_str);
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1091 }
6361c7e41b97 Handle the InvalidPassportUser response when adding buddies and report it to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24782
diff changeset
1092 }
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1093 return;
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1094 }
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1095
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1096 if (msn_userlist_add_buddy_to_group(userlist, state->who,
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1097 state->new_group_name)) {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1098 purple_debug_info("msn", "Contact %s added to group %s successfully!\n", state->who, state->new_group_name);
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1099 } else {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1100 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);
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1101 }
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1102
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1103 if (state->action & MSN_ADD_BUDDY) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1104 MsnUser *user = msn_userlist_find_user(userlist, state->who);
24437
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
1105 xmlnode *guid = xmlnode_get_child(resp->xml,
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
1106 "Body/ABGroupContactAddResponse/ABGroupContactAddResult/guid");
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
1107
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
1108 if (guid != NULL) {
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
1109 char *uid = xmlnode_get_data(guid);
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
1110 msn_user_set_uid(user, uid);
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
1111 purple_debug_info("msn", "Set %s guid to %s.\n", state->who, uid);
b29928b7857c Save the MSN ContactID after adding a buddy so it can be used for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24419
diff changeset
1112 g_free(uid);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1113 }
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1114
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1115 if ( !msn_user_is_yahoo(state->session->account, state->who) ) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1116 msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1117 msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1118 }
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1119
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1120 if (msn_userlist_user_is_in_list(user, MSN_LIST_PL)) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1121 msn_del_contact_from_list(state->session, NULL, state->who, MSN_LIST_PL);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1122 return;
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1123 }
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1124 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1125
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1126 if (state->action & MSN_MOVE_BUDDY) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1127 msn_del_contact_from_group(state->session, state->who, state->old_group_name);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1128 }
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1129 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1130
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1131 void
23776
7c9016406cf1 explicit merge of 'b99873683821d4c450ce32e4a93ba2831d7507cc'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23441 23773
diff changeset
1132 msn_add_contact_to_group(MsnSession *session, MsnCallbackState *state,
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1133 const char *passport, const char *groupId)
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1134 {
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1135 MsnUserList *userlist;
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1136 MsnUser *user;
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1137 gchar *body = NULL, *contact_xml;
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1138
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1139 g_return_if_fail(passport != NULL);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1140 g_return_if_fail(groupId != NULL);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1141
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1142 g_return_if_fail(session != NULL);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1143
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1144 userlist = session->userlist;
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1145
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1146 if (!strcmp(groupId, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(groupId, MSN_NON_IM_GROUP_ID)) {
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1147
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1148 user = msn_userlist_find_add_user(userlist, passport, passport);
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1149
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1150 if (state->action & MSN_ADD_BUDDY) {
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1151 msn_add_contact(session, state, passport);
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1152 return;
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1153 }
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1154
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1155 if (state->action & MSN_MOVE_BUDDY) {
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1156 msn_user_add_group_id(user, groupId);
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1157 msn_del_contact_from_group(session, passport, state->old_group_name);
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1158 }
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1159
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1160 return;
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1161 }
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1162
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1163 purple_debug_info("msn", "Adding user %s to group %s\n", passport,
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1164 msn_userlist_find_group_name(userlist, groupId));
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1165
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1166 user = msn_userlist_find_user(userlist, passport);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1167 if (user == NULL) {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1168 purple_debug_warning("msn", "Unable to retrieve user %s from the userlist!\n", passport);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1169 msn_callback_state_free(state);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1170 return; /* guess this never happened! */
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1171 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1172
24785
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1173 if (user->uid != NULL) {
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1174 contact_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid);
24785
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1175 } else if (user->networkid != MSN_NETWORK_PASSPORT) {
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1176 contact_xml = g_strdup_printf(MSN_CONTACT_EMAIL_XML,
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1177 user->networkid == MSN_NETWORK_YAHOO ?
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1178 "Messenger2" :
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1179 "Messenger3",
b0f31511b083 Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24783
diff changeset
1180 passport, 0);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1181 } else {
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1182 contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1183 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1184
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1185 body = g_strdup_printf(MSN_ADD_CONTACT_GROUP_TEMPLATE, groupId, contact_xml);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1186
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1187 state->body = xmlnode_from_str(body, -1);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1188 state->post_action = MSN_ADD_CONTACT_GROUP_SOAP_ACTION;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1189 state->post_url = MSN_ADDRESS_BOOK_POST_URL;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1190 state->cb = msn_add_contact_to_group_read_cb;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1191 msn_contact_request(state);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1192
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1193 g_free(contact_xml);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1194 g_free(body);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1195 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1196
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1197 static void
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1198 msn_delete_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1199 gpointer data)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1200 {
21376
e91c52220a41 merge_into_workspace of d270fe91b138cf35b88afe13ead7fe51a6f5f88e and
Ka-Hing Cheung <khc@pidgin.im>
parents: 20851 21368
diff changeset
1201 MsnCallbackState *state = data;
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1202 MsnUserList *userlist = state->session->userlist;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1203 MsnUser *user = msn_userlist_find_user_with_id(userlist, state->uid);
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1204 xmlnode *fault;
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1205
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1206 /* We don't know how to respond to this faultcode, so log it */
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1207 fault = xmlnode_get_child(resp->xml, "Body/Fault");
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1208 if (fault != NULL) {
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1209 char *fault_str = xmlnode_to_str(fault, NULL);
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1210 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n",
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1211 msn_contact_operation_str(state->action), fault_str);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1212 g_free(fault_str);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1213 return;
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1214 }
20609
b92d0b5ab89d 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: 20585
diff changeset
1215
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1216 purple_debug_info("msn", "Delete contact successful\n");
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1217
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1218 if (user != NULL) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1219 msn_userlist_remove_user(userlist, user);
20609
b92d0b5ab89d 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: 20585
diff changeset
1220 }
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1221 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1222
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1223 /*delete a Contact*/
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1224 void
24419
d093f97dcba7 Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24073
diff changeset
1225 msn_delete_contact(MsnSession *session, MsnUser *user)
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1226 {
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1227 gchar *body = NULL;
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1228 gchar *contact_id_xml = NULL ;
20609
b92d0b5ab89d 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: 20585
diff changeset
1229 MsnCallbackState *state;
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1230
24419
d093f97dcba7 Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24073
diff changeset
1231 if (user->uid != NULL) {
d093f97dcba7 Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24073
diff changeset
1232 contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid);
d093f97dcba7 Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24073
diff changeset
1233 purple_debug_info("msn", "Deleting contact with contactId: %s\n", user->uid);
d093f97dcba7 Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24073
diff changeset
1234 } else {
24780
a5995b315452 Deleting a contact without a ContactId doesn't work, so don't bother the server
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24779
diff changeset
1235 purple_debug_info("msn", "Unable to delete contact %s without a ContactId\n", user->passport);
a5995b315452 Deleting a contact without a ContactId doesn't work, so don't bother the server
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24779
diff changeset
1236 return;
24419
d093f97dcba7 Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24073
diff changeset
1237 }
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1238
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1239 state = msn_callback_state_new(session);
24419
d093f97dcba7 Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24073
diff changeset
1240 msn_callback_state_set_uid(state, user->uid);
20609
b92d0b5ab89d 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: 20585
diff changeset
1241
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1242 /* build SOAP request */
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1243 body = g_strdup_printf(MSN_DEL_CONTACT_TEMPLATE, contact_id_xml);
23759
1abf46eeccec fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23758
diff changeset
1244
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1245 state->body = xmlnode_from_str(body, -1);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1246 state->post_action = MSN_CONTACT_DEL_SOAP_ACTION;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1247 state->post_url = MSN_ADDRESS_BOOK_POST_URL;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1248 state->cb = msn_delete_contact_read_cb;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1249 msn_contact_request(state);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1250
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1251 g_free(contact_id_xml);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1252 g_free(body);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1253 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1254
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1255 static void
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1256 msn_del_contact_from_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1257 gpointer data)
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1258 {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1259 MsnCallbackState *state = data;
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1260 xmlnode *fault;
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1261
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1262 /* We don't know how to respond to this faultcode, so log it */
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1263 fault = xmlnode_get_child(resp->xml, "Body/Fault");
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1264 if (fault != NULL) {
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1265 char *fault_str = xmlnode_to_str(fault, NULL);
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1266 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n",
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1267 msn_contact_operation_str(state->action), fault_str);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1268 g_free(fault_str);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1269 return;
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1270 }
20585
a82494142fe3 cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@pidgin.im>
parents: 20578
diff changeset
1271
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1272 if (msn_userlist_rem_buddy_from_group(state->session->userlist,
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1273 state->who, state->old_group_name)) {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1274 purple_debug_info("msn", "Contact %s deleted successfully from group %s\n", state->who, state->old_group_name);
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1275 } else {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1276 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);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1277 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1278 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1279
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1280 void
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1281 msn_del_contact_from_group(MsnSession *session, const char *passport, const char *group_name)
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1282 {
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1283 MsnUserList * userlist;
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1284 MsnUser *user;
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1285 MsnCallbackState *state;
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1286 gchar *body, *contact_id_xml;
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1287 const gchar *groupId;
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1288
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1289 g_return_if_fail(passport != NULL);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1290 g_return_if_fail(group_name != NULL);
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1291 g_return_if_fail(session != NULL);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1292
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1293 userlist = session->userlist;
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1294
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1295 groupId = msn_userlist_find_group_id(userlist, group_name);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1296 if (groupId != NULL) {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1297 purple_debug_info("msn", "Deleting user %s from group %s\n", passport, group_name);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1298 } else {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1299 purple_debug_warning("msn", "Unable to retrieve group id from group %s !\n", group_name);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1300 return;
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1301 }
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1302
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1303 user = msn_userlist_find_user(userlist, passport);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1304
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1305 if (user == NULL) {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1306 purple_debug_warning("msn", "Unable to retrieve user from passport %s!\n", passport);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1307 return;
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1308 }
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1309
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1310 if ( !strcmp(groupId, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(groupId, MSN_NON_IM_GROUP_ID)) {
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1311 msn_user_remove_group_id(user, groupId);
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1312 return;
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1313 }
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1314
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1315 state = msn_callback_state_new(session);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1316 msn_callback_state_set_who(state, passport);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1317 msn_callback_state_set_guid(state, groupId);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1318 msn_callback_state_set_old_group_name(state, group_name);
20728
3b7c8c45f843 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 <datallah@pidgin.im>
parents: 20609
diff changeset
1319
24419
d093f97dcba7 Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24073
diff changeset
1320 if (user->uid != NULL)
d093f97dcba7 Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24073
diff changeset
1321 contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid);
d093f97dcba7 Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24073
diff changeset
1322 else
d093f97dcba7 Use the MSN passport in more places instead of the Contact ID if it's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24073
diff changeset
1323 contact_id_xml = g_strdup_printf(MSN_CONTACT_XML, passport);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1324 body = g_strdup_printf(MSN_CONTACT_DEL_GROUP_TEMPLATE, contact_id_xml, groupId);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1325
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1326 state->body = xmlnode_from_str(body, -1);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1327 state->post_action = MSN_CONTACT_DEL_GROUP_SOAP_ACTION;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1328 state->post_url = MSN_ADDRESS_BOOK_POST_URL;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1329 state->cb = msn_del_contact_from_group_read_cb;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1330 msn_contact_request(state);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1331
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1332 g_free(contact_id_xml);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1333 g_free(body);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1334 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1335
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1336
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1337 static void
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1338 msn_update_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1339 gpointer data)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1340 {
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1341 MsnCallbackState *state = (MsnCallbackState *)data;
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1342 xmlnode *fault;
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1343
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1344 /* We don't know how to respond to this faultcode, so log it */
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1345 fault = xmlnode_get_child(resp->xml, "Body/Fault");
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1346 if (fault != NULL) {
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1347 char *fault_str = xmlnode_to_str(fault, NULL);
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1348 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n",
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1349 msn_contact_operation_str(state->action), fault_str);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1350 g_free(fault_str);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1351 return;
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1352 }
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1353
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1354 purple_debug_info("msn", "Contact updated successfully\n");
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1355 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1356
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1357 /* Update a contact's info */
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1358 void
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1359 msn_update_contact(MsnSession *session, const char *passport, MsnContactUpdateType type, const char* value)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1360 {
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1361 MsnCallbackState *state;
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1362 xmlnode *contact;
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1363 xmlnode *contact_info;
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1364 xmlnode *changes;
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1365
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1366 purple_debug_info("msn", "Update contact information with new %s: %s\n",
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1367 type==MSN_UPDATE_DISPLAY ? "display name" : "alias", value);
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1368 purple_debug_info("msn", "passport=%s\n", passport);
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1369 g_return_if_fail(passport != NULL);
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1370 contact_info = xmlnode_new("contactInfo");
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1371 changes = xmlnode_new("propertiesChanged");
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1372
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1373 switch (type) {
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1374 xmlnode *annotations;
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1375 xmlnode *display;
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1376 xmlnode *a, *n, *v;
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1377 case MSN_UPDATE_DISPLAY:
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1378 display = xmlnode_new_child(contact_info, "displayName");
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1379 xmlnode_insert_data(display, value, -1);
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1380 xmlnode_insert_data(changes, "DisplayName", -1);
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1381 break;
20733
a179242f6bef Further cleanup of the msn prpl including preventing the authorization request callback from crashing if triggered after the account is disconnected. Also removal of some extraneous debuggery, there is more that needs to be removed.
Daniel Atallah <datallah@pidgin.im>
parents: 20728
diff changeset
1382
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1383 case MSN_UPDATE_ALIAS:
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1384 annotations = xmlnode_new_child(contact_info, "annotations");
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1385 xmlnode_insert_data(changes, "Annotation ", -1);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1386
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1387 a = xmlnode_new_child(annotations, "Annotation");
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1388 n = xmlnode_new_child(a, "Name");
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1389 xmlnode_insert_data(n, "AB.NickName", -1);
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1390 v = xmlnode_new_child(a, "Value");
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1391 xmlnode_insert_data(v, value, -1);
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1392 break;
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1393
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1394 default:
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1395 g_return_if_reached();
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1396 }
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1397
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1398
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1399
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1400 state = msn_callback_state_new(session);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1401
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1402 state->body = xmlnode_from_str(MSN_CONTACT_UPDATE_TEMPLATE, -1);
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1403 state->action = MSN_UPDATE_INFO;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1404 state->post_action = MSN_CONTACT_UPDATE_SOAP_ACTION;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1405 state->post_url = MSN_ADDRESS_BOOK_POST_URL;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1406 state->cb = msn_update_contact_read_cb;
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1407
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1408 contact = xmlnode_get_child(state->body, "Body/ABContactUpdate/contacts/Contact");
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1409 xmlnode_insert_child(contact, contact_info);
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1410 xmlnode_insert_child(contact, changes);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1411
23784
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1412 if (!strcmp(passport, "Me")) {
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1413 xmlnode *contactType = xmlnode_new_child(contact_info, "contactType");
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1414 xmlnode_insert_data(contactType, "Me", -1);
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1415 } else {
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1416 MsnUser *user = msn_userlist_find_user(session->userlist, passport);
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1417 xmlnode *contactId = xmlnode_new_child(contact, "contactId");
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1418 msn_callback_state_set_uid(state, user->uid);
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1419 xmlnode_insert_data(contactId, state->uid, -1);
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1420 }
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1421
f09ed4e732df Add real server-side aliasing to MSN.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23782
diff changeset
1422 msn_contact_request(state);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1423 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1424
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1425 static void
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1426 msn_del_contact_from_list_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1427 gpointer data)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1428 {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1429 MsnCallbackState *state = data;
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1430 MsnSession *session = state->session;
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1431 xmlnode *fault;
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1432
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1433 /* We don't know how to respond to this faultcode, so log it */
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1434 fault = xmlnode_get_child(resp->xml, "Body/Fault");
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1435 if (fault != NULL) {
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1436 char *fault_str = xmlnode_to_str(fault, NULL);
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1437 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n",
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1438 msn_contact_operation_str(state->action), fault_str);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1439 g_free(fault_str);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1440 return;
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1441 }
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1442
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1443 purple_debug_info("msn", "Contact %s deleted successfully from %s list on server!\n", state->who, MsnMemberRole[state->list_id]);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1444
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1445 if (state->list_id == MSN_LIST_PL) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1446 MsnUser *user = msn_userlist_find_user(session->userlist, state->who);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1447 MsnCallbackState *new_state = msn_callback_state_dup(state);
20850
8905d796644b Keep MsnUser->list_op in sync.
Carlos Silva <typ0@pidgin.im>
parents: 20849
diff changeset
1448
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1449 if (user != NULL)
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1450 msn_user_unset_op(user, MSN_LIST_PL_OP);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1451
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1452 msn_add_contact_to_list(session, new_state, state->who, MSN_LIST_RL);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1453 return;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1454 } else if (state->list_id == MSN_LIST_AL) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1455 purple_privacy_permit_remove(session->account, state->who, TRUE);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1456 msn_add_contact_to_list(session, NULL, state->who, MSN_LIST_BL);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1457 } else if (state->list_id == MSN_LIST_BL) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1458 purple_privacy_deny_remove(session->account, state->who, TRUE);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1459 msn_add_contact_to_list(session, NULL, state->who, MSN_LIST_AL);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1460 }
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1461
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1462 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1463
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1464 void
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1465 msn_del_contact_from_list(MsnSession *session, MsnCallbackState *state,
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1466 const gchar *passport, const MsnListId list)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1467 {
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1468 gchar *body = NULL, *member = NULL;
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1469 MsnSoapPartnerScenario partner_scenario;
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1470 MsnUser *user;
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1471
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1472 g_return_if_fail(session != NULL);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1473 g_return_if_fail(passport != NULL);
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1474 g_return_if_fail(list < 5);
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1475
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1476 purple_debug_info("msn", "Deleting contact %s from %s list\n", passport, MsnMemberRole[list]);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1477
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1478 if (state == NULL) {
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1479 state = msn_callback_state_new(session);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1480 }
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1481 msn_callback_state_set_list_id(state, list);
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1482 msn_callback_state_set_who(state, passport);
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1483
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1484 if (list == MSN_LIST_PL) {
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1485 g_return_if_fail(session->userlist != NULL);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1486
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1487 user = msn_userlist_find_user(session->userlist, passport);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1488
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1489 partner_scenario = MSN_PS_CONTACT_API;
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1490 member = g_strdup_printf(MSN_MEMBER_MEMBERSHIPID_XML, user->membership_id[MSN_LIST_PL]);
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1491 } else {
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1492 /* list == MSN_LIST_AL || list == MSN_LIST_BL */
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1493 partner_scenario = MSN_PS_BLOCK_UNBLOCK;
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1494
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1495 member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, passport);
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1496 }
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1497
24782
9ec0db5da66f Fix a typo in a name.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24781
diff changeset
1498 body = g_strdup_printf(MSN_CONTACT_DELETE_FROM_LIST_TEMPLATE,
23759
1abf46eeccec fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23758
diff changeset
1499 MsnSoapPartnerScenarioText[partner_scenario],
1abf46eeccec fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23758
diff changeset
1500 MsnMemberRole[list], member);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1501
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1502 state->body = xmlnode_from_str(body, -1);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1503 state->post_action = MSN_DELETE_MEMBER_FROM_LIST_SOAP_ACTION;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1504 state->post_url = MSN_SHARE_POST_URL;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1505 state->cb = msn_del_contact_from_list_read_cb;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1506 msn_contact_request(state);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1507
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1508 g_free(member);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1509 g_free(body);
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1510 }
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1511
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1512 static void
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1513 msn_add_contact_to_list_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1514 gpointer data)
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1515 {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1516 MsnCallbackState *state = data;
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1517 xmlnode *fault;
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1518
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1519 /* We don't know how to respond to this faultcode, so log it */
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1520 fault = xmlnode_get_child(resp->xml, "Body/Fault");
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1521 if (fault != NULL) {
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1522 char *fault_str = xmlnode_to_str(fault, NULL);
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1523 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n",
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1524 msn_contact_operation_str(state->action), fault_str);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1525 g_free(fault_str);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1526 return;
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1527 }
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1528
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1529 g_return_if_fail(state->session != NULL);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1530
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1531 purple_debug_info("msn", "Contact %s added successfully to %s list on server!\n", state->who, MsnMemberRole[state->list_id]);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1532
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1533 if (state->list_id == MSN_LIST_RL) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1534 MsnUser *user = msn_userlist_find_user(state->session->userlist, state->who);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1535
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1536 if (user != NULL) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1537 msn_user_set_op(user, MSN_LIST_RL_OP);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1538 }
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1539
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1540 if (state->action & MSN_DENIED_BUDDY) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1541 msn_add_contact_to_list(state->session, NULL, state->who, MSN_LIST_BL);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1542 } else if (state->list_id == MSN_LIST_AL) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1543 purple_privacy_permit_add(state->session->account, state->who, TRUE);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1544 } else if (state->list_id == MSN_LIST_BL) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1545 purple_privacy_deny_add(state->session->account, state->who, TRUE);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1546 }
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1547 }
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1548 }
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1549
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1550 void
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1551 msn_add_contact_to_list(MsnSession *session, MsnCallbackState *state,
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1552 const gchar *passport, const MsnListId list)
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1553 {
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1554 gchar *body = NULL, *member = NULL;
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1555 MsnSoapPartnerScenario partner_scenario;
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1556
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1557 g_return_if_fail(session != NULL);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1558 g_return_if_fail(passport != NULL);
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1559 g_return_if_fail(list < 5);
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1560
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1561 purple_debug_info("msn", "Adding contact %s to %s list\n", passport, MsnMemberRole[list]);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1562
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1563 if (state == NULL) {
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1564 state = msn_callback_state_new(session);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1565 }
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1566 msn_callback_state_set_list_id(state, list);
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1567 msn_callback_state_set_who(state, passport);
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1568
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1569 partner_scenario = (list == MSN_LIST_RL) ? MSN_PS_CONTACT_API : MSN_PS_BLOCK_UNBLOCK;
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1570
21402
798a9b9c2ae6 fix allowing to be added, some old fix was lost during one of the merges
Ka-Hing Cheung <khc@pidgin.im>
parents: 21390
diff changeset
1571 member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, state->who);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1572
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1573 body = g_strdup_printf(MSN_CONTACT_ADD_TO_LIST_TEMPLATE,
23759
1abf46eeccec fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23758
diff changeset
1574 MsnSoapPartnerScenarioText[partner_scenario],
1abf46eeccec fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23758
diff changeset
1575 MsnMemberRole[list], member);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1576
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1577 state->body = xmlnode_from_str(body, -1);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1578 state->post_action = MSN_ADD_MEMBER_TO_LIST_SOAP_ACTION;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1579 state->post_url = MSN_SHARE_POST_URL;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1580 state->cb = msn_add_contact_to_list_read_cb;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1581 msn_contact_request(state);
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20567
diff changeset
1582
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1583 g_free(member);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1584 g_free(body);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1585 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1586
20510
cba185e9a346 Fix a compile warning by #if 0'ing out some unused code
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20486
diff changeset
1587 #if 0
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1588 static void
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1589 msn_gleams_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1590 {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1591 purple_debug_info("msn", "Gleams read done\n");
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1592 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1593
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1594 /*get the gleams info*/
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1595 void
23771
c98f7e879218 killing MsnContact which just wraps MsnSession
Ka-Hing Cheung <khc@pidgin.im>
parents: 23765
diff changeset
1596 msn_get_gleams(MsnSession *session)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1597 {
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1598 MsnSoapReq *soap_request;
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1599
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1600 purple_debug_info("msn", "msn get gleams info...\n");
23776
7c9016406cf1 explicit merge of 'b99873683821d4c450ce32e4a93ba2831d7507cc'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23441 23773
diff changeset
1601
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1602 state = msn_callback_state_new(session);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1603 state->body = xmlnode_from_str(MSN_GLEAMS_TEMPLATE, -1);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1604 state->post_action = MSN_GET_GLEAMS_SOAP_ACTION;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1605 state->post_url = MSN_ADDRESS_BOOK_POST_URL;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1606 state->cb = msn_gleams_read_cb;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1607 msn_contact_request(state);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1608 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1609 #endif
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1610
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1611
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1612 /***************************************************************
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1613 * Group Operations
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1614 ***************************************************************/
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1615
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1616 static void
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1617 msn_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1618 {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1619 MsnCallbackState *state = data;
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1620 MsnSession *session;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1621 MsnUserList *userlist;
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1622 xmlnode *fault;
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1623
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1624 /* We don't know how to respond to this faultcode, so log it */
24781
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1625 fault = xmlnode_get_child(resp->xml, "Body/Fault");
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1626 if (fault != NULL) {
5c1d0615a168 Split up that faultcode stuff I just changed. Stops it from printing an annoying
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24780
diff changeset
1627 char *fault_str = xmlnode_to_str(fault, NULL);
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1628 purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n",
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1629 msn_contact_operation_str(state->action), fault_str);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1630 g_free(fault_str);
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1631 return;
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1632 }
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1633
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1634 purple_debug_info("msn", "Group request successful.\n");
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1635
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1636 g_return_if_fail(state->session != NULL);
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1637 g_return_if_fail(state->session->userlist != NULL);
20585
a82494142fe3 cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@pidgin.im>
parents: 20578
diff changeset
1638
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1639 session = state->session;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1640 userlist = session->userlist;
20585
a82494142fe3 cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@pidgin.im>
parents: 20578
diff changeset
1641
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1642 if (state->action & MSN_RENAME_GROUP) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1643 msn_userlist_rename_group_id(session->userlist,
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1644 state->guid,
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1645 state->new_group_name);
20585
a82494142fe3 cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@pidgin.im>
parents: 20578
diff changeset
1646 }
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1647
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1648 if (state->action & MSN_ADD_GROUP) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1649 /* the response is taken from
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1650 http://telepathy.freedesktop.org/wiki/Pymsn/MSNP/ContactListActions
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1651 should copy it to msnpiki some day */
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1652 xmlnode *guid_node = xmlnode_get_child(resp->xml,
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1653 "Body/ABGroupAddResponse/ABGroupAddResult/guid");
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1654
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1655 if (guid_node) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1656 char *guid = xmlnode_get_data(guid_node);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1657
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1658 /* create and add the new group to the userlist */
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1659 purple_debug_info("msn", "Adding group %s with guid = %s to the userlist\n", state->new_group_name, guid);
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1660 msn_group_new(session->userlist, guid, state->new_group_name);
20560
79e9c94c34db Add the possibility to create an Address Book, useful for newly registered MSN users.
Carlos Silva <typ0@pidgin.im>
parents: 20550
diff changeset
1661
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1662 if (state->action & MSN_ADD_BUDDY) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1663 msn_userlist_add_buddy(session->userlist,
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1664 state->who,
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1665 state->new_group_name);
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1666 } else if (state->action & MSN_MOVE_BUDDY) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1667 /* This will be freed when the add contact callback fires */
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1668 MsnCallbackState *new_state = msn_callback_state_dup(state);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1669 msn_add_contact_to_group(session, new_state, state->who, guid);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1670 g_free(guid);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1671 return;
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1672 }
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1673 g_free(guid);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1674 } else {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1675 purple_debug_info("msn", "Adding group %s failed\n",
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1676 state->new_group_name);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1677 }
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1678 }
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1679
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1680 if (state->action & MSN_DEL_GROUP) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1681 GList *l;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1682
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1683 msn_userlist_remove_group_id(session->userlist, state->guid);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1684 for (l = userlist->users; l != NULL; l = l->next) {
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1685 msn_user_remove_group_id( (MsnUser *)l->data, state->guid);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1686 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1687 }
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1688 }
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1689
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1690 /* add group */
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1691 void
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1692 msn_add_group(MsnSession *session, MsnCallbackState *state, const char* group_name)
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1693 {
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1694 char *body = NULL;
23758
873b77e99c8e Patch 4 from Qulogic, this one fixes a group name escape bug introduced by
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23757
diff changeset
1695 char *escaped_group_name = NULL;
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1696
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1697 g_return_if_fail(session != NULL);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1698 g_return_if_fail(group_name != NULL);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1699
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1700 purple_debug_info("msn", "Adding group %s to contact list.\n", group_name);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1701
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1702 if (state == NULL) {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1703 state = msn_callback_state_new(session);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1704 }
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1705
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1706 msn_callback_state_set_action(state, MSN_ADD_GROUP);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1707 msn_callback_state_set_new_group_name(state, group_name);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1708
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1709 /* escape group name's html special chars so it can safely be sent
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1710 * in a XML SOAP request
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1711 */
23758
873b77e99c8e Patch 4 from Qulogic, this one fixes a group name escape bug introduced by
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23757
diff changeset
1712 escaped_group_name = g_markup_escape_text(group_name, -1);
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1713 body = g_strdup_printf(MSN_GROUP_ADD_TEMPLATE, escaped_group_name);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1714
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1715 state->body = xmlnode_from_str(body, -1);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1716 state->post_action = MSN_GROUP_ADD_SOAP_ACTION;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1717 state->post_url = MSN_ADDRESS_BOOK_POST_URL;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1718 state->cb = msn_group_read_cb;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1719 msn_contact_request(state);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1720
23759
1abf46eeccec fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23758
diff changeset
1721 g_free(escaped_group_name);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1722 g_free(body);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1723 }
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1724
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1725 /* delete group */
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1726 void
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1727 msn_del_group(MsnSession *session, const gchar *group_name)
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1728 {
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1729 MsnCallbackState *state;
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1730 char *body = NULL;
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1731 const gchar *guid;
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1732
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1733 g_return_if_fail(session != NULL);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1734
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1735 g_return_if_fail(group_name != NULL);
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1736 purple_debug_info("msn", "Deleting group %s from contact list\n", group_name);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1737
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1738 guid = msn_userlist_find_group_id(session->userlist, group_name);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1739
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1740 /* if group uid we need to del is NULL,
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1741 * we need to delete nothing
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1742 */
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1743 if (guid == NULL) {
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1744 purple_debug_info("msn", "Group %s guid not found, returning.\n", group_name);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1745 return;
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1746 }
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1747
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1748 if ( !strcmp(guid, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(guid, MSN_NON_IM_GROUP_ID) ) {
23833
1a4c1d44858d Take care of more cleanup in the MSN code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23830
diff changeset
1749 /* XXX add back PurpleGroup since it isn't really removed in the server? */
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1750 return;
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1751 }
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1752
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1753 state = msn_callback_state_new(session);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1754 msn_callback_state_set_action(state, MSN_DEL_GROUP);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1755 msn_callback_state_set_guid(state, guid);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1756
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1757 body = g_strdup_printf(MSN_GROUP_DEL_TEMPLATE, guid);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1758
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1759 state->body = xmlnode_from_str(body, -1);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1760 state->post_action = MSN_GROUP_DEL_SOAP_ACTION;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1761 state->post_url = MSN_ADDRESS_BOOK_POST_URL;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1762 state->cb = msn_group_read_cb;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1763 msn_contact_request(state);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1764
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1765 g_free(body);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1766 }
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1767
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1768 /* rename group */
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1769 void
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1770 msn_contact_rename_group(MsnSession *session, const char *old_group_name, const char *new_group_name)
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1771 {
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1772 gchar *body = NULL;
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1773 const gchar * guid;
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1774 MsnCallbackState *state;
23758
873b77e99c8e Patch 4 from Qulogic, this one fixes a group name escape bug introduced by
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23757
diff changeset
1775 char *escaped_group_name;
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1776
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1777 g_return_if_fail(session != NULL);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1778 g_return_if_fail(session->userlist != NULL);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1779 g_return_if_fail(old_group_name != NULL);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1780 g_return_if_fail(new_group_name != NULL);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1781
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23819
diff changeset
1782 purple_debug_info("msn", "Renaming group %s to %s.\n", old_group_name, new_group_name);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1783
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1784 guid = msn_userlist_find_group_id(session->userlist, old_group_name);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1785 if (guid == NULL)
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1786 return;
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1787
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1788 state = msn_callback_state_new(session);
20564
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1789 msn_callback_state_set_guid(state, guid);
35675dd4a44d Make buddy and group management actually work, add some SOAP templates, redesign some parts of code and separate some bigger functions into its smaller tasks which are completely unrelated to each other
Carlos Silva <typ0@pidgin.im>
parents: 20562
diff changeset
1790 msn_callback_state_set_new_group_name(state, new_group_name);
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1791
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1792 if ( !strcmp(guid, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(guid, MSN_NON_IM_GROUP_ID) ) {
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1793 MsnCallbackState *new_state = msn_callback_state_dup(state);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1794 msn_add_group(session, new_state, new_group_name);
23833
1a4c1d44858d Take care of more cleanup in the MSN code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23830
diff changeset
1795 /* XXX move every buddy there (we probably need to fix concurrent SOAP reqs first) */
20567
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1796 }
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1797
2417aff6ff3b Handle special cases in buddy/group management (wrt MSN_INDIVIDUALS_GROUP and MSN_NON_IM_GROUP).
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
1798 msn_callback_state_set_action(state, MSN_RENAME_GROUP);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22981
diff changeset
1799
23758
873b77e99c8e Patch 4 from Qulogic, this one fixes a group name escape bug introduced by
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23757
diff changeset
1800 escaped_group_name = g_markup_escape_text(new_group_name, -1);
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1801 body = g_strdup_printf(MSN_GROUP_RENAME_TEMPLATE, guid, escaped_group_name);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1802
23782
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1803 state->body = xmlnode_from_str(body, -1);
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1804 state->post_action = MSN_GROUP_RENAME_SOAP_ACTION;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1805 state->post_url = MSN_ADDRESS_BOOK_POST_URL;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1806 state->cb = msn_group_read_cb;
56c9f93017e1 Update MSN Contact tokens when an invalid token error is returned.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23776
diff changeset
1807 msn_contact_request(state);
21368
d270fe91b138 finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@pidgin.im>
parents: 20585
diff changeset
1808
23759
1abf46eeccec fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23758
diff changeset
1809 g_free(escaped_group_name);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1810 g_free(body);
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents:
diff changeset
1811 }
24777
88a91411beb5 Send the SOAP faultcode to the callbacks for each Contact operation. They all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24776
diff changeset
1812

mercurial