| 1 /** |
|
| 2 * @file user.h User functions |
|
| 3 * |
|
| 4 * gaim |
|
| 5 * |
|
| 6 * Gaim 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 char * uid; /*< User Id */ |
|
| 49 |
|
| 50 const char *status; /**< The state of the user. */ |
|
| 51 const char *statusline; /**< The state of the user. */ |
|
| 52 |
|
| 53 gboolean idle; /**< The idle state of the user. */ |
|
| 54 |
|
| 55 struct |
|
| 56 { |
|
| 57 char *home; /**< Home phone number. */ |
|
| 58 char *work; /**< Work phone number. */ |
|
| 59 char *mobile; /**< Mobile phone number. */ |
|
| 60 |
|
| 61 } phone; |
|
| 62 |
|
| 63 gboolean authorized; /**< Authorized to add this user. */ |
|
| 64 gboolean mobile; /**< Signed up with MSN Mobile. */ |
|
| 65 |
|
| 66 GList *group_ids; /**< The group IDs. */ |
|
| 67 |
|
| 68 MsnObject *msnobj; /**< The user's MSN Object. */ |
|
| 69 |
|
| 70 GHashTable *clientcaps; /**< The client's capabilities. */ |
|
| 71 |
|
| 72 int type; |
|
| 73 int list_op; |
|
| 74 }; |
|
| 75 |
|
| 76 /**************************************************************************/ |
|
| 77 /** @name User API */ |
|
| 78 /**************************************************************************/ |
|
| 79 /*@{*/ |
|
| 80 |
|
| 81 /** |
|
| 82 * Creates a new user structure. |
|
| 83 * |
|
| 84 * @param session The MSN session. |
|
| 85 * @param passport The initial passport. |
|
| 86 * @param stored_name The initial stored name. |
|
| 87 * |
|
| 88 * @return A new user structure. |
|
| 89 */ |
|
| 90 MsnUser *msn_user_new(MsnUserList *userlist, const char *passport, |
|
| 91 const char *store_name); |
|
| 92 |
|
| 93 /** |
|
| 94 * Destroys a user structure. |
|
| 95 * |
|
| 96 * @param user The user to destroy. |
|
| 97 */ |
|
| 98 void msn_user_destroy(MsnUser *user); |
|
| 99 |
|
| 100 |
|
| 101 /** |
|
| 102 * Updates the user. |
|
| 103 * |
|
| 104 * Communicates with the core to update the ui, etc. |
|
| 105 * |
|
| 106 * @param user The user to update. |
|
| 107 */ |
|
| 108 void msn_user_update(MsnUser *user); |
|
| 109 |
|
| 110 /** |
|
| 111 * Sets the new statusline of user. |
|
| 112 * |
|
| 113 * @param user The user. |
|
| 114 * @param state The statusline string. |
|
| 115 */ |
|
| 116 void msn_user_set_statusline(MsnUser *user, const char *statusline); |
|
| 117 |
|
| 118 /** |
|
| 119 * Sets the new state of user. |
|
| 120 * |
|
| 121 * @param user The user. |
|
| 122 * @param state The state string. |
|
| 123 */ |
|
| 124 void msn_user_set_state(MsnUser *user, const char *state); |
|
| 125 |
|
| 126 /** |
|
| 127 * Sets the passport account for a user. |
|
| 128 * |
|
| 129 * @param user The user. |
|
| 130 * @param passport The passport account. |
|
| 131 */ |
|
| 132 void msn_user_set_passport(MsnUser *user, const char *passport); |
|
| 133 |
|
| 134 /** |
|
| 135 * Sets the friendly name for a user. |
|
| 136 * |
|
| 137 * @param user The user. |
|
| 138 * @param name The friendly name. |
|
| 139 */ |
|
| 140 void msn_user_set_friendly_name(MsnUser *user, const char *name); |
|
| 141 |
|
| 142 /** |
|
| 143 * Sets the store name for a user. |
|
| 144 * |
|
| 145 * @param user The user. |
|
| 146 * @param name The store name. |
|
| 147 */ |
|
| 148 void msn_user_set_store_name(MsnUser *user, const char *name); |
|
| 149 |
|
| 150 /** |
|
| 151 * Sets the buddy icon for a local user. |
|
| 152 * |
|
| 153 * @param user The user. |
|
| 154 * @param filename The path to the buddy icon. |
|
| 155 */ |
|
| 156 void msn_user_set_buddy_icon(MsnUser *user, const char *filename); |
|
| 157 |
|
| 158 /** |
|
| 159 * Sets the group ID list for a user. |
|
| 160 * |
|
| 161 * @param user The user. |
|
| 162 * @param ids The group ID list. |
|
| 163 */ |
|
| 164 void msn_user_set_group_ids(MsnUser *user, GList *ids); |
|
| 165 |
|
| 166 /** |
|
| 167 * Adds the group ID for a user. |
|
| 168 * |
|
| 169 * @param user The user. |
|
| 170 * @param id The group ID. |
|
| 171 */ |
|
| 172 void msn_user_add_group_id(MsnUser *user, const char * id); |
|
| 173 |
|
| 174 /** |
|
| 175 * Removes the group ID from a user. |
|
| 176 * |
|
| 177 * @param user The user. |
|
| 178 * @param id The group ID. |
|
| 179 */ |
|
| 180 void msn_user_remove_group_id(MsnUser *user, const char * id); |
|
| 181 |
|
| 182 /** |
|
| 183 * Sets the home phone number for a user. |
|
| 184 * |
|
| 185 * @param user The user. |
|
| 186 * @param number The home phone number. |
|
| 187 */ |
|
| 188 void msn_user_set_home_phone(MsnUser *user, const char *number); |
|
| 189 |
|
| 190 /** |
|
| 191 * Sets the work phone number for a user. |
|
| 192 * |
|
| 193 * @param user The user. |
|
| 194 * @param number The work phone number. |
|
| 195 */ |
|
| 196 void msn_user_set_work_phone(MsnUser *user, const char *number); |
|
| 197 |
|
| 198 void msn_user_set_uid(MsnUser *user, const char *uid); |
|
| 199 void msn_user_set_type(MsnUser *user,int type); |
|
| 200 |
|
| 201 /** |
|
| 202 * Sets the mobile phone number for a user. |
|
| 203 * |
|
| 204 * @param user The user. |
|
| 205 * @param number The mobile phone number. |
|
| 206 */ |
|
| 207 void msn_user_set_mobile_phone(MsnUser *user, const char *number); |
|
| 208 |
|
| 209 /** |
|
| 210 * Sets the MSNObject for a user. |
|
| 211 * |
|
| 212 * @param user The user. |
|
| 213 * @param obj The MSNObject. |
|
| 214 */ |
|
| 215 void msn_user_set_object(MsnUser *user, MsnObject *obj); |
|
| 216 |
|
| 217 /** |
|
| 218 * Sets the client information for a user. |
|
| 219 * |
|
| 220 * @param user The user. |
|
| 221 * @param info The client information. |
|
| 222 */ |
|
| 223 void msn_user_set_client_caps(MsnUser *user, GHashTable *info); |
|
| 224 |
|
| 225 |
|
| 226 /** |
|
| 227 * Returns the passport account for a user. |
|
| 228 * |
|
| 229 * @param user The user. |
|
| 230 * |
|
| 231 * @return The passport account. |
|
| 232 */ |
|
| 233 const char *msn_user_get_passport(const MsnUser *user); |
|
| 234 |
|
| 235 /** |
|
| 236 * Returns the friendly name for a user. |
|
| 237 * |
|
| 238 * @param user The user. |
|
| 239 * |
|
| 240 * @return The friendly name. |
|
| 241 */ |
|
| 242 const char *msn_user_get_friendly_name(const MsnUser *user); |
|
| 243 |
|
| 244 /** |
|
| 245 * Returns the store name for a user. |
|
| 246 * |
|
| 247 * @param user The user. |
|
| 248 * |
|
| 249 * @return The store name. |
|
| 250 */ |
|
| 251 const char *msn_user_get_store_name(const MsnUser *user); |
|
| 252 |
|
| 253 /** |
|
| 254 * Returns the home phone number for a user. |
|
| 255 * |
|
| 256 * @param user The user. |
|
| 257 * |
|
| 258 * @return The user's home phone number. |
|
| 259 */ |
|
| 260 const char *msn_user_get_home_phone(const MsnUser *user); |
|
| 261 |
|
| 262 /** |
|
| 263 * Returns the work phone number for a user. |
|
| 264 * |
|
| 265 * @param user The user. |
|
| 266 * |
|
| 267 * @return The user's work phone number. |
|
| 268 */ |
|
| 269 const char *msn_user_get_work_phone(const MsnUser *user); |
|
| 270 |
|
| 271 /** |
|
| 272 * Returns the mobile phone number for a user. |
|
| 273 * |
|
| 274 * @param user The user. |
|
| 275 * |
|
| 276 * @return The user's mobile phone number. |
|
| 277 */ |
|
| 278 const char *msn_user_get_mobile_phone(const MsnUser *user); |
|
| 279 |
|
| 280 /** |
|
| 281 * Returns the MSNObject for a user. |
|
| 282 * |
|
| 283 * @param user The user. |
|
| 284 * |
|
| 285 * @return The MSNObject. |
|
| 286 */ |
|
| 287 MsnObject *msn_user_get_object(const MsnUser *user); |
|
| 288 |
|
| 289 /** |
|
| 290 * Returns the client information for a user. |
|
| 291 * |
|
| 292 * @param user The user. |
|
| 293 * |
|
| 294 * @return The client information. |
|
| 295 */ |
|
| 296 GHashTable *msn_user_get_client_caps(const MsnUser *user); |
|
| 297 |
|
| 298 /** |
|
| 299 * check to see if user is online |
|
| 300 */ |
|
| 301 gboolean |
|
| 302 msn_user_is_online(GaimAccount *account, const char *name); |
|
| 303 |
|
| 304 /** |
|
| 305 * check to see if user is Yahoo User |
|
| 306 */ |
|
| 307 gboolean |
|
| 308 msn_user_is_yahoo(GaimAccount *account ,const char *name); |
|
| 309 |
|
| 310 void msn_user_set_op(MsnUser *user,int list_op); |
|
| 311 |
|
| 312 /*@}*/ |
|
| 313 |
|
| 314 |
|
| 315 #endif /* _MSN_USER_H_ */ |
|