2 * @file user.h User functions
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
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.
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.
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
27 typedef struct _MsnUser MsnUser;
36 MSN_NETWORK_UNKNOWN = 0x00,
37 MSN_NETWORK_PASSPORT = 0x01,
38 MSN_NETWORK_COMMUNICATOR = 0x02,
39 MSN_NETWORK_MOBILE = 0x04,
40 MSN_NETWORK_MNI = 0x08,
41 MSN_NETWORK_SMTP = 0x10,
42 MSN_NETWORK_YAHOO = 0x20
50 CURRENT_MEDIA_UNKNOWN,
56 typedef struct _CurrentMedia
58 CurrentMediaType type; /**< Type. */
59 char *title; /**< Title. */
60 char *artist; /**< Artist. */
61 char *album; /**< Album. */
69 MsnUserList *userlist;
71 char *passport; /**< The passport account. */
72 char *friendly_name; /**< The friendly name. */
74 char * uid; /*< User Id */
76 const char *status; /**< The state of the user. */
77 char *statusline; /**< The state of the user. */
78 CurrentMedia media; /**< Current media of the user. */
80 gboolean idle; /**< The idle state of the user. */
84 char *home; /**< Home phone number. */
85 char *work; /**< Work phone number. */
86 char *mobile; /**< Mobile phone number. */
90 gboolean authorized; /**< Authorized to add this user. */
91 gboolean mobile; /**< Signed up with MSN Mobile. */
93 GList *group_ids; /**< The group IDs. */
94 char *pending_group; /**< A pending group to add. */
96 MsnObject *msnobj; /**< The user's MSN Object. */
98 GHashTable *clientcaps; /**< The client's capabilities. */
100 guint clientid; /**< The client's ID */
102 MsnNetwork networkid; /**< The user's network */
104 int list_op; /**< Which lists the user is in */
106 guint membership_id[5]; /**< The membershipId sent by the contacts server,
107 indexed by the list it belongs to */
109 char *invite_message; /**< Invite message of user request */
112 /**************************************************************************
114 **************************************************************************/
118 * Creates a new user structure.
120 * @param session The MSN session.
121 * @param passport The initial passport.
122 * @param stored_name The initial stored name.
124 * @return A new user structure.
126 MsnUser *msn_user_new(MsnUserList *userlist, const char *passport,
127 const char *friendly_name);
130 * Destroys a user structure.
132 * @param user The user to destroy.
134 void msn_user_destroy(MsnUser *user);
140 * Communicates with the core to update the ui, etc.
142 * @param user The user to update.
144 void msn_user_update(MsnUser *user);
147 * Sets the new statusline of user.
149 * @param user The user.
150 * @param state The statusline string.
152 void msn_user_set_statusline(MsnUser *user, const char *statusline);
155 * Sets the current media of user.
157 * @param user The user.
158 * @param cmedia Current media.
160 void msn_user_set_currentmedia(MsnUser *user, const CurrentMedia *cmedia);
163 * Sets the new state of user.
165 * @param user The user.
166 * @param state The state string.
168 void msn_user_set_state(MsnUser *user, const char *state);
171 * Sets the passport account for a user.
173 * @param user The user.
174 * @param passport The passport account.
176 void msn_user_set_passport(MsnUser *user, const char *passport);
179 * Sets the friendly name for a user.
181 * @param user The user.
182 * @param name The friendly name.
184 * @returns TRUE is name actually changed, FALSE otherwise.
186 gboolean msn_user_set_friendly_name(MsnUser *user, const char *name);
189 * Sets the buddy icon for a local user.
191 * @param user The user.
192 * @param img The buddy icon image
194 void msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img);
197 * Sets the group ID list for a user.
199 * @param user The user.
200 * @param ids The group ID list.
202 void msn_user_set_group_ids(MsnUser *user, GList *ids);
205 * Adds the group ID for a user.
207 * @param user The user.
208 * @param id The group ID.
210 void msn_user_add_group_id(MsnUser *user, const char * id);
213 * Removes the group ID from a user.
215 * @param user The user.
216 * @param id The group ID.
218 void msn_user_remove_group_id(MsnUser *user, const char * id);
221 * Sets the pending group for a user.
223 * @param user The user.
224 * @param group The group name.
226 void msn_user_set_pending_group(MsnUser *user, const char *group);
229 * Removes the pending group from a user.
231 * @param user The user.
233 * @return Returns the pending group name.
235 char *msn_user_remove_pending_group(MsnUser *user);
238 * Sets the home phone number for a user.
240 * @param user The user.
241 * @param number The home phone number.
243 void msn_user_set_home_phone(MsnUser *user, const char *number);
246 * Sets the work phone number for a user.
248 * @param user The user.
249 * @param number The work phone number.
251 void msn_user_set_work_phone(MsnUser *user, const char *number);
253 void msn_user_set_uid(MsnUser *user, const char *uid);
256 * Sets the client id for a user.
258 * @param user The user.
259 * @param clientid The client id.
261 void msn_user_set_clientid(MsnUser *user, guint clientid);
264 * Sets the network id for a user.
266 * @param user The user.
267 * @param network The network id.
269 void msn_user_set_network(MsnUser *user, MsnNetwork network);
272 * Sets the mobile phone number for a user.
274 * @param user The user.
275 * @param number The mobile phone number.
277 void msn_user_set_mobile_phone(MsnUser *user, const char *number);
280 * Sets the MSNObject for a user.
282 * @param user The user.
283 * @param obj The MSNObject.
285 void msn_user_set_object(MsnUser *user, MsnObject *obj);
288 * Sets the client information for a user.
290 * @param user The user.
291 * @param info The client information.
293 void msn_user_set_client_caps(MsnUser *user, GHashTable *info);
296 * Sets the invite message for a user.
298 * @param user The user.
299 * @param message The invite message for a user.
301 void msn_user_set_invite_message(MsnUser *user, const char *message);
305 * Returns the passport account for a user.
307 * @param user The user.
309 * @return The passport account.
311 const char *msn_user_get_passport(const MsnUser *user);
314 * Returns the friendly name for a user.
316 * @param user The user.
318 * @return The friendly name.
320 const char *msn_user_get_friendly_name(const MsnUser *user);
323 * Returns the home phone number for a user.
325 * @param user The user.
327 * @return The user's home phone number.
329 const char *msn_user_get_home_phone(const MsnUser *user);
332 * Returns the work phone number for a user.
334 * @param user The user.
336 * @return The user's work phone number.
338 const char *msn_user_get_work_phone(const MsnUser *user);
341 * Returns the mobile phone number for a user.
343 * @param user The user.
345 * @return The user's mobile phone number.
347 const char *msn_user_get_mobile_phone(const MsnUser *user);
350 * Returns the client id for a user.
352 * @param user The user.
354 * @return The user's client id.
356 guint msn_user_get_clientid(const MsnUser *user);
359 * Returns the network id for a user.
361 * @param user The user.
363 * @return The user's network id.
365 MsnNetwork msn_user_get_network(const MsnUser *user);
368 * Returns the MSNObject for a user.
370 * @param user The user.
372 * @return The MSNObject.
374 MsnObject *msn_user_get_object(const MsnUser *user);
377 * Returns the client information for a user.
379 * @param user The user.
381 * @return The client information.
383 GHashTable *msn_user_get_client_caps(const MsnUser *user);
386 * Returns the invite message for a user.
388 * @param user The user.
390 * @return The user's invite message.
392 const char *msn_user_get_invite_message(const MsnUser *user);
395 * check to see if user is online
398 msn_user_is_online(PurpleAccount *account, const char *name);
401 * check to see if user is Yahoo User
404 msn_user_is_yahoo(PurpleAccount *account ,const char *name);
406 void msn_user_set_op(MsnUser *user, int list_op);
407 void msn_user_unset_op(MsnUser *user, int list_op);
412 #endif /* _MSN_USER_H_ */