annotate libpurple/protocols/msn/user.c @ 31196:230caecf5435

Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
author masca@cpw.pidgin.im
date Fri, 28 May 2010 22:45:52 +0000
parents a99b6dcdb60d
children 2327aa51a780
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file user.c User functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15541
diff changeset
4 * purple
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15541
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16867
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 */
31180
a99b6dcdb60d Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents: 31179
diff changeset
24
31196
230caecf5435 Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
masca@cpw.pidgin.im
parents: 31180
diff changeset
25 #include "internal.h"
31180
a99b6dcdb60d Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents: 31179
diff changeset
26 #include "debug.h"
a99b6dcdb60d Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents: 31179
diff changeset
27
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "user.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "slp.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30
31166
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
31 static void free_user_endpoint(MsnUserEndpoint *data)
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
32 {
31167
edb7c80bf930 Need to add back this g_free.
Mark Doliner <mark@kingant.net>
parents: 31166
diff changeset
33 g_free(data->id);
31166
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
34 g_free(data->name);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
35 g_free(data);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
36 }
31114
43cf75e21702 Don't leak the Endpoint ID.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31111
diff changeset
37
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
38 /*new a user object*/
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 MsnUser *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 msn_user_new(MsnUserList *userlist, const char *passport,
23516
5a6cf27ead31 Remove MSN's use of a "store name" in favour of the "friendly name"
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23300
diff changeset
41 const char *friendly_name)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 MsnUser *user;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 user = g_new0(MsnUser, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 user->userlist = userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 msn_user_set_passport(user, passport);
23516
5a6cf27ead31 Remove MSN's use of a "store name" in favour of the "friendly name"
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23300
diff changeset
50 msn_user_set_friendly_name(user, friendly_name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51
31176
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
52 return msn_user_ref(user);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
55 /*destroy a user object*/
31179
417899347f8a Remove msn_user_destroy in favor of msn_user_unref.
masca@cpw.pidgin.im
parents: 31176
diff changeset
56 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 msn_user_destroy(MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60
31176
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
61 if (user->refcount > 1) {
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
62 msn_user_unref(user);
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
63 return;
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
64 }
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
65
31166
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
66 while (user->endpoints != NULL) {
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
67 free_user_endpoint(user->endpoints->data);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
68 user->endpoints = g_slist_delete_link(user->endpoints, user->endpoints);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
69 }
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
70
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 if (user->clientcaps != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 g_hash_table_destroy(user->clientcaps);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 if (user->group_ids != NULL)
20425
5048651671e1 Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <stu@nosnilmot.com>
parents: 20411
diff changeset
75 {
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
76 GList *l;
20425
5048651671e1 Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <stu@nosnilmot.com>
parents: 20411
diff changeset
77 for (l = user->group_ids; l != NULL; l = l->next)
5048651671e1 Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <stu@nosnilmot.com>
parents: 20411
diff changeset
78 {
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
79 g_free(l->data);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
80 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 g_list_free(user->group_ids);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
82 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 if (user->msnobj != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 msn_object_destroy(user->msnobj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 g_free(user->passport);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 g_free(user->friendly_name);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
89 g_free(user->uid);
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
90 if (user->extinfo) {
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
91 g_free(user->extinfo->media_album);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
92 g_free(user->extinfo->media_artist);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
93 g_free(user->extinfo->media_title);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
94 g_free(user->extinfo->phone_home);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
95 g_free(user->extinfo->phone_mobile);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
96 g_free(user->extinfo->phone_work);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
97 g_free(user->extinfo);
29350
99d1b433dba0 Keep CurrentMedia in a separate object outside of MsnUser that needs to
Mark Doliner <mark@kingant.net>
parents: 28738
diff changeset
98 }
21791
c80d0732fa40 memleak fixes
Ka-Hing Cheung <khc@hxbc.us>
parents: 21284
diff changeset
99 g_free(user->statusline);
26991
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
100 g_free(user->invite_message);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 g_free(user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104
31176
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
105 MsnUser *
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
106 msn_user_ref(MsnUser *user)
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
107 {
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
108 g_return_val_if_fail(user != NULL, NULL);
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
109
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
110 user->refcount++;
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
111
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
112 return user;
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
113 }
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
114
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
115 void
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
116 msn_user_unref(MsnUser *user)
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
117 {
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
118 g_return_if_fail(user != NULL);
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
119
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
120 user->refcount--;
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
121
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
122 if(user->refcount == 0)
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
123 msn_user_destroy(user);
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
124 }
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 31169
diff changeset
125
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 msn_user_update(MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15541
diff changeset
129 PurpleAccount *account;
23543
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
130 gboolean offline;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131
23876
169c1451b7e5 Don't crash if user == NULL in a couple more places. Not exactly the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23602
diff changeset
132 g_return_if_fail(user != NULL);
169c1451b7e5 Don't crash if user == NULL in a couple more places. Not exactly the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23602
diff changeset
133
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 account = user->userlist->session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135
23543
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
136 offline = (user->status == NULL);
22553
1168dc635ac1 some other mobile stuff that Maiku fixed, fixes #2359
Ka-Hing Cheung <khc@hxbc.us>
parents: 21791
diff changeset
137
23543
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
138 if (!offline) {
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
139 purple_prpl_got_user_status(account, user->passport, user->status,
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
140 "message", user->statusline, NULL);
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
141 } else {
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
142 if (user->mobile) {
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
143 purple_prpl_got_user_status(account, user->passport, "mobile", NULL);
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
144 purple_prpl_got_user_status(account, user->passport, "available", NULL);
22553
1168dc635ac1 some other mobile stuff that Maiku fixed, fixes #2359
Ka-Hing Cheung <khc@hxbc.us>
parents: 21791
diff changeset
145 } else {
23543
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
146 purple_prpl_got_user_status(account, user->passport, "offline", NULL);
22553
1168dc635ac1 some other mobile stuff that Maiku fixed, fixes #2359
Ka-Hing Cheung <khc@hxbc.us>
parents: 21791
diff changeset
147 }
23543
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
148 }
22553
1168dc635ac1 some other mobile stuff that Maiku fixed, fixes #2359
Ka-Hing Cheung <khc@hxbc.us>
parents: 21791
diff changeset
149
23543
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
150 if (!offline || !user->mobile) {
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
151 purple_prpl_got_user_status_deactive(account, user->passport, "mobile");
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
152 }
20570
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20514
diff changeset
153
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
154 if (!offline && user->extinfo && user->extinfo->media_type != CURRENT_MEDIA_UNKNOWN) {
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
155 if (user->extinfo->media_type == CURRENT_MEDIA_MUSIC) {
24455
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23876
diff changeset
156 purple_prpl_got_user_status(account, user->passport, "tune",
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
157 PURPLE_TUNE_ARTIST, user->extinfo->media_artist,
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
158 PURPLE_TUNE_ALBUM, user->extinfo->media_album,
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
159 PURPLE_TUNE_TITLE, user->extinfo->media_title,
24455
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23876
diff changeset
160 NULL);
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
161 } else if (user->extinfo->media_type == CURRENT_MEDIA_GAMES) {
24455
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23876
diff changeset
162 purple_prpl_got_user_status(account, user->passport, "tune",
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
163 "game", user->extinfo->media_title,
24455
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23876
diff changeset
164 NULL);
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
165 } else if (user->extinfo->media_type == CURRENT_MEDIA_OFFICE) {
24455
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23876
diff changeset
166 purple_prpl_got_user_status(account, user->passport, "tune",
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
167 "office", user->extinfo->media_title,
24455
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23876
diff changeset
168 NULL);
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23876
diff changeset
169 } else {
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23876
diff changeset
170 purple_debug_warning("msn", "Got CurrentMedia with unknown type %d.\n",
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
171 user->extinfo->media_type);
24455
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23876
diff changeset
172 }
23543
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
173 } else {
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
174 purple_prpl_got_user_status_deactive(account, user->passport, "tune");
15541
d74985add99f 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@gmail.com>
parents: 15374
diff changeset
175 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 if (user->idle)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15541
diff changeset
178 purple_prpl_got_user_idle(account, user->passport, TRUE, -1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15541
diff changeset
180 purple_prpl_got_user_idle(account, user->passport, FALSE, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 msn_user_set_state(MsnUser *user, const char *state)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 const char *status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187
23876
169c1451b7e5 Don't crash if user == NULL in a couple more places. Not exactly the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23602
diff changeset
188 g_return_if_fail(user != NULL);
169c1451b7e5 Don't crash if user == NULL in a couple more places. Not exactly the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23602
diff changeset
189
23543
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
190 if (state == NULL) {
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
191 user->status = NULL;
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
192 return;
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
193 }
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23526
diff changeset
194
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 if (!g_ascii_strcasecmp(state, "BSY"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 status = "busy";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 else if (!g_ascii_strcasecmp(state, "BRB"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 status = "brb";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 else if (!g_ascii_strcasecmp(state, "AWY"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 status = "away";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 else if (!g_ascii_strcasecmp(state, "PHN"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 status = "phone";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 else if (!g_ascii_strcasecmp(state, "LUN"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 status = "lunch";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 status = "available";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 if (!g_ascii_strcasecmp(state, "IDL"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 user->idle = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 user->idle = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 user->status = status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 msn_user_set_passport(MsnUser *user, const char *passport)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 g_free(user->passport);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 user->passport = g_strdup(passport);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224
25033
f5188d4d84e3 Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24463
diff changeset
225 gboolean
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 msn_user_set_friendly_name(MsnUser *user, const char *name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 {
25051
cd7aa76faef6 Fix this compile warning:
Mark Doliner <mark@kingant.net>
parents: 25033
diff changeset
228 g_return_val_if_fail(user != NULL, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229
31111
d32c0a73c689 Don't update the server with our own information on initial login, since we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31102
diff changeset
230 if (user == user->userlist->session->user)
d32c0a73c689 Don't update the server with our own information on initial login, since we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31102
diff changeset
231 return FALSE;
d32c0a73c689 Don't update the server with our own information on initial login, since we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31102
diff changeset
232
28738
d213c8ad89da Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26991
diff changeset
233 if (user->friendly_name && name && (!strcmp(user->friendly_name, name) ||
d213c8ad89da Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26991
diff changeset
234 !strcmp(user->passport, name)))
25033
f5188d4d84e3 Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24463
diff changeset
235 return FALSE;
f5188d4d84e3 Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24463
diff changeset
236
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 g_free(user->friendly_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 user->friendly_name = g_strdup(name);
25033
f5188d4d84e3 Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24463
diff changeset
239
28738
d213c8ad89da Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26991
diff changeset
240 serv_got_alias(purple_account_get_connection(user->userlist->session->account),
d213c8ad89da Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26991
diff changeset
241 user->passport, name);
25033
f5188d4d84e3 Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24463
diff changeset
242 return TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 void
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
246 msn_user_set_statusline(MsnUser *user, const char *statusline)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
247 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
248 g_return_if_fail(user != NULL);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
249
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
250 g_free(user->statusline);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
251 user->statusline = g_strdup(statusline);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
252 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
253
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
254 void
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
255 msn_user_set_uid(MsnUser *user, const char *uid)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
256 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
257 g_return_if_fail(user != NULL);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
258
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
259 g_free(user->uid);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
260 user->uid = g_strdup(uid);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
261 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
262
31166
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
263 void
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
264 msn_user_set_endpoint_data(MsnUser *user, const char *input, MsnUserEndpoint *newep)
31114
43cf75e21702 Don't leak the Endpoint ID.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31111
diff changeset
265 {
31166
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
266 MsnUserEndpoint *ep;
31118
690bd42ce0ea Endpoint names are case-insensitive, so put the id in lowercase always.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31114
diff changeset
267 char *endpoint;
31166
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
268 GSList *l;
31118
690bd42ce0ea Endpoint names are case-insensitive, so put the id in lowercase always.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31114
diff changeset
269
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
270 g_return_if_fail(user != NULL);
31118
690bd42ce0ea Endpoint names are case-insensitive, so put the id in lowercase always.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31114
diff changeset
271 g_return_if_fail(input != NULL);
690bd42ce0ea Endpoint names are case-insensitive, so put the id in lowercase always.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31114
diff changeset
272
690bd42ce0ea Endpoint names are case-insensitive, so put the id in lowercase always.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31114
diff changeset
273 endpoint = g_ascii_strdown(input, -1);
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
274
31166
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
275 for (l = user->endpoints; l; l = l->next) {
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
276 ep = l->data;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
277 if (g_str_equal(ep->id, endpoint)) {
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
278 /* We have info about this endpoint! */
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
279
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
280 g_free(endpoint);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
281
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
282 if (newep == NULL) {
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
283 /* Delete it and exit */
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
284 user->endpoints = g_slist_delete_link(user->endpoints, l);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
285 free_user_endpoint(ep);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
286 return;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
287 }
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
288
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
289 /* Break out of our loop and update it */
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
290 break;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
291 }
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
292 }
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
293 if (l == NULL) {
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
294 /* Need to add a new endpoint */
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
295 ep = g_new0(MsnUserEndpoint, 1);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
296 ep->id = endpoint;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
297 user->endpoints = g_slist_prepend(user->endpoints, ep);
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
298 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
299
31166
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
300 ep->clientid = newep->clientid;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
301 ep->extcaps = newep->extcaps;
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
302 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
303
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
304 void
29374
7f97370e674b Use our MsnListOp enum in more places instead of int. I'm assuming
Mark Doliner <mark@kingant.net>
parents: 29368
diff changeset
305 msn_user_set_op(MsnUser *user, MsnListOp list_op)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
306 {
20425
5048651671e1 Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <stu@nosnilmot.com>
parents: 20411
diff changeset
307 g_return_if_fail(user != NULL);
5048651671e1 Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <stu@nosnilmot.com>
parents: 20411
diff changeset
308
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
309 user->list_op |= list_op;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 void
29374
7f97370e674b Use our MsnListOp enum in more places instead of int. I'm assuming
Mark Doliner <mark@kingant.net>
parents: 29368
diff changeset
313 msn_user_unset_op(MsnUser *user, MsnListOp list_op)
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
314 {
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
315 g_return_if_fail(user != NULL);
23300
5cdd93dac7a2 Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 23124
diff changeset
316
20486
ff4ae9dde291 Make block/unblock work right, as well as being add by a buddy. Finally fixes #723
Carlos Silva <typ0@pidgin.im>
parents: 20481
diff changeset
317 user->list_op &= ~list_op;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 void
16390
4fc51a87ce42 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
321 msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322 {
22887
b65997110933 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 <imadil@gmail.com>
parents: 21791
diff changeset
323 MsnObject *msnobj;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326
22887
b65997110933 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 <imadil@gmail.com>
parents: 21791
diff changeset
327 msnobj = msn_object_new_from_image(img, "TFR2C2.tmp",
b65997110933 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 <imadil@gmail.com>
parents: 21791
diff changeset
328 user->passport, MSN_OBJECT_USERTILE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329
22887
b65997110933 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 <imadil@gmail.com>
parents: 21791
diff changeset
330 if (!msnobj)
b65997110933 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 <imadil@gmail.com>
parents: 21791
diff changeset
331 purple_debug_error("msn", "Unable to open buddy icon from %s!\n", user->passport);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332
22887
b65997110933 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 <imadil@gmail.com>
parents: 21791
diff changeset
333 msn_user_set_object(user, msnobj);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
336 /*add group id to User object*/
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 void
23602
aaaff38e144f Fix a double free when connecting to the sender of a bonjour file fails. Also plug a small leak. Fixes #5971.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23564
diff changeset
338 msn_user_add_group_id(MsnUser *user, const char* group_id)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340 MsnUserList *userlist;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15541
diff changeset
341 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15541
diff changeset
342 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15541
diff changeset
343 PurpleGroup *g;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 const char *passport;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 const char *group_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 g_return_if_fail(user != NULL);
23602
aaaff38e144f Fix a double free when connecting to the sender of a bonjour file fails. Also plug a small leak. Fixes #5971.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23564
diff changeset
348 g_return_if_fail(group_id != NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349
23602
aaaff38e144f Fix a double free when connecting to the sender of a bonjour file fails. Also plug a small leak. Fixes #5971.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23564
diff changeset
350 user->group_ids = g_list_append(user->group_ids, g_strdup(group_id));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 userlist = user->userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 account = userlist->session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 passport = msn_user_get_passport(user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
356 group_name = msn_userlist_find_group_name(userlist, group_id);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
357
23564
7bceac816e19 The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23543
diff changeset
358 purple_debug_info("msn", "User: group id:%s,name:%s,user:%s\n", group_id, group_name, passport);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15541
diff changeset
360 g = purple_find_group(group_name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361
23602
aaaff38e144f Fix a double free when connecting to the sender of a bonjour file fails. Also plug a small leak. Fixes #5971.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23564
diff changeset
362 if ((group_id == NULL) && (g == NULL))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15541
diff changeset
364 g = purple_group_new(group_name);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15541
diff changeset
365 purple_blist_add_group(g, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15541
diff changeset
368 b = purple_find_buddy_in_group(account, passport, g);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 if (b == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15541
diff changeset
371 b = purple_buddy_new(account, passport, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15541
diff changeset
372 purple_blist_add_buddy(b, NULL, g, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 }
25290
8d562557ed6f Some more PurpleBuddy::proto_data related changes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23876
diff changeset
374 purple_buddy_set_protocol_data(b, user);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
375 /*Update the blist Node info*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
376 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
378 /*check if the msn user is online*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
379 gboolean
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
380 msn_user_is_online(PurpleAccount *account, const char *name)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
381 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
382 PurpleBuddy *buddy;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
383
23876
169c1451b7e5 Don't crash if user == NULL in a couple more places. Not exactly the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23602
diff changeset
384 buddy = purple_find_buddy(account, name);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
385 return PURPLE_BUDDY_IS_ONLINE(buddy);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
386 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
387
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
388 gboolean
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
389 msn_user_is_yahoo(PurpleAccount *account, const char *name)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
390 {
20447
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
391 MsnSession *session = NULL;
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
392 MsnUser *user;
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
393 PurpleConnection *gc;
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
394
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
395 gc = purple_account_get_connection(account);
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
396 if (gc != NULL)
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
397 session = gc->proto_data;
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
398
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
399 if ((session != NULL) && (user = msn_userlist_find_user(session->userlist, name)) != NULL)
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
400 {
23523
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
401 return (user->networkid == MSN_NETWORK_YAHOO);
20447
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
402 }
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
403 return (strstr(name,"@yahoo.") != NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406 void
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
407 msn_user_remove_group_id(MsnUser *user, const char *id)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 {
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
409 GList *l;
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
410
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 g_return_if_fail(user != NULL);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
412 g_return_if_fail(id != NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
414 l = g_list_find_custom(user->group_ids, id, (GCompareFunc)strcmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
416 if (l == NULL)
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
417 return;
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
418
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
419 g_free(l->data);
20987
0cbfc19e4909 Fix some leaks caused by misuse of g_list_remove_link() instead of g_list_delete_link().
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20942
diff changeset
420 user->group_ids = g_list_delete_link(user->group_ids, l);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 void
24463
4fd22591e3f0 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24455
diff changeset
424 msn_user_set_pending_group(MsnUser *user, const char *group)
4fd22591e3f0 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24455
diff changeset
425 {
4fd22591e3f0 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24455
diff changeset
426 user->pending_group = g_strdup(group);
4fd22591e3f0 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24455
diff changeset
427 }
4fd22591e3f0 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24455
diff changeset
428
4fd22591e3f0 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24455
diff changeset
429 char *
4fd22591e3f0 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24455
diff changeset
430 msn_user_remove_pending_group(MsnUser *user)
4fd22591e3f0 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24455
diff changeset
431 {
4fd22591e3f0 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24455
diff changeset
432 char *group = user->pending_group;
4fd22591e3f0 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24455
diff changeset
433 user->pending_group = NULL;
4fd22591e3f0 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24455
diff changeset
434 return group;
4fd22591e3f0 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24455
diff changeset
435 }
4fd22591e3f0 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24455
diff changeset
436
4fd22591e3f0 Send FQY as the first thing when adding a buddy so that we know what network
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24455
diff changeset
437 void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 msn_user_set_home_phone(MsnUser *user, const char *number)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
442 if (!number && !user->extinfo)
29351
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 29350
diff changeset
443 return;
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 29350
diff changeset
444
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
445 if (user->extinfo)
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
446 g_free(user->extinfo->phone_home);
29351
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 29350
diff changeset
447 else
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
448 user->extinfo = g_new0(MsnUserExtendedInfo, 1);
29351
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 29350
diff changeset
449
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
450 user->extinfo->phone_home = g_strdup(number);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 msn_user_set_work_phone(MsnUser *user, const char *number)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
458 if (!number && !user->extinfo)
29351
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 29350
diff changeset
459 return;
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 29350
diff changeset
460
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
461 if (user->extinfo)
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
462 g_free(user->extinfo->phone_work);
29351
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 29350
diff changeset
463 else
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
464 user->extinfo = g_new0(MsnUserExtendedInfo, 1);
29351
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 29350
diff changeset
465
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
466 user->extinfo->phone_work = g_strdup(number);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 msn_user_set_mobile_phone(MsnUser *user, const char *number)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
474 if (!number && !user->extinfo)
29351
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 29350
diff changeset
475 return;
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 29350
diff changeset
476
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
477 if (user->extinfo)
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
478 g_free(user->extinfo->phone_mobile);
29351
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 29350
diff changeset
479 else
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
480 user->extinfo = g_new0(MsnUserExtendedInfo, 1);
29351
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 29350
diff changeset
481
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
482 user->extinfo->phone_mobile = g_strdup(number);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 void
23523
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
486 msn_user_set_clientid(MsnUser *user, guint clientid)
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
487 {
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
488 g_return_if_fail(user != NULL);
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
489
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
490 user->clientid = clientid;
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
491 }
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
492
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
493 void
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
494 msn_user_set_extcaps(MsnUser *user, guint extcaps)
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
495 {
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
496 g_return_if_fail(user != NULL);
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
497
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
498 user->extcaps = extcaps;
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
499 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
500
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
501 void
23523
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
502 msn_user_set_network(MsnUser *user, MsnNetwork network)
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
503 {
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
504 g_return_if_fail(user != NULL);
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
505
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
506 user->networkid = network;
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
507 }
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
508
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
509 void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510 msn_user_set_object(MsnUser *user, MsnObject *obj)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 if (user->msnobj != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 msn_object_destroy(user->msnobj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 user->msnobj = obj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518
31111
d32c0a73c689 Don't update the server with our own information on initial login, since we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31102
diff changeset
519 if (user != user->userlist->session->user && user->list_op & MSN_LIST_FL_OP)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 msn_queue_buddy_icon_request(user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 msn_user_set_client_caps(MsnUser *user, GHashTable *info)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 g_return_if_fail(info != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 if (user->clientcaps != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 g_hash_table_destroy(user->clientcaps);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 user->clientcaps = info;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534
26991
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
535 void
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
536 msn_user_set_invite_message(MsnUser *user, const char *message)
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
537 {
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
538 g_return_if_fail(user != NULL);
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
539
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
540 g_free(user->invite_message);
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
541 user->invite_message = g_strdup(message);
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
542 }
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
543
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 msn_user_get_passport(const MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 g_return_val_if_fail(user != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 return user->passport;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 msn_user_get_friendly_name(const MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 g_return_val_if_fail(user != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 return user->friendly_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 msn_user_get_home_phone(const MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 g_return_val_if_fail(user != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
565 return user->extinfo ? user->extinfo->phone_home : NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 msn_user_get_work_phone(const MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571 g_return_val_if_fail(user != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
573 return user->extinfo ? user->extinfo->phone_work : NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 msn_user_get_mobile_phone(const MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579 g_return_val_if_fail(user != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580
29368
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 29351
diff changeset
581 return user->extinfo ? user->extinfo->phone_mobile : NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583
23523
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
584 guint
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
585 msn_user_get_clientid(const MsnUser *user)
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
586 {
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
587 g_return_val_if_fail(user != NULL, 0);
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
588
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
589 return user->clientid;
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
590 }
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23516
diff changeset
591
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
592 guint
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
593 msn_user_get_extcaps(const MsnUser *user)
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
594 {
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
595 g_return_val_if_fail(user != NULL, 0);
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
596
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
597 return user->extcaps;
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
598 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
599
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
600 MsnUserEndpoint *
31119
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31118
diff changeset
601 msn_user_get_endpoint_data(MsnUser *user, const char *input)
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
602 {
31119
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31118
diff changeset
603 char *endpoint;
31166
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
604 GSList *l;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
605 MsnUserEndpoint *ep;
31119
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31118
diff changeset
606
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
607 g_return_val_if_fail(user != NULL, NULL);
31119
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31118
diff changeset
608 g_return_val_if_fail(input != NULL, NULL);
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
609
31119
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31118
diff changeset
610 endpoint = g_ascii_strdown(input, -1);
31166
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
611
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
612 for (l = user->endpoints; l; l = l->next) {
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
613 ep = l->data;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
614 if (g_str_equal(ep->id, endpoint)) {
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
615 g_free(endpoint);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
616 return ep;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
617 }
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
618 }
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
619
31119
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31118
diff changeset
620 g_free(endpoint);
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31118
diff changeset
621
31166
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
622 return NULL;
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
623 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
624
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
625 MsnObject *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
626 msn_user_get_object(const MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628 g_return_val_if_fail(user != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630 return user->msnobj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
631 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
633 GHashTable *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
634 msn_user_get_client_caps(const MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
635 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636 g_return_val_if_fail(user != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 return user->clientcaps;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639 }
26991
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
640
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
641 const char *
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
642 msn_user_get_invite_message(const MsnUser *user)
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
643 {
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
644 g_return_val_if_fail(user != NULL, NULL);
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
645
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
646 return user->invite_message;
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
647 }
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25438
diff changeset
648
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
649 gboolean
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
650 msn_user_is_capable(MsnUser *user, char *endpoint, guint capability, guint extcap)
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
651 {
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
652 g_return_val_if_fail(user != NULL, FALSE);
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
653
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
654 if (endpoint != NULL) {
31166
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
655 MsnUserEndpoint *ep = msn_user_get_endpoint_data(user, endpoint);
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
656 if (ep != NULL)
31166
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
657 return (ep->clientid & capability) && (ep->extcaps & extcap);
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
658 else
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
659 return FALSE;
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
660 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
661
31166
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 31163
diff changeset
662 return (user->clientid & capability) && (user->extcaps & extcap);
31097
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28738
diff changeset
663 }
31169
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
664
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
665 /**************************************************************************
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
666 * Utility functions
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
667 **************************************************************************/
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
668
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
669 gboolean
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
670 msn_user_is_in_group(MsnUser *user, const char * group_id)
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
671 {
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
672 if (user == NULL)
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
673 return FALSE;
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
674
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
675 if (group_id == NULL)
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
676 return FALSE;
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
677
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
678 return (g_list_find_custom(user->group_ids, group_id, (GCompareFunc)strcmp)) != NULL;
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
679 }
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
680
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
681 gboolean
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
682 msn_user_is_in_list(MsnUser *user, MsnListId list_id)
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
683 {
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
684 if (user == NULL)
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
685 return FALSE;
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
686
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
687 return (user->list_op & (1 << list_id));
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
688 }
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 31167
diff changeset
689