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. */
|
|
59 char *alias; /**< The current alias. */
|
|
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
|
|
290 * an account go through this function or gaim_account_set_status_vargs
|
|
291 * or gaim_account_set_status_list.
|
|
292 *
|
|
293 * Only independent statuses can be deactivated with this. To deactivate
|
|
294 * an exclusive status, activate a different (and exclusive?) status.
|
|
295 *
|
|
296 * @param account The account.
|
|
297 * @param status_id The ID of the status.
|
|
298 * @param active The active state.
|
|
299 * @param ... Optional NULL-terminated attributes passed for the
|
|
300 * new status, in an id, value pair.
|
|
301 */
|
|
302 void gaim_account_set_status(GaimAccount *account, const char *status_id,
|
|
303 gboolean active, ...);
|
|
304
|
|
305
|
|
306 /**
|
|
307 * Activates or deactivates a status. All changes to the statuses of
|
|
308 * an account go through this function or gaim_account_set_status or
|
|
309 * gaim_account_set_status_list.
|
|
310 *
|
|
311 * Only independent statuses can be deactivated with this. To deactivate
|
|
312 * an exclusive status, activate a different (and exclusive?) status.
|
|
313 *
|
|
314 * @param account The account.
|
|
315 * @param status_id The ID of the status.
|
|
316 * @param active The active state.
|
|
317 * @param args The va_list of attributes.
|
|
318 */
|
|
319 void gaim_account_set_status_vargs(GaimAccount *account,
|
|
320 const char *status_id,
|
|
321 gboolean active, va_list args);
|
|
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 or
|
|
326 * gaim_account_set_status_vargs.
|
|
327 *
|
|
328 * Only independent statuses can be deactivated with this. To deactivate
|
|
329 * an exclusive status, activate a different (and exclusive?) status.
|
|
330 *
|
|
331 * @param account The account.
|
|
332 * @param status_id The ID of the status.
|
|
333 * @param active The active state.
|
|
334 * @param attrs A list of attributes in key/value pairs
|
|
335 */
|
|
336 void gaim_account_set_status_list(GaimAccount *account,
|
|
337 const char *status_id,
|
|
338 gboolean active, GList *attrs);
|
|
339
|
|
340 /**
|
|
341 * Clears all protocol-specific settings on an account.
|
|
342 *
|
|
343 * @param account The account.
|
|
344 */
|
|
345 void gaim_account_clear_settings(GaimAccount *account);
|
|
346
|
|
347 /**
|
|
348 * Sets a protocol-specific integer 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_int(GaimAccount *account, const char *name, int value);
|
|
355
|
|
356 /**
|
|
357 * Sets a protocol-specific string setting for an account.
|
|
358 *
|
|
359 * @param account The account.
|
|
360 * @param name The name of the setting.
|
|
361 * @param value The setting's value.
|
|
362 */
|
|
363 void gaim_account_set_string(GaimAccount *account, const char *name,
|
|
364 const char *value);
|
|
365
|
|
366 /**
|
|
367 * Sets a protocol-specific boolean setting for an account.
|
|
368 *
|
|
369 * @param account The account.
|
|
370 * @param name The name of the setting.
|
|
371 * @param value The setting's value.
|
|
372 */
|
|
373 void gaim_account_set_bool(GaimAccount *account, const char *name,
|
|
374 gboolean value);
|
|
375
|
|
376 /**
|
|
377 * Sets a UI-specific integer setting for an account.
|
|
378 *
|
|
379 * @param account The account.
|
|
380 * @param ui The UI name.
|
|
381 * @param name The name of the setting.
|
|
382 * @param value The setting's value.
|
|
383 */
|
|
384 void gaim_account_set_ui_int(GaimAccount *account, const char *ui,
|
|
385 const char *name, int value);
|
|
386
|
|
387 /**
|
|
388 * Sets a UI-specific string setting for an account.
|
|
389 *
|
|
390 * @param account The account.
|
|
391 * @param ui The UI name.
|
|
392 * @param name The name of the setting.
|
|
393 * @param value The setting's value.
|
|
394 */
|
|
395 void gaim_account_set_ui_string(GaimAccount *account, const char *ui,
|
|
396 const char *name, const char *value);
|
|
397
|
|
398 /**
|
|
399 * Sets a UI-specific boolean setting for an account.
|
|
400 *
|
|
401 * @param account The account.
|
|
402 * @param ui The UI name.
|
|
403 * @param name The name of the setting.
|
|
404 * @param value The setting's value.
|
|
405 */
|
|
406 void gaim_account_set_ui_bool(GaimAccount *account, const char *ui,
|
|
407 const char *name, gboolean value);
|
|
408
|
|
409 /**
|
|
410 * Returns whether or not the account is connected.
|
|
411 *
|
|
412 * @param account The account.
|
|
413 *
|
|
414 * @return @c TRUE if connected, or @c FALSE otherwise.
|
|
415 */
|
|
416 gboolean gaim_account_is_connected(const GaimAccount *account);
|
|
417
|
|
418 /**
|
|
419 * Returns whether or not the account is connecting.
|
|
420 *
|
|
421 * @param account The account.
|
|
422 *
|
|
423 * @return @c TRUE if connecting, or @c FALSE otherwise.
|
|
424 */
|
|
425 gboolean gaim_account_is_connecting(const GaimAccount *account);
|
|
426
|
|
427 /**
|
|
428 * Returns whether or not the account is disconnected.
|
|
429 *
|
|
430 * @param account The account.
|
|
431 *
|
|
432 * @return @c TRUE if disconnected, or @c FALSE otherwise.
|
|
433 */
|
|
434 gboolean gaim_account_is_disconnected(const GaimAccount *account);
|
|
435
|
|
436 /**
|
|
437 * Returns the account's username.
|
|
438 *
|
|
439 * @param account The account.
|
|
440 *
|
|
441 * @return The username.
|
|
442 */
|
|
443 const char *gaim_account_get_username(const GaimAccount *account);
|
|
444
|
|
445 /**
|
|
446 * Returns the account's password.
|
|
447 *
|
|
448 * @param account The account.
|
|
449 *
|
|
450 * @return The password.
|
|
451 */
|
|
452 const char *gaim_account_get_password(const GaimAccount *account);
|
|
453
|
|
454 /**
|
|
455 * Returns the account's alias.
|
|
456 *
|
|
457 * @param account The account.
|
|
458 *
|
|
459 * @return The alias.
|
|
460 */
|
|
461 const char *gaim_account_get_alias(const GaimAccount *account);
|
|
462
|
|
463 /**
|
|
464 * Returns the account's user information.
|
|
465 *
|
|
466 * @param account The account.
|
|
467 *
|
|
468 * @return The user information.
|
|
469 */
|
|
470 const char *gaim_account_get_user_info(const GaimAccount *account);
|
|
471
|
|
472 /**
|
|
473 * Returns the account's buddy icon filename.
|
|
474 *
|
|
475 * @param account The account.
|
|
476 *
|
|
477 * @return The buddy icon filename.
|
|
478 */
|
|
479 const char *gaim_account_get_buddy_icon(const GaimAccount *account);
|
|
480
|
|
481 /**
|
|
482 * Returns the account's protocol ID.
|
|
483 *
|
|
484 * @param account The account.
|
|
485 *
|
|
486 * @return The protocol ID.
|
|
487 */
|
|
488 const char *gaim_account_get_protocol_id(const GaimAccount *account);
|
|
489
|
|
490 /**
|
|
491 * Returns the account's protocol name.
|
|
492 *
|
|
493 * @param account The account.
|
|
494 *
|
|
495 * @return The protocol name.
|
|
496 */
|
|
497 const char *gaim_account_get_protocol_name(const GaimAccount *account);
|
|
498
|
|
499 /**
|
|
500 * Returns the account's connection.
|
|
501 *
|
|
502 * @param account The account.
|
|
503 *
|
|
504 * @return The connection.
|
|
505 */
|
|
506 GaimConnection *gaim_account_get_connection(const GaimAccount *account);
|
|
507
|
|
508 /**
|
|
509 * Returns whether or not this account should save its password.
|
|
510 *
|
|
511 * @param account The account.
|
|
512 *
|
|
513 * @return @c TRUE if it should remember the password.
|
|
514 */
|
|
515 gboolean gaim_account_get_remember_password(const GaimAccount *account);
|
|
516
|
|
517 /**
|
|
518 * Returns whether or not this account should check for mail.
|
|
519 *
|
|
520 * @param account The account.
|
|
521 *
|
|
522 * @return @c TRUE if it should check for mail.
|
|
523 */
|
|
524 gboolean gaim_account_get_check_mail(const GaimAccount *account);
|
|
525
|
|
526 /**
|
|
527 * Returns whether or not this account is enabled for the
|
|
528 * specified UI.
|
|
529 *
|
|
530 * @param account The account.
|
|
531 * @param ui The UI.
|
|
532 *
|
|
533 * @return @c TRUE if it enabled on this UI.
|
|
534 */
|
|
535 gboolean gaim_account_get_enabled(const GaimAccount *account,
|
|
536 const char *ui);
|
|
537
|
|
538 /**
|
|
539 * Returns the account's proxy information.
|
|
540 *
|
|
541 * @param account The account.
|
|
542 *
|
|
543 * @return The proxy information.
|
|
544 */
|
|
545 GaimProxyInfo *gaim_account_get_proxy_info(const GaimAccount *account);
|
|
546
|
|
547 /**
|
|
548 * Returns the active status for this account. This looks through
|
|
549 * the GaimPresence associated with this account and returns the
|
|
550 * GaimStatus that has its active flag set to "TRUE." There can be
|
|
551 * only one active GaimStatus in a GaimPresence.
|
|
552 *
|
|
553 * @param account The account.
|
|
554 *
|
|
555 * @return The active status.
|
|
556 */
|
|
557 GaimStatus *gaim_account_get_active_status(const GaimAccount *account);
|
|
558
|
|
559 /**
|
|
560 * Returns the account status with the specified ID.
|
|
561 *
|
|
562 * Note that this works differently than gaim_buddy_get_status() in that
|
|
563 * it will only return NULL if the status was not registered.
|
|
564 *
|
|
565 * @param account The account.
|
|
566 * @param status_id The status ID.
|
|
567 *
|
|
568 * @return The status, or NULL if it was never registered.
|
|
569 */
|
|
570 GaimStatus *gaim_account_get_status(const GaimAccount *account,
|
|
571 const char *status_id);
|
|
572
|
|
573 /**
|
|
574 * Returns the account status type with the specified ID.
|
|
575 *
|
|
576 * @param account The account.
|
|
577 * @param id The ID of the status type to find.
|
|
578 *
|
|
579 * @return The status type if found, or NULL.
|
|
580 */
|
|
581 GaimStatusType *gaim_account_get_status_type(const GaimAccount *account,
|
|
582 const char *id);
|
|
583
|
|
584 /**
|
|
585 * Returns the account status type with the specified primitive.
|
|
586 * Note: It is possible for an account to have more than one
|
|
587 * GaimStatusType with the same primitive. In this case, the
|
|
588 * first GaimStatusType is returned.
|
|
589 *
|
|
590 * @param account The account.
|
|
591 * @param primitive The type of the status type to find.
|
|
592 *
|
|
593 * @return The status if found, or NULL.
|
|
594 */
|
|
595 GaimStatusType *gaim_account_get_status_type_with_primitive(
|
|
596 const GaimAccount *account,
|
|
597 GaimStatusPrimitive primitive);
|
|
598
|
|
599 /**
|
|
600 * Returns the account's presence.
|
|
601 *
|
|
602 * @param account The account.
|
|
603 *
|
|
604 * @return The account's presence.
|
|
605 */
|
|
606 GaimPresence *gaim_account_get_presence(const GaimAccount *account);
|
|
607
|
|
608 /**
|
|
609 * Returns whether or not an account status is active.
|
|
610 *
|
|
611 * @param account The account.
|
|
612 * @param status_id The status ID.
|
|
613 *
|
|
614 * @return TRUE if active, or FALSE if not.
|
|
615 */
|
|
616 gboolean gaim_account_is_status_active(const GaimAccount *account,
|
|
617 const char *status_id);
|
|
618
|
|
619 /**
|
|
620 * Returns the account's status types.
|
|
621 *
|
|
622 * @param account The account.
|
|
623 *
|
|
624 * @return The account's status types.
|
|
625 */
|
|
626 const GList *gaim_account_get_status_types(const GaimAccount *account);
|
|
627
|
|
628 /**
|
|
629 * Returns a protocol-specific integer setting for an account.
|
|
630 *
|
|
631 * @param account The account.
|
|
632 * @param name The name of the setting.
|
|
633 * @param default_value The default value.
|
|
634 *
|
|
635 * @return The value.
|
|
636 */
|
|
637 int gaim_account_get_int(const GaimAccount *account, const char *name,
|
|
638 int default_value);
|
|
639
|
|
640 /**
|
|
641 * Returns a protocol-specific string setting for an account.
|
|
642 *
|
|
643 * @param account The account.
|
|
644 * @param name The name of the setting.
|
|
645 * @param default_value The default value.
|
|
646 *
|
|
647 * @return The value.
|
|
648 */
|
|
649 const char *gaim_account_get_string(const GaimAccount *account,
|
|
650 const char *name,
|
|
651 const char *default_value);
|
|
652
|
|
653 /**
|
|
654 * Returns a protocol-specific boolean 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 gboolean gaim_account_get_bool(const GaimAccount *account, const char *name,
|
|
663 gboolean default_value);
|
|
664
|
|
665 /**
|
|
666 * Returns a UI-specific integer setting for an account.
|
|
667 *
|
|
668 * @param account The account.
|
|
669 * @param ui The UI name.
|
|
670 * @param name The name of the setting.
|
|
671 * @param default_value The default value.
|
|
672 *
|
|
673 * @return The value.
|
|
674 */
|
|
675 int gaim_account_get_ui_int(const GaimAccount *account, const char *ui,
|
|
676 const char *name, int default_value);
|
|
677
|
|
678 /**
|
|
679 * Returns a UI-specific string setting for an account.
|
|
680 *
|
|
681 * @param account The account.
|
|
682 * @param ui The UI name.
|
|
683 * @param name The name of the setting.
|
|
684 * @param default_value The default value.
|
|
685 *
|
|
686 * @return The value.
|
|
687 */
|
|
688 const char *gaim_account_get_ui_string(const GaimAccount *account,
|
|
689 const char *ui, const char *name,
|
|
690 const char *default_value);
|
|
691
|
|
692 /**
|
|
693 * Returns a UI-specific boolean setting for an account.
|
|
694 *
|
|
695 * @param account The account.
|
|
696 * @param ui The UI name.
|
|
697 * @param name The name of the setting.
|
|
698 * @param default_value The default value.
|
|
699 *
|
|
700 * @return The value.
|
|
701 */
|
|
702 gboolean gaim_account_get_ui_bool(const GaimAccount *account, const char *ui,
|
|
703 const char *name, gboolean default_value);
|
|
704
|
|
705
|
|
706 /**
|
|
707 * Returns the system log for an account.
|
|
708 *
|
|
709 * @param account The account.
|
|
710 * @param create Should it be created if it doesn't exist?
|
|
711 *
|
|
712 * @return The log.
|
|
713 *
|
|
714 * @note Callers should almost always pass @c FALSE for @a create.
|
|
715 * Passing @c TRUE could result in an existing log being reopened,
|
|
716 * if the log has already been closed, which not all loggers deal
|
|
717 * with appropriately.
|
|
718 */
|
|
719 GaimLog *gaim_account_get_log(GaimAccount *account, gboolean create);
|
|
720
|
|
721 /**
|
|
722 * Frees the system log of an account
|
|
723 *
|
|
724 * @param account The account.
|
|
725 */
|
|
726 void gaim_account_destroy_log(GaimAccount *account);
|
|
727
|
|
728 /**
|
|
729 * Adds a buddy to the server-side buddy list for the specified account.
|
|
730 *
|
|
731 * @param account The account.
|
|
732 * @param buddy The buddy to add.
|
|
733 */
|
|
734 void gaim_account_add_buddy(GaimAccount *account, GaimBuddy *buddy);
|
|
735 /**
|
|
736 * Adds a list of buddies to the server-side buddy list.
|
|
737 *
|
|
738 * @param account The account.
|
|
739 * @param buddies The list of GaimBlistNodes representing the buddies to add.
|
|
740 */
|
|
741 void gaim_account_add_buddies(GaimAccount *account, GList *buddies);
|
|
742
|
|
743 /**
|
|
744 * Removes a buddy from the server-side buddy list.
|
|
745 *
|
|
746 * @param account The account.
|
|
747 * @param buddy The buddy to remove.
|
|
748 * @param group The group to remove the buddy from.
|
|
749 */
|
|
750 void gaim_account_remove_buddy(GaimAccount *account, GaimBuddy *buddy,
|
|
751 GaimGroup *group);
|
|
752
|
|
753 /**
|
|
754 * Removes a list of buddies from the server-side buddy list.
|
|
755 *
|
|
756 * @note The lists buddies and groups are parallel lists. Be sure that node n of
|
|
757 * groups matches node n of buddies.
|
|
758 *
|
|
759 * @param account The account.
|
|
760 * @param buddies The list of buddies to remove.
|
|
761 * @param groups The list of groups to remove buddies from. Each node of this
|
|
762 * list should match the corresponding node of buddies.
|
|
763 */
|
|
764 void gaim_account_remove_buddies(GaimAccount *account, GList *buddies,
|
|
765 GList *groups);
|
|
766
|
|
767 /**
|
|
768 * Removes a group from the server-side buddy list.
|
|
769 *
|
|
770 * @param account The account.
|
|
771 * @param group The group to remove.
|
|
772 */
|
|
773 void gaim_account_remove_group(GaimAccount *account, GaimGroup *group);
|
|
774
|
|
775 /**
|
|
776 * Changes the password on the specified account.
|
|
777 *
|
|
778 * @param account The account.
|
|
779 * @param orig_pw The old password.
|
|
780 * @param new_pw The new password.
|
|
781 */
|
|
782 void gaim_account_change_password(GaimAccount *account, const char *orig_pw,
|
|
783 const char *new_pw);
|
|
784
|
|
785 /**
|
|
786 * Whether the account supports sending offline messages to buddy.
|
|
787 *
|
|
788 * @param account The account
|
|
789 * @param buddy The buddy
|
|
790 */
|
|
791 gboolean gaim_account_supports_offline_message(GaimAccount *account, GaimBuddy *buddy);
|
|
792
|
|
793 /*@}*/
|
|
794
|
|
795 /**************************************************************************/
|
|
796 /** @name Accounts API */
|
|
797 /**************************************************************************/
|
|
798 /*@{*/
|
|
799
|
|
800 /**
|
|
801 * Adds an account to the list of accounts.
|
|
802 *
|
|
803 * @param account The account.
|
|
804 */
|
|
805 void gaim_accounts_add(GaimAccount *account);
|
|
806
|
|
807 /**
|
|
808 * Removes an account from the list of accounts.
|
|
809 *
|
|
810 * @param account The account.
|
|
811 */
|
|
812 void gaim_accounts_remove(GaimAccount *account);
|
|
813
|
|
814 /**
|
|
815 * Deletes an account.
|
|
816 *
|
|
817 * This will remove any buddies from the buddy list that belong to this
|
|
818 * account, buddy pounces that belong to this account, and will also
|
|
819 * destroy @a account.
|
|
820 *
|
|
821 * @param account The account.
|
|
822 */
|
|
823 void gaim_accounts_delete(GaimAccount *account);
|
|
824
|
|
825 /**
|
|
826 * Reorders an account.
|
|
827 *
|
|
828 * @param account The account to reorder.
|
|
829 * @param new_index The new index for the account.
|
|
830 */
|
|
831 void gaim_accounts_reorder(GaimAccount *account, gint new_index);
|
|
832
|
|
833 /**
|
|
834 * Returns a list of all accounts.
|
|
835 *
|
|
836 * @return A list of all accounts.
|
|
837 */
|
|
838 GList *gaim_accounts_get_all(void);
|
|
839
|
|
840 /**
|
|
841 * Returns a list of all enabled accounts
|
|
842 *
|
|
843 * @return A list of all enabled accounts. The list is owned
|
|
844 * by the caller, and must be g_list_free()d to avoid
|
|
845 * leaking the nodes.
|
|
846 */
|
|
847 GList *gaim_accounts_get_all_active(void);
|
|
848
|
|
849 /**
|
|
850 * Finds an account with the specified name and protocol id.
|
|
851 *
|
|
852 * @param name The account username.
|
|
853 * @param protocol The account protocol ID.
|
|
854 *
|
|
855 * @return The account, if found, or @c FALSE otherwise.
|
|
856 */
|
|
857 GaimAccount *gaim_accounts_find(const char *name, const char *protocol);
|
|
858
|
|
859 /**
|
|
860 * This is called by the core after all subsystems and what
|
|
861 * not have been initialized. It sets all enabled accounts
|
|
862 * to their startup status by signing them on, setting them
|
|
863 * away, etc.
|
|
864 *
|
|
865 * You probably shouldn't call this unless you really know
|
|
866 * what you're doing.
|
|
867 */
|
|
868 void gaim_accounts_restore_current_statuses(void);
|
|
869
|
|
870 /*@}*/
|
|
871
|
|
872
|
|
873 /**************************************************************************/
|
|
874 /** @name UI Registration Functions */
|
|
875 /**************************************************************************/
|
|
876 /*@{*/
|
|
877 /**
|
|
878 * Sets the UI operations structure to be used for accounts.
|
|
879 *
|
|
880 * @param ops The UI operations structure.
|
|
881 */
|
|
882 void gaim_accounts_set_ui_ops(GaimAccountUiOps *ops);
|
|
883
|
|
884 /**
|
|
885 * Returns the UI operations structure used for accounts.
|
|
886 *
|
|
887 * @return The UI operations structure in use.
|
|
888 */
|
|
889 GaimAccountUiOps *gaim_accounts_get_ui_ops(void);
|
|
890
|
|
891 /*@}*/
|
|
892
|
|
893
|
|
894 /**************************************************************************/
|
|
895 /** @name Accounts Subsystem */
|
|
896 /**************************************************************************/
|
|
897 /*@{*/
|
|
898
|
|
899 /**
|
|
900 * Returns the accounts subsystem handle.
|
|
901 *
|
|
902 * @return The accounts subsystem handle.
|
|
903 */
|
|
904 void *gaim_accounts_get_handle(void);
|
|
905
|
|
906 /**
|
|
907 * Initializes the accounts subsystem.
|
|
908 */
|
|
909 void gaim_accounts_init(void);
|
|
910
|
|
911 /**
|
|
912 * Uninitializes the accounts subsystem.
|
|
913 */
|
|
914 void gaim_accounts_uninit(void);
|
|
915
|
|
916 /*@}*/
|
|
917
|
|
918 #ifdef __cplusplus
|
|
919 }
|
|
920 #endif
|
|
921
|
|
922 #endif /* _GAIM_ACCOUNT_H_ */
|