annotate libpurple/protocols/msn/user.c @ 30742:a99b6dcdb60d

Remove unnecesary includes from msn.h. Replace msn.h with the needed includes, most of the cases only debug.h was needed.
author masca@cpw.pidgin.im
date Fri, 28 May 2010 08:05:38 +0000
parents 417899347f8a
children 230caecf5435
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15373
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 *
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
4 * purple
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
15373
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
19681
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16856
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 */
30742
a99b6dcdb60d Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents: 30741
diff changeset
24
a99b6dcdb60d Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents: 30741
diff changeset
25 #include "debug.h"
a99b6dcdb60d Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents: 30741
diff changeset
26
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "user.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "slp.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
30 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: 30725
diff changeset
31 {
30729
edb7c80bf930 Need to add back this g_free.
Mark Doliner <mark@kingant.net>
parents: 30728
diff changeset
32 g_free(data->id);
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
33 g_free(data->name);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
34 g_free(data);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
35 }
30676
43cf75e21702 Don't leak the Endpoint ID.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30673
diff changeset
36
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
37 /*new a user object*/
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 MsnUser *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 msn_user_new(MsnUserList *userlist, const char *passport,
23471
5a6cf27ead31 Remove MSN's use of a "store name" in favour of the "friendly name"
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23298
diff changeset
40 const char *friendly_name)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 MsnUser *user;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 user = g_new0(MsnUser, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 user->userlist = userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 msn_user_set_passport(user, passport);
23471
5a6cf27ead31 Remove MSN's use of a "store name" in favour of the "friendly name"
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23298
diff changeset
49 msn_user_set_friendly_name(user, friendly_name);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50
30738
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
51 return msn_user_ref(user);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
54 /*destroy a user object*/
30741
417899347f8a Remove msn_user_destroy in favor of msn_user_unref.
masca@cpw.pidgin.im
parents: 30738
diff changeset
55 static void
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 msn_user_destroy(MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59
30738
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
60 if (user->refcount > 1) {
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
61 msn_user_unref(user);
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
62 return;
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
63 }
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
64
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
65 while (user->endpoints != NULL) {
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
66 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: 30725
diff changeset
67 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: 30725
diff changeset
68 }
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
69
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 if (user->clientcaps != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 g_hash_table_destroy(user->clientcaps);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 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
74 {
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
75 GList *l;
20425
5048651671e1 Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <stu@nosnilmot.com>
parents: 20411
diff changeset
76 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
77 {
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
78 g_free(l->data);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
79 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 g_list_free(user->group_ids);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
81 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 if (user->msnobj != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 msn_object_destroy(user->msnobj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 g_free(user->passport);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 g_free(user->friendly_name);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
88 g_free(user->uid);
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
89 if (user->extinfo) {
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
90 g_free(user->extinfo->media_album);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
91 g_free(user->extinfo->media_artist);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
92 g_free(user->extinfo->media_title);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
93 g_free(user->extinfo->phone_home);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
94 g_free(user->extinfo->phone_mobile);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
95 g_free(user->extinfo->phone_work);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
96 g_free(user->extinfo);
28960
99d1b433dba0 Keep CurrentMedia in a separate object outside of MsnUser that needs to
Mark Doliner <mark@kingant.net>
parents: 28369
diff changeset
97 }
21791
c80d0732fa40 memleak fixes
Ka-Hing Cheung <khc@hxbc.us>
parents: 21284
diff changeset
98 g_free(user->statusline);
26909
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25947
diff changeset
99 g_free(user->invite_message);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 g_free(user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
30738
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
104 MsnUser *
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
105 msn_user_ref(MsnUser *user)
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
106 {
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
107 g_return_val_if_fail(user != NULL, NULL);
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
108
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
109 user->refcount++;
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
110
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
111 return user;
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
112 }
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
113
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
114 void
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
115 msn_user_unref(MsnUser *user)
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
116 {
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
117 g_return_if_fail(user != NULL);
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
118
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
119 user->refcount--;
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
120
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
121 if(user->refcount == 0)
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
122 msn_user_destroy(user);
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
123 }
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
124
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 msn_user_update(MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
128 PurpleAccount *account;
23498
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23481
diff changeset
129 gboolean offline;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130
23946
169c1451b7e5 Don't crash if user == NULL in a couple more places. Not exactly the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23557
diff changeset
131 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: 23557
diff changeset
132
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 account = user->userlist->session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134
23498
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23481
diff changeset
135 offline = (user->status == NULL);
22570
1168dc635ac1 some other mobile stuff that Maiku fixed, fixes #2359
Ka-Hing Cheung <khc@hxbc.us>
parents: 21791
diff changeset
136
23498
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23481
diff changeset
137 if (!offline) {
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23481
diff changeset
138 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: 23481
diff changeset
139 "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: 23481
diff changeset
140 } else {
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23481
diff changeset
141 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: 23481
diff changeset
142 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: 23481
diff changeset
143 purple_prpl_got_user_status(account, user->passport, "available", NULL);
22570
1168dc635ac1 some other mobile stuff that Maiku fixed, fixes #2359
Ka-Hing Cheung <khc@hxbc.us>
parents: 21791
diff changeset
144 } else {
23498
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23481
diff changeset
145 purple_prpl_got_user_status(account, user->passport, "offline", NULL);
22570
1168dc635ac1 some other mobile stuff that Maiku fixed, fixes #2359
Ka-Hing Cheung <khc@hxbc.us>
parents: 21791
diff changeset
146 }
23498
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23481
diff changeset
147 }
22570
1168dc635ac1 some other mobile stuff that Maiku fixed, fixes #2359
Ka-Hing Cheung <khc@hxbc.us>
parents: 21791
diff changeset
148
23498
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23481
diff changeset
149 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: 23481
diff changeset
150 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: 23481
diff changeset
151 }
20570
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20514
diff changeset
152
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
153 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: 28961
diff changeset
154 if (user->extinfo->media_type == CURRENT_MEDIA_MUSIC) {
24510
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23946
diff changeset
155 purple_prpl_got_user_status(account, user->passport, "tune",
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
156 PURPLE_TUNE_ARTIST, user->extinfo->media_artist,
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
157 PURPLE_TUNE_ALBUM, user->extinfo->media_album,
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
158 PURPLE_TUNE_TITLE, user->extinfo->media_title,
24510
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23946
diff changeset
159 NULL);
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
160 } else if (user->extinfo->media_type == CURRENT_MEDIA_GAMES) {
24510
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23946
diff changeset
161 purple_prpl_got_user_status(account, user->passport, "tune",
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
162 "game", user->extinfo->media_title,
24510
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23946
diff changeset
163 NULL);
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
164 } else if (user->extinfo->media_type == CURRENT_MEDIA_OFFICE) {
24510
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23946
diff changeset
165 purple_prpl_got_user_status(account, user->passport, "tune",
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
166 "office", user->extinfo->media_title,
24510
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23946
diff changeset
167 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: 23946
diff changeset
168 } 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: 23946
diff changeset
169 purple_debug_warning("msn", "Got CurrentMedia with unknown type %d.\n",
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
170 user->extinfo->media_type);
24510
e344426d7c28 Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23946
diff changeset
171 }
23498
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23481
diff changeset
172 } else {
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23481
diff changeset
173 purple_prpl_got_user_status_deactive(account, user->passport, "tune");
15540
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: 15373
diff changeset
174 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 if (user->idle)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
177 purple_prpl_got_user_idle(account, user->passport, TRUE, -1);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
179 purple_prpl_got_user_idle(account, user->passport, FALSE, 0);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 }
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 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 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
184 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 const char *status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186
23946
169c1451b7e5 Don't crash if user == NULL in a couple more places. Not exactly the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23557
diff changeset
187 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: 23557
diff changeset
188
23498
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23481
diff changeset
189 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: 23481
diff changeset
190 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: 23481
diff changeset
191 return;
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23481
diff changeset
192 }
80d09f42b157 A patch from felipec to consistently use NULL for the status of offline
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23481
diff changeset
193
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 if (!g_ascii_strcasecmp(state, "BSY"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 status = "busy";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 else if (!g_ascii_strcasecmp(state, "BRB"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 status = "brb";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 else if (!g_ascii_strcasecmp(state, "AWY"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 status = "away";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 else if (!g_ascii_strcasecmp(state, "PHN"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 status = "phone";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 else if (!g_ascii_strcasecmp(state, "LUN"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 status = "lunch";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 status = "available";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 if (!g_ascii_strcasecmp(state, "IDL"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 user->idle = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 user->idle = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 user->status = status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 }
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 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 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
217 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 g_free(user->passport);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 user->passport = g_strdup(passport);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223
25393
f5188d4d84e3 Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24518
diff changeset
224 gboolean
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 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
226 {
25413
cd7aa76faef6 Fix this compile warning:
Mark Doliner <mark@kingant.net>
parents: 25393
diff changeset
227 g_return_val_if_fail(user != NULL, FALSE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228
30673
d32c0a73c689 Don't update the server with our own information on initial login, since we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30664
diff changeset
229 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: 30664
diff changeset
230 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: 30664
diff changeset
231
28369
d213c8ad89da Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26909
diff changeset
232 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: 26909
diff changeset
233 !strcmp(user->passport, name)))
25393
f5188d4d84e3 Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24518
diff changeset
234 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: 24518
diff changeset
235
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 g_free(user->friendly_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 user->friendly_name = g_strdup(name);
25393
f5188d4d84e3 Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24518
diff changeset
238
28369
d213c8ad89da Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26909
diff changeset
239 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: 26909
diff changeset
240 user->passport, name);
25393
f5188d4d84e3 Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24518
diff changeset
241 return TRUE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 }
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 void
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
245 msn_user_set_statusline(MsnUser *user, const char *statusline)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
246 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
247 g_return_if_fail(user != NULL);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
248
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
249 g_free(user->statusline);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
250 user->statusline = g_strdup(statusline);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
251 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
252
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
253 void
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
254 msn_user_set_uid(MsnUser *user, const char *uid)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
255 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
256 g_return_if_fail(user != NULL);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
257
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
258 g_free(user->uid);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
259 user->uid = g_strdup(uid);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
260 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
261
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
262 void
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
263 msn_user_set_endpoint_data(MsnUser *user, const char *input, MsnUserEndpoint *newep)
30676
43cf75e21702 Don't leak the Endpoint ID.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30673
diff changeset
264 {
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
265 MsnUserEndpoint *ep;
30680
690bd42ce0ea Endpoint names are case-insensitive, so put the id in lowercase always.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30676
diff changeset
266 char *endpoint;
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
267 GSList *l;
30680
690bd42ce0ea Endpoint names are case-insensitive, so put the id in lowercase always.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30676
diff changeset
268
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
269 g_return_if_fail(user != NULL);
30680
690bd42ce0ea Endpoint names are case-insensitive, so put the id in lowercase always.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30676
diff changeset
270 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: 30676
diff changeset
271
690bd42ce0ea Endpoint names are case-insensitive, so put the id in lowercase always.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30676
diff changeset
272 endpoint = g_ascii_strdown(input, -1);
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
273
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
274 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: 30725
diff changeset
275 ep = l->data;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
276 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: 30725
diff changeset
277 /* 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: 30725
diff changeset
278
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
279 g_free(endpoint);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
280
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
281 if (newep == NULL) {
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
282 /* Delete it and exit */
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
283 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: 30725
diff changeset
284 free_user_endpoint(ep);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
285 return;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
286 }
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
287
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
288 /* 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: 30725
diff changeset
289 break;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
290 }
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
291 }
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
292 if (l == NULL) {
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
293 /* 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: 30725
diff changeset
294 ep = g_new0(MsnUserEndpoint, 1);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
295 ep->id = endpoint;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
296 user->endpoints = g_slist_prepend(user->endpoints, ep);
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
297 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
298
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
299 ep->clientid = newep->clientid;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
300 ep->extcaps = newep->extcaps;
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
301 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
302
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
303 void
28984
7f97370e674b Use our MsnListOp enum in more places instead of int. I'm assuming
Mark Doliner <mark@kingant.net>
parents: 28978
diff changeset
304 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: 15822
diff changeset
305 {
20425
5048651671e1 Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <stu@nosnilmot.com>
parents: 20411
diff changeset
306 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
307
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
308 user->list_op |= list_op;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 }
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 void
28984
7f97370e674b Use our MsnListOp enum in more places instead of int. I'm assuming
Mark Doliner <mark@kingant.net>
parents: 28978
diff changeset
312 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
313 {
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 g_return_if_fail(user != NULL);
23298
5cdd93dac7a2 Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 23122
diff changeset
315
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
316 user->list_op &= ~list_op;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 }
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 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: 15822
diff changeset
320 msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 {
22512
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
322 MsnObject *msnobj;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325
22512
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
326 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
327 user->passport, MSN_OBJECT_USERTILE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328
22512
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
329 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
330 purple_debug_error("msn", "Unable to open buddy icon from %s!\n", user->passport);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331
22512
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
332 msn_user_set_object(user, msnobj);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
335 /*add group id to User object*/
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336 void
23557
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: 23519
diff changeset
337 msn_user_add_group_id(MsnUser *user, const char* group_id)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 MsnUserList *userlist;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
340 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
341 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
342 PurpleGroup *g;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 const char *passport;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 const char *group_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 g_return_if_fail(user != NULL);
23557
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: 23519
diff changeset
347 g_return_if_fail(group_id != NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348
23557
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: 23519
diff changeset
349 user->group_ids = g_list_append(user->group_ids, g_strdup(group_id));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351 userlist = user->userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 account = userlist->session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 passport = msn_user_get_passport(user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
355 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: 15822
diff changeset
356
23519
7bceac816e19 The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23498
diff changeset
357 purple_debug_info("msn", "User: group id:%s,name:%s,user:%s\n", group_id, group_name, passport);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
358
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
359 g = purple_find_group(group_name);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360
23557
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: 23519
diff changeset
361 if ((group_id == NULL) && (g == NULL))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
363 g = purple_group_new(group_name);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
364 purple_blist_add_group(g, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
367 b = purple_find_buddy_in_group(account, passport, g);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 if (b == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
370 b = purple_buddy_new(account, passport, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
371 purple_blist_add_buddy(b, NULL, g, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 }
25799
8d562557ed6f Some more PurpleBuddy::proto_data related changes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23946
diff changeset
373 purple_buddy_set_protocol_data(b, user);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
374 /*Update the blist Node info*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
375 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
377 /*check if the msn user is online*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
378 gboolean
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
379 msn_user_is_online(PurpleAccount *account, const char *name)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
380 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
381 PurpleBuddy *buddy;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
382
23946
169c1451b7e5 Don't crash if user == NULL in a couple more places. Not exactly the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23557
diff changeset
383 buddy = purple_find_buddy(account, name);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
384 return PURPLE_BUDDY_IS_ONLINE(buddy);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
385 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
386
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
387 gboolean
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
388 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: 15822
diff changeset
389 {
20447
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
390 MsnSession *session = NULL;
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
391 MsnUser *user;
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
392 PurpleConnection *gc;
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
393
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
394 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
395 if (gc != NULL)
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
396 session = gc->proto_data;
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
397
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
398 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
399 {
23478
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23471
diff changeset
400 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
401 }
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
402 return (strstr(name,"@yahoo.") != NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 }
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 void
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
406 msn_user_remove_group_id(MsnUser *user, const char *id)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 {
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
408 GList *l;
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
409
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 g_return_if_fail(user != NULL);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
411 g_return_if_fail(id != NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
413 l = g_list_find_custom(user->group_ids, id, (GCompareFunc)strcmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
415 if (l == NULL)
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
416 return;
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
417
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
418 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
419 user->group_ids = g_list_delete_link(user->group_ids, l);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 }
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 void
24518
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: 24510
diff changeset
423 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: 24510
diff changeset
424 {
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: 24510
diff changeset
425 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: 24510
diff changeset
426 }
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: 24510
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: 24510
diff changeset
428 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: 24510
diff changeset
429 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: 24510
diff changeset
430 {
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: 24510
diff changeset
431 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: 24510
diff changeset
432 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: 24510
diff changeset
433 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: 24510
diff changeset
434 }
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: 24510
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: 24510
diff changeset
436 void
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 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
438 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
441 if (!number && !user->extinfo)
28961
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
442 return;
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
443
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
444 if (user->extinfo)
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
445 g_free(user->extinfo->phone_home);
28961
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
446 else
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
447 user->extinfo = g_new0(MsnUserExtendedInfo, 1);
28961
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
448
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
449 user->extinfo->phone_home = g_strdup(number);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 }
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 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 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
454 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
457 if (!number && !user->extinfo)
28961
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
458 return;
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
459
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
460 if (user->extinfo)
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
461 g_free(user->extinfo->phone_work);
28961
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
462 else
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
463 user->extinfo = g_new0(MsnUserExtendedInfo, 1);
28961
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
464
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
465 user->extinfo->phone_work = g_strdup(number);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 }
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 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 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
470 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
473 if (!number && !user->extinfo)
28961
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
474 return;
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
475
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
476 if (user->extinfo)
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
477 g_free(user->extinfo->phone_mobile);
28961
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
478 else
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
479 user->extinfo = g_new0(MsnUserExtendedInfo, 1);
28961
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
480
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
481 user->extinfo->phone_mobile = g_strdup(number);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 }
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 void
23478
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23471
diff changeset
485 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: 23471
diff changeset
486 {
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23471
diff changeset
487 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: 23471
diff changeset
488
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23471
diff changeset
489 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: 23471
diff changeset
490 }
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23471
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: 23471
diff changeset
492 void
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
493 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: 28369
diff changeset
494 {
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
495 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: 28369
diff changeset
496
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
497 user->extcaps = extcaps;
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
498 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
499
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
500 void
23478
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23471
diff changeset
501 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: 23471
diff changeset
502 {
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23471
diff changeset
503 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: 23471
diff changeset
504
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23471
diff changeset
505 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: 23471
diff changeset
506 }
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23471
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: 23471
diff changeset
508 void
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 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
510 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 if (user->msnobj != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 msn_object_destroy(user->msnobj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516 user->msnobj = obj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517
30673
d32c0a73c689 Don't update the server with our own information on initial login, since we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30664
diff changeset
518 if (user != user->userlist->session->user && user->list_op & MSN_LIST_FL_OP)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 msn_queue_buddy_icon_request(user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 }
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 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 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
524 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526 g_return_if_fail(info != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 if (user->clientcaps != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 g_hash_table_destroy(user->clientcaps);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531 user->clientcaps = info;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533
26909
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25947
diff changeset
534 void
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25947
diff changeset
535 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: 25947
diff changeset
536 {
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25947
diff changeset
537 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: 25947
diff changeset
538
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25947
diff changeset
539 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: 25947
diff changeset
540 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: 25947
diff changeset
541 }
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25947
diff changeset
542
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 msn_user_get_passport(const MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 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
547
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548 return user->passport;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 }
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 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 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
553 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 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
555
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 return user->friendly_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 }
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 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 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
561 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 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
563
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
564 return user->extinfo ? user->extinfo->phone_home : NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 }
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 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 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
569 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 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
571
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
572 return user->extinfo ? user->extinfo->phone_work : NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 }
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 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 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
577 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 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
579
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
580 return user->extinfo ? user->extinfo->phone_mobile : NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582
23478
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23471
diff changeset
583 guint
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23471
diff changeset
584 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: 23471
diff changeset
585 {
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23471
diff changeset
586 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: 23471
diff changeset
587
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23471
diff changeset
588 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: 23471
diff changeset
589 }
31b5a1334e7e Modifications to the MSN code for some stuff I'll be doing in later
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23471
diff changeset
590
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
591 guint
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
592 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: 28369
diff changeset
593 {
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
594 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: 28369
diff changeset
595
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
596 return user->extcaps;
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
597 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
598
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
599 MsnUserEndpoint *
30681
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30680
diff changeset
600 msn_user_get_endpoint_data(MsnUser *user, const char *input)
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
601 {
30681
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30680
diff changeset
602 char *endpoint;
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
603 GSList *l;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
604 MsnUserEndpoint *ep;
30681
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30680
diff changeset
605
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
606 g_return_val_if_fail(user != NULL, NULL);
30681
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30680
diff changeset
607 g_return_val_if_fail(input != NULL, NULL);
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
608
30681
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30680
diff changeset
609 endpoint = g_ascii_strdown(input, -1);
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
610
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
611 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: 30725
diff changeset
612 ep = l->data;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
613 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: 30725
diff changeset
614 g_free(endpoint);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
615 return ep;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
616 }
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
617 }
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
618
30681
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30680
diff changeset
619 g_free(endpoint);
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30680
diff changeset
620
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
621 return NULL;
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
622 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
623
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624 MsnObject *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
625 msn_user_get_object(const MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
626 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627 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
628
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629 return user->msnobj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630 }
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 GHashTable *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
633 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
634 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
635 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
636
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637 return user->clientcaps;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 }
26909
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25947
diff changeset
639
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25947
diff changeset
640 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: 25947
diff changeset
641 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: 25947
diff changeset
642 {
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25947
diff changeset
643 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: 25947
diff changeset
644
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25947
diff changeset
645 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: 25947
diff changeset
646 }
2a95e8bd9b80 Parse the invite message out of the pending membership list so that it can
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25947
diff changeset
647
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
648 gboolean
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
649 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: 28369
diff changeset
650 {
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
651 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: 28369
diff changeset
652
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
653 if (endpoint != NULL) {
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
654 MsnUserEndpoint *ep = msn_user_get_endpoint_data(user, endpoint);
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
655 if (ep != NULL)
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
656 return (ep->clientid & capability) && (ep->extcaps & extcap);
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
657 else
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
658 return FALSE;
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
659 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
660
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
661 return (user->clientid & capability) && (user->extcaps & extcap);
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
662 }
30731
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
663
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
664 /**************************************************************************
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
665 * Utility functions
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
666 **************************************************************************/
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
667
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
668 gboolean
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
669 msn_user_is_in_group(MsnUser *user, const char * group_id)
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
670 {
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
671 if (user == NULL)
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
672 return FALSE;
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
673
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
674 if (group_id == NULL)
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
675 return FALSE;
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
676
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
677 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: 30729
diff changeset
678 }
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
679
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
680 gboolean
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
681 msn_user_is_in_list(MsnUser *user, MsnListId list_id)
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
682 {
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
683 if (user == NULL)
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
684 return FALSE;
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
685
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
686 return (user->list_op & (1 << list_id));
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
687 }
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
688