| |
1 /** |
| |
2 * @file user.h User functions |
| |
3 * |
| |
4 * purple |
| |
5 * |
| |
6 * Purple is the legal property of its developers, whose names are too numerous |
| |
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
| |
8 * source distribution. |
| |
9 * |
| |
10 * This program is free software; you can redistribute it and/or modify |
| |
11 * it under the terms of the GNU General Public License as published by |
| |
12 * the Free Software Foundation; either version 2 of the License, or |
| |
13 * (at your option) any later version. |
| |
14 * |
| |
15 * This program is distributed in the hope that it will be useful, |
| |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| |
18 * GNU General Public License for more details. |
| |
19 * |
| |
20 * You should have received a copy of the GNU General Public License |
| |
21 * along with this program; if not, write to the Free Software |
| |
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| |
23 */ |
| |
24 #ifndef _MSN_USER_H_ |
| |
25 #define _MSN_USER_H_ |
| |
26 |
| |
27 typedef struct _MsnUser MsnUser; |
| |
28 |
| |
29 #include "session.h" |
| |
30 #include "object.h" |
| |
31 |
| |
32 #include "userlist.h" |
| |
33 |
| |
34 /** |
| |
35 * A user. |
| |
36 */ |
| |
37 struct _MsnUser |
| |
38 { |
| |
39 #if 0 |
| |
40 MsnSession *session; /**< The MSN session. */ |
| |
41 #endif |
| |
42 MsnUserList *userlist; |
| |
43 |
| |
44 char *passport; /**< The passport account. */ |
| |
45 char *store_name; /**< The name stored in the server. */ |
| |
46 char *friendly_name; /**< The friendly name. */ |
| |
47 |
| |
48 const char *status; /**< The state of the user. */ |
| |
49 gboolean idle; /**< The idle state of the user. */ |
| |
50 |
| |
51 struct |
| |
52 { |
| |
53 char *home; /**< Home phone number. */ |
| |
54 char *work; /**< Work phone number. */ |
| |
55 char *mobile; /**< Mobile phone number. */ |
| |
56 |
| |
57 } phone; |
| |
58 |
| |
59 gboolean authorized; /**< Authorized to add this user. */ |
| |
60 gboolean mobile; /**< Signed up with MSN Mobile. */ |
| |
61 |
| |
62 GList *group_ids; /**< The group IDs. */ |
| |
63 |
| |
64 MsnObject *msnobj; /**< The user's MSN Object. */ |
| |
65 |
| |
66 GHashTable *clientcaps; /**< The client's capabilities. */ |
| |
67 |
| |
68 int list_op; |
| |
69 }; |
| |
70 |
| |
71 /**************************************************************************/ |
| |
72 /** @name User API */ |
| |
73 /**************************************************************************/ |
| |
74 /*@{*/ |
| |
75 |
| |
76 /** |
| |
77 * Creates a new user structure. |
| |
78 * |
| |
79 * @param session The MSN session. |
| |
80 * @param passport The initial passport. |
| |
81 * @param stored_name The initial stored name. |
| |
82 * |
| |
83 * @return A new user structure. |
| |
84 */ |
| |
85 MsnUser *msn_user_new(MsnUserList *userlist, const char *passport, |
| |
86 const char *store_name); |
| |
87 |
| |
88 /** |
| |
89 * Destroys a user structure. |
| |
90 * |
| |
91 * @param user The user to destroy. |
| |
92 */ |
| |
93 void msn_user_destroy(MsnUser *user); |
| |
94 |
| |
95 |
| |
96 /** |
| |
97 * Updates the user. |
| |
98 * |
| |
99 * Communicates with the core to update the ui, etc. |
| |
100 * |
| |
101 * @param user The user to update. |
| |
102 */ |
| |
103 void msn_user_update(MsnUser *user); |
| |
104 |
| |
105 /** |
| |
106 * Sets the new state of user. |
| |
107 * |
| |
108 * @param user The user. |
| |
109 * @param state The state string. |
| |
110 */ |
| |
111 void msn_user_set_state(MsnUser *user, const char *state); |
| |
112 |
| |
113 /** |
| |
114 * Sets the passport account for a user. |
| |
115 * |
| |
116 * @param user The user. |
| |
117 * @param passport The passport account. |
| |
118 */ |
| |
119 void msn_user_set_passport(MsnUser *user, const char *passport); |
| |
120 |
| |
121 /** |
| |
122 * Sets the friendly name for a user. |
| |
123 * |
| |
124 * @param user The user. |
| |
125 * @param name The friendly name. |
| |
126 */ |
| |
127 void msn_user_set_friendly_name(MsnUser *user, const char *name); |
| |
128 |
| |
129 /** |
| |
130 * Sets the store name for a user. |
| |
131 * |
| |
132 * @param user The user. |
| |
133 * @param name The store name. |
| |
134 */ |
| |
135 void msn_user_set_store_name(MsnUser *user, const char *name); |
| |
136 |
| |
137 /** |
| |
138 * Sets the buddy icon for a local user. |
| |
139 * |
| |
140 * @param user The user. |
| |
141 * @param img The buddy icon image |
| |
142 */ |
| |
143 void msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img); |
| |
144 |
| |
145 /** |
| |
146 * Sets the group ID list for a user. |
| |
147 * |
| |
148 * @param user The user. |
| |
149 * @param ids The group ID list. |
| |
150 */ |
| |
151 void msn_user_set_group_ids(MsnUser *user, GList *ids); |
| |
152 |
| |
153 /** |
| |
154 * Adds the group ID for a user. |
| |
155 * |
| |
156 * @param user The user. |
| |
157 * @param id The group ID. |
| |
158 */ |
| |
159 void msn_user_add_group_id(MsnUser *user, int id); |
| |
160 |
| |
161 /** |
| |
162 * Removes the group ID from a user. |
| |
163 * |
| |
164 * @param user The user. |
| |
165 * @param id The group ID. |
| |
166 */ |
| |
167 void msn_user_remove_group_id(MsnUser *user, int id); |
| |
168 |
| |
169 /** |
| |
170 * Sets the home phone number for a user. |
| |
171 * |
| |
172 * @param user The user. |
| |
173 * @param number The home phone number. |
| |
174 */ |
| |
175 void msn_user_set_home_phone(MsnUser *user, const char *number); |
| |
176 |
| |
177 /** |
| |
178 * Sets the work phone number for a user. |
| |
179 * |
| |
180 * @param user The user. |
| |
181 * @param number The work phone number. |
| |
182 */ |
| |
183 void msn_user_set_work_phone(MsnUser *user, const char *number); |
| |
184 |
| |
185 /** |
| |
186 * Sets the mobile phone number for a user. |
| |
187 * |
| |
188 * @param user The user. |
| |
189 * @param number The mobile phone number. |
| |
190 */ |
| |
191 void msn_user_set_mobile_phone(MsnUser *user, const char *number); |
| |
192 |
| |
193 /** |
| |
194 * Sets the MSNObject for a user. |
| |
195 * |
| |
196 * @param user The user. |
| |
197 * @param obj The MSNObject. |
| |
198 */ |
| |
199 void msn_user_set_object(MsnUser *user, MsnObject *obj); |
| |
200 |
| |
201 /** |
| |
202 * Sets the client information for a user. |
| |
203 * |
| |
204 * @param user The user. |
| |
205 * @param info The client information. |
| |
206 */ |
| |
207 void msn_user_set_client_caps(MsnUser *user, GHashTable *info); |
| |
208 |
| |
209 |
| |
210 /** |
| |
211 * Returns the passport account for a user. |
| |
212 * |
| |
213 * @param user The user. |
| |
214 * |
| |
215 * @return The passport account. |
| |
216 */ |
| |
217 const char *msn_user_get_passport(const MsnUser *user); |
| |
218 |
| |
219 /** |
| |
220 * Returns the friendly name for a user. |
| |
221 * |
| |
222 * @param user The user. |
| |
223 * |
| |
224 * @return The friendly name. |
| |
225 */ |
| |
226 const char *msn_user_get_friendly_name(const MsnUser *user); |
| |
227 |
| |
228 /** |
| |
229 * Returns the store name for a user. |
| |
230 * |
| |
231 * @param user The user. |
| |
232 * |
| |
233 * @return The store name. |
| |
234 */ |
| |
235 const char *msn_user_get_store_name(const MsnUser *user); |
| |
236 |
| |
237 /** |
| |
238 * Returns the home phone number for a user. |
| |
239 * |
| |
240 * @param user The user. |
| |
241 * |
| |
242 * @return The user's home phone number. |
| |
243 */ |
| |
244 const char *msn_user_get_home_phone(const MsnUser *user); |
| |
245 |
| |
246 /** |
| |
247 * Returns the work phone number for a user. |
| |
248 * |
| |
249 * @param user The user. |
| |
250 * |
| |
251 * @return The user's work phone number. |
| |
252 */ |
| |
253 const char *msn_user_get_work_phone(const MsnUser *user); |
| |
254 |
| |
255 /** |
| |
256 * Returns the mobile phone number for a user. |
| |
257 * |
| |
258 * @param user The user. |
| |
259 * |
| |
260 * @return The user's mobile phone number. |
| |
261 */ |
| |
262 const char *msn_user_get_mobile_phone(const MsnUser *user); |
| |
263 |
| |
264 /** |
| |
265 * Returns the MSNObject for a user. |
| |
266 * |
| |
267 * @param user The user. |
| |
268 * |
| |
269 * @return The MSNObject. |
| |
270 */ |
| |
271 MsnObject *msn_user_get_object(const MsnUser *user); |
| |
272 |
| |
273 /** |
| |
274 * Returns the client information for a user. |
| |
275 * |
| |
276 * @param user The user. |
| |
277 * |
| |
278 * @return The client information. |
| |
279 */ |
| |
280 GHashTable *msn_user_get_client_caps(const MsnUser *user); |
| |
281 |
| |
282 /*@}*/ |
| |
283 |
| |
284 #endif /* _MSN_USER_H_ */ |