14192
|
1 /**
|
|
2 * @file account.h Account API
|
|
3 * @ingroup core
|
|
4 *
|
|
5 * gaim
|
|
6 *
|
|
7 * Gaim is the legal property of its developers, whose names are too numerous
|
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this
|
|
9 * source distribution.
|
|
10 *
|
|
11 * This program is free software; you can redistribute it and/or modify
|
|
12 * it under the terms of the GNU General Public License as published by
|
|
13 * the Free Software Foundation; either version 2 of the License, or
|
|
14 * (at your option) any later version.
|
|
15 *
|
|
16 * This program is distributed in the hope that it will be useful,
|
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19 * GNU General Public License for more details.
|
|
20 *
|
|
21 * You should have received a copy of the GNU General Public License
|
|
22 * along with this program; if not, write to the Free Software
|
|
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
24 *
|
|
25 * @see @ref account-signals
|
|
26 */
|
|
27 #ifndef _GAIM_ACCOUNT_H_
|
|
28 #define _GAIM_ACCOUNT_H_
|
|
29
|
|
30 #include <glib.h>
|
|
31
|
|
32 typedef struct _GaimAccountUiOps GaimAccountUiOps;
|
|
33 typedef struct _GaimAccount GaimAccount;
|
|
34
|
|
35 typedef gboolean (*GaimFilterAccountFunc)(GaimAccount *account);
|
|
36
|
|
37 #include "connection.h"
|
|
38 #include "log.h"
|
|
39 #include "proxy.h"
|
|
40 #include "prpl.h"
|
|
41 #include "status.h"
|
|
42
|
|
43 struct _GaimAccountUiOps
|
|
44 {
|
|
45 /* A buddy we already have added us to their buddy list. */
|
|
46 void (*notify_added)(GaimAccount *account, const char *remote_user,
|
|
47 const char *id, const char *alias,
|
|
48 const char *message);
|
|
49 void (*status_changed)(GaimAccount *account, GaimStatus *status);
|
|
50 /* Someone we don't have on our list added us. Will prompt to add them. */
|
|
51 void (*request_add)(GaimAccount *account, const char *remote_user,
|
|
52 const char *id, const char *alias,
|
|
53 const char *message);
|
|
54 };
|
|
55
|
|
56 struct _GaimAccount
|
|
57 {
|
|
58 char *username; /**< The username. */
|
14275
|
59 char *alias; /**< How you appear to yourself. */
|
14192
|
60 char *password; /**< The account password. */
|
|
61 char *user_info; /**< User information. */
|
|
62
|
|
63 char *buddy_icon; /**< The buddy icon. */
|
|
64
|
|
65 gboolean remember_pass; /**< Remember the password. */
|
|
66
|
|
67 char *protocol_id; /**< The ID of the protocol. */
|
|
68
|
|
69 GaimConnection *gc; /**< The connection handle. */
|
|
70 gboolean disconnecting; /**< The account is currently disconnecting */
|
|
71
|
|
72 GHashTable *settings; /**< Protocol-specific settings. */
|
|
73 GHashTable *ui_settings; /**< UI-specific settings. */
|
|
74
|
|
75 GaimProxyInfo *proxy_info; /**< Proxy information. This will be set */
|
|
76 /* to NULL when the account inherits */
|
|
77 /* proxy settings from global prefs. */
|
|
78
|
|
79 GSList *permit; /**< Permit list. */
|
|
80 GSList *deny; /**< Deny list. */
|
|
81 int perm_deny; /**< The permit/deny setting. */
|
|
82
|
|
83 GList *status_types; /**< Status types. */
|
|
84
|
|
85 GaimPresence *presence; /**< Presence. */
|
|
86 GaimLog *system_log; /**< The system log */
|
|
87
|
|
88 void *ui_data; /**< The UI can put data here. */
|
|
89 };
|
|
90
|
|
91 #ifdef __cplusplus
|
|
92 extern "C" {
|
|
93 #endif
|
|
94
|
|
95 /**************************************************************************/
|
|
96 /** @name Account API */
|
|
97 /**************************************************************************/
|
|
98 /*@{*/
|
|
99
|
|
100 /**
|
|
101 * Creates a new account.
|
|
102 *
|
|
103 * @param username The username.
|
|
104 * @param protocol_id The protocol ID.
|
|
105 *
|
|
106 * @return The new account.
|
|
107 */
|
|
108 GaimAccount *gaim_account_new(const char *username, const char *protocol_id);
|
|
109
|
|
110 /**
|
|
111 * Destroys an account.
|
|
112 *
|
|
113 * @param account The account to destroy.
|
|
114 */
|
|
115 void gaim_account_destroy(GaimAccount *account);
|
|
116
|
|
117 /**
|
|
118 * Connects to an account.
|
|
119 *
|
|
120 * @param account The account to connect to.
|
|
121 */
|
|
122 void gaim_account_connect(GaimAccount *account);
|
|
123
|
|
124 /**
|
|
125 * Registers an account.
|
|
126 *
|
|
127 * @param account The account to register.
|
|
128 */
|
|
129 void gaim_account_register(GaimAccount *account);
|
|
130
|
|
131 /**
|
|
132 * Disconnects from an account.
|
|
133 *
|
|
134 * @param account The account to disconnect from.
|
|
135 */
|
|
136 void gaim_account_disconnect(GaimAccount *account);
|
|
137
|
|
138 /**
|
|
139 * Notifies the user that the account was added to a remote user's
|
|
140 * buddy list.
|
|
141 *
|
|
142 * This will present a dialog informing the user that he was added to the
|
|
143 * remote user's buddy list.
|
|
144 *
|
|
145 * @param account The account that was added.
|
|
146 * @param remote_user The name of the user that added this account.
|
|
147 * @param id The optional ID of the local account. Rarely used.
|
|
148 * @param alias The optional alias of the user.
|
|
149 * @param message The optional message sent from the user adding you.
|
|
150 */
|
|
151 void gaim_account_notify_added(GaimAccount *account, const char *remote_user,
|
|
152 const char *id, const char *alias,
|
|
153 const char *message);
|
|
154
|
|
155 /**
|
|
156 * Notifies the user that the account was addded to a remote user's buddy
|
|
157 * list and asks ther user if they want to add the remote user to their buddy
|
|
158 * list.
|
|
159 *
|
|
160 * This will present a dialog informing the local user that the remote user
|
|
161 * added them to the remote user's buddy list and will ask if they want to add
|
|
162 * the remote user to the buddy list.
|
|
163 *
|
|
164 * @param account The account that was added.
|
|
165 * @param remote_user The name of the user that added this account.
|
|
166 * @param id The optional ID of the local account. Rarely used.
|
|
167 * @param alias The optional alias of the user.
|
|
168 * @param message The optional message sent from the user adding you.
|
|
169 */
|
|
170 void gaim_account_request_add(GaimAccount *account, const char *remote_user,
|
|
171 const char *id, const char *alias,
|
|
172 const char *message);
|
|
173 /**
|
|
174 * Requests information from the user to change the account's password.
|
|
175 *
|
|
176 * @param account The account to change the password on.
|
|
177 */
|
|
178 void gaim_account_request_change_password(GaimAccount *account);
|
|
179
|
|
180 /**
|
|
181 * Requests information from the user to change the account's
|
|
182 * user information.
|
|
183 *
|
|
184 * @param account The account to change the user information on.
|
|
185 */
|
|
186 void gaim_account_request_change_user_info(GaimAccount *account);
|
|
187
|
|
188 /**
|
|
189 * Sets the account's username.
|
|
190 *
|
|
191 * @param account The account.
|
|
192 * @param username The username.
|
|
193 */
|
|
194 void gaim_account_set_username(GaimAccount *account, const char *username);
|
|
195
|
|
196 /**
|
|
197 * Sets the account's password.
|
|
198 *
|
|
199 * @param account The account.
|
|
200 * @param password The password.
|
|
201 */
|
|
202 void gaim_account_set_password(GaimAccount *account, const char *password);
|
|
203
|
|
204 /**
|
|
205 * Sets the account's alias.
|
|
206 *
|
|
207 * @param account The account.
|
|
208 * @param alias The alias.
|
|
209 */
|
|
210 void gaim_account_set_alias(GaimAccount *account, const char *alias);
|
|
211
|
|
212 /**
|
|
213 * Sets the account's user information
|
|
214 *
|
|
215 * @param account The account.
|
|
216 * @param user_info The user information.
|
|
217 */
|
|
218 void gaim_account_set_user_info(GaimAccount *account, const char *user_info);
|
|
219
|
|
220 /**
|
|
221 * Sets the account's buddy icon.
|
|
222 *
|
|
223 * @param account The account.
|
|
224 * @param icon The buddy icon file.
|
|
225 */
|
|
226 void gaim_account_set_buddy_icon(GaimAccount *account, const char *icon);
|
|
227
|
|
228 /**
|
|
229 * Sets the account's protocol ID.
|
|
230 *
|
|
231 * @param account The account.
|
|
232 * @param protocol_id The protocol ID.
|
|
233 */
|
|
234 void gaim_account_set_protocol_id(GaimAccount *account,
|
|
235 const char *protocol_id);
|
|
236
|
|
237 /**
|
|
238 * Sets the account's connection.
|
|
239 *
|
|
240 * @param account The account.
|
|
241 * @param gc The connection.
|
|
242 */
|
|
243 void gaim_account_set_connection(GaimAccount *account, GaimConnection *gc);
|
|
244
|
|
245 /**
|
|
246 * Sets whether or not this account should save its password.
|
|
247 *
|
|
248 * @param account The account.
|
|
249 * @param value @c TRUE if it should remember the password.
|
|
250 */
|
|
251 void gaim_account_set_remember_password(GaimAccount *account, gboolean value);
|
|
252
|
|
253 /**
|
|
254 * Sets whether or not this account should check for mail.
|
|
255 *
|
|
256 * @param account The account.
|
|
257 * @param value @c TRUE if it should check for mail.
|
|
258 */
|
|
259 void gaim_account_set_check_mail(GaimAccount *account, gboolean value);
|
|
260
|
|
261 /**
|
|
262 * Sets whether or not this account is enabled for the specified
|
|
263 * UI.
|
|
264 *
|
|
265 * @param account The account.
|
|
266 * @param ui The UI.
|
|
267 * @param value @c TRUE if it is enabled.
|
|
268 */
|
|
269 void gaim_account_set_enabled(GaimAccount *account, const char *ui,
|
|
270 gboolean value);
|
|
271
|
|
272 /**
|
|
273 * Sets the account's proxy information.
|
|
274 *
|
|
275 * @param account The account.
|
|
276 * @param info The proxy information.
|
|
277 */
|
|
278 void gaim_account_set_proxy_info(GaimAccount *account, GaimProxyInfo *info);
|
|
279
|
|
280 /**
|
|
281 * Sets the account's status types.
|
|
282 *
|
|
283 * @param account The account.
|
|
284 * @param status_types The list of status types.
|
|
285 */
|
|
286 void gaim_account_set_status_types(GaimAccount *account, GList *status_types);
|
|
287
|
|
288 /**
|
|
289 * Activates or deactivates a status. All changes to the statuses of
|
14643
|
290 * an account go through this function or gaim_account_set_status_list.
|
14192
|
291 *
|
|
292 * Only independent statuses can be deactivated with this. To deactivate
|
|
293 * an exclusive status, activate a different (and exclusive?) status.
|
|
294 *
|
|
295 * @param account The account.
|
|
296 * @param status_id The ID of the status.
|
|
297 * @param active The active state.
|
14643
|
298 * @param ... Pairs of attributes for the new status passed in
|
|
299 * as a NULL-terminated list of id/value pairs.
|
14192
|
300 */
|
|
301 void gaim_account_set_status(GaimAccount *account, const char *status_id,
|
|
302 gboolean active, ...);
|
|
303
|
|
304
|
|
305 /**
|
|
306 * Activates or deactivates a status. All changes to the statuses of
|
14643
|
307 * an account go through this function or gaim_account_set_status.
|
14192
|
308 *
|
|
309 * Only independent statuses can be deactivated with this. To deactivate
|
|
310 * an exclusive status, activate a different (and exclusive?) status.
|
|
311 *
|
|
312 * @param account The account.
|
|
313 * @param status_id The ID of the status.
|
|
314 * @param active The active state.
|
|
315 * @param attrs A list of attributes in key/value pairs
|
|
316 */
|
|
317 void gaim_account_set_status_list(GaimAccount *account,
|
|
318 const char *status_id,
|
|
319 gboolean active, GList *attrs);
|
|
320
|
|
321 /**
|
|
322 * Clears all protocol-specific settings on an account.
|
|
323 *
|
|
324 * @param account The account.
|
|
325 */
|
|
326 void gaim_account_clear_settings(GaimAccount *account);
|
|
327
|
|
328 /**
|
|
329 * Sets a protocol-specific integer setting for an account.
|
|
330 *
|
|
331 * @param account The account.
|
|
332 * @param name The name of the setting.
|
|
333 * @param value The setting's value.
|
|
334 */
|
|
335 void gaim_account_set_int(GaimAccount *account, const char *name, int value);
|
|
336
|
|
337 /**
|
|
338 * Sets a protocol-specific string setting for an account.
|
|
339 *
|
|
340 * @param account The account.
|
|
341 * @param name The name of the setting.
|
|
342 * @param value The setting's value.
|
|
343 */
|
|
344 void gaim_account_set_string(GaimAccount *account, const char *name,
|
|
345 const char *value);
|
|
346
|
|
347 /**
|
|
348 * Sets a protocol-specific boolean setting for an account.
|
|
349 *
|
|
350 * @param account The account.
|
|
351 * @param name The name of the setting.
|
|
352 * @param value The setting's value.
|
|
353 */
|
|
354 void gaim_account_set_bool(GaimAccount *account, const char *name,
|
|
355 gboolean value);
|
|
356
|
|
357 /**
|
|
358 * Sets a UI-specific integer setting for an account.
|
|
359 *
|
|
360 * @param account The account.
|
|
361 * @param ui The UI name.
|
|
362 * @param name The name of the setting.
|
|
363 * @param value The setting's value.
|
|
364 */
|
|
365 void gaim_account_set_ui_int(GaimAccount *account, const char *ui,
|
|
366 const char *name, int value);
|
|
367
|
|
368 /**
|
|
369 * Sets a UI-specific string setting for an account.
|
|
370 *
|
|
371 * @param account The account.
|
|
372 * @param ui The UI name.
|
|
373 * @param name The name of the setting.
|
|
374 * @param value The setting's value.
|
|
375 */
|
|
376 void gaim_account_set_ui_string(GaimAccount *account, const char *ui,
|
|
377 const char *name, const char *value);
|
|
378
|
|
379 /**
|
|
380 * Sets a UI-specific boolean setting for an account.
|
|
381 *
|
|
382 * @param account The account.
|
|
383 * @param ui The UI name.
|
|
384 * @param name The name of the setting.
|
|
385 * @param value The setting's value.
|
|
386 */
|
|
387 void gaim_account_set_ui_bool(GaimAccount *account, const char *ui,
|
|
388 const char *name, gboolean value);
|
|
389
|
|
390 /**
|
|
391 * Returns whether or not the account is connected.
|
|
392 *
|
|
393 * @param account The account.
|
|
394 *
|
|
395 * @return @c TRUE if connected, or @c FALSE otherwise.
|
|
396 */
|
|
397 gboolean gaim_account_is_connected(const GaimAccount *account);
|
|
398
|
|
399 /**
|
|
400 * Returns whether or not the account is connecting.
|
|
401 *
|
|
402 * @param account The account.
|
|
403 *
|
|
404 * @return @c TRUE if connecting, or @c FALSE otherwise.
|
|
405 */
|
|
406 gboolean gaim_account_is_connecting(const GaimAccount *account);
|
|
407
|
|
408 /**
|
|
409 * Returns whether or not the account is disconnected.
|
|
410 *
|
|
411 * @param account The account.
|
|
412 *
|
|
413 * @return @c TRUE if disconnected, or @c FALSE otherwise.
|
|
414 */
|
|
415 gboolean gaim_account_is_disconnected(const GaimAccount *account);
|
|
416
|
|
417 /**
|
|
418 * Returns the account's username.
|
|
419 *
|
|
420 * @param account The account.
|
|
421 *
|
|
422 * @return The username.
|
|
423 */
|
|
424 const char *gaim_account_get_username(const GaimAccount *account);
|
|
425
|
|
426 /**
|
|
427 * Returns the account's password.
|
|
428 *
|
|
429 * @param account The account.
|
|
430 *
|
|
431 * @return The password.
|
|
432 */
|
|
433 const char *gaim_account_get_password(const GaimAccount *account);
|
|
434
|
|
435 /**
|
|
436 * Returns the account's alias.
|
|
437 *
|
|
438 * @param account The account.
|
|
439 *
|
|
440 * @return The alias.
|
|
441 */
|
|
442 const char *gaim_account_get_alias(const GaimAccount *account);
|
|
443
|
|
444 /**
|
|
445 * Returns the account's user information.
|
|
446 *
|
|
447 * @param account The account.
|
|
448 *
|
|
449 * @return The user information.
|
|
450 */
|
|
451 const char *gaim_account_get_user_info(const GaimAccount *account);
|
|
452
|
|
453 /**
|
|
454 * Returns the account's buddy icon filename.
|
|
455 *
|
|
456 * @param account The account.
|
|
457 *
|
|
458 * @return The buddy icon filename.
|
|
459 */
|
|
460 const char *gaim_account_get_buddy_icon(const GaimAccount *account);
|
|
461
|
|
462 /**
|
|
463 * Returns the account's protocol ID.
|
|
464 *
|
|
465 * @param account The account.
|
|
466 *
|
|
467 * @return The protocol ID.
|
|
468 */
|
|
469 const char *gaim_account_get_protocol_id(const GaimAccount *account);
|
|
470
|
|
471 /**
|
|
472 * Returns the account's protocol name.
|
|
473 *
|
|
474 * @param account The account.
|
|
475 *
|
|
476 * @return The protocol name.
|
|
477 */
|
|
478 const char *gaim_account_get_protocol_name(const GaimAccount *account);
|
|
479
|
|
480 /**
|
|
481 * Returns the account's connection.
|
|
482 *
|
|
483 * @param account The account.
|
|
484 *
|
|
485 * @return The connection.
|
|
486 */
|
|
487 GaimConnection *gaim_account_get_connection(const GaimAccount *account);
|
|
488
|
|
489 /**
|
|
490 * Returns whether or not this account should save its password.
|
|
491 *
|
|
492 * @param account The account.
|
|
493 *
|
|
494 * @return @c TRUE if it should remember the password.
|
|
495 */
|
|
496 gboolean gaim_account_get_remember_password(const GaimAccount *account);
|
|
497
|
|
498 /**
|
|
499 * Returns whether or not this account should check for mail.
|
|
500 *
|
|
501 * @param account The account.
|
|
502 *
|
|
503 * @return @c TRUE if it should check for mail.
|
|
504 */
|
|
505 gboolean gaim_account_get_check_mail(const GaimAccount *account);
|
|
506
|
|
507 /**
|
|
508 * Returns whether or not this account is enabled for the
|
|
509 * specified UI.
|
|
510 *
|
|
511 * @param account The account.
|
|
512 * @param ui The UI.
|
|
513 *
|
|
514 * @return @c TRUE if it enabled on this UI.
|
|
515 */
|
|
516 gboolean gaim_account_get_enabled(const GaimAccount *account,
|
|
517 const char *ui);
|
|
518
|
|
519 /**
|
|
520 * Returns the account's proxy information.
|
|
521 *
|
|
522 * @param account The account.
|
|
523 *
|
|
524 * @return The proxy information.
|
|
525 */
|
|
526 GaimProxyInfo *gaim_account_get_proxy_info(const GaimAccount *account);
|
|
527
|
|
528 /**
|
|
529 * Returns the active status for this account. This looks through
|
|
530 * the GaimPresence associated with this account and returns the
|
|
531 * GaimStatus that has its active flag set to "TRUE." There can be
|
|
532 * only one active GaimStatus in a GaimPresence.
|
|
533 *
|
|
534 * @param account The account.
|
|
535 *
|
|
536 * @return The active status.
|
|
537 */
|
|
538 GaimStatus *gaim_account_get_active_status(const GaimAccount *account);
|
|
539
|
|
540 /**
|
|
541 * Returns the account status with the specified ID.
|
|
542 *
|
|
543 * Note that this works differently than gaim_buddy_get_status() in that
|
|
544 * it will only return NULL if the status was not registered.
|
|
545 *
|
|
546 * @param account The account.
|
|
547 * @param status_id The status ID.
|
|
548 *
|
|
549 * @return The status, or NULL if it was never registered.
|
|
550 */
|
|
551 GaimStatus *gaim_account_get_status(const GaimAccount *account,
|
|
552 const char *status_id);
|
|
553
|
|
554 /**
|
|
555 * Returns the account status type with the specified ID.
|
|
556 *
|
|
557 * @param account The account.
|
|
558 * @param id The ID of the status type to find.
|
|
559 *
|
|
560 * @return The status type if found, or NULL.
|
|
561 */
|
|
562 GaimStatusType *gaim_account_get_status_type(const GaimAccount *account,
|
|
563 const char *id);
|
|
564
|
|
565 /**
|
|
566 * Returns the account status type with the specified primitive.
|
|
567 * Note: It is possible for an account to have more than one
|
|
568 * GaimStatusType with the same primitive. In this case, the
|
|
569 * first GaimStatusType is returned.
|
|
570 *
|
|
571 * @param account The account.
|
|
572 * @param primitive The type of the status type to find.
|
|
573 *
|
|
574 * @return The status if found, or NULL.
|
|
575 */
|
|
576 GaimStatusType *gaim_account_get_status_type_with_primitive(
|
|
577 const GaimAccount *account,
|
|
578 GaimStatusPrimitive primitive);
|
|
579
|
|
580 /**
|
|
581 * Returns the account's presence.
|
|
582 *
|
|
583 * @param account The account.
|
|
584 *
|
|
585 * @return The account's presence.
|
|
586 */
|
|
587 GaimPresence *gaim_account_get_presence(const GaimAccount *account);
|
|
588
|
|
589 /**
|
|
590 * Returns whether or not an account status is active.
|
|
591 *
|
|
592 * @param account The account.
|
|
593 * @param status_id The status ID.
|
|
594 *
|
|
595 * @return TRUE if active, or FALSE if not.
|
|
596 */
|
|
597 gboolean gaim_account_is_status_active(const GaimAccount *account,
|
|
598 const char *status_id);
|
|
599
|
|
600 /**
|
|
601 * Returns the account's status types.
|
|
602 *
|
|
603 * @param account The account.
|
|
604 *
|
|
605 * @return The account's status types.
|
|
606 */
|
|
607 const GList *gaim_account_get_status_types(const GaimAccount *account);
|
|
608
|
|
609 /**
|
|
610 * Returns a protocol-specific integer setting for an account.
|
|
611 *
|
|
612 * @param account The account.
|
|
613 * @param name The name of the setting.
|
|
614 * @param default_value The default value.
|
|
615 *
|
|
616 * @return The value.
|
|
617 */
|
|
618 int gaim_account_get_int(const GaimAccount *account, const char *name,
|
|
619 int default_value);
|
|
620
|
|
621 /**
|
|
622 * Returns a protocol-specific string setting for an account.
|
|
623 *
|
|
624 * @param account The account.
|
|
625 * @param name The name of the setting.
|
|
626 * @param default_value The default value.
|
|
627 *
|
|
628 * @return The value.
|
|
629 */
|
|
630 const char *gaim_account_get_string(const GaimAccount *account,
|
|
631 const char *name,
|
|
632 const char *default_value);
|
|
633
|
|
634 /**
|
|
635 * Returns a protocol-specific boolean setting for an account.
|
|
636 *
|
|
637 * @param account The account.
|
|
638 * @param name The name of the setting.
|
|
639 * @param default_value The default value.
|
|
640 *
|
|
641 * @return The value.
|
|
642 */
|
|
643 gboolean gaim_account_get_bool(const GaimAccount *account, const char *name,
|
|
644 gboolean default_value);
|
|
645
|
|
646 /**
|
|
647 * Returns a UI-specific integer setting for an account.
|
|
648 *
|
|
649 * @param account The account.
|
|
650 * @param ui The UI name.
|
|
651 * @param name The name of the setting.
|
|
652 * @param default_value The default value.
|
|
653 *
|
|
654 * @return The value.
|
|
655 */
|
|
656 int gaim_account_get_ui_int(const GaimAccount *account, const char *ui,
|
|
657 const char *name, int default_value);
|
|
658
|
|
659 /**
|
|
660 * Returns a UI-specific string setting for an account.
|
|
661 *
|
|
662 * @param account The account.
|
|
663 * @param ui The UI name.
|
|
664 * @param name The name of the setting.
|
|
665 * @param default_value The default value.
|
|
666 *
|
|
667 * @return The value.
|
|
668 */
|
|
669 const char *gaim_account_get_ui_string(const GaimAccount *account,
|
|
670 const char *ui, const char *name,
|
|
671 const char *default_value);
|
|
672
|
|
673 /**
|
|
674 * Returns a UI-specific boolean setting for an account.
|
|
675 *
|
|
676 * @param account The account.
|
|
677 * @param ui The UI name.
|
|
678 * @param name The name of the setting.
|
|
679 * @param default_value The default value.
|
|
680 *
|
|
681 * @return The value.
|
|
682 */
|
|
683 gboolean gaim_account_get_ui_bool(const GaimAccount *account, const char *ui,
|
|
684 const char *name, gboolean default_value);
|
|
685
|
|
686
|
|
687 /**
|
|
688 * Returns the system log for an account.
|
|
689 *
|
|
690 * @param account The account.
|
|
691 * @param create Should it be created if it doesn't exist?
|
|
692 *
|
|
693 * @return The log.
|
|
694 *
|
|
695 * @note Callers should almost always pass @c FALSE for @a create.
|
|
696 * Passing @c TRUE could result in an existing log being reopened,
|
|
697 * if the log has already been closed, which not all loggers deal
|
|
698 * with appropriately.
|
|
699 */
|
|
700 GaimLog *gaim_account_get_log(GaimAccount *account, gboolean create);
|
|
701
|
|
702 /**
|
|
703 * Frees the system log of an account
|
|
704 *
|
|
705 * @param account The account.
|
|
706 */
|
|
707 void gaim_account_destroy_log(GaimAccount *account);
|
|
708
|
|
709 /**
|
|
710 * Adds a buddy to the server-side buddy list for the specified account.
|
|
711 *
|
|
712 * @param account The account.
|
|
713 * @param buddy The buddy to add.
|
|
714 */
|
|
715 void gaim_account_add_buddy(GaimAccount *account, GaimBuddy *buddy);
|
|
716 /**
|
|
717 * Adds a list of buddies to the server-side buddy list.
|
|
718 *
|
|
719 * @param account The account.
|
|
720 * @param buddies The list of GaimBlistNodes representing the buddies to add.
|
|
721 */
|
|
722 void gaim_account_add_buddies(GaimAccount *account, GList *buddies);
|
|
723
|
|
724 /**
|
|
725 * Removes a buddy from the server-side buddy list.
|
|
726 *
|
|
727 * @param account The account.
|
|
728 * @param buddy The buddy to remove.
|
|
729 * @param group The group to remove the buddy from.
|
|
730 */
|
|
731 void gaim_account_remove_buddy(GaimAccount *account, GaimBuddy *buddy,
|
|
732 GaimGroup *group);
|
|
733
|
|
734 /**
|
|
735 * Removes a list of buddies from the server-side buddy list.
|
|
736 *
|
|
737 * @note The lists buddies and groups are parallel lists. Be sure that node n of
|
|
738 * groups matches node n of buddies.
|
|
739 *
|
|
740 * @param account The account.
|
|
741 * @param buddies The list of buddies to remove.
|
|
742 * @param groups The list of groups to remove buddies from. Each node of this
|
|
743 * list should match the corresponding node of buddies.
|
|
744 */
|
|
745 void gaim_account_remove_buddies(GaimAccount *account, GList *buddies,
|
|
746 GList *groups);
|
|
747
|
|
748 /**
|
|
749 * Removes a group from the server-side buddy list.
|
|
750 *
|
|
751 * @param account The account.
|
|
752 * @param group The group to remove.
|
|
753 */
|
|
754 void gaim_account_remove_group(GaimAccount *account, GaimGroup *group);
|
|
755
|
|
756 /**
|
|
757 * Changes the password on the specified account.
|
|
758 *
|
|
759 * @param account The account.
|
|
760 * @param orig_pw The old password.
|
|
761 * @param new_pw The new password.
|
|
762 */
|
|
763 void gaim_account_change_password(GaimAccount *account, const char *orig_pw,
|
|
764 const char *new_pw);
|
|
765
|
|
766 /**
|
|
767 * Whether the account supports sending offline messages to buddy.
|
|
768 *
|
|
769 * @param account The account
|
|
770 * @param buddy The buddy
|
|
771 */
|
|
772 gboolean gaim_account_supports_offline_message(GaimAccount *account, GaimBuddy *buddy);
|
|
773
|
|
774 /*@}*/
|
|
775
|
|
776 /**************************************************************************/
|
|
777 /** @name Accounts API */
|
|
778 /**************************************************************************/
|
|
779 /*@{*/
|
|
780
|
|
781 /**
|
|
782 * Adds an account to the list of accounts.
|
|
783 *
|
|
784 * @param account The account.
|
|
785 */
|
|
786 void gaim_accounts_add(GaimAccount *account);
|
|
787
|
|
788 /**
|
|
789 * Removes an account from the list of accounts.
|
|
790 *
|
|
791 * @param account The account.
|
|
792 */
|
|
793 void gaim_accounts_remove(GaimAccount *account);
|
|
794
|
|
795 /**
|
|
796 * Deletes an account.
|
|
797 *
|
|
798 * This will remove any buddies from the buddy list that belong to this
|
|
799 * account, buddy pounces that belong to this account, and will also
|
|
800 * destroy @a account.
|
|
801 *
|
|
802 * @param account The account.
|
|
803 */
|
|
804 void gaim_accounts_delete(GaimAccount *account);
|
|
805
|
|
806 /**
|
|
807 * Reorders an account.
|
|
808 *
|
|
809 * @param account The account to reorder.
|
|
810 * @param new_index The new index for the account.
|
|
811 */
|
|
812 void gaim_accounts_reorder(GaimAccount *account, gint new_index);
|
|
813
|
|
814 /**
|
|
815 * Returns a list of all accounts.
|
|
816 *
|
|
817 * @return A list of all accounts.
|
|
818 */
|
|
819 GList *gaim_accounts_get_all(void);
|
|
820
|
|
821 /**
|
|
822 * Returns a list of all enabled accounts
|
|
823 *
|
|
824 * @return A list of all enabled accounts. The list is owned
|
|
825 * by the caller, and must be g_list_free()d to avoid
|
|
826 * leaking the nodes.
|
|
827 */
|
|
828 GList *gaim_accounts_get_all_active(void);
|
|
829
|
|
830 /**
|
|
831 * Finds an account with the specified name and protocol id.
|
|
832 *
|
|
833 * @param name The account username.
|
|
834 * @param protocol The account protocol ID.
|
|
835 *
|
|
836 * @return The account, if found, or @c FALSE otherwise.
|
|
837 */
|
|
838 GaimAccount *gaim_accounts_find(const char *name, const char *protocol);
|
|
839
|
|
840 /**
|
|
841 * This is called by the core after all subsystems and what
|
|
842 * not have been initialized. It sets all enabled accounts
|
|
843 * to their startup status by signing them on, setting them
|
|
844 * away, etc.
|
|
845 *
|
|
846 * You probably shouldn't call this unless you really know
|
|
847 * what you're doing.
|
|
848 */
|
|
849 void gaim_accounts_restore_current_statuses(void);
|
|
850
|
|
851 /*@}*/
|
|
852
|
|
853
|
|
854 /**************************************************************************/
|
|
855 /** @name UI Registration Functions */
|
|
856 /**************************************************************************/
|
|
857 /*@{*/
|
|
858 /**
|
|
859 * Sets the UI operations structure to be used for accounts.
|
|
860 *
|
|
861 * @param ops The UI operations structure.
|
|
862 */
|
|
863 void gaim_accounts_set_ui_ops(GaimAccountUiOps *ops);
|
|
864
|
|
865 /**
|
|
866 * Returns the UI operations structure used for accounts.
|
|
867 *
|
|
868 * @return The UI operations structure in use.
|
|
869 */
|
|
870 GaimAccountUiOps *gaim_accounts_get_ui_ops(void);
|
|
871
|
|
872 /*@}*/
|
|
873
|
|
874
|
|
875 /**************************************************************************/
|
|
876 /** @name Accounts Subsystem */
|
|
877 /**************************************************************************/
|
|
878 /*@{*/
|
|
879
|
|
880 /**
|
|
881 * Returns the accounts subsystem handle.
|
|
882 *
|
|
883 * @return The accounts subsystem handle.
|
|
884 */
|
|
885 void *gaim_accounts_get_handle(void);
|
|
886
|
|
887 /**
|
|
888 * Initializes the accounts subsystem.
|
|
889 */
|
|
890 void gaim_accounts_init(void);
|
|
891
|
|
892 /**
|
|
893 * Uninitializes the accounts subsystem.
|
|
894 */
|
|
895 void gaim_accounts_uninit(void);
|
|
896
|
|
897 /*@}*/
|
|
898
|
|
899 #ifdef __cplusplus
|
|
900 }
|
|
901 #endif
|
|
902
|
|
903 #endif /* _GAIM_ACCOUNT_H_ */
|