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