Mercurial > pidgin
annotate src/protocols/msn/user.h @ 5475:ad9887c91a59
[gaim-migrate @ 5871]
Fixed our support for the standard. I misread the discussion and used an
alternative proposal. So now we use the new, correct one.
Basically, what this means to the users is that 0.64 users will still see
0.63 MSN buddy icons, but 0.63 won't see 0.64's. No big deal.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 22 May 2003 01:31:56 +0000 |
parents | 0436e39c70cf |
children | bf2a7a7b739d |
rev | line source |
---|---|
5309 | 1 /** |
2 * @file user.h User functions | |
3 * | |
4 * gaim | |
5 * | |
6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
7 * | |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 */ | |
22 #ifndef _MSN_USER_H_ | |
23 #define _MSN_USER_H_ | |
24 | |
25 typedef struct _MsnUser MsnUser; | |
26 typedef struct _MsnUsers MsnUsers; | |
27 | |
28 #include "session.h" | |
29 | |
30 /** | |
31 * A user. | |
32 */ | |
33 struct _MsnUser | |
34 { | |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
35 MsnSession *session; /**< The MSN session. */ |
5316
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
36 |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
37 char *passport; /**< The passport account. */ |
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
38 char *name; /**< The friendly name. */ |
5309 | 39 |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
40 struct |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
41 { |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
42 char *home; /**< Home phone number. */ |
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
43 char *work; /**< Work phone number. */ |
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
44 char *mobile; /**< Mobile phone number. */ |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
45 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
46 } phone; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
47 |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
48 gboolean mobile; /**< Signed up with MSN Mobile. */ |
5309 | 49 |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
50 int group_id; /**< The group ID. */ |
5309 | 51 |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
52 size_t ref_count; /**< The reference count. */ |
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
53 |
5475
ad9887c91a59
[gaim-migrate @ 5871]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
54 GHashTable *clientcaps; /**< The client's capabilities. */ |
5309 | 55 }; |
56 | |
57 /** | |
58 * A collection of users. | |
59 */ | |
60 struct _MsnUsers | |
61 { | |
62 GList *users; /** The list of users. */ | |
63 }; | |
64 | |
65 /** | |
66 * Creates a new user structure. | |
67 * | |
68 * @param session The MSN session. | |
69 * @param passport The initial passport. | |
70 * @param name The initial friendly name. | |
71 * | |
72 * @return A new user structure. | |
73 */ | |
74 MsnUser *msn_user_new(MsnSession *session, const char *passport, | |
75 const char *name); | |
76 | |
77 /** | |
78 * Destroys a user structure. | |
79 * | |
80 * @param user The user to destroy. | |
81 */ | |
82 void msn_user_destroy(MsnUser *user); | |
83 | |
84 /** | |
85 * Increments the reference count on a user. | |
86 * | |
87 * @param user The user. | |
88 * | |
89 * @return @a user | |
90 */ | |
91 MsnUser *msn_user_ref(MsnUser *user); | |
92 | |
93 /** | |
94 * Decrements the reference count on a user. | |
95 * | |
96 * This will destroy the structure if the count hits 0. | |
97 * | |
98 * @param user The user. | |
99 * | |
100 * @return @a user, or @c NULL if the new count is 0. | |
101 */ | |
102 MsnUser *msn_user_unref(MsnUser *user); | |
103 | |
104 /** | |
105 * Sets the passport account for a user. | |
106 * | |
107 * @param user The user. | |
108 * @param passport The passport account. | |
109 */ | |
110 void msn_user_set_passport(MsnUser *user, const char *passport); | |
111 | |
112 /** | |
113 * Sets the friendly name for a user. | |
114 * | |
115 * @param user The user. | |
116 * @param name The friendly name. | |
117 */ | |
118 void msn_user_set_name(MsnUser *user, const char *name); | |
119 | |
120 /** | |
121 * Sets the group ID for a user. | |
122 * | |
123 * @param user The user. | |
124 * @param id The group ID. | |
125 */ | |
126 void msn_user_set_group_id(MsnUser *user, int id); | |
127 | |
128 /** | |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
129 * Sets the home phone number for a user. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
130 * |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
131 * @param user The user. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
132 * @param number The home phone number. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
133 */ |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
134 void msn_user_set_home_phone(MsnUser *user, const char *number); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
135 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
136 /** |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
137 * Sets the work phone number for a user. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
138 * |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
139 * @param user The user. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
140 * @param number The work phone number. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
141 */ |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
142 void msn_user_set_work_phone(MsnUser *user, const char *number); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
143 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
144 /** |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
145 * Sets the mobile phone number for a user. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
146 * |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
147 * @param user The user. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
148 * @param number The mobile phone number. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
149 */ |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
150 void msn_user_set_mobile_phone(MsnUser *user, const char *number); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
151 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
152 /** |
5309 | 153 * Returns the passport account for a user. |
154 * | |
155 * @param user The user. | |
156 * | |
157 * @return The passport account. | |
158 */ | |
159 const char *msn_user_get_passport(const MsnUser *user); | |
160 | |
161 /** | |
162 * Returns the friendly name for a user. | |
163 * | |
164 * @param user The user. | |
165 * | |
166 * @return The friendly name. | |
167 */ | |
168 const char *msn_user_get_name(const MsnUser *user); | |
169 | |
170 /** | |
171 * Returns the group ID for a user. | |
172 * | |
173 * @param user The user. | |
174 * | |
175 * @return The group ID. | |
176 */ | |
177 int msn_user_get_group_id(const MsnUser *user); | |
178 | |
179 /** | |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
180 * Returns the home phone number for a user. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
181 * |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
182 * @param user The user. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
183 * |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
184 * @return The user's home phone number. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
185 */ |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
186 const char *msn_user_get_home_phone(const MsnUser *user); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
187 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
188 /** |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
189 * Returns the work phone number for a user. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
190 * |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
191 * @param user The user. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
192 * |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
193 * @return The user's work phone number. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
194 */ |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
195 const char *msn_user_get_work_phone(const MsnUser *user); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
196 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
197 /** |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
198 * Returns the mobile phone number for a user. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
199 * |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
200 * @param user The user. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
201 * |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
202 * @return The user's mobile phone number. |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
203 */ |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
204 const char *msn_user_get_mobile_phone(const MsnUser *user); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
205 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5316
diff
changeset
|
206 /** |
5316
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
207 * Sets the client information for a user. |
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
208 * |
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
209 * @param user The user. |
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
210 * @param info The client information. |
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
211 */ |
5475
ad9887c91a59
[gaim-migrate @ 5871]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
212 void msn_user_set_client_caps(MsnUser *user, GHashTable *info); |
5316
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
213 |
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
214 /** |
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
215 * Returns the client information for a user. |
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
216 * |
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
217 * @param user The user. |
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
218 * |
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
219 * @return The client information. |
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
220 */ |
5475
ad9887c91a59
[gaim-migrate @ 5871]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
221 GHashTable *msn_user_get_client_caps(const MsnUser *user); |
5316
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
222 |
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
223 /** |
5309 | 224 * Creates a new MsnUsers structure. |
225 * | |
226 * @return A new MsnUsers structure. | |
227 */ | |
228 MsnUsers *msn_users_new(void); | |
229 | |
230 /** | |
231 * Destroys a users list. | |
232 * | |
233 * @param users The users list. | |
234 */ | |
235 void msn_users_destroy(MsnUsers *users); | |
236 | |
237 /** | |
238 * Adds a user to a users list. | |
239 * | |
240 * @param users The users list. | |
241 * @param user The user. | |
242 */ | |
243 void msn_users_add(MsnUsers *users, MsnUser *user); | |
244 | |
245 /** | |
246 * Removes a user from a users list. | |
247 * | |
248 * @param users The users list. | |
249 * @param user The user. | |
250 */ | |
251 void msn_users_remove(MsnUsers *users, MsnUser *user); | |
252 | |
253 /** | |
254 * Finds a user with the specified passport. | |
255 * | |
256 * @param users A list of users. | |
257 * @param passport The passport. | |
258 * | |
259 * @return The user if found, or @c NULL otherwise. | |
260 */ | |
261 MsnUser *msn_users_find_with_passport(MsnUsers *users, const char *passport); | |
262 | |
263 #endif /* _MSN_USER_H_ */ |