libpurple/protocols/msn/user.c

Mon, 28 Feb 2011 07:12:27 +0000

author
Mark Doliner <markdoliner@pidgin.im>
date
Mon, 28 Feb 2011 07:12:27 +0000
changeset 31482
a189fa1292c9
parent 31240
db0cb3d72bc9
child 31478
a6ff60b58148
permissions
-rw-r--r--

Fix a memleak in the MSN prpl when removing a buddy from your buddy list.
We needed to call msn_user_unref() after calling msn_userlist_remove_user()

I chose to fix this by changing msn_userlist_add_user() and
msn_userlist_remove_user() to incremend and decrement the reference counter
themselves--after all, they ARE the ones who add/remove a reference to
the MsnUser struct. Conceptually I thought this made the most sense.

5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file user.c User functions
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15602
diff changeset
4 * purple
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15602
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
9198
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
8 * source distribution.
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
9 *
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * (at your option) any later version.
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 *
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * GNU General Public License for more details.
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 *
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16912
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 */
30945
b875cf477e19 Remove unnecesary includes from msn.h.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30944
diff changeset
24
30961
885064b16c54 Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30945
diff changeset
25 #include "internal.h"
30945
b875cf477e19 Remove unnecesary includes from msn.h.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30944
diff changeset
26 #include "debug.h"
31021
e1fc8202950d Fix a bad behavior when talking with users using multiple locations. The
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31019
diff changeset
27 #include "util.h"
30945
b875cf477e19 Remove unnecesary includes from msn.h.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30944
diff changeset
28
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 #include "user.h"
9860
8f54a6091294 [gaim-migrate @ 10739]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 9776
diff changeset
30 #include "slp.h"
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31
30927
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
32 static void free_user_endpoint(MsnUserEndpoint *data)
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
33 {
30928
c44ebbf7d687 Need to add back this g_free.
Mark Doliner <markdoliner@pidgin.im>
parents: 30927
diff changeset
34 g_free(data->id);
30927
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
35 g_free(data->name);
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
36 g_free(data);
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
37 }
29439
38c32318156c Don't leak the Endpoint ID.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29436
diff changeset
38
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
39 /*new a user object*/
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 MsnUser *
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
41 msn_user_new(MsnUserList *userlist, const char *passport,
23783
cf52f8bc3b93 Remove MSN's use of a "store name" in favour of the "friendly name"
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23441
diff changeset
42 const char *friendly_name)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 {
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 MsnUser *user;
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
46 user = g_new0(MsnUser, 1);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
48 user->userlist = userlist;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
50 msn_user_set_passport(user, passport);
23783
cf52f8bc3b93 Remove MSN's use of a "store name" in favour of the "friendly name"
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23441
diff changeset
51 msn_user_set_friendly_name(user, friendly_name);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52
30941
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
53 return msn_user_ref(user);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
56 /*destroy a user object*/
30944
4f1fc7c401fd Remove msn_user_destroy in favor of msn_user_unref.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30941
diff changeset
57 static void
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 msn_user_destroy(MsnUser *user)
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 {
30927
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
60 while (user->endpoints != NULL) {
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
61 free_user_endpoint(user->endpoints->data);
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
62 user->endpoints = g_slist_delete_link(user->endpoints, user->endpoints);
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
63 }
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
64
5475
a2f856cac665 [gaim-migrate @ 5871]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
65 if (user->clientcaps != NULL)
a2f856cac665 [gaim-migrate @ 5871]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
66 g_hash_table_destroy(user->clientcaps);
5316
ec9cbe50e70c [gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
67
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
68 if (user->group_ids != NULL)
20508
a8855578906a Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20494
diff changeset
69 {
13899
495981413953 [gaim-migrate @ 17055]
Ma Yuan <mayuan2006@gmail.com>
parents: 13893
diff changeset
70 GList *l;
20508
a8855578906a Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20494
diff changeset
71 for (l = user->group_ids; l != NULL; l = l->next)
a8855578906a Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20494
diff changeset
72 {
13899
495981413953 [gaim-migrate @ 17055]
Ma Yuan <mayuan2006@gmail.com>
parents: 13893
diff changeset
73 g_free(l->data);
495981413953 [gaim-migrate @ 17055]
Ma Yuan <mayuan2006@gmail.com>
parents: 13893
diff changeset
74 }
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
75 g_list_free(user->group_ids);
13899
495981413953 [gaim-migrate @ 17055]
Ma Yuan <mayuan2006@gmail.com>
parents: 13893
diff changeset
76 }
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
77
6800
8f99c220b503 [gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents: 6788
diff changeset
78 if (user->msnobj != NULL)
8f99c220b503 [gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents: 6788
diff changeset
79 msn_object_destroy(user->msnobj);
8f99c220b503 [gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents: 6788
diff changeset
80
13695
64da09d24cbe [gaim-migrate @ 16096]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12315
diff changeset
81 g_free(user->passport);
64da09d24cbe [gaim-migrate @ 16096]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12315
diff changeset
82 g_free(user->friendly_name);
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
83 g_free(user->uid);
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
84 if (user->extinfo) {
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
85 g_free(user->extinfo->media_album);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
86 g_free(user->extinfo->media_artist);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
87 g_free(user->extinfo->media_title);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
88 g_free(user->extinfo->phone_home);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
89 g_free(user->extinfo->phone_mobile);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
90 g_free(user->extinfo->phone_work);
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
91 g_free(user->extinfo);
29281
276f50ebf4d3 Keep CurrentMedia in a separate object outside of MsnUser that needs to
Mark Doliner <markdoliner@pidgin.im>
parents: 28665
diff changeset
92 }
21906
3827b1442a73 memleak fixes
Ka-Hing Cheung <khc@pidgin.im>
parents: 21453
diff changeset
93 g_free(user->statusline);
27101
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
94 g_free(user->invite_message);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 g_free(user);
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98
30941
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
99 MsnUser *
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
100 msn_user_ref(MsnUser *user)
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
101 {
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
102 g_return_val_if_fail(user != NULL, NULL);
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
103
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
104 user->refcount++;
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
105
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
106 return user;
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
107 }
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
108
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
109 void
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
110 msn_user_unref(MsnUser *user)
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
111 {
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
112 g_return_if_fail(user != NULL);
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
113
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
114 user->refcount--;
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
115
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
116 if(user->refcount == 0)
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
117 msn_user_destroy(user);
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
118 }
a715275f60ae Add ref/unref support to MsnUser.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30936
diff changeset
119
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 void
10451
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
121 msn_user_update(MsnUser *user)
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
122 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15602
diff changeset
123 PurpleAccount *account;
23810
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
124 gboolean offline;
10451
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
125
24169
e7a20691ba4e Don't crash if user == NULL in a couple more places. Not exactly the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23869
diff changeset
126 g_return_if_fail(user != NULL);
e7a20691ba4e Don't crash if user == NULL in a couple more places. Not exactly the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23869
diff changeset
127
10451
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
128 account = user->userlist->session->account;
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
129
23810
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
130 offline = (user->status == NULL);
22711
16e50aae4932 some other mobile stuff that Maiku fixed, fixes #2359
Ka-Hing Cheung <khc@pidgin.im>
parents: 21906
diff changeset
131
23810
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
132 if (!offline) {
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
133 purple_prpl_got_user_status(account, user->passport, user->status,
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
134 "message", user->statusline, NULL);
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
135 } else {
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
136 if (user->mobile) {
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
137 purple_prpl_got_user_status(account, user->passport, "mobile", NULL);
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
138 purple_prpl_got_user_status(account, user->passport, "available", NULL);
22711
16e50aae4932 some other mobile stuff that Maiku fixed, fixes #2359
Ka-Hing Cheung <khc@pidgin.im>
parents: 21906
diff changeset
139 } else {
23810
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
140 purple_prpl_got_user_status(account, user->passport, "offline", NULL);
22711
16e50aae4932 some other mobile stuff that Maiku fixed, fixes #2359
Ka-Hing Cheung <khc@pidgin.im>
parents: 21906
diff changeset
141 }
23810
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
142 }
22711
16e50aae4932 some other mobile stuff that Maiku fixed, fixes #2359
Ka-Hing Cheung <khc@pidgin.im>
parents: 21906
diff changeset
143
23810
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
144 if (!offline || !user->mobile) {
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
145 purple_prpl_got_user_status_deactive(account, user->passport, "mobile");
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
146 }
21193
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20597
diff changeset
147
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
148 if (!offline && user->extinfo && user->extinfo->media_type != CURRENT_MEDIA_UNKNOWN) {
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
149 if (user->extinfo->media_type == CURRENT_MEDIA_MUSIC) {
24771
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24169
diff changeset
150 purple_prpl_got_user_status(account, user->passport, "tune",
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
151 PURPLE_TUNE_ARTIST, user->extinfo->media_artist,
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
152 PURPLE_TUNE_ALBUM, user->extinfo->media_album,
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
153 PURPLE_TUNE_TITLE, user->extinfo->media_title,
24771
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24169
diff changeset
154 NULL);
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
155 } else if (user->extinfo->media_type == CURRENT_MEDIA_GAMES) {
24771
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24169
diff changeset
156 purple_prpl_got_user_status(account, user->passport, "tune",
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
157 "game", user->extinfo->media_title,
24771
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24169
diff changeset
158 NULL);
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
159 } else if (user->extinfo->media_type == CURRENT_MEDIA_OFFICE) {
24771
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24169
diff changeset
160 purple_prpl_got_user_status(account, user->passport, "tune",
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
161 "office", user->extinfo->media_title,
24771
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24169
diff changeset
162 NULL);
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24169
diff changeset
163 } else {
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24169
diff changeset
164 purple_debug_warning("msn", "Got CurrentMedia with unknown type %d.\n",
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
165 user->extinfo->media_type);
24771
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24169
diff changeset
166 }
23810
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
167 } else {
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
168 purple_prpl_got_user_status_deactive(account, user->passport, "tune");
15602
6d1d20a9e297 This is my attempt at MSN mobile status, but I suspect MSN mobile status doesn't exist. If it's confirmed that it doesn't, I'll revert this. But I want to keep it for posterity, in case it does exist
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
169 }
10451
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
170
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
171 if (user->idle)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15602
diff changeset
172 purple_prpl_got_user_idle(account, user->passport, TRUE, -1);
10451
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
173 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15602
diff changeset
174 purple_prpl_got_user_idle(account, user->passport, FALSE, 0);
10451
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
175 }
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
176
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
177 void
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
178 msn_user_set_state(MsnUser *user, const char *state)
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
179 {
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
180 const char *status;
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
181
24169
e7a20691ba4e Don't crash if user == NULL in a couple more places. Not exactly the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23869
diff changeset
182 g_return_if_fail(user != NULL);
e7a20691ba4e Don't crash if user == NULL in a couple more places. Not exactly the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23869
diff changeset
183
23810
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
184 if (state == NULL) {
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
185 user->status = NULL;
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
186 return;
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
187 }
55d608317926 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23793
diff changeset
188
10451
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
189 if (!g_ascii_strcasecmp(state, "BSY"))
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
190 status = "busy";
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
191 else if (!g_ascii_strcasecmp(state, "BRB"))
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
192 status = "brb";
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
193 else if (!g_ascii_strcasecmp(state, "AWY"))
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
194 status = "away";
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
195 else if (!g_ascii_strcasecmp(state, "PHN"))
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
196 status = "phone";
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
197 else if (!g_ascii_strcasecmp(state, "LUN"))
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
198 status = "lunch";
31187
74d004ec56f2 Add the HDN status to status parsing, which means invisible, but you'd
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31116
diff changeset
199 else if (!g_ascii_strcasecmp(state, "HDN"))
74d004ec56f2 Add the HDN status to status parsing, which means invisible, but you'd
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31116
diff changeset
200 status = NULL;
10451
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
201 else
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
202 status = "available";
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
203
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
204 if (!g_ascii_strcasecmp(state, "IDL"))
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
205 user->idle = TRUE;
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
206 else
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
207 user->idle = FALSE;
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
208
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
209 user->status = status;
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
210 }
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
211
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
212 void
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213 msn_user_set_passport(MsnUser *user, const char *passport)
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 {
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 g_return_if_fail(user != NULL);
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216
13695
64da09d24cbe [gaim-migrate @ 16096]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12315
diff changeset
217 g_free(user->passport);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 user->passport = g_strdup(passport);
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220
25533
e00f6966801d Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24779
diff changeset
221 gboolean
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
222 msn_user_set_friendly_name(MsnUser *user, const char *name)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223 {
25558
94aa46eb4604 Fix this compile warning:
Mark Doliner <markdoliner@pidgin.im>
parents: 25533
diff changeset
224 g_return_val_if_fail(user != NULL, FALSE);
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225
28665
3ac533844419 Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27101
diff changeset
226 if (user->friendly_name && name && (!strcmp(user->friendly_name, name) ||
3ac533844419 Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27101
diff changeset
227 !strcmp(user->passport, name)))
25533
e00f6966801d Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24779
diff changeset
228 return FALSE;
e00f6966801d Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24779
diff changeset
229
13695
64da09d24cbe [gaim-migrate @ 16096]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12315
diff changeset
230 g_free(user->friendly_name);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
231 user->friendly_name = g_strdup(name);
25533
e00f6966801d Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24779
diff changeset
232
28665
3ac533844419 Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27101
diff changeset
233 serv_got_alias(purple_account_get_connection(user->userlist->session->account),
3ac533844419 Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27101
diff changeset
234 user->passport, name);
25533
e00f6966801d Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24779
diff changeset
235 return TRUE;
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
236 }
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
238 void
13888
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13870
diff changeset
239 msn_user_set_statusline(MsnUser *user, const char *statusline)
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13870
diff changeset
240 {
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13870
diff changeset
241 g_return_if_fail(user != NULL);
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13870
diff changeset
242
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13870
diff changeset
243 g_free(user->statusline);
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13870
diff changeset
244 user->statusline = g_strdup(statusline);
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13870
diff changeset
245 }
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13870
diff changeset
246
bda6f562e1e6 [gaim-migrate @ 17003]
Ma Yuan <mayuan2006@gmail.com>
parents: 13870
diff changeset
247 void
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
248 msn_user_set_uid(MsnUser *user, const char *uid)
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
249 {
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
250 g_return_if_fail(user != NULL);
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
251
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
252 g_free(user->uid);
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
253 user->uid = g_strdup(uid);
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
254 }
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
255
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
256 void
30927
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
257 msn_user_set_endpoint_data(MsnUser *user, const char *input, MsnUserEndpoint *newep)
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
258 {
30927
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
259 MsnUserEndpoint *ep;
29443
465c6d8d30ae Endpoint names are case-insensitive, so put the id in lowercase always.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29439
diff changeset
260 char *endpoint;
30927
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
261 GSList *l;
29443
465c6d8d30ae Endpoint names are case-insensitive, so put the id in lowercase always.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29439
diff changeset
262
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
263 g_return_if_fail(user != NULL);
29443
465c6d8d30ae Endpoint names are case-insensitive, so put the id in lowercase always.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29439
diff changeset
264 g_return_if_fail(input != NULL);
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
265
29443
465c6d8d30ae Endpoint names are case-insensitive, so put the id in lowercase always.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29439
diff changeset
266 endpoint = g_ascii_strdown(input, -1);
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
267
30927
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
268 for (l = user->endpoints; l; l = l->next) {
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
269 ep = l->data;
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
270 if (g_str_equal(ep->id, endpoint)) {
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
271 /* We have info about this endpoint! */
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
272
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
273 g_free(endpoint);
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
274
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
275 if (newep == NULL) {
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
276 /* Delete it and exit */
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
277 user->endpoints = g_slist_delete_link(user->endpoints, l);
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
278 free_user_endpoint(ep);
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
279 return;
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
280 }
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
281
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
282 /* Break out of our loop and update it */
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
283 break;
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
284 }
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
285 }
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
286 if (l == NULL) {
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
287 /* Need to add a new endpoint */
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
288 ep = g_new0(MsnUserEndpoint, 1);
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
289 ep->id = endpoint;
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
290 user->endpoints = g_slist_prepend(user->endpoints, ep);
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
291 }
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
292
30927
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
293 ep->clientid = newep->clientid;
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
294 ep->extcaps = newep->extcaps;
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
295 }
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
296
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
297 void
31200
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
298 msn_user_clear_endpoints(MsnUser *user)
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
299 {
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
300 MsnUserEndpoint *ep;
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
301 GSList *l;
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
302
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
303 g_return_if_fail(user != NULL);
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
304
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
305 for (l = user->endpoints; l; l = g_slist_delete_link(l, l)) {
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
306 ep = l->data;
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
307 free_user_endpoint(ep);
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
308 }
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
309
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
310 user->endpoints = NULL;
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
311 }
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
312
0f59dbdb51c1 Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31187
diff changeset
313 void
29306
dff954e98aea Use our MsnListOp enum in more places instead of int. I'm assuming
Mark Doliner <markdoliner@pidgin.im>
parents: 29300
diff changeset
314 msn_user_set_op(MsnUser *user, MsnListOp list_op)
13910
fb8f57c2b934 [gaim-migrate @ 17481]
Ma Yuan <mayuan2006@gmail.com>
parents: 13900
diff changeset
315 {
20508
a8855578906a Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20494
diff changeset
316 g_return_if_fail(user != NULL);
a8855578906a Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20494
diff changeset
317
13910
fb8f57c2b934 [gaim-migrate @ 17481]
Ma Yuan <mayuan2006@gmail.com>
parents: 13900
diff changeset
318 user->list_op |= list_op;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
319 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
320
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
321 void
29306
dff954e98aea Use our MsnListOp enum in more places instead of int. I'm assuming
Mark Doliner <markdoliner@pidgin.im>
parents: 29300
diff changeset
322 msn_user_unset_op(MsnUser *user, MsnListOp list_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: 20564
diff changeset
323 {
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
324 g_return_if_fail(user != NULL);
23441
fd45c23a3eb2 Delete trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 22737
diff changeset
325
20569
66628c75dada Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20564
diff changeset
326 user->list_op &= ~list_op;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
329 void
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
330 msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img)
7590
54b26062c7e0 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
331 {
22653
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21906
diff changeset
332 MsnObject *msnobj;
7590
54b26062c7e0 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
333
54b26062c7e0 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
334 g_return_if_fail(user != NULL);
54b26062c7e0 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
335
22653
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21906
diff changeset
336 msnobj = msn_object_new_from_image(img, "TFR2C2.tmp",
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21906
diff changeset
337 user->passport, MSN_OBJECT_USERTILE);
7590
54b26062c7e0 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
338
22653
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21906
diff changeset
339 if (!msnobj)
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21906
diff changeset
340 purple_debug_error("msn", "Unable to open buddy icon from %s!\n", user->passport);
7590
54b26062c7e0 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
341
22653
bed3d8152a58 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21906
diff changeset
342 msn_user_set_object(user, msnobj);
7590
54b26062c7e0 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
343 }
54b26062c7e0 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
344
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
345 /*add group id to User object*/
7590
54b26062c7e0 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
346 void
23869
e650ca347f69 Fix a double free when connecting to the sender of a bonjour file fails. Also plug a small leak. Fixes #5971.
Daniel Atallah <datallah@pidgin.im>
parents: 23830
diff changeset
347 msn_user_add_group_id(MsnUser *user, const char* group_id)
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
348 {
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
349 MsnUserList *userlist;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15602
diff changeset
350 PurpleAccount *account;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15602
diff changeset
351 PurpleBuddy *b;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15602
diff changeset
352 PurpleGroup *g;
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
353 const char *passport;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
354 const char *group_name;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
355
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
356 g_return_if_fail(user != NULL);
23869
e650ca347f69 Fix a double free when connecting to the sender of a bonjour file fails. Also plug a small leak. Fixes #5971.
Daniel Atallah <datallah@pidgin.im>
parents: 23830
diff changeset
357 g_return_if_fail(group_id != NULL);
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
358
23869
e650ca347f69 Fix a double free when connecting to the sender of a bonjour file fails. Also plug a small leak. Fixes #5971.
Daniel Atallah <datallah@pidgin.im>
parents: 23830
diff changeset
359 user->group_ids = g_list_append(user->group_ids, g_strdup(group_id));
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
360
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
361 userlist = user->userlist;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
362 account = userlist->session->account;
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
363 passport = msn_user_get_passport(user);
9198
e8eb6d5eb9eb [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
364
13899
495981413953 [gaim-migrate @ 17055]
Ma Yuan <mayuan2006@gmail.com>
parents: 13893
diff changeset
365 group_name = msn_userlist_find_group_name(userlist, group_id);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
366
23830
1436e3de5d6c The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23810
diff changeset
367 purple_debug_info("msn", "User: group id:%s,name:%s,user:%s\n", group_id, group_name, passport);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
368
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15602
diff changeset
369 g = purple_find_group(group_name);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
370
23869
e650ca347f69 Fix a double free when connecting to the sender of a bonjour file fails. Also plug a small leak. Fixes #5971.
Daniel Atallah <datallah@pidgin.im>
parents: 23830
diff changeset
371 if ((group_id == NULL) && (g == NULL))
10451
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
372 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15602
diff changeset
373 g = purple_group_new(group_name);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15602
diff changeset
374 purple_blist_add_group(g, NULL);
10451
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
375 }
2df35a139363 [gaim-migrate @ 11717]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10388
diff changeset
376
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15602
diff changeset
377 b = purple_find_buddy_in_group(account, passport, g);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
378 if (b == NULL)
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
379 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15602
diff changeset
380 b = purple_buddy_new(account, passport, NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15602
diff changeset
381 purple_blist_add_buddy(b, NULL, g, NULL);
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
382 }
24946
390536329dc5 Some more PurpleBuddy::proto_data related changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24169
diff changeset
383 purple_buddy_set_protocol_data(b, user);
13910
fb8f57c2b934 [gaim-migrate @ 17481]
Ma Yuan <mayuan2006@gmail.com>
parents: 13900
diff changeset
384 /*Update the blist Node info*/
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
385 }
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
386
13893
228bc0341563 [gaim-migrate @ 17034]
Ma Yuan <mayuan2006@gmail.com>
parents: 13888
diff changeset
387 /*check if the msn user is online*/
228bc0341563 [gaim-migrate @ 17034]
Ma Yuan <mayuan2006@gmail.com>
parents: 13888
diff changeset
388 gboolean
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents: 20474 15884
diff changeset
389 msn_user_is_online(PurpleAccount *account, const char *name)
13893
228bc0341563 [gaim-migrate @ 17034]
Ma Yuan <mayuan2006@gmail.com>
parents: 13888
diff changeset
390 {
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents: 20474 15884
diff changeset
391 PurpleBuddy *buddy;
13893
228bc0341563 [gaim-migrate @ 17034]
Ma Yuan <mayuan2006@gmail.com>
parents: 13888
diff changeset
392
24169
e7a20691ba4e Don't crash if user == NULL in a couple more places. Not exactly the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23869
diff changeset
393 buddy = purple_find_buddy(account, name);
20478
46933dc62880 propagate from branch 'im.pidgin.pidgin' (head 88b7040408c88e4516c008f4eac579f98ef53e85)
Richard Laager <rlaager@pidgin.im>
parents: 20474 15884
diff changeset
394 return PURPLE_BUDDY_IS_ONLINE(buddy);
13893
228bc0341563 [gaim-migrate @ 17034]
Ma Yuan <mayuan2006@gmail.com>
parents: 13888
diff changeset
395 }
228bc0341563 [gaim-migrate @ 17034]
Ma Yuan <mayuan2006@gmail.com>
parents: 13888
diff changeset
396
13900
ce507a208510 [gaim-migrate @ 17056]
Ma Yuan <mayuan2006@gmail.com>
parents: 13899
diff changeset
397 gboolean
20519
35db99dd2ece Fix msn_user_remove_group_id()
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20508
diff changeset
398 msn_user_is_yahoo(PurpleAccount *account, const char *name)
13900
ce507a208510 [gaim-migrate @ 17056]
Ma Yuan <mayuan2006@gmail.com>
parents: 13899
diff changeset
399 {
20530
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20528
diff changeset
400 MsnSession *session = NULL;
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20528
diff changeset
401 MsnUser *user;
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20528
diff changeset
402 PurpleConnection *gc;
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20528
diff changeset
403
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20528
diff changeset
404 gc = purple_account_get_connection(account);
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20528
diff changeset
405 if (gc != NULL)
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20528
diff changeset
406 session = gc->proto_data;
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20528
diff changeset
407
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20528
diff changeset
408 if ((session != NULL) && (user = msn_userlist_find_user(session->userlist, name)) != NULL)
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20528
diff changeset
409 {
23790
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
410 return (user->networkid == MSN_NETWORK_YAHOO);
20530
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20528
diff changeset
411 }
0178f0d66bf0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20528
diff changeset
412 return (strstr(name,"@yahoo.") != NULL);
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
413 }
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
414
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
415 void
20519
35db99dd2ece Fix msn_user_remove_group_id()
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20508
diff changeset
416 msn_user_remove_group_id(MsnUser *user, const char *id)
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
417 {
20519
35db99dd2ece Fix msn_user_remove_group_id()
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20508
diff changeset
418 GList *l;
35db99dd2ece Fix msn_user_remove_group_id()
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20508
diff changeset
419
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
420 g_return_if_fail(user != NULL);
13855
24cff9e060d7 [gaim-migrate @ 16507]
Ma Yuan <mayuan2006@gmail.com>
parents: 13713
diff changeset
421 g_return_if_fail(id != NULL);
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
422
20519
35db99dd2ece Fix msn_user_remove_group_id()
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20508
diff changeset
423 l = g_list_find_custom(user->group_ids, id, (GCompareFunc)strcmp);
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
424
20519
35db99dd2ece Fix msn_user_remove_group_id()
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20508
diff changeset
425 if (l == NULL)
35db99dd2ece Fix msn_user_remove_group_id()
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20508
diff changeset
426 return;
35db99dd2ece Fix msn_user_remove_group_id()
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20508
diff changeset
427
35db99dd2ece Fix msn_user_remove_group_id()
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20508
diff changeset
428 g_free(l->data);
21063
911e85f207c7 Fix some leaks caused by misuse of g_list_remove_link() instead of g_list_delete_link().
Daniel Atallah <datallah@pidgin.im>
parents: 21029
diff changeset
429 user->group_ids = g_list_delete_link(user->group_ids, l);
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
430 }
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
431
6701
7e2db9273748 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
432 void
24779
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
433 msn_user_set_pending_group(MsnUser *user, const char *group)
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
434 {
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
435 user->pending_group = g_strdup(group);
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
436 }
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
437
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
438 char *
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
439 msn_user_remove_pending_group(MsnUser *user)
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
440 {
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
441 char *group = user->pending_group;
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
442 user->pending_group = NULL;
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
443 return group;
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
444 }
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
445
b348af6b49a9 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24771
diff changeset
446 void
5363
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
447 msn_user_set_home_phone(MsnUser *user, const char *number)
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
448 {
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
449 g_return_if_fail(user != NULL);
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
450
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
451 if (!number && !user->extinfo)
29282
8bd020863f49 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <markdoliner@pidgin.im>
parents: 29281
diff changeset
452 return;
8bd020863f49 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <markdoliner@pidgin.im>
parents: 29281
diff changeset
453
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
454 if (user->extinfo)
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
455 g_free(user->extinfo->phone_home);
29282
8bd020863f49 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <markdoliner@pidgin.im>
parents: 29281
diff changeset
456 else
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
457 user->extinfo = g_new0(MsnUserExtendedInfo, 1);
29282
8bd020863f49 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <markdoliner@pidgin.im>
parents: 29281
diff changeset
458
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
459 user->extinfo->phone_home = g_strdup(number);
5363
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
460 }
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
461
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
462 void
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
463 msn_user_set_work_phone(MsnUser *user, const char *number)
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
464 {
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
465 g_return_if_fail(user != NULL);
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
466
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
467 if (!number && !user->extinfo)
29282
8bd020863f49 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <markdoliner@pidgin.im>
parents: 29281
diff changeset
468 return;
8bd020863f49 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <markdoliner@pidgin.im>
parents: 29281
diff changeset
469
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
470 if (user->extinfo)
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
471 g_free(user->extinfo->phone_work);
29282
8bd020863f49 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <markdoliner@pidgin.im>
parents: 29281
diff changeset
472 else
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
473 user->extinfo = g_new0(MsnUserExtendedInfo, 1);
29282
8bd020863f49 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <markdoliner@pidgin.im>
parents: 29281
diff changeset
474
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
475 user->extinfo->phone_work = g_strdup(number);
5363
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
476 }
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
477
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
478 void
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
479 msn_user_set_mobile_phone(MsnUser *user, const char *number)
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
480 {
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
481 g_return_if_fail(user != NULL);
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
482
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
483 if (!number && !user->extinfo)
29282
8bd020863f49 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <markdoliner@pidgin.im>
parents: 29281
diff changeset
484 return;
8bd020863f49 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <markdoliner@pidgin.im>
parents: 29281
diff changeset
485
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
486 if (user->extinfo)
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
487 g_free(user->extinfo->phone_mobile);
29282
8bd020863f49 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <markdoliner@pidgin.im>
parents: 29281
diff changeset
488 else
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
489 user->extinfo = g_new0(MsnUserExtendedInfo, 1);
29282
8bd020863f49 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <markdoliner@pidgin.im>
parents: 29281
diff changeset
490
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
491 user->extinfo->phone_mobile = g_strdup(number);
5363
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
492 }
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
493
6788
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
494 void
23790
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
495 msn_user_set_clientid(MsnUser *user, guint clientid)
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
496 {
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
497 g_return_if_fail(user != NULL);
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
498
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
499 user->clientid = clientid;
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
500 }
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
501
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
502 void
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
503 msn_user_set_extcaps(MsnUser *user, guint extcaps)
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
504 {
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
505 g_return_if_fail(user != NULL);
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
506
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
507 user->extcaps = extcaps;
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
508 }
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
509
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
510 void
23790
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
511 msn_user_set_network(MsnUser *user, MsnNetwork network)
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
512 {
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
513 g_return_if_fail(user != NULL);
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
514
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
515 user->networkid = network;
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
516 }
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
517
31037
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
518 static gboolean
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
519 buddy_icon_cached(PurpleConnection *gc, MsnObject *obj)
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
520 {
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
521 PurpleAccount *account;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
522 PurpleBuddy *buddy;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
523 const char *old;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
524 const char *new;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
525
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
526 g_return_val_if_fail(obj != NULL, FALSE);
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
527
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
528 account = purple_connection_get_account(gc);
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
529
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
530 buddy = purple_find_buddy(account, msn_object_get_creator(obj));
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
531 if (buddy == NULL)
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
532 return FALSE;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
533
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
534 old = purple_buddy_icons_get_checksum_for_user(buddy);
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
535 new = msn_object_get_sha1(obj);
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
536
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
537 if (new == NULL)
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
538 return FALSE;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
539
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
540 /* If the old and new checksums are the same, and the file actually exists,
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
541 * then return TRUE */
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
542 if (old != NULL && !strcmp(old, new))
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
543 return TRUE;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
544
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
545 return FALSE;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
546 }
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
547
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
548 static void
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
549 queue_buddy_icon_request(MsnUser *user)
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
550 {
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
551 PurpleAccount *account;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
552 MsnObject *obj;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
553 GQueue *queue;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
554
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
555 g_return_if_fail(user != NULL);
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
556
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
557 account = user->userlist->session->account;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
558
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
559 obj = msn_user_get_object(user);
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
560
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
561 if (obj == NULL) {
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
562 purple_buddy_icons_set_for_user(account, user->passport, NULL, 0, NULL);
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
563 return;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
564 }
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
565
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
566 if (!buddy_icon_cached(account->gc, obj)) {
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
567 MsnUserList *userlist;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
568
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
569 userlist = user->userlist;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
570 queue = userlist->buddy_icon_requests;
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
571
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
572 if (purple_debug_is_verbose())
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
573 purple_debug_info("msn", "Queueing buddy icon request for %s (buddy_icon_window = %i)\n",
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
574 user->passport, userlist->buddy_icon_window);
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
575
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
576 g_queue_push_tail(queue, user);
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
577
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
578 if (userlist->buddy_icon_window > 0)
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
579 msn_release_buddy_icon_request(userlist);
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
580 }
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
581 }
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
582
23790
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
583 void
6788
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
584 msn_user_set_object(MsnUser *user, MsnObject *obj)
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
585 {
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
586 g_return_if_fail(user != NULL);
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
587
31063
7df334acf090 Don't destroy our local object storing the display picture when a NLN command show us the same MsnObject.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31037
diff changeset
588 if (user->msnobj != NULL && !msn_object_find_local(msn_object_get_sha1(obj)))
6788
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
589 msn_object_destroy(user->msnobj);
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
590
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
591 user->msnobj = obj;
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
592
29464
536884b02b88 disapproval of revision '1e785cb597e8dad4ba1b32c6a36dd630f41fc329'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29436
diff changeset
593 if (user->list_op & MSN_LIST_FL_OP)
31037
457c61e53d50 Move queue logic in requesting user display out of slp code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31021
diff changeset
594 queue_buddy_icon_request(user);
6788
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
595 }
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
596
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
597 void
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
598 msn_user_set_client_caps(MsnUser *user, GHashTable *info)
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
599 {
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
600 g_return_if_fail(user != NULL);
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
601 g_return_if_fail(info != NULL);
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
602
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
603 if (user->clientcaps != NULL)
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
604 g_hash_table_destroy(user->clientcaps);
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
605
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
606 user->clientcaps = info;
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
607 }
5363
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
608
27101
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
609 void
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
610 msn_user_set_invite_message(MsnUser *user, const char *message)
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
611 {
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
612 g_return_if_fail(user != NULL);
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
613
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
614 g_free(user->invite_message);
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
615 user->invite_message = g_strdup(message);
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
616 }
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
617
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
618 const char *
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
619 msn_user_get_passport(const MsnUser *user)
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
620 {
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
621 g_return_val_if_fail(user != NULL, NULL);
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
622
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
623 return user->passport;
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
624 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
625
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
626 const char *
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
627 msn_user_get_friendly_name(const MsnUser *user)
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
628 {
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
629 g_return_val_if_fail(user != NULL, NULL);
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
630
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
631 return user->friendly_name;
5309
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
632 }
3178acad1449 [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
633
9193
6e76f1367896 [gaim-migrate @ 9988]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 8475
diff changeset
634 const char *
5363
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
635 msn_user_get_home_phone(const MsnUser *user)
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
636 {
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
637 g_return_val_if_fail(user != NULL, NULL);
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
638
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
639 return user->extinfo ? user->extinfo->phone_home : NULL;
5363
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
640 }
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
641
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
642 const char *
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
643 msn_user_get_work_phone(const MsnUser *user)
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
644 {
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
645 g_return_val_if_fail(user != NULL, NULL);
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
646
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
647 return user->extinfo ? user->extinfo->phone_work : NULL;
5363
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
648 }
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
649
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
650 const char *
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
651 msn_user_get_mobile_phone(const MsnUser *user)
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
652 {
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
653 g_return_val_if_fail(user != NULL, NULL);
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
654
29300
8d9c8a4a03af Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <markdoliner@pidgin.im>
parents: 29282
diff changeset
655 return user->extinfo ? user->extinfo->phone_mobile : NULL;
5363
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
656 }
b6e28be0c9bd [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5316
diff changeset
657
23790
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
658 guint
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
659 msn_user_get_clientid(const MsnUser *user)
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
660 {
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
661 g_return_val_if_fail(user != NULL, 0);
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
662
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
663 return user->clientid;
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
664 }
eb49b07a62d6 Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23783
diff changeset
665
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
666 guint
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
667 msn_user_get_extcaps(const MsnUser *user)
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
668 {
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
669 g_return_val_if_fail(user != NULL, 0);
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
670
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
671 return user->extcaps;
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
672 }
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
673
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
674 MsnUserEndpoint *
29444
09f82938321c Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29443
diff changeset
675 msn_user_get_endpoint_data(MsnUser *user, const char *input)
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
676 {
29444
09f82938321c Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29443
diff changeset
677 char *endpoint;
30927
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
678 GSList *l;
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
679 MsnUserEndpoint *ep;
29444
09f82938321c Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29443
diff changeset
680
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
681 g_return_val_if_fail(user != NULL, NULL);
29444
09f82938321c Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29443
diff changeset
682 g_return_val_if_fail(input != NULL, NULL);
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
683
29444
09f82938321c Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29443
diff changeset
684 endpoint = g_ascii_strdown(input, -1);
30927
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
685
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
686 for (l = user->endpoints; l; l = l->next) {
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
687 ep = l->data;
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
688 if (g_str_equal(ep->id, endpoint)) {
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
689 g_free(endpoint);
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
690 return ep;
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
691 }
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
692 }
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
693
29444
09f82938321c Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29443
diff changeset
694 g_free(endpoint);
09f82938321c Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29443
diff changeset
695
30927
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
696 return NULL;
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
697 }
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
698
6788
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
699 MsnObject *
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
700 msn_user_get_object(const MsnUser *user)
5316
ec9cbe50e70c [gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
701 {
6788
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
702 g_return_val_if_fail(user != NULL, NULL);
5316
ec9cbe50e70c [gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
703
6788
26d148d26f2f [gaim-migrate @ 7327]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
704 return user->msnobj;
5316
ec9cbe50e70c [gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
705 }
ec9cbe50e70c [gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
706
ec9cbe50e70c [gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
707 GHashTable *
5475
a2f856cac665 [gaim-migrate @ 5871]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
708 msn_user_get_client_caps(const MsnUser *user)
5316
ec9cbe50e70c [gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
709 {
ec9cbe50e70c [gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
710 g_return_val_if_fail(user != NULL, NULL);
ec9cbe50e70c [gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
711
5475
a2f856cac665 [gaim-migrate @ 5871]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
712 return user->clientcaps;
5316
ec9cbe50e70c [gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
713 }
27101
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
714
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
715 const char *
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
716 msn_user_get_invite_message(const MsnUser *user)
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
717 {
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
718 g_return_val_if_fail(user != NULL, NULL);
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
719
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
720 return user->invite_message;
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
721 }
754a5afb2df7 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
722
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
723 gboolean
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
724 msn_user_is_capable(MsnUser *user, char *endpoint, guint capability, guint extcap)
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
725 {
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
726 g_return_val_if_fail(user != NULL, FALSE);
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
727
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
728 if (endpoint != NULL) {
30927
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
729 MsnUserEndpoint *ep = msn_user_get_endpoint_data(user, endpoint);
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
730 if (ep != NULL)
30927
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
731 return (ep->clientid & capability) && (ep->extcaps & extcap);
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
732 else
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
733 return FALSE;
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
734 }
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
735
30927
ca3c59bdc5d3 Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <markdoliner@pidgin.im>
parents: 30924
diff changeset
736 return (user->clientid & capability) && (user->extcaps & extcap);
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
737 }
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
738
30936
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
739 /**************************************************************************
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
740 * Utility functions
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
741 **************************************************************************/
29422
70d641613755 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28665
diff changeset
742
31019
d5560bd5f1c0 Move an user utility function to User.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30961
diff changeset
743 int
d5560bd5f1c0 Move an user utility function to User.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30961
diff changeset
744 msn_user_passport_cmp(MsnUser *user, const char *passport)
d5560bd5f1c0 Move an user utility function to User.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30961
diff changeset
745 {
31082
58956c5274b1 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31078
diff changeset
746 const char *str;
58956c5274b1 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31078
diff changeset
747 char *pass;
58956c5274b1 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31078
diff changeset
748 int result;
31019
d5560bd5f1c0 Move an user utility function to User.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30961
diff changeset
749
31082
58956c5274b1 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31078
diff changeset
750 str = purple_normalize_nocase(NULL, msn_user_get_passport(user));
58956c5274b1 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31078
diff changeset
751 pass = g_strdup(str);
31019
d5560bd5f1c0 Move an user utility function to User.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30961
diff changeset
752
31116
3bfb30fac095 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <markdoliner@pidgin.im>
parents: 31082
diff changeset
753 #if GLIB_CHECK_VERSION(2,16,0)
31082
58956c5274b1 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31078
diff changeset
754 result = g_strcmp0(pass, purple_normalize_nocase(NULL, passport));
31116
3bfb30fac095 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <markdoliner@pidgin.im>
parents: 31082
diff changeset
755 #else
3bfb30fac095 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <markdoliner@pidgin.im>
parents: 31082
diff changeset
756 str = purple_normalize_nocase(NULL, passport);
3bfb30fac095 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <markdoliner@pidgin.im>
parents: 31082
diff changeset
757 if (!pass)
3bfb30fac095 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <markdoliner@pidgin.im>
parents: 31082
diff changeset
758 result = -(pass != str);
3bfb30fac095 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <markdoliner@pidgin.im>
parents: 31082
diff changeset
759 else if (!str)
3bfb30fac095 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <markdoliner@pidgin.im>
parents: 31082
diff changeset
760 result = pass != str;
3bfb30fac095 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <markdoliner@pidgin.im>
parents: 31082
diff changeset
761 else
3bfb30fac095 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <markdoliner@pidgin.im>
parents: 31082
diff changeset
762 result = strcmp(pass, str);
3bfb30fac095 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <markdoliner@pidgin.im>
parents: 31082
diff changeset
763 #endif /* GLIB < 2.16.0 */
3bfb30fac095 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <markdoliner@pidgin.im>
parents: 31082
diff changeset
764
31082
58956c5274b1 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31078
diff changeset
765 g_free(pass);
58956c5274b1 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31078
diff changeset
766
58956c5274b1 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31078
diff changeset
767 return result;
31019
d5560bd5f1c0 Move an user utility function to User.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30961
diff changeset
768 }
d5560bd5f1c0 Move an user utility function to User.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30961
diff changeset
769
30936
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
770 gboolean
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
771 msn_user_is_in_group(MsnUser *user, const char * group_id)
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
772 {
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
773 if (user == NULL)
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
774 return FALSE;
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
775
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
776 if (group_id == NULL)
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
777 return FALSE;
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
778
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
779 return (g_list_find_custom(user->group_ids, group_id, (GCompareFunc)strcmp)) != NULL;
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
780 }
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
781
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
782 gboolean
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
783 msn_user_is_in_list(MsnUser *user, MsnListId list_id)
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
784 {
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
785 if (user == NULL)
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
786 return FALSE;
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
787
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
788 return (user->list_op & (1 << list_id));
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
789 }
8beec3081849 This are MsnUser functions, move them there.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30928
diff changeset
790

mercurial