annotate libpurple/protocols/msnp9/user.c @ 23123:981a0bfc3d9d

Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 31 Mar 2008 21:23:57 +0000
parents 5ffb0b5f785f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1 /**
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2 * @file user.c User functions
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
3 *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
4 * purple
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
5 *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
8 * source distribution.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
9 *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
13 * (at your option) any later version.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
14 *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
18 * GNU General Public License for more details.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
19 *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
23 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
24 #include "msn.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
25 #include "user.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
26 #include "slp.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
27
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
28 MsnUser *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
29 msn_user_new(MsnUserList *userlist, const char *passport,
21589
af5de2b08fe0 QuLogic submitted this patch a long time ago, References #2571. I believe
Ka-Hing Cheung <khc@hxbc.us>
parents: 21312
diff changeset
30 const char *friendly_name)
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
31 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
32 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
33
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
34 user = g_new0(MsnUser, 1);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
35
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
36 user->userlist = userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
37
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
38 msn_user_set_passport(user, passport);
22247
5ffb0b5f785f Passing NULL to msn_user_set_friendly_name explodes, and msn_user_new is called
Will Thompson <will.thompson@collabora.co.uk>
parents: 21685
diff changeset
39 if (friendly_name != NULL)
5ffb0b5f785f Passing NULL to msn_user_set_friendly_name explodes, and msn_user_new is called
Will Thompson <will.thompson@collabora.co.uk>
parents: 21685
diff changeset
40 msn_user_set_friendly_name(user, friendly_name);
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
41
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
42 return user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
43 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
44
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
45 void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
46 msn_user_destroy(MsnUser *user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
47 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
48 g_return_if_fail(user != NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
49
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
50 if (user->clientcaps != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
51 g_hash_table_destroy(user->clientcaps);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
52
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
53 if (user->group_ids != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
54 g_list_free(user->group_ids);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
55
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
56 if (user->msnobj != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
57 msn_object_destroy(user->msnobj);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
58
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
59 g_free(user->passport);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
60 g_free(user->friendly_name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
61 g_free(user->phone.home);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
62 g_free(user->phone.work);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
63 g_free(user->phone.mobile);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
64
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
65 g_free(user);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
66 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
67
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
68 void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
69 msn_user_update(MsnUser *user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
70 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
71 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
72
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
73 account = user->userlist->session->account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
74
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
75 if (user->status != NULL) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
76 if (!strcmp(user->status, "offline") && user->mobile) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
77 purple_prpl_got_user_status(account, user->passport, "offline", NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
78 purple_prpl_got_user_status(account, user->passport, "mobile", NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
79 } else {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
80 purple_prpl_got_user_status(account, user->passport, user->status, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
81 purple_prpl_got_user_status_deactive(account, user->passport, "mobile");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
82 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
83 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
84
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
85 if (user->idle)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
86 purple_prpl_got_user_idle(account, user->passport, TRUE, -1);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
87 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
88 purple_prpl_got_user_idle(account, user->passport, FALSE, 0);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
89 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
90
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
91 void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
92 msn_user_set_state(MsnUser *user, const char *state)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
93 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
94 const char *status;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
95
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
96 if (!g_ascii_strcasecmp(state, "BSY"))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
97 status = "busy";
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
98 else if (!g_ascii_strcasecmp(state, "BRB"))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
99 status = "brb";
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
100 else if (!g_ascii_strcasecmp(state, "AWY"))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
101 status = "away";
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
102 else if (!g_ascii_strcasecmp(state, "PHN"))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
103 status = "phone";
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
104 else if (!g_ascii_strcasecmp(state, "LUN"))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
105 status = "lunch";
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
106 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
107 status = "available";
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
108
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
109 if (!g_ascii_strcasecmp(state, "IDL"))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
110 user->idle = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
111 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
112 user->idle = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
113
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
114 user->status = status;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
115 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
116
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
117 void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
118 msn_user_set_passport(MsnUser *user, const char *passport)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
119 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
120 g_return_if_fail(user != NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
121
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
122 g_free(user->passport);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
123 user->passport = g_strdup(passport);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
124 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
125
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
126 void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
127 msn_user_set_friendly_name(MsnUser *user, const char *name)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
128 {
21589
af5de2b08fe0 QuLogic submitted this patch a long time ago, References #2571. I believe
Ka-Hing Cheung <khc@hxbc.us>
parents: 21312
diff changeset
129 MsnCmdProc *cmdproc;
21685
b08d0296ab88 Fix 2 more issues related to friendly names:
Stu Tomlinson <stu@nosnilmot.com>
parents: 21674
diff changeset
130 MsnSession *session;
21674
4bc7d44f543a Prevent exceeding the server limit on friendly name length when setting
Stu Tomlinson <stu@nosnilmot.com>
parents: 21589
diff changeset
131 const char *encoded;
21589
af5de2b08fe0 QuLogic submitted this patch a long time ago, References #2571. I believe
Ka-Hing Cheung <khc@hxbc.us>
parents: 21312
diff changeset
132
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
133 g_return_if_fail(user != NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
134
21674
4bc7d44f543a Prevent exceeding the server limit on friendly name length when setting
Stu Tomlinson <stu@nosnilmot.com>
parents: 21589
diff changeset
135 encoded = purple_url_encode(name);
21685
b08d0296ab88 Fix 2 more issues related to friendly names:
Stu Tomlinson <stu@nosnilmot.com>
parents: 21674
diff changeset
136 session = user->userlist->session;
21674
4bc7d44f543a Prevent exceeding the server limit on friendly name length when setting
Stu Tomlinson <stu@nosnilmot.com>
parents: 21589
diff changeset
137
21685
b08d0296ab88 Fix 2 more issues related to friendly names:
Stu Tomlinson <stu@nosnilmot.com>
parents: 21674
diff changeset
138 if (user->friendly_name && strcmp(user->friendly_name, name)
b08d0296ab88 Fix 2 more issues related to friendly names:
Stu Tomlinson <stu@nosnilmot.com>
parents: 21674
diff changeset
139 && (strlen(encoded) < 387) && session->passport_info.verified &&
b08d0296ab88 Fix 2 more issues related to friendly names:
Stu Tomlinson <stu@nosnilmot.com>
parents: 21674
diff changeset
140 (user->list_op & MSN_LIST_FL_OP)) {
21589
af5de2b08fe0 QuLogic submitted this patch a long time ago, References #2571. I believe
Ka-Hing Cheung <khc@hxbc.us>
parents: 21312
diff changeset
141 /* copy the new name to the server list, but only when new */
af5de2b08fe0 QuLogic submitted this patch a long time ago, References #2571. I believe
Ka-Hing Cheung <khc@hxbc.us>
parents: 21312
diff changeset
142 /* should we check this more thoroughly? */
21685
b08d0296ab88 Fix 2 more issues related to friendly names:
Stu Tomlinson <stu@nosnilmot.com>
parents: 21674
diff changeset
143 cmdproc = session->notification->cmdproc;
21589
af5de2b08fe0 QuLogic submitted this patch a long time ago, References #2571. I believe
Ka-Hing Cheung <khc@hxbc.us>
parents: 21312
diff changeset
144 msn_cmdproc_send(cmdproc, "REA", "%s %s",
af5de2b08fe0 QuLogic submitted this patch a long time ago, References #2571. I believe
Ka-Hing Cheung <khc@hxbc.us>
parents: 21312
diff changeset
145 user->passport,
21674
4bc7d44f543a Prevent exceeding the server limit on friendly name length when setting
Stu Tomlinson <stu@nosnilmot.com>
parents: 21589
diff changeset
146 encoded);
21589
af5de2b08fe0 QuLogic submitted this patch a long time ago, References #2571. I believe
Ka-Hing Cheung <khc@hxbc.us>
parents: 21312
diff changeset
147 }
af5de2b08fe0 QuLogic submitted this patch a long time ago, References #2571. I believe
Ka-Hing Cheung <khc@hxbc.us>
parents: 21312
diff changeset
148
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
149 g_free(user->friendly_name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
150 user->friendly_name = g_strdup(name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
151 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
152
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
153 void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
154 msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
155 {
23123
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22247
diff changeset
156 MsnObject *msnobj = NULL;
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
157
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
158 g_return_if_fail(user != NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
159
23123
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22247
diff changeset
160 msnobj = msn_object_new_from_image(img, "TFR2C2.tmp",
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22247
diff changeset
161 user->passport, MSN_OBJECT_USERTILE);
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
162
23123
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22247
diff changeset
163 if(!msnobj)
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22247
diff changeset
164 purple_debug_error("msn", "Unable to open buddy icon from %s!\n", user->passport);
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
165
23123
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22247
diff changeset
166 msn_user_set_object(user, msnobj);
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
167 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
168
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
169 void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
170 msn_user_add_group_id(MsnUser *user, int id)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
171 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
172 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
173 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
174 PurpleBuddy *b;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
175 PurpleGroup *g;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
176 const char *passport;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
177 const char *group_name;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
178
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
179 g_return_if_fail(user != NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
180 g_return_if_fail(id >= 0);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
181
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
182 user->group_ids = g_list_append(user->group_ids, GINT_TO_POINTER(id));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
183
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
184 userlist = user->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
185 account = userlist->session->account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
186 passport = msn_user_get_passport(user);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
187
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
188 group_name = msn_userlist_find_group_name(userlist, id);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
189
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
190 g = purple_find_group(group_name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
191
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
192 if ((id == 0) && (g == NULL))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
193 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
194 g = purple_group_new(group_name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
195 purple_blist_add_group(g, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
196 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
197
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
198 b = purple_find_buddy_in_group(account, passport, g);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
199
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
200 if (b == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
201 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
202 b = purple_buddy_new(account, passport, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
203
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
204 purple_blist_add_buddy(b, NULL, g, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
205 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
206
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
207 b->proto_data = user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
208 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
209
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
210 void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
211 msn_user_remove_group_id(MsnUser *user, int id)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
212 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
213 g_return_if_fail(user != NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
214 g_return_if_fail(id >= 0);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
215
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
216 user->group_ids = g_list_remove(user->group_ids, GINT_TO_POINTER(id));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
217 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
218
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
219 void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
220 msn_user_set_home_phone(MsnUser *user, const char *number)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
221 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
222 g_return_if_fail(user != NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
223
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
224 if (user->phone.home != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
225 g_free(user->phone.home);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
226
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
227 user->phone.home = (number == NULL ? NULL : g_strdup(number));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
228 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
229
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
230 void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
231 msn_user_set_work_phone(MsnUser *user, const char *number)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
232 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
233 g_return_if_fail(user != NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
234
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
235 if (user->phone.work != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
236 g_free(user->phone.work);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
237
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
238 user->phone.work = (number == NULL ? NULL : g_strdup(number));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
239 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
240
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
241 void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
242 msn_user_set_mobile_phone(MsnUser *user, const char *number)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
243 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
244 g_return_if_fail(user != NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
245
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
246 if (user->phone.mobile != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
247 g_free(user->phone.mobile);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
248
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
249 user->phone.mobile = (number == NULL ? NULL : g_strdup(number));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
250 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
251
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
252 void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
253 msn_user_set_object(MsnUser *user, MsnObject *obj)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
254 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
255 g_return_if_fail(user != NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
256
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
257 if (user->msnobj != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
258 msn_object_destroy(user->msnobj);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
259
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
260 user->msnobj = obj;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
261
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
262 if (user->list_op & MSN_LIST_FL_OP)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
263 msn_queue_buddy_icon_request(user);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
264 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
265
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
266 void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
267 msn_user_set_client_caps(MsnUser *user, GHashTable *info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
268 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
269 g_return_if_fail(user != NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
270 g_return_if_fail(info != NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
271
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
272 if (user->clientcaps != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
273 g_hash_table_destroy(user->clientcaps);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
274
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
275 user->clientcaps = info;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
276 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
277
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
278 const char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
279 msn_user_get_passport(const MsnUser *user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
280 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
281 g_return_val_if_fail(user != NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
282
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
283 return user->passport;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
284 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
285
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
286 const char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
287 msn_user_get_friendly_name(const MsnUser *user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
288 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
289 g_return_val_if_fail(user != NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
290
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
291 return user->friendly_name;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
292 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
293
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
294 const char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
295 msn_user_get_home_phone(const MsnUser *user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
296 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
297 g_return_val_if_fail(user != NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
298
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
299 return user->phone.home;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
300 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
301
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
302 const char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
303 msn_user_get_work_phone(const MsnUser *user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
304 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
305 g_return_val_if_fail(user != NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
306
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
307 return user->phone.work;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
308 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
309
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
310 const char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
311 msn_user_get_mobile_phone(const MsnUser *user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
312 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
313 g_return_val_if_fail(user != NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
314
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
315 return user->phone.mobile;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
316 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
317
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
318 MsnObject *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
319 msn_user_get_object(const MsnUser *user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
320 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
321 g_return_val_if_fail(user != NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
322
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
323 return user->msnobj;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
324 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
325
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
326 GHashTable *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
327 msn_user_get_client_caps(const MsnUser *user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
328 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
329 g_return_val_if_fail(user != NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
330
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
331 return user->clientcaps;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
332 }