annotate libpurple/protocols/msn/user.c @ 31022:78dccab9824c

Add the session user to the userlist. This reduces the amount of special-casing needed and corrects the buddy icon if you have yourself on your list. Fixes #12973.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 10 Dec 2010 06:38:17 +0000
parents 0a58b4f084fb
children 05e05d96ba75
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
30758
230caecf5435 Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
masca@cpw.pidgin.im
parents: 30742
diff changeset
25 #include "internal.h"
30742
a99b6dcdb60d Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents: 30741
diff changeset
26 #include "debug.h"
30819
c83902e953c4 Fix a bad behavior when talking with users using multiple locations. The
masca@cpw.pidgin.im
parents: 30817
diff changeset
27 #include "util.h"
30742
a99b6dcdb60d Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents: 30741
diff changeset
28
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "user.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "slp.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
32 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
33 {
30729
edb7c80bf930 Need to add back this g_free.
Mark Doliner <mark@kingant.net>
parents: 30728
diff changeset
34 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
35 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
36 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
37 }
30676
43cf75e21702 Don't leak the Endpoint ID.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30673
diff changeset
38
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
39 /*new a user object*/
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 MsnUser *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 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
42 const char *friendly_name)
15373
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 MsnUser *user;
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 = g_new0(MsnUser, 1);
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 user->userlist = userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 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
51 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
52
30738
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
53 return msn_user_ref(user);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
56 /*destroy a user object*/
30741
417899347f8a Remove msn_user_destroy in favor of msn_user_unref.
masca@cpw.pidgin.im
parents: 30738
diff changeset
57 static void
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 msn_user_destroy(MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61
30738
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
62 if (user->refcount > 1) {
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
63 msn_user_unref(user);
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
64 return;
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
65 }
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
66
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
67 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
68 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
69 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
70 }
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
71
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 if (user->clientcaps != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 g_hash_table_destroy(user->clientcaps);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 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
76 {
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
77 GList *l;
20425
5048651671e1 Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <stu@nosnilmot.com>
parents: 20411
diff changeset
78 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
79 {
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
80 g_free(l->data);
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 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
83 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 if (user->msnobj != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 msn_object_destroy(user->msnobj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 g_free(user->passport);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 g_free(user->friendly_name);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
90 g_free(user->uid);
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
91 if (user->extinfo) {
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
92 g_free(user->extinfo->media_album);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
93 g_free(user->extinfo->media_artist);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
94 g_free(user->extinfo->media_title);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
95 g_free(user->extinfo->phone_home);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
96 g_free(user->extinfo->phone_mobile);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
97 g_free(user->extinfo->phone_work);
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
98 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
99 }
21791
c80d0732fa40 memleak fixes
Ka-Hing Cheung <khc@hxbc.us>
parents: 21284
diff changeset
100 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
101 g_free(user->invite_message);
15373
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 g_free(user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105
30738
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
106 MsnUser *
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
107 msn_user_ref(MsnUser *user)
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 g_return_val_if_fail(user != NULL, NULL);
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 user->refcount++;
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 return user;
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
114 }
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
115
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
116 void
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
117 msn_user_unref(MsnUser *user)
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 g_return_if_fail(user != NULL);
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 user->refcount--;
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
122
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
123 if(user->refcount == 0)
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
124 msn_user_destroy(user);
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
125 }
0c090a41522c Add ref/unref support to MsnUser.
masca@cpw.pidgin.im
parents: 30731
diff changeset
126
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 msn_user_update(MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
130 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
131 gboolean offline;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132
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
133 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
134
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 account = user->userlist->session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
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 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
138
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
139 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
140 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
141 "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
142 } 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
143 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
144 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
145 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
146 } 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
147 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
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 }
22570
1168dc635ac1 some other mobile stuff that Maiku fixed, fixes #2359
Ka-Hing Cheung <khc@hxbc.us>
parents: 21791
diff changeset
150
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
151 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
152 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
153 }
20570
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20514
diff changeset
154
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
155 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
156 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
157 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
158 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
159 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
160 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
161 NULL);
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
162 } 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
163 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
164 "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
165 NULL);
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
166 } 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
167 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
168 "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
169 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
170 } 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
171 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
172 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
173 }
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
174 } 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
175 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
176 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 if (user->idle)
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, TRUE, -1);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
181 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
182 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 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
186 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 const char *status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188
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
189 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
190
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
191 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
192 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
193 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
194 }
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
195
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 if (!g_ascii_strcasecmp(state, "BSY"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 status = "busy";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 else if (!g_ascii_strcasecmp(state, "BRB"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 status = "brb";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 else if (!g_ascii_strcasecmp(state, "AWY"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 status = "away";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 else if (!g_ascii_strcasecmp(state, "PHN"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 status = "phone";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 else if (!g_ascii_strcasecmp(state, "LUN"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 status = "lunch";
30976
7300259608c9 Add the HDN status to status parsing, which means invisible, but you'd
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30916
diff changeset
206 else if (!g_ascii_strcasecmp(state, "HDN"))
7300259608c9 Add the HDN status to status parsing, which means invisible, but you'd
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30916
diff changeset
207 status = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 status = "available";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 if (!g_ascii_strcasecmp(state, "IDL"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 user->idle = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 user->idle = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 user->status = status;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 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
221 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 g_free(user->passport);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 user->passport = g_strdup(passport);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227
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
228 gboolean
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 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
230 {
25413
cd7aa76faef6 Fix this compile warning:
Mark Doliner <mark@kingant.net>
parents: 25393
diff changeset
231 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
232
28369
d213c8ad89da Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26909
diff changeset
233 if (user->friendly_name && name && (!strcmp(user->friendly_name, name) ||
d213c8ad89da Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26909
diff changeset
234 !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
235 return FALSE;
f5188d4d84e3 Move the check for whether to update the server alias out of nln_cmd and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24518
diff changeset
236
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 g_free(user->friendly_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 user->friendly_name = g_strdup(name);
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
239
28369
d213c8ad89da Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26909
diff changeset
240 serv_got_alias(purple_account_get_connection(user->userlist->session->account),
d213c8ad89da Fix MSN forgetting display names for buddies. Fixes #10421.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26909
diff changeset
241 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
242 return TRUE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 void
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
246 msn_user_set_statusline(MsnUser *user, const char *statusline)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
247 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
248 g_return_if_fail(user != NULL);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
249
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
250 g_free(user->statusline);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
251 user->statusline = g_strdup(statusline);
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
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
254 void
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
255 msn_user_set_uid(MsnUser *user, const char *uid)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
256 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
257 g_return_if_fail(user != NULL);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
258
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
259 g_free(user->uid);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
260 user->uid = g_strdup(uid);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
261 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
262
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
263 void
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
264 msn_user_set_endpoint_data(MsnUser *user, const char *input, MsnUserEndpoint *newep)
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
265 {
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
266 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
267 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
268 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
269
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
270 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
271 g_return_if_fail(input != 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
272
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
273 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
274
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
275 for (l = user->endpoints; l; l = l->next) {
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
276 ep = l->data;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
277 if (g_str_equal(ep->id, endpoint)) {
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
278 /* We have info about this endpoint! */
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
279
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
280 g_free(endpoint);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
281
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
282 if (newep == NULL) {
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
283 /* Delete it and exit */
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
284 user->endpoints = g_slist_delete_link(user->endpoints, l);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
285 free_user_endpoint(ep);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
286 return;
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
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
289 /* Break out of our loop and update it */
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
290 break;
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 }
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
293 if (l == NULL) {
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
294 /* Need to add a new endpoint */
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
295 ep = g_new0(MsnUserEndpoint, 1);
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
296 ep->id = endpoint;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
297 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
298 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
299
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
300 ep->clientid = newep->clientid;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
301 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
302 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
303
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
304 void
30989
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
305 msn_user_clear_endpoints(MsnUser *user)
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
306 {
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
307 MsnUserEndpoint *ep;
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
308 GSList *l;
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
309
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
310 g_return_if_fail(user != NULL);
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
311
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
312 for (l = user->endpoints; l; l = g_slist_delete_link(l, l)) {
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
313 ep = l->data;
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
314 free_user_endpoint(ep);
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
315 }
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
316
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
317 user->endpoints = NULL;
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
318 }
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
319
7bf659dbacee Clear out the old list of endpoints when we receive a new one. This
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30976
diff changeset
320 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
321 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
322 {
20425
5048651671e1 Revert a bunch of whitespace changes so reviewing a diff against
Stu Tomlinson <stu@nosnilmot.com>
parents: 20411
diff changeset
323 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
324
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
325 user->list_op |= list_op;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 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
329 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
330 {
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
331 g_return_if_fail(user != NULL);
23298
5cdd93dac7a2 Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 23122
diff changeset
332
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
333 user->list_op &= ~list_op;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336 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
337 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
338 {
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
339 MsnObject *msnobj;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342
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
343 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
344 user->passport, MSN_OBJECT_USERTILE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345
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
346 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
347 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
348
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
349 msn_user_set_object(user, msnobj);
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
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
352 /*add group id to User object*/
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 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
354 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
355 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356 MsnUserList *userlist;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
357 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
358 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
359 PurpleGroup *g;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360 const char *passport;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 const char *group_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 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
364 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
365
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
366 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
367
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 userlist = user->userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 account = userlist->session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 passport = msn_user_get_passport(user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
372 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
373
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
374 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
375
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
376 g = purple_find_group(group_name);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377
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
378 if ((group_id == NULL) && (g == NULL))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
380 g = purple_group_new(group_name);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
381 purple_blist_add_group(g, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
384 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
385 if (b == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
387 b = purple_buddy_new(account, passport, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15540
diff changeset
388 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
389 }
25799
8d562557ed6f Some more PurpleBuddy::proto_data related changes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23946
diff changeset
390 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
391 /*Update the blist Node info*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
392 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
394 /*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
395 gboolean
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
396 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
397 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
398 PurpleBuddy *buddy;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
399
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
400 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
401 return PURPLE_BUDDY_IS_ONLINE(buddy);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
402 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
403
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
404 gboolean
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
405 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
406 {
20447
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
407 MsnSession *session = NULL;
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
408 MsnUser *user;
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
409 PurpleConnection *gc;
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
410
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
411 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
412 if (gc != NULL)
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
413 session = gc->proto_data;
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
414
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
415 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
416 {
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
417 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
418 }
18ecdee88ed0 Add Pending list to recognized lists during contact list parsing
Stu Tomlinson <stu@nosnilmot.com>
parents: 20445
diff changeset
419 return (strstr(name,"@yahoo.") != NULL);
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
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
423 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
424 {
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
425 GList *l;
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
426
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 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
428 g_return_if_fail(id != NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
430 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
431
20436
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
432 if (l == NULL)
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
433 return;
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
434
ad481ea028be Fix msn_user_remove_group_id()
Stu Tomlinson <stu@nosnilmot.com>
parents: 20425
diff changeset
435 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
436 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
437 }
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 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
440 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
441 {
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
442 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
443 }
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
444
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
445 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
446 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
447 {
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
448 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
449 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
450 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
451 }
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
452
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
453 void
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 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
455 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
458 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
459 return;
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
460
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
461 if (user->extinfo)
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
462 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
463 else
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
464 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
465
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
466 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
467 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 msn_user_set_work_phone(MsnUser *user, const char *number)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
474 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
475 return;
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
476
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
477 if (user->extinfo)
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
478 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
479 else
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
480 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
481
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
482 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
483 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 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
487 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
490 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
491 return;
08296b862f98 Move the three phone numbers from the MsnUser struct into a separate
Mark Doliner <mark@kingant.net>
parents: 28960
diff changeset
492
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
493 if (user->extinfo)
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
494 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
495 else
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
496 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
497
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
498 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
499 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 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
502 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
503 {
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 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
505
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 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
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
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
509 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
510 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
511 {
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
512 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
513
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
514 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
515 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
516
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
517 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
518 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
519 {
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
520 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
521
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
522 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
523 }
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
524
30835
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
525 static gboolean
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
526 buddy_icon_cached(PurpleConnection *gc, MsnObject *obj)
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
527 {
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
528 PurpleAccount *account;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
529 PurpleBuddy *buddy;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
530 const char *old;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
531 const char *new;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
532
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
533 g_return_val_if_fail(obj != NULL, FALSE);
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
534
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
535 account = purple_connection_get_account(gc);
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
536
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
537 buddy = purple_find_buddy(account, msn_object_get_creator(obj));
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
538 if (buddy == NULL)
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
539 return FALSE;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
540
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
541 old = purple_buddy_icons_get_checksum_for_user(buddy);
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
542 new = msn_object_get_sha1(obj);
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
543
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
544 if (new == NULL)
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
545 return FALSE;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
546
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
547 /* If the old and new checksums are the same, and the file actually exists,
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
548 * then return TRUE */
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
549 if (old != NULL && !strcmp(old, new))
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
550 return TRUE;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
551
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
552 return FALSE;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
553 }
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
554
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
555 static void
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
556 queue_buddy_icon_request(MsnUser *user)
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
557 {
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
558 PurpleAccount *account;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
559 MsnObject *obj;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
560 GQueue *queue;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
561
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
562 g_return_if_fail(user != NULL);
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
563
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
564 account = user->userlist->session->account;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
565
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
566 obj = msn_user_get_object(user);
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
567
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
568 if (obj == NULL) {
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
569 purple_buddy_icons_set_for_user(account, user->passport, NULL, 0, NULL);
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
570 return;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
571 }
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
572
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
573 if (!buddy_icon_cached(account->gc, obj)) {
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
574 MsnUserList *userlist;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
575
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
576 userlist = user->userlist;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
577 queue = userlist->buddy_icon_requests;
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
578
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
579 if (purple_debug_is_verbose())
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
580 purple_debug_info("msn", "Queueing buddy icon request for %s (buddy_icon_window = %i)\n",
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
581 user->passport, userlist->buddy_icon_window);
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
582
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
583 g_queue_push_tail(queue, user);
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
584
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
585 if (userlist->buddy_icon_window > 0)
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
586 msn_release_buddy_icon_request(userlist);
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
587 }
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
588 }
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
589
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
590 void
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591 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
592 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594
30861
4445ae4215b8 Don't destroy our local object storing the display picture when a NLN command show us the same MsnObject.
masca@cpw.pidgin.im
parents: 30835
diff changeset
595 if (user->msnobj != NULL && !msn_object_find_local(msn_object_get_sha1(obj)))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 msn_object_destroy(user->msnobj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 user->msnobj = obj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599
31017
2d1e1556fa1f disapproval of revision 'e67fc1b6eccb8879246c1f55a677c5a7202372f8'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30673
diff changeset
600 if (user->list_op & MSN_LIST_FL_OP)
30835
56ef12440d52 Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents: 30819
diff changeset
601 queue_buddy_icon_request(user);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605 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
606 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 g_return_if_fail(info != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 if (user->clientcaps != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 g_hash_table_destroy(user->clientcaps);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613 user->clientcaps = info;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615
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
616 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
617 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
618 {
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
619 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
620
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
621 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
622 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
623 }
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
624
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
625 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
626 msn_user_get_passport(const MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628 g_return_val_if_fail(user != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630 return user->passport;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
631 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
633 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
634 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
635 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636 g_return_val_if_fail(user != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 return user->friendly_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642 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
643 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644 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
645
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
646 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
647 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650 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
651 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 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
653
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
654 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
655 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
656
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
657 const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658 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
659 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660 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
661
28978
746bf7d8b34e Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
Mark Doliner <mark@kingant.net>
parents: 28961
diff changeset
662 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
663 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664
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
665 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
666 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
667 {
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
668 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
669
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
670 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
671 }
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
672
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
673 guint
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
674 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
675 {
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
676 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
677
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
678 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
679 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
680
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
681 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
682 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
683 {
30681
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30680
diff changeset
684 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
685 GSList *l;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
686 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
687
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
688 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
689 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
690
30681
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30680
diff changeset
691 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
692
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
693 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
694 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
695 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
696 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
697 return ep;
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
698 }
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
699 }
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
700
30681
fee2d38d14bd Also, lower-case the endpoint name when looking up endpoint data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30680
diff changeset
701 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
702
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
703 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
704 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
705
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706 MsnObject *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707 msn_user_get_object(const MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 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
710
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 return user->msnobj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
713
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 GHashTable *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715 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
716 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 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
718
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 return user->clientcaps;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 }
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
721
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
722 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
723 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
724 {
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
725 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
726
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
727 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
728 }
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
729
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
730 gboolean
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
731 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
732 {
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
733 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
734
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
735 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
736 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
737 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
738 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
739 else
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
740 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
741 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
742
30728
2a5dbea6ab6b Use a linked list to store MsnUserEndpoints instead of a hash table.
Mark Doliner <mark@kingant.net>
parents: 30725
diff changeset
743 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
744 }
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
745
30731
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
746 /**************************************************************************
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
747 * Utility functions
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
748 **************************************************************************/
30659
88c48bcb5455 Allow saving extended capabilities and endpoint-specific data in an MSN
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28369
diff changeset
749
30817
2327aa51a780 Move an user utility function to User.
masca@cpw.pidgin.im
parents: 30758
diff changeset
750 int
2327aa51a780 Move an user utility function to User.
masca@cpw.pidgin.im
parents: 30758
diff changeset
751 msn_user_passport_cmp(MsnUser *user, const char *passport)
2327aa51a780 Move an user utility function to User.
masca@cpw.pidgin.im
parents: 30758
diff changeset
752 {
30883
b7b2b1f81aa0 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
masca@cpw.pidgin.im
parents: 30879
diff changeset
753 const char *str;
b7b2b1f81aa0 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
masca@cpw.pidgin.im
parents: 30879
diff changeset
754 char *pass;
b7b2b1f81aa0 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
masca@cpw.pidgin.im
parents: 30879
diff changeset
755 int result;
30817
2327aa51a780 Move an user utility function to User.
masca@cpw.pidgin.im
parents: 30758
diff changeset
756
30883
b7b2b1f81aa0 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
masca@cpw.pidgin.im
parents: 30879
diff changeset
757 str = purple_normalize_nocase(NULL, msn_user_get_passport(user));
b7b2b1f81aa0 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
masca@cpw.pidgin.im
parents: 30879
diff changeset
758 pass = g_strdup(str);
30817
2327aa51a780 Move an user utility function to User.
masca@cpw.pidgin.im
parents: 30758
diff changeset
759
30916
4ba00731d066 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <mark@kingant.net>
parents: 30883
diff changeset
760 #if GLIB_CHECK_VERSION(2,16,0)
30883
b7b2b1f81aa0 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
masca@cpw.pidgin.im
parents: 30879
diff changeset
761 result = g_strcmp0(pass, purple_normalize_nocase(NULL, passport));
30916
4ba00731d066 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <mark@kingant.net>
parents: 30883
diff changeset
762 #else
4ba00731d066 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <mark@kingant.net>
parents: 30883
diff changeset
763 str = purple_normalize_nocase(NULL, passport);
4ba00731d066 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <mark@kingant.net>
parents: 30883
diff changeset
764 if (!pass)
4ba00731d066 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <mark@kingant.net>
parents: 30883
diff changeset
765 result = -(pass != str);
4ba00731d066 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <mark@kingant.net>
parents: 30883
diff changeset
766 else if (!str)
4ba00731d066 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <mark@kingant.net>
parents: 30883
diff changeset
767 result = pass != str;
4ba00731d066 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <mark@kingant.net>
parents: 30883
diff changeset
768 else
4ba00731d066 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <mark@kingant.net>
parents: 30883
diff changeset
769 result = strcmp(pass, str);
4ba00731d066 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <mark@kingant.net>
parents: 30883
diff changeset
770 #endif /* GLIB < 2.16.0 */
4ba00731d066 g_strcmp0 was added in glib 2.16.0, but we keep compatibility with 2.12.
Mark Doliner <mark@kingant.net>
parents: 30883
diff changeset
771
30883
b7b2b1f81aa0 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
masca@cpw.pidgin.im
parents: 30879
diff changeset
772 g_free(pass);
b7b2b1f81aa0 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
masca@cpw.pidgin.im
parents: 30879
diff changeset
773
b7b2b1f81aa0 Normalize both passports before comparation. This fixes the bug that opens a MUC with a buddy that is logged in on mutiple endpoints.
masca@cpw.pidgin.im
parents: 30879
diff changeset
774 return result;
30817
2327aa51a780 Move an user utility function to User.
masca@cpw.pidgin.im
parents: 30758
diff changeset
775 }
2327aa51a780 Move an user utility function to User.
masca@cpw.pidgin.im
parents: 30758
diff changeset
776
30731
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
777 gboolean
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
778 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
779 {
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
780 if (user == NULL)
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
781 return FALSE;
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
782
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
783 if (group_id == NULL)
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
784 return FALSE;
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
785
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
786 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
787 }
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
788
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
789 gboolean
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
790 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
791 {
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
792 if (user == NULL)
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
793 return FALSE;
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
794
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
795 return (user->list_op & (1 << list_id));
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
796 }
02dc01aa8c07 This are MsnUser functions, move them there.
masca@cpw.pidgin.im
parents: 30729
diff changeset
797