Mercurial > pidgin
annotate src/account.c @ 13519:d6dd68a8be06
[gaim-migrate @ 15895]
The error message when using an invalid browser command should not
escape HTML stuffs. Patch from Bjoern Voigt.
Richard, can you add the gtknotify.c changes to your list of stuff
to tweak after we're out of the string freeze?
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 16 Mar 2006 04:27:00 +0000 |
parents | 702107dd58f1 |
children | 1f1dc7f4cd29 |
rev | line source |
---|---|
5865
412c5a0f9ef1
[gaim-migrate @ 6296]
Christian Hammond <chipx86@chipx86.com>
parents:
5842
diff
changeset
|
1 /** |
5563 | 2 * @file account.c Account API |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
8046 | 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. | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
10 * |
5563 | 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 */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
25 #include "internal.h" |
5563 | 26 #include "account.h" |
11053
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
27 #include "core.h" |
11067 | 28 #include "dbus-maybe.h" |
5717 | 29 #include "debug.h" |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
30 #include "notify.h" |
8235 | 31 #include "pounce.h" |
5563 | 32 #include "prefs.h" |
10945 | 33 #include "privacy.h" |
5665
132a30783c3d
[gaim-migrate @ 6081]
Christian Hammond <chipx86@chipx86.com>
parents:
5659
diff
changeset
|
34 #include "prpl.h" |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
35 #include "request.h" |
9944 | 36 #include "server.h" |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
37 #include "signals.h" |
9944 | 38 #include "status.h" |
5717 | 39 #include "util.h" |
10423 | 40 #include "xmlnode.h" |
5563 | 41 |
10429 | 42 /* TODO: Should use GaimValue instead of this? What about "ui"? */ |
5563 | 43 typedef struct |
44 { | |
45 GaimPrefType type; | |
46 | |
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
47 char *ui; |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
48 |
5563 | 49 union |
50 { | |
51 int integer; | |
52 char *string; | |
53 gboolean bool; | |
54 | |
55 } value; | |
56 | |
57 } GaimAccountSetting; | |
58 | |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
59 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
60 static GaimAccountUiOps *account_ui_ops = NULL; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
61 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
62 static GList *accounts = NULL; |
10428 | 63 static guint save_timer = 0; |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
64 static gboolean accounts_loaded = FALSE; |
5563 | 65 |
10427 | 66 |
10428 | 67 /********************************************************************* |
10429 | 68 * Writing to disk * |
10428 | 69 *********************************************************************/ |
10427 | 70 |
71 static void | |
72 setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data) | |
73 { | |
74 const char *name; | |
75 GaimAccountSetting *setting; | |
76 xmlnode *node, *child; | |
77 char buf[20]; | |
78 | |
79 name = (const char *)key; | |
80 setting = (GaimAccountSetting *)value; | |
81 node = (xmlnode *)user_data; | |
82 | |
83 child = xmlnode_new_child(node, "setting"); | |
84 xmlnode_set_attrib(child, "name", name); | |
85 | |
86 if (setting->type == GAIM_PREF_INT) { | |
87 xmlnode_set_attrib(child, "type", "int"); | |
88 snprintf(buf, sizeof(buf), "%d", setting->value.integer); | |
89 xmlnode_insert_data(child, buf, -1); | |
90 } | |
91 else if (setting->type == GAIM_PREF_STRING && setting->value.string != NULL) { | |
92 xmlnode_set_attrib(child, "type", "string"); | |
93 xmlnode_insert_data(child, setting->value.string, -1); | |
94 } | |
95 else if (setting->type == GAIM_PREF_BOOLEAN) { | |
96 xmlnode_set_attrib(child, "type", "bool"); | |
97 snprintf(buf, sizeof(buf), "%d", setting->value.bool); | |
98 xmlnode_insert_data(child, buf, -1); | |
99 } | |
100 } | |
101 | |
102 static void | |
103 ui_setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data) | |
104 { | |
105 const char *ui; | |
106 GHashTable *table; | |
107 xmlnode *node, *child; | |
108 | |
109 ui = (const char *)key; | |
110 table = (GHashTable *)value; | |
111 node = (xmlnode *)user_data; | |
112 | |
113 if (g_hash_table_size(table) > 0) | |
114 { | |
115 child = xmlnode_new_child(node, "settings"); | |
116 xmlnode_set_attrib(child, "ui", ui); | |
117 g_hash_table_foreach(table, setting_to_xmlnode, child); | |
118 } | |
119 } | |
120 | |
121 static xmlnode * | |
11249 | 122 status_attr_to_xmlnode(const GaimStatus *status, const GaimStatusType *type, const GaimStatusAttr *attr) |
123 { | |
124 xmlnode *node; | |
125 const char *id; | |
126 char *value = NULL; | |
127 GaimStatusAttr *default_attr; | |
128 GaimValue *default_value; | |
129 GaimType attr_type; | |
130 GaimValue *attr_value; | |
131 | |
132 id = gaim_status_attr_get_id(attr); | |
133 g_return_val_if_fail(id, NULL); | |
134 | |
135 attr_value = gaim_status_get_attr_value(status, id); | |
136 g_return_val_if_fail(attr_value, NULL); | |
137 attr_type = gaim_value_get_type(attr_value); | |
138 | |
139 /* | |
140 * If attr_value is a different type than it should be | |
141 * then don't write it to the file. | |
142 */ | |
143 default_attr = gaim_status_type_get_attr(type, id); | |
144 default_value = gaim_status_attr_get_value(default_attr); | |
145 if (attr_type != gaim_value_get_type(default_value)) | |
146 return NULL; | |
147 | |
148 /* | |
149 * If attr_value is the same as the default for this status | |
150 * then there is no need to write it to the file. | |
151 */ | |
152 if (attr_type == GAIM_TYPE_STRING) | |
153 { | |
154 const char *string_value = gaim_value_get_string(attr_value); | |
155 const char *default_string_value = gaim_value_get_string(default_value); | |
156 if (((string_value == NULL) && (default_string_value == NULL)) || | |
157 ((string_value != NULL) && (default_string_value != NULL) && | |
158 !strcmp(string_value, default_string_value))) | |
159 return NULL; | |
160 value = g_strdup(gaim_value_get_string(attr_value)); | |
161 } | |
162 else if (attr_type == GAIM_TYPE_INT) | |
163 { | |
164 int int_value = gaim_value_get_int(attr_value); | |
165 if (int_value == gaim_value_get_int(default_value)) | |
166 return NULL; | |
167 value = g_strdup_printf("%d", int_value); | |
168 } | |
169 else if (attr_type == GAIM_TYPE_BOOLEAN) | |
170 { | |
171 gboolean boolean_value = gaim_value_get_boolean(attr_value); | |
172 if (boolean_value == gaim_value_get_boolean(default_value)) | |
173 return NULL; | |
174 value = g_strdup(boolean_value ? | |
175 "true" : "false"); | |
176 } | |
177 else | |
178 { | |
179 return NULL; | |
180 } | |
181 | |
182 g_return_val_if_fail(value, NULL); | |
183 | |
184 node = xmlnode_new("attribute"); | |
185 | |
186 xmlnode_set_attrib(node, "id", id); | |
187 xmlnode_set_attrib(node, "value", value); | |
188 | |
189 g_free(value); | |
190 | |
191 return node; | |
192 } | |
193 | |
194 static xmlnode * | |
195 status_attrs_to_xmlnode(const GaimStatus *status) | |
196 { | |
197 GaimStatusType *type = gaim_status_get_type(status); | |
198 xmlnode *node, *child; | |
199 const GList *attrs, *attr; | |
200 | |
201 node = xmlnode_new("attributes"); | |
202 | |
203 attrs = gaim_status_type_get_attrs(type); | |
204 for (attr = attrs; attr != NULL; attr = attr->next) | |
205 { | |
206 child = status_attr_to_xmlnode(status, type, (const GaimStatusAttr *)attr->data); | |
207 if (child) | |
208 xmlnode_insert_child(node, child); | |
209 } | |
210 | |
211 return node; | |
212 } | |
213 | |
214 static xmlnode * | |
10738 | 215 status_to_xmlnode(const GaimStatus *status) |
216 { | |
11249 | 217 xmlnode *node, *child; |
10738 | 218 |
219 node = xmlnode_new("status"); | |
220 xmlnode_set_attrib(node, "type", gaim_status_get_id(status)); | |
221 if (gaim_status_get_name(status) != NULL) | |
222 xmlnode_set_attrib(node, "name", gaim_status_get_name(status)); | |
223 xmlnode_set_attrib(node, "active", gaim_status_is_active(status) ? "true" : "false"); | |
224 | |
11249 | 225 child = status_attrs_to_xmlnode(status); |
226 xmlnode_insert_child(node, child); | |
10738 | 227 |
228 return node; | |
229 } | |
230 | |
231 static xmlnode * | |
232 statuses_to_xmlnode(const GaimPresence *presence) | |
233 { | |
234 xmlnode *node, *child; | |
235 const GList *statuses, *status; | |
236 | |
237 node = xmlnode_new("statuses"); | |
238 | |
239 statuses = gaim_presence_get_statuses(presence); | |
240 for (status = statuses; status != NULL; status = status->next) | |
241 { | |
242 child = status_to_xmlnode((GaimStatus *)status->data); | |
243 xmlnode_insert_child(node, child); | |
244 } | |
245 | |
246 return node; | |
247 } | |
248 | |
249 static xmlnode * | |
10427 | 250 proxy_settings_to_xmlnode(GaimProxyInfo *proxy_info) |
251 { | |
252 xmlnode *node, *child; | |
253 GaimProxyType proxy_type; | |
254 const char *value; | |
255 int int_value; | |
256 char buf[20]; | |
257 | |
258 proxy_type = gaim_proxy_info_get_type(proxy_info); | |
259 | |
260 node = xmlnode_new("proxy"); | |
261 | |
262 child = xmlnode_new_child(node, "type"); | |
263 xmlnode_insert_data(child, | |
264 (proxy_type == GAIM_PROXY_USE_GLOBAL ? "global" : | |
265 proxy_type == GAIM_PROXY_NONE ? "none" : | |
266 proxy_type == GAIM_PROXY_HTTP ? "http" : | |
267 proxy_type == GAIM_PROXY_SOCKS4 ? "socks4" : | |
268 proxy_type == GAIM_PROXY_SOCKS5 ? "socks5" : | |
269 proxy_type == GAIM_PROXY_USE_ENVVAR ? "envvar" : "unknown"), -1); | |
270 | |
271 if (proxy_type != GAIM_PROXY_USE_GLOBAL && | |
272 proxy_type != GAIM_PROXY_NONE && | |
273 proxy_type != GAIM_PROXY_USE_ENVVAR) | |
274 { | |
275 if ((value = gaim_proxy_info_get_host(proxy_info)) != NULL) | |
276 { | |
277 child = xmlnode_new_child(node, "host"); | |
278 xmlnode_insert_data(child, value, -1); | |
279 } | |
280 | |
281 if ((int_value = gaim_proxy_info_get_port(proxy_info)) != 0) | |
282 { | |
283 snprintf(buf, sizeof(buf), "%d", int_value); | |
284 child = xmlnode_new_child(node, "port"); | |
285 xmlnode_insert_data(child, buf, -1); | |
286 } | |
287 | |
288 if ((value = gaim_proxy_info_get_username(proxy_info)) != NULL) | |
289 { | |
290 child = xmlnode_new_child(node, "username"); | |
291 xmlnode_insert_data(child, value, -1); | |
292 } | |
293 | |
294 if ((value = gaim_proxy_info_get_password(proxy_info)) != NULL) | |
295 { | |
296 child = xmlnode_new_child(node, "password"); | |
297 xmlnode_insert_data(child, value, -1); | |
298 } | |
299 } | |
300 | |
301 return node; | |
302 } | |
303 | |
304 static xmlnode * | |
305 account_to_xmlnode(GaimAccount *account) | |
306 { | |
307 xmlnode *node, *child; | |
308 const char *tmp; | |
10738 | 309 GaimPresence *presence; |
10427 | 310 GaimProxyInfo *proxy_info; |
311 | |
312 node = xmlnode_new("account"); | |
313 | |
314 child = xmlnode_new_child(node, "protocol"); | |
315 xmlnode_insert_data(child, gaim_account_get_protocol_id(account), -1); | |
316 | |
317 child = xmlnode_new_child(node, "name"); | |
318 xmlnode_insert_data(child, gaim_account_get_username(account), -1); | |
319 | |
320 if (gaim_account_get_remember_password(account) && | |
321 ((tmp = gaim_account_get_password(account)) != NULL)) | |
322 { | |
323 child = xmlnode_new_child(node, "password"); | |
324 xmlnode_insert_data(child, tmp, -1); | |
325 } | |
326 | |
327 if ((tmp = gaim_account_get_alias(account)) != NULL) | |
328 { | |
329 child = xmlnode_new_child(node, "alias"); | |
330 xmlnode_insert_data(child, tmp, -1); | |
331 } | |
332 | |
10738 | 333 if ((presence = gaim_account_get_presence(account)) != NULL) |
334 { | |
335 child = statuses_to_xmlnode(presence); | |
336 xmlnode_insert_child(node, child); | |
337 } | |
338 | |
10427 | 339 if ((tmp = gaim_account_get_user_info(account)) != NULL) |
340 { | |
11920 | 341 /* TODO: Do we need to call gaim_str_strip_char(tmp, '\r') here? */ |
10427 | 342 child = xmlnode_new_child(node, "userinfo"); |
343 xmlnode_insert_data(child, tmp, -1); | |
344 } | |
345 | |
346 if ((tmp = gaim_account_get_buddy_icon(account)) != NULL) | |
347 { | |
348 child = xmlnode_new_child(node, "buddyicon"); | |
349 xmlnode_insert_data(child, tmp, -1); | |
350 } | |
351 | |
352 if (g_hash_table_size(account->settings) > 0) | |
353 { | |
354 child = xmlnode_new_child(node, "settings"); | |
355 g_hash_table_foreach(account->settings, setting_to_xmlnode, child); | |
356 } | |
357 | |
358 if (g_hash_table_size(account->ui_settings) > 0) | |
359 { | |
360 g_hash_table_foreach(account->ui_settings, ui_setting_to_xmlnode, node); | |
361 } | |
362 | |
363 if ((proxy_info = gaim_account_get_proxy_info(account)) != NULL) | |
364 { | |
365 child = proxy_settings_to_xmlnode(proxy_info); | |
366 xmlnode_insert_child(node, child); | |
367 } | |
368 | |
369 return node; | |
370 } | |
371 | |
372 static xmlnode * | |
373 accounts_to_xmlnode(void) | |
374 { | |
375 xmlnode *node, *child; | |
376 GList *cur; | |
377 | |
10760 | 378 node = xmlnode_new("account"); |
10427 | 379 xmlnode_set_attrib(node, "version", "1.0"); |
380 | |
381 for (cur = gaim_accounts_get_all(); cur != NULL; cur = cur->next) | |
382 { | |
383 child = account_to_xmlnode(cur->data); | |
384 xmlnode_insert_child(node, child); | |
385 } | |
386 | |
387 return node; | |
388 } | |
389 | |
390 static void | |
391 sync_accounts(void) | |
392 { | |
393 xmlnode *node; | |
394 char *data; | |
395 | |
10428 | 396 if (!accounts_loaded) |
397 { | |
10760 | 398 gaim_debug_error("account", "Attempted to save accounts before " |
10443 | 399 "they were read!\n"); |
400 return; | |
10427 | 401 } |
402 | |
403 node = accounts_to_xmlnode(); | |
404 data = xmlnode_to_formatted_str(node, NULL); | |
405 gaim_util_write_data_to_file("accounts.xml", data, -1); | |
406 g_free(data); | |
407 xmlnode_free(node); | |
408 } | |
409 | |
410 static gboolean | |
411 save_cb(gpointer data) | |
412 { | |
413 sync_accounts(); | |
10428 | 414 save_timer = 0; |
10427 | 415 return FALSE; |
416 } | |
417 | |
418 static void | |
419 schedule_accounts_save() | |
420 { | |
10428 | 421 if (save_timer == 0) |
422 save_timer = gaim_timeout_add(5000, save_cb, NULL); | |
10427 | 423 } |
424 | |
425 | |
10428 | 426 /********************************************************************* |
427 * Reading from disk * | |
428 *********************************************************************/ | |
10427 | 429 |
430 static void | |
431 parse_settings(xmlnode *node, GaimAccount *account) | |
432 { | |
433 const char *ui; | |
434 xmlnode *child; | |
435 | |
436 /* Get the UI string, if these are UI settings */ | |
437 ui = xmlnode_get_attrib(node, "ui"); | |
438 | |
439 /* Read settings, one by one */ | |
440 for (child = xmlnode_get_child(node, "setting"); child != NULL; | |
441 child = xmlnode_get_next_twin(child)) | |
442 { | |
443 const char *name, *str_type; | |
444 GaimPrefType type; | |
445 char *data; | |
446 | |
447 name = xmlnode_get_attrib(child, "name"); | |
448 if (name == NULL) | |
449 /* Ignore this setting */ | |
450 continue; | |
451 | |
452 str_type = xmlnode_get_attrib(child, "type"); | |
10448 | 453 if (str_type == NULL) |
454 /* Ignore this setting */ | |
455 continue; | |
456 | |
10427 | 457 if (!strcmp(str_type, "string")) |
458 type = GAIM_PREF_STRING; | |
459 else if (!strcmp(str_type, "int")) | |
460 type = GAIM_PREF_INT; | |
461 else if (!strcmp(str_type, "bool")) | |
462 type = GAIM_PREF_BOOLEAN; | |
463 else | |
464 /* Ignore this setting */ | |
465 continue; | |
466 | |
467 data = xmlnode_get_data(child); | |
468 if (data == NULL) | |
469 /* Ignore this setting */ | |
470 continue; | |
471 | |
472 if (ui == NULL) | |
473 { | |
474 if (type == GAIM_PREF_STRING) | |
475 gaim_account_set_string(account, name, data); | |
476 else if (type == GAIM_PREF_INT) | |
477 gaim_account_set_int(account, name, atoi(data)); | |
478 else if (type == GAIM_PREF_BOOLEAN) | |
479 gaim_account_set_bool(account, name, | |
480 (*data == '0' ? FALSE : TRUE)); | |
481 } else { | |
482 if (type == GAIM_PREF_STRING) | |
483 gaim_account_set_ui_string(account, ui, name, data); | |
484 else if (type == GAIM_PREF_INT) | |
485 gaim_account_set_ui_int(account, ui, name, atoi(data)); | |
486 else if (type == GAIM_PREF_BOOLEAN) | |
487 gaim_account_set_ui_bool(account, ui, name, | |
488 (*data == '0' ? FALSE : TRUE)); | |
489 } | |
490 | |
491 g_free(data); | |
492 } | |
493 } | |
494 | |
11249 | 495 static GList * |
496 parse_status_attrs(xmlnode *node, GaimStatus *status) | |
497 { | |
498 GList *list = NULL; | |
499 xmlnode *child; | |
500 GaimValue *attr_value; | |
501 | |
502 for (child = xmlnode_get_child(node, "attribute"); child != NULL; | |
503 child = xmlnode_get_next_twin(child)) | |
504 { | |
505 const char *id = xmlnode_get_attrib(child, "id"); | |
506 const char *value = xmlnode_get_attrib(child, "value"); | |
507 | |
508 if (!id || !*id || !value || !*value) | |
509 continue; | |
510 | |
511 attr_value = gaim_status_get_attr_value(status, id); | |
512 if (!attr_value) | |
513 continue; | |
514 | |
515 list = g_list_append(list, (char *)id); | |
516 | |
517 switch (gaim_value_get_type(attr_value)) | |
518 { | |
519 case GAIM_TYPE_STRING: | |
520 list = g_list_append(list, (char *)value); | |
521 break; | |
522 case GAIM_TYPE_INT: | |
523 case GAIM_TYPE_BOOLEAN: | |
524 { | |
525 int v; | |
526 if (sscanf(value, "%d", &v) == 1) | |
527 list = g_list_append(list, GINT_TO_POINTER(v)); | |
528 else | |
529 list = g_list_remove(list, id); | |
530 break; | |
531 } | |
532 default: | |
533 break; | |
534 } | |
535 } | |
536 | |
537 return list; | |
538 } | |
539 | |
10427 | 540 static void |
10738 | 541 parse_status(xmlnode *node, GaimAccount *account) |
542 { | |
543 gboolean active = FALSE; | |
544 const char *data; | |
545 const char *type; | |
11249 | 546 xmlnode *child; |
547 GList *attrs = NULL; | |
10738 | 548 |
549 /* Get the active/inactive state */ | |
11075 | 550 data = xmlnode_get_attrib(node, "active"); |
11076 | 551 if (data == NULL) |
552 return; | |
553 if (strcasecmp(data, "true") == 0) | |
554 active = TRUE; | |
555 else if (strcasecmp(data, "false") == 0) | |
556 active = FALSE; | |
10738 | 557 else |
558 return; | |
559 | |
560 /* Get the type of the status */ | |
11075 | 561 type = xmlnode_get_attrib(node, "type"); |
562 if (type == NULL) | |
10738 | 563 return; |
564 | |
11249 | 565 /* Read attributes into a GList */ |
566 child = xmlnode_get_child(node, "attributes"); | |
567 if (child != NULL) | |
568 { | |
569 attrs = parse_status_attrs(child, | |
570 gaim_account_get_status(account, type)); | |
571 } | |
10738 | 572 |
11249 | 573 gaim_account_set_status_list(account, type, active, attrs); |
574 | |
575 g_list_free(attrs); | |
10738 | 576 } |
577 | |
578 static void | |
579 parse_statuses(xmlnode *node, GaimAccount *account) | |
580 { | |
581 xmlnode *child; | |
582 | |
583 for (child = xmlnode_get_child(node, "status"); child != NULL; | |
584 child = xmlnode_get_next_twin(child)) | |
585 { | |
586 parse_status(child, account); | |
587 } | |
588 } | |
589 | |
590 static void | |
10427 | 591 parse_proxy_info(xmlnode *node, GaimAccount *account) |
592 { | |
593 GaimProxyInfo *proxy_info; | |
594 xmlnode *child; | |
595 char *data; | |
596 | |
597 proxy_info = gaim_proxy_info_new(); | |
598 | |
599 /* Use the global proxy settings, by default */ | |
600 gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_USE_GLOBAL); | |
601 | |
602 /* Read proxy type */ | |
603 child = xmlnode_get_child(node, "type"); | |
604 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
605 { | |
606 if (!strcmp(data, "global")) | |
607 gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_USE_GLOBAL); | |
608 else if (!strcmp(data, "none")) | |
609 gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_NONE); | |
610 else if (!strcmp(data, "http")) | |
611 gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_HTTP); | |
612 else if (!strcmp(data, "socks4")) | |
613 gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_SOCKS4); | |
614 else if (!strcmp(data, "socks5")) | |
615 gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_SOCKS5); | |
616 else if (!strcmp(data, "envvar")) | |
617 gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_USE_ENVVAR); | |
618 else | |
619 { | |
620 gaim_debug_error("account", "Invalid proxy type found when " | |
621 "loading account information for %s\n", | |
622 gaim_account_get_username(account)); | |
623 } | |
624 g_free(data); | |
625 } | |
626 | |
627 /* Read proxy host */ | |
628 child = xmlnode_get_child(node, "host"); | |
629 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
630 { | |
631 gaim_proxy_info_set_host(proxy_info, data); | |
632 g_free(data); | |
633 } | |
634 | |
635 /* Read proxy port */ | |
636 child = xmlnode_get_child(node, "port"); | |
637 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
638 { | |
639 gaim_proxy_info_set_port(proxy_info, atoi(data)); | |
640 g_free(data); | |
641 } | |
642 | |
643 /* Read proxy username */ | |
644 child = xmlnode_get_child(node, "username"); | |
645 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
646 { | |
647 gaim_proxy_info_set_username(proxy_info, data); | |
648 g_free(data); | |
649 } | |
650 | |
651 /* Read proxy password */ | |
652 child = xmlnode_get_child(node, "password"); | |
653 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
654 { | |
655 gaim_proxy_info_set_password(proxy_info, data); | |
656 g_free(data); | |
657 } | |
658 | |
659 /* If there are no values set then proxy_infourn NULL */ | |
660 if ((gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_USE_GLOBAL) && | |
661 (gaim_proxy_info_get_host(proxy_info) == NULL) && | |
662 (gaim_proxy_info_get_port(proxy_info) == 0) && | |
663 (gaim_proxy_info_get_username(proxy_info) == NULL) && | |
664 (gaim_proxy_info_get_password(proxy_info) == NULL)) | |
665 { | |
666 gaim_proxy_info_destroy(proxy_info); | |
667 return; | |
668 } | |
669 | |
670 gaim_account_set_proxy_info(account, proxy_info); | |
671 } | |
672 | |
673 static GaimAccount * | |
674 parse_account(xmlnode *node) | |
675 { | |
676 GaimAccount *ret; | |
677 xmlnode *child; | |
678 char *protocol_id = NULL; | |
679 char *name = NULL; | |
680 char *data; | |
681 | |
682 child = xmlnode_get_child(node, "protocol"); | |
683 if (child != NULL) | |
684 protocol_id = xmlnode_get_data(child); | |
685 | |
686 child = xmlnode_get_child(node, "name"); | |
687 if (child != NULL) | |
688 name = xmlnode_get_data(child); | |
689 if (name == NULL) | |
690 { | |
691 /* Do we really need to do this? */ | |
692 child = xmlnode_get_child(node, "username"); | |
693 if (child != NULL) | |
694 name = xmlnode_get_data(child); | |
695 } | |
696 | |
697 if ((protocol_id == NULL) || (name == NULL)) | |
698 { | |
699 free(protocol_id); | |
700 free(name); | |
701 return NULL; | |
702 } | |
703 | |
704 ret = gaim_account_new(name, protocol_id); | |
705 free(name); | |
706 free(protocol_id); | |
707 | |
708 /* Read the password */ | |
709 child = xmlnode_get_child(node, "password"); | |
710 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
711 { | |
10743 | 712 gaim_account_set_remember_password(ret, TRUE); |
10427 | 713 gaim_account_set_password(ret, data); |
714 g_free(data); | |
715 } | |
716 | |
717 /* Read the alias */ | |
718 child = xmlnode_get_child(node, "alias"); | |
719 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
720 { | |
11247 | 721 if (*data != '\0') |
722 gaim_account_set_alias(ret, data); | |
10427 | 723 g_free(data); |
724 } | |
725 | |
10738 | 726 /* Read the statuses */ |
727 child = xmlnode_get_child(node, "statuses"); | |
728 if (child != NULL) | |
729 { | |
730 parse_statuses(child, ret); | |
731 } | |
732 | |
10427 | 733 /* Read the userinfo */ |
734 child = xmlnode_get_child(node, "userinfo"); | |
735 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
736 { | |
737 gaim_account_set_user_info(ret, data); | |
738 g_free(data); | |
739 } | |
740 | |
741 /* Read the buddyicon */ | |
742 child = xmlnode_get_child(node, "buddyicon"); | |
743 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
744 { | |
745 gaim_account_set_buddy_icon(ret, data); | |
746 g_free(data); | |
747 } | |
748 | |
749 /* Read settings (both core and UI) */ | |
750 for (child = xmlnode_get_child(node, "settings"); child != NULL; | |
751 child = xmlnode_get_next_twin(child)) | |
752 { | |
753 parse_settings(child, ret); | |
754 } | |
755 | |
756 /* Read proxy */ | |
757 child = xmlnode_get_child(node, "proxy"); | |
758 if (child != NULL) | |
759 { | |
760 parse_proxy_info(child, ret); | |
761 } | |
762 | |
763 return ret; | |
764 } | |
765 | |
766 static void | |
767 load_accounts(void) | |
768 { | |
769 xmlnode *node, *child; | |
770 | |
771 accounts_loaded = TRUE; | |
772 | |
773 node = gaim_util_read_xml_from_file("accounts.xml", _("accounts")); | |
774 | |
775 if (node == NULL) | |
776 return; | |
777 | |
778 for (child = xmlnode_get_child(node, "account"); child != NULL; | |
779 child = xmlnode_get_next_twin(child)) | |
780 { | |
10490 | 781 GaimAccount *new_acct; |
782 new_acct = parse_account(child); | |
783 gaim_accounts_add(new_acct); | |
10427 | 784 } |
11593
4b7fb30b8926
[gaim-migrate @ 13863]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11562
diff
changeset
|
785 |
4b7fb30b8926
[gaim-migrate @ 13863]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11562
diff
changeset
|
786 xmlnode_free(node); |
10427 | 787 } |
788 | |
789 | |
5563 | 790 static void |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5792
diff
changeset
|
791 delete_setting(void *data) |
5563 | 792 { |
793 GaimAccountSetting *setting = (GaimAccountSetting *)data; | |
794 | |
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
795 if (setting->ui != NULL) |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
796 g_free(setting->ui); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
797 |
5563 | 798 if (setting->type == GAIM_PREF_STRING) |
799 g_free(setting->value.string); | |
800 | |
801 g_free(setting); | |
802 } | |
803 | |
804 GaimAccount * | |
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
805 gaim_account_new(const char *username, const char *protocol_id) |
5563 | 806 { |
6067 | 807 GaimAccount *account = NULL; |
10012 | 808 GaimPlugin *prpl = NULL; |
809 GaimPluginProtocolInfo *prpl_info = NULL; | |
11982 | 810 GaimStatusType *status_type; |
5563 | 811 |
9944 | 812 g_return_val_if_fail(username != NULL, NULL); |
9971 | 813 g_return_val_if_fail(protocol_id != NULL, NULL); |
5563 | 814 |
9971 | 815 account = gaim_accounts_find(username, protocol_id); |
5867
db4df0be06fd
[gaim-migrate @ 6298]
Christian Hammond <chipx86@chipx86.com>
parents:
5865
diff
changeset
|
816 |
5874
964e4f94fc56
[gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
817 if (account != NULL) |
964e4f94fc56
[gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
818 return account; |
5867
db4df0be06fd
[gaim-migrate @ 6298]
Christian Hammond <chipx86@chipx86.com>
parents:
5865
diff
changeset
|
819 |
5563 | 820 account = g_new0(GaimAccount, 1); |
11146 | 821 GAIM_DBUS_REGISTER_POINTER(account, GaimAccount); |
5563 | 822 |
6067 | 823 gaim_account_set_username(account, username); |
824 | |
9971 | 825 gaim_account_set_protocol_id(account, protocol_id); |
5563 | 826 |
827 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal, | |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5792
diff
changeset
|
828 g_free, delete_setting); |
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
829 account->ui_settings = g_hash_table_new_full(g_str_hash, g_str_equal, |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
830 g_free, (GDestroyNotify)g_hash_table_destroy); |
8573 | 831 account->system_log = NULL; |
10944 | 832 /* 0 is not a valid privacy setting */ |
10945 | 833 account->perm_deny = GAIM_PRIVACY_ALLOW_ALL; |
10720 | 834 |
9944 | 835 account->presence = gaim_presence_new_for_account(account); |
836 | |
10447 | 837 prpl = gaim_find_prpl(protocol_id); |
10052 | 838 |
10012 | 839 if (prpl == NULL) |
840 return account; | |
10052 | 841 |
10012 | 842 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); |
10738 | 843 if (prpl_info != NULL && prpl_info->status_types != NULL) |
10012 | 844 gaim_account_set_status_types(account, prpl_info->status_types(account)); |
845 | |
11982 | 846 status_type = gaim_account_get_status_type_with_primitive(account, GAIM_STATUS_AVAILABLE); |
847 if (status_type != NULL) | |
848 gaim_presence_set_status_active(account->presence, | |
849 gaim_status_type_get_id(status_type), | |
850 TRUE); | |
851 else | |
852 gaim_presence_set_status_active(account->presence, | |
853 "offline", | |
854 TRUE); | |
10052 | 855 |
5563 | 856 return account; |
857 } | |
858 | |
859 void | |
860 gaim_account_destroy(GaimAccount *account) | |
861 { | |
7324
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
862 GList *l; |
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
863 |
5563 | 864 g_return_if_fail(account != NULL); |
865 | |
9944 | 866 gaim_debug_info("account", "Destroying account %p\n", account); |
5930
03f1d6cd784c
[gaim-migrate @ 6370]
Christian Hammond <chipx86@chipx86.com>
parents:
5926
diff
changeset
|
867 |
10742 | 868 if (gaim_account_is_connected(account)) |
869 gaim_account_disconnect(account); | |
5563 | 870 |
9944 | 871 gaim_debug_info("account", "Continuing to destroy account %p\n", account); |
5930
03f1d6cd784c
[gaim-migrate @ 6370]
Christian Hammond <chipx86@chipx86.com>
parents:
5926
diff
changeset
|
872 |
7324
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
873 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
874 { |
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
875 GaimConversation *conv = (GaimConversation *)l->data; |
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
876 |
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
877 if (gaim_conversation_get_account(conv) == account) |
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
878 gaim_conversation_set_account(conv, NULL); |
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
879 } |
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
880 |
11985 | 881 g_free(account->username); |
882 g_free(account->alias); | |
883 g_free(account->password); | |
884 g_free(account->user_info); | |
885 g_free(account->protocol_id); | |
5563 | 886 |
887 g_hash_table_destroy(account->settings); | |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
888 g_hash_table_destroy(account->ui_settings); |
5563 | 889 |
9944 | 890 gaim_account_set_status_types(account, NULL); |
891 | |
892 gaim_presence_destroy(account->presence); | |
893 | |
8573 | 894 if(account->system_log) |
895 gaim_log_free(account->system_log); | |
896 | |
11067 | 897 GAIM_DBUS_UNREGISTER_POINTER(account); |
5563 | 898 g_free(account); |
899 } | |
900 | |
10740 | 901 void |
6581 | 902 gaim_account_register(GaimAccount *account) |
903 { | |
10740 | 904 g_return_if_fail(account != NULL); |
6581 | 905 |
10740 | 906 gaim_debug_info("account", "Registering account %s\n", |
907 gaim_account_get_username(account)); | |
6581 | 908 |
10740 | 909 gaim_connection_new(account, TRUE, NULL); |
910 } | |
6581 | 911 |
10740 | 912 static void |
11042
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
913 request_password_ok_cb(GaimAccount *account, GaimRequestFields *fields) |
10740 | 914 { |
11042
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
915 const char *entry; |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
916 gboolean remember; |
11985 | 917 |
11042
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
918 entry = gaim_request_fields_get_string(fields, "password"); |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
919 remember = gaim_request_fields_get_bool(fields, "remember"); |
11985 | 920 |
10740 | 921 if (!entry || !*entry) |
922 { | |
923 gaim_notify_error(account, NULL, _("Password is required to sign on."), NULL); | |
924 return; | |
925 } | |
6581 | 926 |
11042
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
927 if(remember) |
11562 | 928 gaim_account_set_remember_password(account, TRUE); |
11042
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
929 |
11562 | 930 gaim_account_set_password(account, entry); |
6581 | 931 |
10740 | 932 gaim_connection_new(account, FALSE, entry); |
6581 | 933 } |
934 | |
10740 | 935 static void |
936 request_password(GaimAccount *account) | |
937 { | |
938 gchar *primary; | |
939 const gchar *username; | |
11042
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
940 GaimRequestFieldGroup *group; |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
941 GaimRequestField *field; |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
942 GaimRequestFields *fields; |
10740 | 943 |
10758 | 944 /* Close any previous password request windows */ |
945 gaim_request_close_with_handle(account); | |
946 | |
10740 | 947 username = gaim_account_get_username(account); |
10774 | 948 primary = g_strdup_printf(_("Enter password for %s (%s)"), username, |
10740 | 949 gaim_account_get_protocol_name(account)); |
11042
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
950 |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
951 fields = gaim_request_fields_new(); |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
952 group = gaim_request_field_group_new(NULL); |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
953 gaim_request_fields_add_group(fields, group); |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
954 |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
955 field = gaim_request_field_string_new("password", _("Enter Password"), NULL, FALSE); |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
956 gaim_request_field_string_set_masked(field, TRUE); |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
957 gaim_request_field_set_required(field, TRUE); |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
958 gaim_request_field_group_add_field(group, field); |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
959 |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
960 field = gaim_request_field_bool_new("remember", _("Save password"), FALSE); |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
961 gaim_request_field_group_add_field(group, field); |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
962 |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
963 gaim_request_fields(account, |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
964 NULL, |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
965 primary, |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
966 NULL, |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
967 fields, |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
968 _("OK"), G_CALLBACK(request_password_ok_cb), |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
969 _("Cancel"), NULL, |
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
970 account); |
10740 | 971 g_free(primary); |
972 } | |
973 | |
974 void | |
10738 | 975 gaim_account_connect(GaimAccount *account) |
5563 | 976 { |
10740 | 977 GaimPlugin *prpl; |
978 GaimPluginProtocolInfo *prpl_info; | |
979 const char *password; | |
980 | |
981 g_return_if_fail(account != NULL); | |
5563 | 982 |
10740 | 983 gaim_debug_info("account", "Connecting to account %s\n", |
984 gaim_account_get_username(account)); | |
5563 | 985 |
11722 | 986 if (!gaim_account_get_enabled(account, gaim_core_get_ui())) |
987 return; | |
988 | |
10740 | 989 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); |
990 if (prpl == NULL) | |
991 { | |
992 gchar *message; | |
6036 | 993 |
10740 | 994 message = g_strdup_printf(_("Missing protocol plugin for %s"), |
995 gaim_account_get_username(account)); | |
10758 | 996 gaim_notify_error(account, _("Connection Error"), message, NULL); |
10740 | 997 g_free(message); |
998 return; | |
999 } | |
5563 | 1000 |
10740 | 1001 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); |
1002 password = gaim_account_get_password(account); | |
1003 if ((password == NULL) && | |
1004 !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && | |
1005 !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) | |
1006 request_password(account); | |
1007 else | |
1008 gaim_connection_new(account, FALSE, password); | |
5563 | 1009 } |
1010 | |
1011 void | |
1012 gaim_account_disconnect(GaimAccount *account) | |
1013 { | |
5926
6c22d37c6a3c
[gaim-migrate @ 6366]
Christian Hammond <chipx86@chipx86.com>
parents:
5879
diff
changeset
|
1014 GaimConnection *gc; |
6c22d37c6a3c
[gaim-migrate @ 6366]
Christian Hammond <chipx86@chipx86.com>
parents:
5879
diff
changeset
|
1015 |
5563 | 1016 g_return_if_fail(account != NULL); |
11251 | 1017 g_return_if_fail(!gaim_account_is_disconnected(account)); |
5563 | 1018 |
9944 | 1019 gaim_debug_info("account", "Disconnecting account %p\n", account); |
5930
03f1d6cd784c
[gaim-migrate @ 6370]
Christian Hammond <chipx86@chipx86.com>
parents:
5926
diff
changeset
|
1020 |
10384 | 1021 account->disconnecting = TRUE; |
5563 | 1022 |
10742 | 1023 gc = gaim_account_get_connection(account); |
1024 gaim_connection_destroy(gc); | |
11562 | 1025 if (!gaim_account_get_remember_password(account)) |
1026 gaim_account_set_password(account, NULL); | |
10742 | 1027 gaim_account_set_connection(account, NULL); |
10384 | 1028 |
1029 account->disconnecting = FALSE; | |
5563 | 1030 } |
1031 | |
1032 void | |
12287
e4a9be312854
[gaim-migrate @ 14591]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12286
diff
changeset
|
1033 gaim_account_notify_added(GaimAccount *account, const char *remote_user, |
e4a9be312854
[gaim-migrate @ 14591]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12286
diff
changeset
|
1034 const char *id, const char *alias, |
12286
255e6912607b
[gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12285
diff
changeset
|
1035 const char *message) |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1036 { |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1037 GaimAccountUiOps *ui_ops; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1038 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1039 g_return_if_fail(account != NULL); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1040 g_return_if_fail(remote_user != NULL); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1041 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1042 ui_ops = gaim_accounts_get_ui_ops(); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1043 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1044 if (ui_ops != NULL && ui_ops->notify_added != NULL) |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1045 ui_ops->notify_added(account, remote_user, id, alias, message); |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1046 } |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1047 |
12285
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1048 void |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1049 gaim_account_request_add(GaimAccount *account, const char *remote_user, |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1050 const char *id, const char *alias, |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1051 const char *message) |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1052 { |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1053 GaimAccountUiOps *ui_ops; |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1054 |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1055 g_return_if_fail(account != NULL); |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1056 g_return_if_fail(remote_user != NULL); |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1057 |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1058 ui_ops = gaim_accounts_get_ui_ops(); |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1059 |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1060 if (ui_ops != NULL && ui_ops->request_add != NULL) |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1061 ui_ops->request_add(account, remote_user, id, alias, message); |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1062 } |
af257d8679fe
[gaim-migrate @ 14589]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12088
diff
changeset
|
1063 |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1064 static void |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1065 change_password_cb(GaimAccount *account, GaimRequestFields *fields) |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1066 { |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1067 const char *orig_pass, *new_pass_1, *new_pass_2; |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1068 |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1069 orig_pass = gaim_request_fields_get_string(fields, "password"); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1070 new_pass_1 = gaim_request_fields_get_string(fields, "new_password_1"); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1071 new_pass_2 = gaim_request_fields_get_string(fields, "new_password_2"); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1072 |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1073 if (g_utf8_collate(new_pass_1, new_pass_2)) |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1074 { |
10758 | 1075 gaim_notify_error(account, NULL, |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1076 _("New passwords do not match."), NULL); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1077 |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1078 return; |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1079 } |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1080 |
8638 | 1081 if (orig_pass == NULL || new_pass_1 == NULL || new_pass_2 == NULL || |
1082 *orig_pass == '\0' || *new_pass_1 == '\0' || *new_pass_2 == '\0') | |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1083 { |
10758 | 1084 gaim_notify_error(account, NULL, |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1085 _("Fill out all fields completely."), NULL); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1086 return; |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1087 } |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1088 |
11643 | 1089 gaim_account_change_password(account, orig_pass, new_pass_1); |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1090 } |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1091 |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1092 void |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1093 gaim_account_request_change_password(GaimAccount *account) |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1094 { |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1095 GaimRequestFields *fields; |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1096 GaimRequestFieldGroup *group; |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1097 GaimRequestField *field; |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1098 char primary[256]; |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1099 |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1100 g_return_if_fail(account != NULL); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1101 g_return_if_fail(gaim_account_is_connected(account)); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1102 |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1103 fields = gaim_request_fields_new(); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1104 |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1105 group = gaim_request_field_group_new(NULL); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1106 gaim_request_fields_add_group(fields, group); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1107 |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1108 field = gaim_request_field_string_new("password", _("Original password"), |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1109 NULL, FALSE); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1110 gaim_request_field_string_set_masked(field, TRUE); |
8638 | 1111 gaim_request_field_set_required(field, TRUE); |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1112 gaim_request_field_group_add_field(group, field); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1113 |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1114 field = gaim_request_field_string_new("new_password_1", |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1115 _("New password"), |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1116 NULL, FALSE); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1117 gaim_request_field_string_set_masked(field, TRUE); |
8638 | 1118 gaim_request_field_set_required(field, TRUE); |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1119 gaim_request_field_group_add_field(group, field); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1120 |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1121 field = gaim_request_field_string_new("new_password_2", |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1122 _("New password (again)"), |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1123 NULL, FALSE); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1124 gaim_request_field_string_set_masked(field, TRUE); |
8638 | 1125 gaim_request_field_set_required(field, TRUE); |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1126 gaim_request_field_group_add_field(group, field); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1127 |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1128 g_snprintf(primary, sizeof(primary), _("Change password for %s"), |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1129 gaim_account_get_username(account)); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1130 |
7755 | 1131 /* I'm sticking this somewhere in the code: bologna */ |
1132 | |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1133 gaim_request_fields(gaim_account_get_connection(account), |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1134 NULL, |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1135 primary, |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1136 _("Please enter your current password and your " |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1137 "new password."), |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1138 fields, |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1139 _("OK"), G_CALLBACK(change_password_cb), |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1140 _("Cancel"), NULL, |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1141 account); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1142 } |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1143 |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1144 static void |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1145 set_user_info_cb(GaimAccount *account, const char *user_info) |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1146 { |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1147 GaimConnection *gc; |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1148 |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1149 gaim_account_set_user_info(account, user_info); |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1150 |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1151 gc = gaim_account_get_connection(account); |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1152 |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1153 if (gc != NULL) |
12975 | 1154 serv_set_info(gc, user_info); |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1155 } |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1156 |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1157 void |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1158 gaim_account_request_change_user_info(GaimAccount *account) |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1159 { |
8697 | 1160 GaimConnection *gc; |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1161 char primary[256]; |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1162 |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1163 g_return_if_fail(account != NULL); |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1164 g_return_if_fail(gaim_account_is_connected(account)); |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1165 |
8697 | 1166 gc = gaim_account_get_connection(account); |
1167 | |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1168 g_snprintf(primary, sizeof(primary), |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1169 _("Change user information for %s"), |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1170 gaim_account_get_username(account)); |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1171 |
12975 | 1172 gaim_request_input(gc, NULL, primary, NULL, |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1173 gaim_account_get_user_info(account), |
8697 | 1174 TRUE, FALSE, ((gc != NULL) && |
1175 (gc->flags & GAIM_CONNECTION_HTML) ? "html" : NULL), | |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1176 _("Save"), G_CALLBACK(set_user_info_cb), |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1177 _("Cancel"), NULL, account); |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1178 } |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1179 |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1180 void |
5563 | 1181 gaim_account_set_username(GaimAccount *account, const char *username) |
1182 { | |
5711
e33778b9d395
[gaim-migrate @ 6132]
Christian Hammond <chipx86@chipx86.com>
parents:
5710
diff
changeset
|
1183 g_return_if_fail(account != NULL); |
5563 | 1184 |
10740 | 1185 g_free(account->username); |
5563 | 1186 account->username = (username == NULL ? NULL : g_strdup(username)); |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1187 |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1188 schedule_accounts_save(); |
5563 | 1189 } |
1190 | |
1191 void | |
1192 gaim_account_set_password(GaimAccount *account, const char *password) | |
1193 { | |
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1194 g_return_if_fail(account != NULL); |
5563 | 1195 |
10740 | 1196 g_free(account->password); |
1197 account->password = NULL; | |
5563 | 1198 account->password = (password == NULL ? NULL : g_strdup(password)); |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1199 |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1200 schedule_accounts_save(); |
5563 | 1201 } |
1202 | |
1203 void | |
1204 gaim_account_set_alias(GaimAccount *account, const char *alias) | |
1205 { | |
1206 g_return_if_fail(account != NULL); | |
1207 | |
13281
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
1208 if ((!alias && account->alias) || (alias && !account->alias) || |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
1209 g_utf8_collate(account->alias, alias)) |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
1210 { |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
1211 char *old = account->alias; |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
1212 |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
1213 account->alias = (alias == NULL ? NULL : g_strdup(alias)); |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
1214 gaim_signal_emit(gaim_accounts_get_handle(), "account-alias-changed", |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
1215 account, old); |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
1216 g_free(old); |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
1217 |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
1218 schedule_accounts_save(); |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
1219 } |
5563 | 1220 } |
1221 | |
1222 void | |
1223 gaim_account_set_user_info(GaimAccount *account, const char *user_info) | |
1224 { | |
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1225 g_return_if_fail(account != NULL); |
5563 | 1226 |
10740 | 1227 g_free(account->user_info); |
5563 | 1228 account->user_info = (user_info == NULL ? NULL : g_strdup(user_info)); |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1229 |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1230 schedule_accounts_save(); |
5563 | 1231 } |
1232 | |
1233 void | |
1234 gaim_account_set_buddy_icon(GaimAccount *account, const char *icon) | |
1235 { | |
1236 g_return_if_fail(account != NULL); | |
1237 | |
11303
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1238 /* Delete an existing icon from the cache. */ |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1239 if (account->buddy_icon != NULL && (icon == NULL || strcmp(account->buddy_icon, icon))) |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1240 { |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1241 const char *dirname = gaim_buddy_icons_get_cache_dir(); |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1242 struct stat st; |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1243 |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1244 if (g_stat(account->buddy_icon, &st) == 0) |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1245 { |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1246 /* The file exists. This is a full path. */ |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1247 |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1248 /* XXX: This is a hack so we only delete the file if it's |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1249 * in the cache dir. Otherwise, people who upgrade (who |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1250 * may have buddy icon filenames set outside of the cache |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1251 * dir) could lose files. */ |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1252 if (!strncmp(dirname, account->buddy_icon, strlen(dirname))) |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1253 g_unlink(account->buddy_icon); |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1254 } |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1255 else |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1256 { |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1257 char *filename = g_build_filename(dirname, account->buddy_icon, NULL); |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1258 g_unlink(filename); |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1259 g_free(filename); |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1260 } |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1261 } |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
1262 |
10740 | 1263 g_free(account->buddy_icon); |
5563 | 1264 account->buddy_icon = (icon == NULL ? NULL : g_strdup(icon)); |
10740 | 1265 if (gaim_account_is_connected(account)) |
11320
d3b567926e8f
[gaim-migrate @ 13523]
Richard Laager <rlaager@wiktel.com>
parents:
11303
diff
changeset
|
1266 { |
d3b567926e8f
[gaim-migrate @ 13523]
Richard Laager <rlaager@wiktel.com>
parents:
11303
diff
changeset
|
1267 char *filename = gaim_buddy_icons_get_full_path(icon); |
d3b567926e8f
[gaim-migrate @ 13523]
Richard Laager <rlaager@wiktel.com>
parents:
11303
diff
changeset
|
1268 serv_set_buddyicon(gaim_account_get_connection(account), filename); |
d3b567926e8f
[gaim-migrate @ 13523]
Richard Laager <rlaager@wiktel.com>
parents:
11303
diff
changeset
|
1269 g_free(filename); |
d3b567926e8f
[gaim-migrate @ 13523]
Richard Laager <rlaager@wiktel.com>
parents:
11303
diff
changeset
|
1270 } |
10418 | 1271 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1272 schedule_accounts_save(); |
5563 | 1273 } |
1274 | |
1275 void | |
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1276 gaim_account_set_protocol_id(GaimAccount *account, const char *protocol_id) |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1277 { |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1278 g_return_if_fail(account != NULL); |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1279 g_return_if_fail(protocol_id != NULL); |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1280 |
10740 | 1281 g_free(account->protocol_id); |
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1282 account->protocol_id = g_strdup(protocol_id); |
5665
132a30783c3d
[gaim-migrate @ 6081]
Christian Hammond <chipx86@chipx86.com>
parents:
5659
diff
changeset
|
1283 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1284 schedule_accounts_save(); |
5563 | 1285 } |
1286 | |
1287 void | |
1288 gaim_account_set_connection(GaimAccount *account, GaimConnection *gc) | |
1289 { | |
1290 g_return_if_fail(account != NULL); | |
1291 | |
1292 account->gc = gc; | |
1293 } | |
1294 | |
1295 void | |
1296 gaim_account_set_remember_password(GaimAccount *account, gboolean value) | |
1297 { | |
1298 g_return_if_fail(account != NULL); | |
1299 | |
1300 account->remember_pass = value; | |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1301 |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1302 schedule_accounts_save(); |
5563 | 1303 } |
1304 | |
1305 void | |
5659
6b3214ab8632
[gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents:
5643
diff
changeset
|
1306 gaim_account_set_check_mail(GaimAccount *account, gboolean value) |
6b3214ab8632
[gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents:
5643
diff
changeset
|
1307 { |
6b3214ab8632
[gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents:
5643
diff
changeset
|
1308 g_return_if_fail(account != NULL); |
6b3214ab8632
[gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents:
5643
diff
changeset
|
1309 |
5977
2d34c02d2031
[gaim-migrate @ 6424]
Christian Hammond <chipx86@chipx86.com>
parents:
5953
diff
changeset
|
1310 gaim_account_set_bool(account, "check-mail", value); |
5659
6b3214ab8632
[gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents:
5643
diff
changeset
|
1311 } |
6b3214ab8632
[gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents:
5643
diff
changeset
|
1312 |
6b3214ab8632
[gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents:
5643
diff
changeset
|
1313 void |
10400 | 1314 gaim_account_set_enabled(GaimAccount *account, const char *ui, |
1315 gboolean value) | |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1316 { |
11638 | 1317 GaimConnection *gc; |
12070 | 1318 gboolean was_enabled = FALSE; |
11638 | 1319 |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1320 g_return_if_fail(account != NULL); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1321 g_return_if_fail(ui != NULL); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1322 |
12070 | 1323 was_enabled = gaim_account_get_enabled(account, ui); |
1324 | |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1325 gaim_account_set_ui_bool(account, ui, "auto-login", value); |
11638 | 1326 gc = gaim_account_get_connection(account); |
1327 | |
12070 | 1328 if(was_enabled && !value) |
1329 gaim_signal_emit(gaim_accounts_get_handle(), "account-disabled", account); | |
1330 else if(!was_enabled && value) | |
1331 gaim_signal_emit(gaim_accounts_get_handle(), "account-enabled", account); | |
1332 | |
11638 | 1333 if ((gc != NULL) && (gc->wants_to_die == TRUE)) |
1334 return; | |
1335 | |
11298 | 1336 if (value && gaim_presence_is_online(account->presence)) |
10862 | 1337 gaim_account_connect(account); |
11348 | 1338 else if (!value && !gaim_account_is_disconnected(account)) |
1339 gaim_account_disconnect(account); | |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1340 } |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1341 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1342 void |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1343 gaim_account_set_proxy_info(GaimAccount *account, GaimProxyInfo *info) |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1344 { |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1345 g_return_if_fail(account != NULL); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1346 |
5695
e42535701e25
[gaim-migrate @ 6116]
Christian Hammond <chipx86@chipx86.com>
parents:
5694
diff
changeset
|
1347 if (account->proxy_info != NULL) |
e42535701e25
[gaim-migrate @ 6116]
Christian Hammond <chipx86@chipx86.com>
parents:
5694
diff
changeset
|
1348 gaim_proxy_info_destroy(account->proxy_info); |
e42535701e25
[gaim-migrate @ 6116]
Christian Hammond <chipx86@chipx86.com>
parents:
5694
diff
changeset
|
1349 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1350 account->proxy_info = info; |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1351 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1352 schedule_accounts_save(); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1353 } |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1354 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1355 void |
9944 | 1356 gaim_account_set_status_types(GaimAccount *account, GList *status_types) |
1357 { | |
1358 g_return_if_fail(account != NULL); | |
1359 | |
10005 | 1360 /* Old with the old... */ |
9944 | 1361 if (account->status_types != NULL) |
1362 { | |
1363 GList *l; | |
1364 | |
1365 for (l = account->status_types; l != NULL; l = l->next) | |
1366 gaim_status_type_destroy((GaimStatusType *)l->data); | |
1367 | |
1368 g_list_free(account->status_types); | |
1369 } | |
1370 | |
10005 | 1371 /* In with the new... */ |
9944 | 1372 account->status_types = status_types; |
1373 } | |
1374 | |
1375 void | |
1376 gaim_account_set_status(GaimAccount *account, const char *status_id, | |
1377 gboolean active, ...) | |
1378 { | |
10738 | 1379 va_list args; |
1380 | |
1381 va_start(args, active); | |
1382 gaim_account_set_status_vargs(account, status_id, active, args); | |
1383 va_end(args); | |
1384 } | |
1385 | |
1386 void | |
1387 gaim_account_set_status_vargs(GaimAccount *account, const char *status_id, | |
1388 gboolean active, va_list args) | |
1389 { | |
11249 | 1390 GList *attrs = NULL; |
1391 const gchar *id; | |
1392 gpointer data; | |
1393 | |
1394 if (args != NULL) | |
1395 { | |
1396 while ((id = va_arg(args, const char *)) != NULL) | |
1397 { | |
1398 attrs = g_list_append(attrs, (char *)id); | |
1399 data = va_arg(args, void *); | |
1400 attrs = g_list_append(attrs, data); | |
1401 } | |
1402 } | |
1403 gaim_account_set_status_list(account, status_id, active, attrs); | |
1404 g_list_free(attrs); | |
1405 } | |
1406 | |
1407 void | |
1408 gaim_account_set_status_list(GaimAccount *account, const char *status_id, | |
1409 gboolean active, GList *attrs) | |
1410 { | |
9944 | 1411 GaimStatus *status; |
1412 | |
1413 g_return_if_fail(account != NULL); | |
1414 g_return_if_fail(status_id != NULL); | |
1415 | |
1416 status = gaim_account_get_status(account, status_id); | |
1417 if (status == NULL) | |
1418 { | |
10760 | 1419 gaim_debug_error("account", |
9944 | 1420 "Invalid status ID %s for account %s (%s)\n", |
1421 status_id, gaim_account_get_username(account), | |
1422 gaim_account_get_protocol_id(account)); | |
1423 return; | |
1424 } | |
10720 | 1425 |
10754 | 1426 if (active || gaim_status_is_independent(status)) |
11249 | 1427 gaim_status_set_active_with_attrs_list(status, active, attrs); |
10862 | 1428 |
1429 /* | |
1430 * Our current statuses are saved to accounts.xml (so that when we | |
1431 * reconnect, we go back to the previous status). | |
1432 */ | |
1433 schedule_accounts_save(); | |
9944 | 1434 } |
1435 | |
1436 void | |
5694
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1437 gaim_account_clear_settings(GaimAccount *account) |
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1438 { |
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1439 g_return_if_fail(account != NULL); |
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1440 |
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1441 g_hash_table_destroy(account->settings); |
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1442 |
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1443 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal, |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5792
diff
changeset
|
1444 g_free, delete_setting); |
5694
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1445 } |
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1446 |
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1447 void |
5563 | 1448 gaim_account_set_int(GaimAccount *account, const char *name, int value) |
1449 { | |
1450 GaimAccountSetting *setting; | |
1451 | |
1452 g_return_if_fail(account != NULL); | |
1453 g_return_if_fail(name != NULL); | |
1454 | |
1455 setting = g_new0(GaimAccountSetting, 1); | |
1456 | |
1457 setting->type = GAIM_PREF_INT; | |
1458 setting->value.integer = value; | |
1459 | |
1460 g_hash_table_insert(account->settings, g_strdup(name), setting); | |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1461 |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1462 schedule_accounts_save(); |
5563 | 1463 } |
1464 | |
1465 void | |
1466 gaim_account_set_string(GaimAccount *account, const char *name, | |
1467 const char *value) | |
1468 { | |
1469 GaimAccountSetting *setting; | |
1470 | |
1471 g_return_if_fail(account != NULL); | |
1472 g_return_if_fail(name != NULL); | |
1473 | |
1474 setting = g_new0(GaimAccountSetting, 1); | |
1475 | |
1476 setting->type = GAIM_PREF_STRING; | |
1477 setting->value.string = g_strdup(value); | |
1478 | |
1479 g_hash_table_insert(account->settings, g_strdup(name), setting); | |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1480 |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1481 schedule_accounts_save(); |
5563 | 1482 } |
1483 | |
1484 void | |
1485 gaim_account_set_bool(GaimAccount *account, const char *name, gboolean value) | |
1486 { | |
1487 GaimAccountSetting *setting; | |
1488 | |
1489 g_return_if_fail(account != NULL); | |
1490 g_return_if_fail(name != NULL); | |
1491 | |
1492 setting = g_new0(GaimAccountSetting, 1); | |
1493 | |
1494 setting->type = GAIM_PREF_BOOLEAN; | |
1495 setting->value.bool = value; | |
1496 | |
1497 g_hash_table_insert(account->settings, g_strdup(name), setting); | |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1498 |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1499 schedule_accounts_save(); |
5563 | 1500 } |
1501 | |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1502 static GHashTable * |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5792
diff
changeset
|
1503 get_ui_settings_table(GaimAccount *account, const char *ui) |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1504 { |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1505 GHashTable *table; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1506 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1507 table = g_hash_table_lookup(account->ui_settings, ui); |
5979
49ae70ffcea5
[gaim-migrate @ 6426]
Christian Hammond <chipx86@chipx86.com>
parents:
5977
diff
changeset
|
1508 |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1509 if (table == NULL) { |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1510 table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5792
diff
changeset
|
1511 delete_setting); |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1512 g_hash_table_insert(account->ui_settings, g_strdup(ui), table); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1513 } |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1514 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1515 return table; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1516 } |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1517 |
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1518 void |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1519 gaim_account_set_ui_int(GaimAccount *account, const char *ui, |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1520 const char *name, int value) |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1521 { |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1522 GaimAccountSetting *setting; |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1523 GHashTable *table; |
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1524 |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1525 g_return_if_fail(account != NULL); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1526 g_return_if_fail(ui != NULL); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1527 g_return_if_fail(name != NULL); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1528 |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1529 setting = g_new0(GaimAccountSetting, 1); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1530 |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1531 setting->type = GAIM_PREF_INT; |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1532 setting->ui = g_strdup(ui); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1533 setting->value.integer = value; |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1534 |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5792
diff
changeset
|
1535 table = get_ui_settings_table(account, ui); |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1536 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1537 g_hash_table_insert(table, g_strdup(name), setting); |
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1538 |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1539 schedule_accounts_save(); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1540 } |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1541 |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1542 void |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1543 gaim_account_set_ui_string(GaimAccount *account, const char *ui, |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1544 const char *name, const char *value) |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1545 { |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1546 GaimAccountSetting *setting; |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1547 GHashTable *table; |
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1548 |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1549 g_return_if_fail(account != NULL); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1550 g_return_if_fail(ui != NULL); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1551 g_return_if_fail(name != NULL); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1552 |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1553 setting = g_new0(GaimAccountSetting, 1); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1554 |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1555 setting->type = GAIM_PREF_STRING; |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1556 setting->ui = g_strdup(ui); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1557 setting->value.string = g_strdup(value); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1558 |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5792
diff
changeset
|
1559 table = get_ui_settings_table(account, ui); |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1560 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1561 g_hash_table_insert(table, g_strdup(name), setting); |
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1562 |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1563 schedule_accounts_save(); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1564 } |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1565 |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1566 void |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1567 gaim_account_set_ui_bool(GaimAccount *account, const char *ui, |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1568 const char *name, gboolean value) |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1569 { |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1570 GaimAccountSetting *setting; |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1571 GHashTable *table; |
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1572 |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1573 g_return_if_fail(account != NULL); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1574 g_return_if_fail(ui != NULL); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1575 g_return_if_fail(name != NULL); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1576 |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1577 setting = g_new0(GaimAccountSetting, 1); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1578 |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1579 setting->type = GAIM_PREF_BOOLEAN; |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1580 setting->ui = g_strdup(ui); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1581 setting->value.bool = value; |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1582 |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5792
diff
changeset
|
1583 table = get_ui_settings_table(account, ui); |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1584 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1585 g_hash_table_insert(table, g_strdup(name), setting); |
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1586 |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1587 schedule_accounts_save(); |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1588 } |
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1589 |
11251 | 1590 static GaimConnectionState |
1591 gaim_account_get_state(const GaimAccount *account) | |
5563 | 1592 { |
9019 | 1593 GaimConnection *gc; |
1594 | |
11251 | 1595 g_return_val_if_fail(account != NULL, GAIM_DISCONNECTED); |
5563 | 1596 |
9019 | 1597 gc = gaim_account_get_connection(account); |
11251 | 1598 if (!gc) |
1599 return GAIM_DISCONNECTED; | |
9019 | 1600 |
11251 | 1601 return gaim_connection_get_state(gc); |
1602 } | |
1603 | |
1604 gboolean | |
1605 gaim_account_is_connected(const GaimAccount *account) | |
1606 { | |
1607 return (gaim_account_get_state(account) == GAIM_CONNECTED); | |
1608 } | |
1609 | |
1610 gboolean | |
1611 gaim_account_is_connecting(const GaimAccount *account) | |
1612 { | |
1613 return (gaim_account_get_state(account) == GAIM_CONNECTING); | |
1614 } | |
1615 | |
1616 gboolean | |
1617 gaim_account_is_disconnected(const GaimAccount *account) | |
1618 { | |
1619 return (gaim_account_get_state(account) == GAIM_DISCONNECTED); | |
5563 | 1620 } |
1621 | |
1622 const char * | |
1623 gaim_account_get_username(const GaimAccount *account) | |
1624 { | |
1625 g_return_val_if_fail(account != NULL, NULL); | |
1626 | |
1627 return account->username; | |
1628 } | |
1629 | |
1630 const char * | |
1631 gaim_account_get_password(const GaimAccount *account) | |
1632 { | |
1633 g_return_val_if_fail(account != NULL, NULL); | |
1634 | |
1635 return account->password; | |
1636 } | |
1637 | |
1638 const char * | |
1639 gaim_account_get_alias(const GaimAccount *account) | |
1640 { | |
1641 g_return_val_if_fail(account != NULL, NULL); | |
1642 | |
1643 return account->alias; | |
1644 } | |
1645 | |
1646 const char * | |
1647 gaim_account_get_user_info(const GaimAccount *account) | |
1648 { | |
1649 g_return_val_if_fail(account != NULL, NULL); | |
1650 | |
1651 return account->user_info; | |
1652 } | |
1653 | |
1654 const char * | |
1655 gaim_account_get_buddy_icon(const GaimAccount *account) | |
1656 { | |
1657 g_return_val_if_fail(account != NULL, NULL); | |
1658 | |
1659 return account->buddy_icon; | |
1660 } | |
1661 | |
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1662 const char * |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1663 gaim_account_get_protocol_id(const GaimAccount *account) |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1664 { |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1665 g_return_val_if_fail(account != NULL, NULL); |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1666 |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1667 return account->protocol_id; |
5563 | 1668 } |
1669 | |
9699 | 1670 const char * |
1671 gaim_account_get_protocol_name(const GaimAccount *account) | |
1672 { | |
9720 | 1673 GaimPlugin *p; |
1674 | |
9699 | 1675 g_return_val_if_fail(account != NULL, NULL); |
1676 | |
9989 | 1677 p = gaim_find_prpl(gaim_account_get_protocol_id(account)); |
9988 | 1678 |
1679 return ((p && p->info->name) ? _(p->info->name) : _("Unknown")); | |
1680 } | |
1681 | |
5563 | 1682 GaimConnection * |
1683 gaim_account_get_connection(const GaimAccount *account) | |
1684 { | |
1685 g_return_val_if_fail(account != NULL, NULL); | |
1686 | |
1687 return account->gc; | |
1688 } | |
1689 | |
1690 gboolean | |
1691 gaim_account_get_remember_password(const GaimAccount *account) | |
1692 { | |
1693 g_return_val_if_fail(account != NULL, FALSE); | |
1694 | |
1695 return account->remember_pass; | |
1696 } | |
1697 | |
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1698 gboolean |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1699 gaim_account_get_check_mail(const GaimAccount *account) |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1700 { |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1701 g_return_val_if_fail(account != NULL, FALSE); |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1702 |
5977
2d34c02d2031
[gaim-migrate @ 6424]
Christian Hammond <chipx86@chipx86.com>
parents:
5953
diff
changeset
|
1703 return gaim_account_get_bool(account, "check-mail", FALSE); |
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1704 } |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1705 |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1706 gboolean |
10400 | 1707 gaim_account_get_enabled(const GaimAccount *account, const char *ui) |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1708 { |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1709 g_return_val_if_fail(account != NULL, FALSE); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1710 g_return_val_if_fail(ui != NULL, FALSE); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1711 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1712 return gaim_account_get_ui_bool(account, ui, "auto-login", FALSE); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1713 } |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1714 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1715 GaimProxyInfo * |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1716 gaim_account_get_proxy_info(const GaimAccount *account) |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1717 { |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1718 g_return_val_if_fail(account != NULL, NULL); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1719 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1720 return account->proxy_info; |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1721 } |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1722 |
9944 | 1723 GaimStatus * |
10738 | 1724 gaim_account_get_active_status(const GaimAccount *account) |
1725 { | |
1726 g_return_val_if_fail(account != NULL, NULL); | |
1727 | |
1728 return gaim_presence_get_active_status(account->presence); | |
1729 } | |
1730 | |
1731 GaimStatus * | |
9944 | 1732 gaim_account_get_status(const GaimAccount *account, const char *status_id) |
1733 { | |
1734 g_return_val_if_fail(account != NULL, NULL); | |
1735 g_return_val_if_fail(status_id != NULL, NULL); | |
1736 | |
1737 return gaim_presence_get_status(account->presence, status_id); | |
1738 } | |
1739 | |
1740 GaimStatusType * | |
1741 gaim_account_get_status_type(const GaimAccount *account, const char *id) | |
1742 { | |
1743 const GList *l; | |
1744 | |
1745 g_return_val_if_fail(account != NULL, NULL); | |
1746 g_return_val_if_fail(id != NULL, NULL); | |
1747 | |
1748 for (l = gaim_account_get_status_types(account); l != NULL; l = l->next) | |
1749 { | |
1750 GaimStatusType *status_type = (GaimStatusType *)l->data; | |
1751 | |
1752 if (!strcmp(gaim_status_type_get_id(status_type), id)) | |
1753 return status_type; | |
1754 } | |
1755 | |
1756 return NULL; | |
1757 } | |
1758 | |
11739 | 1759 GaimStatusType * |
1760 gaim_account_get_status_type_with_primitive(const GaimAccount *account, GaimStatusPrimitive primitive) | |
1761 { | |
1762 const GList *l; | |
1763 | |
1764 g_return_val_if_fail(account != NULL, NULL); | |
1765 | |
1766 for (l = gaim_account_get_status_types(account); l != NULL; l = l->next) | |
1767 { | |
1768 GaimStatusType *status_type = (GaimStatusType *)l->data; | |
1769 | |
1770 if (gaim_status_type_get_primitive(status_type) == primitive) | |
1771 return status_type; | |
1772 } | |
1773 | |
1774 return NULL; | |
1775 } | |
1776 | |
9944 | 1777 GaimPresence * |
1778 gaim_account_get_presence(const GaimAccount *account) | |
1779 { | |
1780 g_return_val_if_fail(account != NULL, NULL); | |
1781 | |
1782 return account->presence; | |
1783 } | |
1784 | |
1785 gboolean | |
1786 gaim_account_is_status_active(const GaimAccount *account, | |
1787 const char *status_id) | |
1788 { | |
1789 g_return_val_if_fail(account != NULL, FALSE); | |
1790 g_return_val_if_fail(status_id != NULL, FALSE); | |
1791 | |
1792 return gaim_presence_is_status_active(account->presence, status_id); | |
1793 } | |
1794 | |
1795 const GList * | |
1796 gaim_account_get_status_types(const GaimAccount *account) | |
1797 { | |
1798 g_return_val_if_fail(account != NULL, NULL); | |
1799 | |
1800 return account->status_types; | |
1801 } | |
1802 | |
5563 | 1803 int |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1804 gaim_account_get_int(const GaimAccount *account, const char *name, |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1805 int default_value) |
5563 | 1806 { |
1807 GaimAccountSetting *setting; | |
1808 | |
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1809 g_return_val_if_fail(account != NULL, default_value); |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1810 g_return_val_if_fail(name != NULL, default_value); |
5563 | 1811 |
1812 setting = g_hash_table_lookup(account->settings, name); | |
1813 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1814 if (setting == NULL) |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1815 return default_value; |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1816 |
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1817 g_return_val_if_fail(setting->type == GAIM_PREF_INT, default_value); |
5563 | 1818 |
1819 return setting->value.integer; | |
1820 } | |
1821 | |
1822 const char * | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1823 gaim_account_get_string(const GaimAccount *account, const char *name, |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1824 const char *default_value) |
5563 | 1825 { |
1826 GaimAccountSetting *setting; | |
1827 | |
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1828 g_return_val_if_fail(account != NULL, default_value); |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1829 g_return_val_if_fail(name != NULL, default_value); |
5563 | 1830 |
1831 setting = g_hash_table_lookup(account->settings, name); | |
1832 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1833 if (setting == NULL) |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1834 return default_value; |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1835 |
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1836 g_return_val_if_fail(setting->type == GAIM_PREF_STRING, default_value); |
5563 | 1837 |
1838 return setting->value.string; | |
1839 } | |
1840 | |
1841 gboolean | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1842 gaim_account_get_bool(const GaimAccount *account, const char *name, |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1843 gboolean default_value) |
5563 | 1844 { |
1845 GaimAccountSetting *setting; | |
1846 | |
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1847 g_return_val_if_fail(account != NULL, default_value); |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1848 g_return_val_if_fail(name != NULL, default_value); |
5563 | 1849 |
1850 setting = g_hash_table_lookup(account->settings, name); | |
1851 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1852 if (setting == NULL) |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1853 return default_value; |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1854 |
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1855 g_return_val_if_fail(setting->type == GAIM_PREF_BOOLEAN, default_value); |
5563 | 1856 |
1857 return setting->value.bool; | |
1858 } | |
1859 | |
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1860 int |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1861 gaim_account_get_ui_int(const GaimAccount *account, const char *ui, |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1862 const char *name, int default_value) |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1863 { |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1864 GaimAccountSetting *setting; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1865 GHashTable *table; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1866 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1867 g_return_val_if_fail(account != NULL, default_value); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1868 g_return_val_if_fail(ui != NULL, default_value); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1869 g_return_val_if_fail(name != NULL, default_value); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1870 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1871 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL) |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1872 return default_value; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1873 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1874 if ((setting = g_hash_table_lookup(table, name)) == NULL) |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1875 return default_value; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1876 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1877 g_return_val_if_fail(setting->type == GAIM_PREF_INT, default_value); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1878 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1879 return setting->value.integer; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1880 } |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1881 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1882 const char * |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1883 gaim_account_get_ui_string(const GaimAccount *account, const char *ui, |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1884 const char *name, const char *default_value) |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1885 { |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1886 GaimAccountSetting *setting; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1887 GHashTable *table; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1888 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1889 g_return_val_if_fail(account != NULL, default_value); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1890 g_return_val_if_fail(ui != NULL, default_value); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1891 g_return_val_if_fail(name != NULL, default_value); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1892 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1893 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL) |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1894 return default_value; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1895 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1896 if ((setting = g_hash_table_lookup(table, name)) == NULL) |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1897 return default_value; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1898 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1899 g_return_val_if_fail(setting->type == GAIM_PREF_STRING, default_value); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1900 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1901 return setting->value.string; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1902 } |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1903 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1904 gboolean |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1905 gaim_account_get_ui_bool(const GaimAccount *account, const char *ui, |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1906 const char *name, gboolean default_value) |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1907 { |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1908 GaimAccountSetting *setting; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1909 GHashTable *table; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1910 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1911 g_return_val_if_fail(account != NULL, default_value); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1912 g_return_val_if_fail(ui != NULL, default_value); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1913 g_return_val_if_fail(name != NULL, default_value); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1914 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1915 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL) |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1916 return default_value; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1917 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1918 if ((setting = g_hash_table_lookup(table, name)) == NULL) |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1919 return default_value; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1920 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1921 g_return_val_if_fail(setting->type == GAIM_PREF_BOOLEAN, default_value); |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1922 |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1923 return setting->value.bool; |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1924 } |
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1925 |
8573 | 1926 GaimLog * |
13507
702107dd58f1
[gaim-migrate @ 15883]
Richard Laager <rlaager@wiktel.com>
parents:
13281
diff
changeset
|
1927 gaim_account_get_log(GaimAccount *account, gboolean create) |
8573 | 1928 { |
1929 g_return_val_if_fail(account != NULL, NULL); | |
1930 | |
13507
702107dd58f1
[gaim-migrate @ 15883]
Richard Laager <rlaager@wiktel.com>
parents:
13281
diff
changeset
|
1931 if(!account->system_log && create){ |
11973 | 1932 GaimPresence *presence; |
1933 int login_time; | |
1934 | |
1935 presence = gaim_account_get_presence(account); | |
1936 login_time = gaim_presence_get_login_time(presence); | |
8658 | 1937 |
8635 | 1938 account->system_log = gaim_log_new(GAIM_LOG_SYSTEM, |
11292
ef9280fdc511
[gaim-migrate @ 13492]
Richard Laager <rlaager@wiktel.com>
parents:
11284
diff
changeset
|
1939 gaim_account_get_username(account), account, NULL, |
13119
fcde3faa1f57
[gaim-migrate @ 15481]
Richard Laager <rlaager@wiktel.com>
parents:
12975
diff
changeset
|
1940 (login_time != 0) ? login_time : time(NULL), NULL); |
8573 | 1941 } |
1942 | |
1943 return account->system_log; | |
1944 } | |
1945 | |
1946 void | |
1947 gaim_account_destroy_log(GaimAccount *account) | |
1948 { | |
1949 g_return_if_fail(account != NULL); | |
1950 | |
1951 if(account->system_log){ | |
1952 gaim_log_free(account->system_log); | |
1953 account->system_log = NULL; | |
1954 } | |
1955 } | |
1956 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1957 void |
11643 | 1958 gaim_account_add_buddy(GaimAccount *account, GaimBuddy *buddy) |
1959 { | |
1960 GaimPluginProtocolInfo *prpl_info = NULL; | |
1961 GaimConnection *gc = gaim_account_get_connection(account); | |
1962 | |
1963 if (gc != NULL && gc->prpl != NULL) | |
1964 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
1965 | |
1966 if (prpl_info != NULL && g_list_find(gaim_connections_get_all(), gc) && | |
1967 prpl_info->add_buddy != NULL) | |
12088 | 1968 prpl_info->add_buddy(gc, buddy, gaim_buddy_get_group(buddy)); |
11643 | 1969 } |
1970 | |
1971 void | |
1972 gaim_account_add_buddies(GaimAccount *account, GList *buddies) | |
1973 { | |
1974 GaimPluginProtocolInfo *prpl_info = NULL; | |
1975 GaimConnection *gc = gaim_account_get_connection(account); | |
1976 | |
1977 if (gc != NULL && gc->prpl != NULL) | |
1978 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
1979 | |
1980 if (prpl_info && g_list_find(gaim_connections_get_all(), gc)) { | |
1981 GList *cur, *groups = NULL; | |
1982 | |
1983 /* Make a list of what group each buddy is in */ | |
1984 for (cur = buddies; cur != NULL; cur = cur->next) { | |
1985 GaimBlistNode *node = cur->data; | |
1986 groups = g_list_append(groups, node->parent->parent); | |
1987 } | |
1988 | |
1989 if (prpl_info->add_buddies != NULL) | |
1990 prpl_info->add_buddies(gc, buddies, groups); | |
1991 else if (prpl_info->add_buddy != NULL) { | |
1992 GList *curb = buddies, *curg = groups; | |
1993 | |
1994 while ((curb != NULL) && (curg != NULL)) { | |
1995 prpl_info->add_buddy(gc, curb->data, curg->data); | |
1996 curb = curb->next; | |
1997 curg = curg->next; | |
1998 } | |
1999 } | |
2000 | |
2001 g_list_free(groups); | |
2002 } | |
2003 } | |
2004 | |
2005 void | |
2006 gaim_account_remove_buddy(GaimAccount *account, GaimBuddy *buddy, | |
2007 GaimGroup *group) | |
2008 { | |
2009 GaimPluginProtocolInfo *prpl_info = NULL; | |
2010 GaimConnection *gc = gaim_account_get_connection(account); | |
2011 | |
2012 if (gc != NULL && gc->prpl != NULL) | |
2013 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
2014 | |
2015 if (prpl_info && g_list_find(gaim_connections_get_all(), gc) && prpl_info->remove_buddy) | |
2016 prpl_info->remove_buddy(gc, buddy, group); | |
2017 } | |
2018 | |
2019 void | |
2020 gaim_account_remove_buddies(GaimAccount *account, GList *buddies, GList *groups) | |
2021 { | |
2022 GaimPluginProtocolInfo *prpl_info = NULL; | |
2023 GaimConnection *gc = gaim_account_get_connection(account); | |
2024 | |
2025 if (!g_list_find(gaim_connections_get_all(), gc)) | |
2026 return; | |
2027 | |
2028 if (gc != NULL && gc->prpl != NULL) | |
2029 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
2030 | |
2031 if (prpl_info && g_list_find(gaim_connections_get_all(), gc)) { | |
2032 if (prpl_info->remove_buddies) | |
2033 prpl_info->remove_buddies(gc, buddies, groups); | |
2034 else { | |
2035 GList *curb = buddies; | |
2036 GList *curg = groups; | |
2037 while ((curb != NULL) && (curg != NULL)) { | |
2038 gaim_account_remove_buddy(account, curb->data, curg->data); | |
2039 curb = curb->next; | |
2040 curg = curg->next; | |
2041 } | |
2042 } | |
2043 } | |
2044 } | |
2045 | |
2046 void | |
2047 gaim_account_remove_group(GaimAccount *account, GaimGroup *group) | |
2048 { | |
2049 GaimPluginProtocolInfo *prpl_info = NULL; | |
2050 GaimConnection *gc = gaim_account_get_connection(account); | |
2051 | |
2052 if (gc != NULL && gc->prpl != NULL) | |
2053 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
2054 | |
2055 if (prpl_info && g_list_find(gaim_connections_get_all(), gc) && prpl_info->remove_group) | |
2056 prpl_info->remove_group(gc, group); | |
2057 } | |
2058 | |
2059 void | |
2060 gaim_account_change_password(GaimAccount *account, const char *orig_pw, | |
2061 const char *new_pw) | |
2062 { | |
2063 GaimPluginProtocolInfo *prpl_info = NULL; | |
2064 GaimConnection *gc = gaim_account_get_connection(account); | |
2065 | |
11985 | 2066 gaim_account_set_password(account, new_pw); |
2067 | |
11643 | 2068 if (gc != NULL && gc->prpl != NULL) |
2069 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
2070 | |
2071 if (prpl_info && g_list_find(gaim_connections_get_all(), gc) && prpl_info->change_passwd) | |
2072 prpl_info->change_passwd(gc, orig_pw, new_pw); | |
11985 | 2073 } |
11643 | 2074 |
12645
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2075 gboolean gaim_account_supports_offline_message(GaimAccount *account, GaimBuddy *buddy) |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2076 { |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2077 GaimConnection *gc; |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2078 GaimPluginProtocolInfo *prpl_info; |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2079 |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2080 g_return_val_if_fail(account, FALSE); |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2081 g_return_val_if_fail(buddy, FALSE); |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2082 |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2083 gc = gaim_account_get_connection(account); |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2084 if (gc == NULL) |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2085 return FALSE; |
12975 | 2086 |
12645
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2087 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2088 |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2089 if (!prpl_info || !prpl_info->offline_message) |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2090 return FALSE; |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2091 return prpl_info->offline_message(buddy); |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2092 } |
fc28451f5d96
[gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents:
12420
diff
changeset
|
2093 |
11643 | 2094 void |
5710
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2095 gaim_accounts_add(GaimAccount *account) |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2096 { |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2097 g_return_if_fail(account != NULL); |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2098 |
5867
db4df0be06fd
[gaim-migrate @ 6298]
Christian Hammond <chipx86@chipx86.com>
parents:
5865
diff
changeset
|
2099 if (g_list_find(accounts, account) != NULL) |
db4df0be06fd
[gaim-migrate @ 6298]
Christian Hammond <chipx86@chipx86.com>
parents:
5865
diff
changeset
|
2100 return; |
db4df0be06fd
[gaim-migrate @ 6298]
Christian Hammond <chipx86@chipx86.com>
parents:
5865
diff
changeset
|
2101 |
5710
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2102 accounts = g_list_append(accounts, account); |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2103 |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2104 schedule_accounts_save(); |
8134 | 2105 |
2106 gaim_signal_emit(gaim_accounts_get_handle(), "account-added", account); | |
5710
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2107 } |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2108 |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2109 void |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2110 gaim_accounts_remove(GaimAccount *account) |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2111 { |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2112 g_return_if_fail(account != NULL); |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2113 |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2114 accounts = g_list_remove(accounts, account); |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2115 |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2116 schedule_accounts_save(); |
8134 | 2117 |
2118 gaim_signal_emit(gaim_accounts_get_handle(), "account-removed", account); | |
6368
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
2119 } |
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
2120 |
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
2121 void |
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
2122 gaim_accounts_delete(GaimAccount *account) |
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
2123 { |
6695 | 2124 GaimBlistNode *gnode, *cnode, *bnode; |
6368
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
2125 |
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
2126 g_return_if_fail(account != NULL); |
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
2127 |
10758 | 2128 gaim_notify_close_with_handle(account); |
2129 gaim_request_close_with_handle(account); | |
2130 | |
6368
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
2131 gaim_accounts_remove(account); |
6367
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
2132 |
8235 | 2133 /* Remove this account's buddies */ |
6367
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
2134 for (gnode = gaim_get_blist()->root; gnode != NULL; gnode = gnode->next) { |
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
2135 if (!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
2136 continue; |
10106
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
2137 |
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
2138 cnode = gnode->child; |
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
2139 while (cnode) { |
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
2140 GaimBlistNode *cnode_next = cnode->next; |
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
2141 |
6695 | 2142 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) { |
10106
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
2143 bnode = cnode->child; |
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
2144 while (bnode) { |
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
2145 GaimBlistNode *bnode_next = bnode->next; |
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
2146 |
6695 | 2147 if (GAIM_BLIST_NODE_IS_BUDDY(bnode)) { |
2148 GaimBuddy *b = (GaimBuddy *)bnode; | |
6367
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
2149 |
6695 | 2150 if (b->account == account) |
2151 gaim_blist_remove_buddy(b); | |
2152 } | |
10106
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
2153 bnode = bnode_next; |
6695 | 2154 } |
2155 } else if (GAIM_BLIST_NODE_IS_CHAT(cnode)) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
2156 GaimChat *c = (GaimChat *)cnode; |
6367
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
2157 |
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
2158 if (c->account == account) |
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
2159 gaim_blist_remove_chat(c); |
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
2160 } |
10106
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
2161 cnode = cnode_next; |
6367
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
2162 } |
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
2163 } |
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
2164 |
8235 | 2165 /* Remove this account's pounces */ |
2166 gaim_pounce_destroy_all_by_account(account); | |
6368
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
2167 |
11303
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
2168 /* This will cause the deletion of an old buddy icon. */ |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
2169 gaim_account_set_buddy_icon(account, NULL); |
10066662176a
[gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents:
11298
diff
changeset
|
2170 |
6368
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
2171 gaim_account_destroy(account); |
5710
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2172 } |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2173 |
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
2174 void |
12420
b7d77321b685
[gaim-migrate @ 14727]
Richard Laager <rlaager@wiktel.com>
parents:
12287
diff
changeset
|
2175 gaim_accounts_reorder(GaimAccount *account, gint new_index) |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2176 { |
12420
b7d77321b685
[gaim-migrate @ 14727]
Richard Laager <rlaager@wiktel.com>
parents:
12287
diff
changeset
|
2177 gint index; |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2178 GList *l; |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2179 |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2180 g_return_if_fail(account != NULL); |
12420
b7d77321b685
[gaim-migrate @ 14727]
Richard Laager <rlaager@wiktel.com>
parents:
12287
diff
changeset
|
2181 g_return_if_fail(new_index <= g_list_length(accounts)); |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2182 |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2183 index = g_list_index(accounts, account); |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2184 |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2185 if (index == -1) { |
10760 | 2186 gaim_debug_error("account", |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2187 "Unregistered account (%s) discovered during reorder!\n", |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2188 gaim_account_get_username(account)); |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2189 return; |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2190 } |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2191 |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2192 l = g_list_nth(accounts, index); |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2193 |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2194 if (new_index > index) |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2195 new_index--; |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2196 |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2197 /* Remove the old one. */ |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2198 accounts = g_list_delete_link(accounts, l); |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2199 |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2200 /* Insert it where it should go. */ |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2201 accounts = g_list_insert(accounts, account, new_index); |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2202 |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2203 schedule_accounts_save(); |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
2204 } |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
2205 |
5563 | 2206 GList * |
2207 gaim_accounts_get_all(void) | |
2208 { | |
2209 return accounts; | |
2210 } | |
5874
964e4f94fc56
[gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2211 |
11053
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2212 GList * |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2213 gaim_accounts_get_all_active(void) |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2214 { |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2215 GList *list = NULL; |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2216 GList *all = gaim_accounts_get_all(); |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2217 |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2218 while (all != NULL) { |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2219 GaimAccount *account = all->data; |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2220 |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2221 if (gaim_account_get_enabled(account, gaim_core_get_ui())) |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2222 list = g_list_append(list, account); |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2223 |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2224 all = all->next; |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2225 } |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2226 |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2227 return list; |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2228 } |
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
2229 |
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2230 GaimAccount * |
7132 | 2231 gaim_accounts_find(const char *name, const char *protocol_id) |
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2232 { |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2233 GaimAccount *account = NULL; |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2234 GList *l; |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2235 char *who; |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2236 |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2237 g_return_val_if_fail(name != NULL, NULL); |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2238 |
7261 | 2239 who = g_strdup(gaim_normalize(NULL, name)); |
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2240 |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2241 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2242 account = (GaimAccount *)l->data; |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2243 |
7261 | 2244 if (!strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who) && |
7132 | 2245 (!protocol_id || !strcmp(account->protocol_id, protocol_id))) { |
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2246 |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2247 break; |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2248 } |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2249 |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2250 account = NULL; |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2251 } |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2252 |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2253 g_free(who); |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2254 |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2255 return account; |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
2256 } |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2257 |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2258 void |
12857
e5f780a6137b
[gaim-migrate @ 15208]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12645
diff
changeset
|
2259 gaim_accounts_restore_current_statuses() |
11348 | 2260 { |
2261 GList *l; | |
2262 GaimAccount *account; | |
2263 | |
2264 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) | |
2265 { | |
2266 account = (GaimAccount *)l->data; | |
2267 if (gaim_account_get_enabled(account, gaim_core_get_ui()) && | |
2268 (gaim_presence_is_online(account->presence))) | |
2269 { | |
2270 gaim_account_connect(account); | |
2271 } | |
2272 } | |
2273 } | |
2274 | |
2275 void | |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2276 gaim_accounts_set_ui_ops(GaimAccountUiOps *ops) |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2277 { |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2278 account_ui_ops = ops; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2279 } |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2280 |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2281 GaimAccountUiOps * |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2282 gaim_accounts_get_ui_ops(void) |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2283 { |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2284 return account_ui_ops; |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2285 } |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2286 |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2287 void * |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2288 gaim_accounts_get_handle(void) |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2289 { |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2290 static int handle; |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2291 |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2292 return &handle; |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2293 } |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2294 |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2295 void |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2296 gaim_accounts_init(void) |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2297 { |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2298 void *handle = gaim_accounts_get_handle(); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2299 |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2300 gaim_signal_register(handle, "account-connecting", |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2301 gaim_marshal_VOID__POINTER, NULL, 1, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2302 gaim_value_new(GAIM_TYPE_SUBTYPE, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2303 GAIM_SUBTYPE_ACCOUNT)); |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2304 |
12070 | 2305 gaim_signal_register(handle, "account-disabled", |
2306 gaim_marshal_VOID__POINTER, NULL, 1, | |
2307 gaim_value_new(GAIM_TYPE_SUBTYPE, | |
2308 GAIM_SUBTYPE_ACCOUNT)); | |
2309 | |
2310 gaim_signal_register(handle, "account-enabled", | |
2311 gaim_marshal_VOID__POINTER, NULL, 1, | |
2312 gaim_value_new(GAIM_TYPE_SUBTYPE, | |
2313 GAIM_SUBTYPE_ACCOUNT)); | |
2314 | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2315 gaim_signal_register(handle, "account-setting-info", |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2316 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2317 gaim_value_new(GAIM_TYPE_SUBTYPE, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2318 GAIM_SUBTYPE_ACCOUNT), |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2319 gaim_value_new(GAIM_TYPE_STRING)); |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2320 |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2321 gaim_signal_register(handle, "account-set-info", |
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2322 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2323 gaim_value_new(GAIM_TYPE_SUBTYPE, |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2324 GAIM_SUBTYPE_ACCOUNT), |
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2325 gaim_value_new(GAIM_TYPE_STRING)); |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2326 |
8134 | 2327 gaim_signal_register(handle, "account-added", |
10447 | 2328 gaim_marshal_VOID__POINTER, NULL, 1, |
2329 gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_ACCOUNT)); | |
8134 | 2330 |
2331 gaim_signal_register(handle, "account-removed", | |
10447 | 2332 gaim_marshal_VOID__POINTER, NULL, 1, |
2333 gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_ACCOUNT)); | |
10490 | 2334 |
11628 | 2335 gaim_signal_register(handle, "account-status-changed", |
2336 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, | |
2337 gaim_value_new(GAIM_TYPE_SUBTYPE, | |
2338 GAIM_SUBTYPE_ACCOUNT), | |
11979
717cbb3115bc
[gaim-migrate @ 14272]
Gary Kramlich <grim@reaperworld.com>
parents:
11976
diff
changeset
|
2339 gaim_value_new(GAIM_TYPE_SUBTYPE, |
717cbb3115bc
[gaim-migrate @ 14272]
Gary Kramlich <grim@reaperworld.com>
parents:
11976
diff
changeset
|
2340 GAIM_SUBTYPE_STATUS), |
717cbb3115bc
[gaim-migrate @ 14272]
Gary Kramlich <grim@reaperworld.com>
parents:
11976
diff
changeset
|
2341 gaim_value_new(GAIM_TYPE_SUBTYPE, |
717cbb3115bc
[gaim-migrate @ 14272]
Gary Kramlich <grim@reaperworld.com>
parents:
11976
diff
changeset
|
2342 GAIM_SUBTYPE_STATUS)); |
13281
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
2343 |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
2344 gaim_signal_register(handle, "account-alias-changed", |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
2345 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
2346 gaim_value_new(GAIM_TYPE_SUBTYPE, |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
2347 GAIM_SUBTYPE_ACCOUNT), |
e629076386f1
[gaim-migrate @ 15647]
Richard Laager <rlaager@wiktel.com>
parents:
13119
diff
changeset
|
2348 gaim_value_new(GAIM_TYPE_STRING)); |
11628 | 2349 |
10490 | 2350 load_accounts(); |
2351 | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2352 } |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2353 |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2354 void |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2355 gaim_accounts_uninit(void) |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2356 { |
10428 | 2357 if (save_timer != 0) |
10427 | 2358 { |
10428 | 2359 gaim_timeout_remove(save_timer); |
2360 save_timer = 0; | |
10427 | 2361 sync_accounts(); |
8235 | 2362 } |
2363 | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2364 gaim_signals_unregister_by_instance(gaim_accounts_get_handle()); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
2365 } |