Mercurial > pidgin
annotate src/account.c @ 11124:00a2a480fc0c
[gaim-migrate @ 13180]
Oopps...should build now.
committer: Tailor Script <tailor@pidgin.im>
| author | John H. Kelm <johnkelm@gmail.com> |
|---|---|
| date | Tue, 19 Jul 2005 00:04:44 +0000 |
| parents | 75be3005640e |
| children | 1c5398ccbeb0 |
| 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 * | |
| 10738 | 122 status_to_xmlnode(const GaimStatus *status) |
| 123 { | |
| 124 xmlnode *node; | |
| 125 | |
| 126 node = xmlnode_new("status"); | |
| 127 xmlnode_set_attrib(node, "type", gaim_status_get_id(status)); | |
| 128 if (gaim_status_get_name(status) != NULL) | |
| 129 xmlnode_set_attrib(node, "name", gaim_status_get_name(status)); | |
| 130 xmlnode_set_attrib(node, "active", gaim_status_is_active(status) ? "true" : "false"); | |
| 131 | |
| 132 /* QQQ: Need to save status->attr_values */ | |
| 133 | |
| 134 return node; | |
| 135 } | |
| 136 | |
| 137 static xmlnode * | |
| 138 statuses_to_xmlnode(const GaimPresence *presence) | |
| 139 { | |
| 140 xmlnode *node, *child; | |
| 141 const GList *statuses, *status; | |
| 142 | |
| 143 node = xmlnode_new("statuses"); | |
| 144 | |
| 145 statuses = gaim_presence_get_statuses(presence); | |
| 146 for (status = statuses; status != NULL; status = status->next) | |
| 147 { | |
| 148 child = status_to_xmlnode((GaimStatus *)status->data); | |
| 149 xmlnode_insert_child(node, child); | |
| 150 } | |
| 151 | |
| 152 return node; | |
| 153 } | |
| 154 | |
| 155 static xmlnode * | |
| 10427 | 156 proxy_settings_to_xmlnode(GaimProxyInfo *proxy_info) |
| 157 { | |
| 158 xmlnode *node, *child; | |
| 159 GaimProxyType proxy_type; | |
| 160 const char *value; | |
| 161 int int_value; | |
| 162 char buf[20]; | |
| 163 | |
| 164 proxy_type = gaim_proxy_info_get_type(proxy_info); | |
| 165 | |
| 166 node = xmlnode_new("proxy"); | |
| 167 | |
| 168 child = xmlnode_new_child(node, "type"); | |
| 169 xmlnode_insert_data(child, | |
| 170 (proxy_type == GAIM_PROXY_USE_GLOBAL ? "global" : | |
| 171 proxy_type == GAIM_PROXY_NONE ? "none" : | |
| 172 proxy_type == GAIM_PROXY_HTTP ? "http" : | |
| 173 proxy_type == GAIM_PROXY_SOCKS4 ? "socks4" : | |
| 174 proxy_type == GAIM_PROXY_SOCKS5 ? "socks5" : | |
| 175 proxy_type == GAIM_PROXY_USE_ENVVAR ? "envvar" : "unknown"), -1); | |
| 176 | |
| 177 if (proxy_type != GAIM_PROXY_USE_GLOBAL && | |
| 178 proxy_type != GAIM_PROXY_NONE && | |
| 179 proxy_type != GAIM_PROXY_USE_ENVVAR) | |
| 180 { | |
| 181 if ((value = gaim_proxy_info_get_host(proxy_info)) != NULL) | |
| 182 { | |
| 183 child = xmlnode_new_child(node, "host"); | |
| 184 xmlnode_insert_data(child, value, -1); | |
| 185 } | |
| 186 | |
| 187 if ((int_value = gaim_proxy_info_get_port(proxy_info)) != 0) | |
| 188 { | |
| 189 snprintf(buf, sizeof(buf), "%d", int_value); | |
| 190 child = xmlnode_new_child(node, "port"); | |
| 191 xmlnode_insert_data(child, buf, -1); | |
| 192 } | |
| 193 | |
| 194 if ((value = gaim_proxy_info_get_username(proxy_info)) != NULL) | |
| 195 { | |
| 196 child = xmlnode_new_child(node, "username"); | |
| 197 xmlnode_insert_data(child, value, -1); | |
| 198 } | |
| 199 | |
| 200 if ((value = gaim_proxy_info_get_password(proxy_info)) != NULL) | |
| 201 { | |
| 202 child = xmlnode_new_child(node, "password"); | |
| 203 xmlnode_insert_data(child, value, -1); | |
| 204 } | |
| 205 } | |
| 206 | |
| 207 return node; | |
| 208 } | |
| 209 | |
| 210 static xmlnode * | |
| 211 account_to_xmlnode(GaimAccount *account) | |
| 212 { | |
| 213 xmlnode *node, *child; | |
| 214 const char *tmp; | |
| 10738 | 215 GaimPresence *presence; |
| 10427 | 216 GaimProxyInfo *proxy_info; |
| 217 | |
| 218 node = xmlnode_new("account"); | |
| 219 | |
| 220 child = xmlnode_new_child(node, "protocol"); | |
| 221 xmlnode_insert_data(child, gaim_account_get_protocol_id(account), -1); | |
| 222 | |
| 223 child = xmlnode_new_child(node, "name"); | |
| 224 xmlnode_insert_data(child, gaim_account_get_username(account), -1); | |
| 225 | |
| 226 if (gaim_account_get_remember_password(account) && | |
| 227 ((tmp = gaim_account_get_password(account)) != NULL)) | |
| 228 { | |
| 229 child = xmlnode_new_child(node, "password"); | |
| 230 xmlnode_insert_data(child, tmp, -1); | |
| 231 } | |
| 232 | |
| 233 if ((tmp = gaim_account_get_alias(account)) != NULL) | |
| 234 { | |
| 235 child = xmlnode_new_child(node, "alias"); | |
| 236 xmlnode_insert_data(child, tmp, -1); | |
| 237 } | |
| 238 | |
| 10738 | 239 if ((presence = gaim_account_get_presence(account)) != NULL) |
| 240 { | |
| 241 child = statuses_to_xmlnode(presence); | |
| 242 xmlnode_insert_child(node, child); | |
| 243 } | |
| 244 | |
| 10427 | 245 if ((tmp = gaim_account_get_user_info(account)) != NULL) |
| 246 { | |
| 247 /* TODO: Do we need to call gaim_str_strip_cr(tmp) here? */ | |
| 248 child = xmlnode_new_child(node, "userinfo"); | |
| 249 xmlnode_insert_data(child, tmp, -1); | |
| 250 } | |
| 251 | |
| 252 if ((tmp = gaim_account_get_buddy_icon(account)) != NULL) | |
| 253 { | |
| 254 child = xmlnode_new_child(node, "buddyicon"); | |
| 255 xmlnode_insert_data(child, tmp, -1); | |
| 256 } | |
| 257 | |
| 258 if (g_hash_table_size(account->settings) > 0) | |
| 259 { | |
| 260 child = xmlnode_new_child(node, "settings"); | |
| 261 g_hash_table_foreach(account->settings, setting_to_xmlnode, child); | |
| 262 } | |
| 263 | |
| 264 if (g_hash_table_size(account->ui_settings) > 0) | |
| 265 { | |
| 266 g_hash_table_foreach(account->ui_settings, ui_setting_to_xmlnode, node); | |
| 267 } | |
| 268 | |
| 269 if ((proxy_info = gaim_account_get_proxy_info(account)) != NULL) | |
| 270 { | |
| 271 child = proxy_settings_to_xmlnode(proxy_info); | |
| 272 xmlnode_insert_child(node, child); | |
| 273 } | |
| 274 | |
| 275 return node; | |
| 276 } | |
| 277 | |
| 278 static xmlnode * | |
| 279 accounts_to_xmlnode(void) | |
| 280 { | |
| 281 xmlnode *node, *child; | |
| 282 GList *cur; | |
| 283 | |
| 10760 | 284 node = xmlnode_new("account"); |
| 10427 | 285 xmlnode_set_attrib(node, "version", "1.0"); |
| 286 | |
| 287 for (cur = gaim_accounts_get_all(); cur != NULL; cur = cur->next) | |
| 288 { | |
| 289 child = account_to_xmlnode(cur->data); | |
| 290 xmlnode_insert_child(node, child); | |
| 291 } | |
| 292 | |
| 293 return node; | |
| 294 } | |
| 295 | |
| 296 static void | |
| 297 sync_accounts(void) | |
| 298 { | |
| 299 xmlnode *node; | |
| 300 char *data; | |
| 301 | |
| 10428 | 302 if (!accounts_loaded) |
| 303 { | |
| 10760 | 304 gaim_debug_error("account", "Attempted to save accounts before " |
| 10443 | 305 "they were read!\n"); |
| 306 return; | |
| 10427 | 307 } |
| 308 | |
| 309 node = accounts_to_xmlnode(); | |
| 310 data = xmlnode_to_formatted_str(node, NULL); | |
| 311 gaim_util_write_data_to_file("accounts.xml", data, -1); | |
| 312 g_free(data); | |
| 313 xmlnode_free(node); | |
| 314 } | |
| 315 | |
| 316 static gboolean | |
| 317 save_cb(gpointer data) | |
| 318 { | |
| 319 sync_accounts(); | |
| 10428 | 320 save_timer = 0; |
| 10427 | 321 return FALSE; |
| 322 } | |
| 323 | |
| 324 static void | |
| 325 schedule_accounts_save() | |
| 326 { | |
| 10428 | 327 if (save_timer == 0) |
| 328 save_timer = gaim_timeout_add(5000, save_cb, NULL); | |
| 10427 | 329 } |
| 330 | |
| 331 | |
| 10428 | 332 /********************************************************************* |
| 333 * Reading from disk * | |
| 334 *********************************************************************/ | |
| 10427 | 335 |
| 336 static void | |
| 337 parse_settings(xmlnode *node, GaimAccount *account) | |
| 338 { | |
| 339 const char *ui; | |
| 340 xmlnode *child; | |
| 341 | |
| 342 /* Get the UI string, if these are UI settings */ | |
| 343 ui = xmlnode_get_attrib(node, "ui"); | |
| 344 | |
| 345 /* Read settings, one by one */ | |
| 346 for (child = xmlnode_get_child(node, "setting"); child != NULL; | |
| 347 child = xmlnode_get_next_twin(child)) | |
| 348 { | |
| 349 const char *name, *str_type; | |
| 350 GaimPrefType type; | |
| 351 char *data; | |
| 352 | |
| 353 name = xmlnode_get_attrib(child, "name"); | |
| 354 if (name == NULL) | |
| 355 /* Ignore this setting */ | |
| 356 continue; | |
| 357 | |
| 358 str_type = xmlnode_get_attrib(child, "type"); | |
| 10448 | 359 if (str_type == NULL) |
| 360 /* Ignore this setting */ | |
| 361 continue; | |
| 362 | |
| 10427 | 363 if (!strcmp(str_type, "string")) |
| 364 type = GAIM_PREF_STRING; | |
| 365 else if (!strcmp(str_type, "int")) | |
| 366 type = GAIM_PREF_INT; | |
| 367 else if (!strcmp(str_type, "bool")) | |
| 368 type = GAIM_PREF_BOOLEAN; | |
| 369 else | |
| 370 /* Ignore this setting */ | |
| 371 continue; | |
| 372 | |
| 373 data = xmlnode_get_data(child); | |
| 374 if (data == NULL) | |
| 375 /* Ignore this setting */ | |
| 376 continue; | |
| 377 | |
| 378 if (ui == NULL) | |
| 379 { | |
| 380 if (type == GAIM_PREF_STRING) | |
| 381 gaim_account_set_string(account, name, data); | |
| 382 else if (type == GAIM_PREF_INT) | |
| 383 gaim_account_set_int(account, name, atoi(data)); | |
| 384 else if (type == GAIM_PREF_BOOLEAN) | |
| 385 gaim_account_set_bool(account, name, | |
| 386 (*data == '0' ? FALSE : TRUE)); | |
| 387 } else { | |
| 388 if (type == GAIM_PREF_STRING) | |
| 389 gaim_account_set_ui_string(account, ui, name, data); | |
| 390 else if (type == GAIM_PREF_INT) | |
| 391 gaim_account_set_ui_int(account, ui, name, atoi(data)); | |
| 392 else if (type == GAIM_PREF_BOOLEAN) | |
| 393 gaim_account_set_ui_bool(account, ui, name, | |
| 394 (*data == '0' ? FALSE : TRUE)); | |
| 395 } | |
| 396 | |
| 397 g_free(data); | |
| 398 } | |
| 399 } | |
| 400 | |
| 401 static void | |
| 10738 | 402 parse_status(xmlnode *node, GaimAccount *account) |
| 403 { | |
| 404 gboolean active = FALSE; | |
| 405 const char *data; | |
| 406 const char *type; | |
| 407 | |
| 408 /* Get the active/inactive state */ | |
| 11075 | 409 data = xmlnode_get_attrib(node, "active"); |
| 11076 | 410 if (data == NULL) |
| 411 return; | |
| 412 if (strcasecmp(data, "true") == 0) | |
| 413 active = TRUE; | |
| 414 else if (strcasecmp(data, "false") == 0) | |
| 415 active = FALSE; | |
| 10738 | 416 else |
| 417 return; | |
| 418 | |
| 419 /* Get the type of the status */ | |
| 11075 | 420 type = xmlnode_get_attrib(node, "type"); |
| 421 if (type == NULL) | |
| 10738 | 422 return; |
| 423 | |
| 424 /* QQQ: Need to read attributes into a vargs */ | |
| 425 | |
| 426 /* QQQ: This needs to do a better job of adding attributes and stuff */ | |
| 11076 | 427 gaim_account_set_status_vargs(account, type, active, NULL); |
| 10738 | 428 } |
| 429 | |
| 430 static void | |
| 431 parse_statuses(xmlnode *node, GaimAccount *account) | |
| 432 { | |
| 433 xmlnode *child; | |
| 434 | |
| 435 for (child = xmlnode_get_child(node, "status"); child != NULL; | |
| 436 child = xmlnode_get_next_twin(child)) | |
| 437 { | |
| 438 parse_status(child, account); | |
| 439 } | |
| 440 } | |
| 441 | |
| 442 static void | |
| 10427 | 443 parse_proxy_info(xmlnode *node, GaimAccount *account) |
| 444 { | |
| 445 GaimProxyInfo *proxy_info; | |
| 446 xmlnode *child; | |
| 447 char *data; | |
| 448 | |
| 449 proxy_info = gaim_proxy_info_new(); | |
| 450 | |
| 451 /* Use the global proxy settings, by default */ | |
| 452 gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_USE_GLOBAL); | |
| 453 | |
| 454 /* Read proxy type */ | |
| 455 child = xmlnode_get_child(node, "type"); | |
| 456 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
| 457 { | |
| 458 if (!strcmp(data, "global")) | |
| 459 gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_USE_GLOBAL); | |
| 460 else if (!strcmp(data, "none")) | |
| 461 gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_NONE); | |
| 462 else if (!strcmp(data, "http")) | |
| 463 gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_HTTP); | |
| 464 else if (!strcmp(data, "socks4")) | |
| 465 gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_SOCKS4); | |
| 466 else if (!strcmp(data, "socks5")) | |
| 467 gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_SOCKS5); | |
| 468 else if (!strcmp(data, "envvar")) | |
| 469 gaim_proxy_info_set_type(proxy_info, GAIM_PROXY_USE_ENVVAR); | |
| 470 else | |
| 471 { | |
| 472 gaim_debug_error("account", "Invalid proxy type found when " | |
| 473 "loading account information for %s\n", | |
| 474 gaim_account_get_username(account)); | |
| 475 } | |
| 476 g_free(data); | |
| 477 } | |
| 478 | |
| 479 /* Read proxy host */ | |
| 480 child = xmlnode_get_child(node, "host"); | |
| 481 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
| 482 { | |
| 483 gaim_proxy_info_set_host(proxy_info, data); | |
| 484 g_free(data); | |
| 485 } | |
| 486 | |
| 487 /* Read proxy port */ | |
| 488 child = xmlnode_get_child(node, "port"); | |
| 489 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
| 490 { | |
| 491 gaim_proxy_info_set_port(proxy_info, atoi(data)); | |
| 492 g_free(data); | |
| 493 } | |
| 494 | |
| 495 /* Read proxy username */ | |
| 496 child = xmlnode_get_child(node, "username"); | |
| 497 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
| 498 { | |
| 499 gaim_proxy_info_set_username(proxy_info, data); | |
| 500 g_free(data); | |
| 501 } | |
| 502 | |
| 503 /* Read proxy password */ | |
| 504 child = xmlnode_get_child(node, "password"); | |
| 505 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
| 506 { | |
| 507 gaim_proxy_info_set_password(proxy_info, data); | |
| 508 g_free(data); | |
| 509 } | |
| 510 | |
| 511 /* If there are no values set then proxy_infourn NULL */ | |
| 512 if ((gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_USE_GLOBAL) && | |
| 513 (gaim_proxy_info_get_host(proxy_info) == NULL) && | |
| 514 (gaim_proxy_info_get_port(proxy_info) == 0) && | |
| 515 (gaim_proxy_info_get_username(proxy_info) == NULL) && | |
| 516 (gaim_proxy_info_get_password(proxy_info) == NULL)) | |
| 517 { | |
| 518 gaim_proxy_info_destroy(proxy_info); | |
| 519 return; | |
| 520 } | |
| 521 | |
| 522 gaim_account_set_proxy_info(account, proxy_info); | |
| 523 } | |
| 524 | |
| 525 static GaimAccount * | |
| 526 parse_account(xmlnode *node) | |
| 527 { | |
| 528 GaimAccount *ret; | |
| 529 xmlnode *child; | |
| 530 char *protocol_id = NULL; | |
| 531 char *name = NULL; | |
| 532 char *data; | |
| 533 | |
| 534 child = xmlnode_get_child(node, "protocol"); | |
| 535 if (child != NULL) | |
| 536 protocol_id = xmlnode_get_data(child); | |
| 537 | |
| 538 child = xmlnode_get_child(node, "name"); | |
| 539 if (child != NULL) | |
| 540 name = xmlnode_get_data(child); | |
| 541 if (name == NULL) | |
| 542 { | |
| 543 /* Do we really need to do this? */ | |
| 544 child = xmlnode_get_child(node, "username"); | |
| 545 if (child != NULL) | |
| 546 name = xmlnode_get_data(child); | |
| 547 } | |
| 548 | |
| 549 if ((protocol_id == NULL) || (name == NULL)) | |
| 550 { | |
| 551 free(protocol_id); | |
| 552 free(name); | |
| 553 return NULL; | |
| 554 } | |
| 555 | |
| 556 ret = gaim_account_new(name, protocol_id); | |
| 557 free(name); | |
| 558 free(protocol_id); | |
| 559 | |
| 560 /* Read the password */ | |
| 561 child = xmlnode_get_child(node, "password"); | |
| 562 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
| 563 { | |
| 10743 | 564 gaim_account_set_remember_password(ret, TRUE); |
| 10427 | 565 gaim_account_set_password(ret, data); |
| 566 g_free(data); | |
| 567 } | |
| 568 | |
| 569 /* Read the alias */ | |
| 570 child = xmlnode_get_child(node, "alias"); | |
| 571 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
| 572 { | |
| 573 gaim_account_set_alias(ret, data); | |
| 574 g_free(data); | |
| 575 } | |
| 576 | |
| 10738 | 577 /* Read the statuses */ |
| 578 child = xmlnode_get_child(node, "statuses"); | |
| 579 if (child != NULL) | |
| 580 { | |
| 581 parse_statuses(child, ret); | |
| 582 } | |
| 583 | |
| 10427 | 584 /* Read the userinfo */ |
| 585 child = xmlnode_get_child(node, "userinfo"); | |
| 586 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
| 587 { | |
| 588 gaim_account_set_user_info(ret, data); | |
| 589 g_free(data); | |
| 590 } | |
| 591 | |
| 592 /* Read the buddyicon */ | |
| 593 child = xmlnode_get_child(node, "buddyicon"); | |
| 594 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) | |
| 595 { | |
| 596 gaim_account_set_buddy_icon(ret, data); | |
| 597 g_free(data); | |
| 598 } | |
| 599 | |
| 600 /* Read settings (both core and UI) */ | |
| 601 for (child = xmlnode_get_child(node, "settings"); child != NULL; | |
| 602 child = xmlnode_get_next_twin(child)) | |
| 603 { | |
| 604 parse_settings(child, ret); | |
| 605 } | |
| 606 | |
| 607 /* Read proxy */ | |
| 608 child = xmlnode_get_child(node, "proxy"); | |
| 609 if (child != NULL) | |
| 610 { | |
| 611 parse_proxy_info(child, ret); | |
| 612 } | |
| 613 | |
| 614 return ret; | |
| 615 } | |
| 616 | |
| 617 static void | |
| 618 load_accounts(void) | |
| 619 { | |
| 620 xmlnode *node, *child; | |
| 621 | |
| 622 accounts_loaded = TRUE; | |
| 623 | |
| 624 node = gaim_util_read_xml_from_file("accounts.xml", _("accounts")); | |
| 625 | |
| 626 if (node == NULL) | |
| 627 return; | |
| 628 | |
| 629 for (child = xmlnode_get_child(node, "account"); child != NULL; | |
| 630 child = xmlnode_get_next_twin(child)) | |
| 631 { | |
| 10490 | 632 GaimAccount *new_acct; |
| 633 new_acct = parse_account(child); | |
| 634 gaim_accounts_add(new_acct); | |
| 10427 | 635 } |
| 636 } | |
| 637 | |
| 638 | |
| 5563 | 639 static void |
|
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5792
diff
changeset
|
640 delete_setting(void *data) |
| 5563 | 641 { |
| 642 GaimAccountSetting *setting = (GaimAccountSetting *)data; | |
| 643 | |
|
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
644 if (setting->ui != NULL) |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
645 g_free(setting->ui); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
646 |
| 5563 | 647 if (setting->type == GAIM_PREF_STRING) |
| 648 g_free(setting->value.string); | |
| 649 | |
| 650 g_free(setting); | |
| 651 } | |
| 652 | |
| 653 GaimAccount * | |
|
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
654 gaim_account_new(const char *username, const char *protocol_id) |
| 5563 | 655 { |
| 6067 | 656 GaimAccount *account = NULL; |
| 10012 | 657 GaimPlugin *prpl = NULL; |
| 658 GaimPluginProtocolInfo *prpl_info = NULL; | |
| 5563 | 659 |
| 9944 | 660 g_return_val_if_fail(username != NULL, NULL); |
| 9971 | 661 g_return_val_if_fail(protocol_id != NULL, NULL); |
| 5563 | 662 |
| 9971 | 663 account = gaim_accounts_find(username, protocol_id); |
|
5867
db4df0be06fd
[gaim-migrate @ 6298]
Christian Hammond <chipx86@chipx86.com>
parents:
5865
diff
changeset
|
664 |
|
5874
964e4f94fc56
[gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
665 if (account != NULL) |
|
964e4f94fc56
[gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
666 return account; |
|
5867
db4df0be06fd
[gaim-migrate @ 6298]
Christian Hammond <chipx86@chipx86.com>
parents:
5865
diff
changeset
|
667 |
| 5563 | 668 account = g_new0(GaimAccount, 1); |
| 669 | |
| 6067 | 670 gaim_account_set_username(account, username); |
| 671 | |
| 9971 | 672 gaim_account_set_protocol_id(account, protocol_id); |
| 5563 | 673 |
| 674 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
|
675 g_free, delete_setting); |
|
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
676 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
|
677 g_free, (GDestroyNotify)g_hash_table_destroy); |
| 8573 | 678 account->system_log = NULL; |
| 10944 | 679 /* 0 is not a valid privacy setting */ |
| 10945 | 680 account->perm_deny = GAIM_PRIVACY_ALLOW_ALL; |
| 10720 | 681 |
| 9944 | 682 account->presence = gaim_presence_new_for_account(account); |
| 683 | |
| 10447 | 684 prpl = gaim_find_prpl(protocol_id); |
| 10052 | 685 |
| 10012 | 686 if (prpl == NULL) |
| 687 return account; | |
| 10052 | 688 |
| 10738 | 689 /* TODO: Should maybe use gaim_prpl_get_statuses()? */ |
| 10012 | 690 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); |
| 10738 | 691 if (prpl_info != NULL && prpl_info->status_types != NULL) |
| 10012 | 692 gaim_account_set_status_types(account, prpl_info->status_types(account)); |
| 693 | |
| 10052 | 694 gaim_presence_set_status_active(account->presence, "offline", TRUE); |
| 695 | |
| 11067 | 696 GAIM_DBUS_REGISTER_POINTER(account, DBUS_POINTER_ACCOUNT); |
| 5563 | 697 return account; |
| 698 } | |
| 699 | |
| 700 void | |
| 701 gaim_account_destroy(GaimAccount *account) | |
| 702 { | |
|
7324
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
703 GList *l; |
|
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
704 |
| 5563 | 705 g_return_if_fail(account != NULL); |
| 706 | |
| 9944 | 707 gaim_debug_info("account", "Destroying account %p\n", account); |
|
5930
03f1d6cd784c
[gaim-migrate @ 6370]
Christian Hammond <chipx86@chipx86.com>
parents:
5926
diff
changeset
|
708 |
| 10742 | 709 if (gaim_account_is_connected(account)) |
| 710 gaim_account_disconnect(account); | |
| 5563 | 711 |
| 9944 | 712 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
|
713 |
|
7324
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
714 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
|
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
715 { |
|
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
716 GaimConversation *conv = (GaimConversation *)l->data; |
|
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
717 |
|
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
718 if (gaim_conversation_get_account(conv) == account) |
|
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
719 gaim_conversation_set_account(conv, NULL); |
|
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
720 } |
|
4963abdebd29
[gaim-migrate @ 7910]
Christian Hammond <chipx86@chipx86.com>
parents:
7263
diff
changeset
|
721 |
|
5643
eb685809108b
[gaim-migrate @ 6057]
Christian Hammond <chipx86@chipx86.com>
parents:
5620
diff
changeset
|
722 if (account->username != NULL) g_free(account->username); |
|
eb685809108b
[gaim-migrate @ 6057]
Christian Hammond <chipx86@chipx86.com>
parents:
5620
diff
changeset
|
723 if (account->alias != NULL) g_free(account->alias); |
|
eb685809108b
[gaim-migrate @ 6057]
Christian Hammond <chipx86@chipx86.com>
parents:
5620
diff
changeset
|
724 if (account->password != NULL) g_free(account->password); |
|
eb685809108b
[gaim-migrate @ 6057]
Christian Hammond <chipx86@chipx86.com>
parents:
5620
diff
changeset
|
725 if (account->user_info != NULL) g_free(account->user_info); |
|
eb685809108b
[gaim-migrate @ 6057]
Christian Hammond <chipx86@chipx86.com>
parents:
5620
diff
changeset
|
726 if (account->protocol_id != NULL) g_free(account->protocol_id); |
| 5563 | 727 |
| 728 g_hash_table_destroy(account->settings); | |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
729 g_hash_table_destroy(account->ui_settings); |
| 5563 | 730 |
| 9944 | 731 gaim_account_set_status_types(account, NULL); |
| 732 | |
| 733 gaim_presence_destroy(account->presence); | |
| 734 | |
| 8573 | 735 if(account->system_log) |
| 736 gaim_log_free(account->system_log); | |
| 737 | |
| 11067 | 738 GAIM_DBUS_UNREGISTER_POINTER(account); |
| 5563 | 739 g_free(account); |
| 740 } | |
| 741 | |
| 10740 | 742 void |
| 6581 | 743 gaim_account_register(GaimAccount *account) |
| 744 { | |
| 10740 | 745 g_return_if_fail(account != NULL); |
| 6581 | 746 |
| 10740 | 747 gaim_debug_info("account", "Registering account %s\n", |
| 748 gaim_account_get_username(account)); | |
| 6581 | 749 |
| 10740 | 750 gaim_connection_new(account, TRUE, NULL); |
| 751 } | |
| 6581 | 752 |
| 10740 | 753 static void |
|
11042
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
754 request_password_ok_cb(GaimAccount *account, GaimRequestFields *fields) |
| 10740 | 755 { |
|
11042
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
756 const char *entry; |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
757 gboolean remember; |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
758 |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
759 entry = gaim_request_fields_get_string(fields, "password"); |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
760 remember = gaim_request_fields_get_bool(fields, "remember"); |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
761 |
| 10740 | 762 if (!entry || !*entry) |
| 763 { | |
| 764 gaim_notify_error(account, NULL, _("Password is required to sign on."), NULL); | |
| 765 return; | |
| 766 } | |
| 6581 | 767 |
|
11042
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
768 if(remember) |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
769 gaim_account_set_remember_password(account, TRUE); |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
770 |
| 10740 | 771 if (gaim_account_get_remember_password(account)) |
| 772 gaim_account_set_password(account, entry); | |
| 6581 | 773 |
| 10740 | 774 gaim_connection_new(account, FALSE, entry); |
| 6581 | 775 } |
| 776 | |
| 10740 | 777 static void |
| 778 request_password(GaimAccount *account) | |
| 779 { | |
| 780 gchar *primary; | |
| 781 const gchar *username; | |
|
11042
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
782 GaimRequestFieldGroup *group; |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
783 GaimRequestField *field; |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
784 GaimRequestFields *fields; |
| 10740 | 785 |
| 10758 | 786 /* Close any previous password request windows */ |
| 787 gaim_request_close_with_handle(account); | |
| 788 | |
| 10740 | 789 username = gaim_account_get_username(account); |
| 10774 | 790 primary = g_strdup_printf(_("Enter password for %s (%s)"), username, |
| 10740 | 791 gaim_account_get_protocol_name(account)); |
|
11042
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
792 |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
793 fields = gaim_request_fields_new(); |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
794 group = gaim_request_field_group_new(NULL); |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
795 gaim_request_fields_add_group(fields, group); |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
796 |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
797 field = gaim_request_field_string_new("password", _("Enter Password"), NULL, FALSE); |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
798 gaim_request_field_string_set_masked(field, TRUE); |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
799 gaim_request_field_set_required(field, TRUE); |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
800 gaim_request_field_group_add_field(group, field); |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
801 |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
802 field = gaim_request_field_bool_new("remember", _("Save password"), FALSE); |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
803 gaim_request_field_group_add_field(group, field); |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
804 |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
805 gaim_request_fields(account, |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
806 NULL, |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
807 primary, |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
808 NULL, |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
809 fields, |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
810 _("OK"), G_CALLBACK(request_password_ok_cb), |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
811 _("Cancel"), NULL, |
|
a5c31b83063f
[gaim-migrate @ 12954]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
812 account); |
| 10740 | 813 g_free(primary); |
| 814 } | |
| 815 | |
| 816 void | |
| 10738 | 817 gaim_account_connect(GaimAccount *account) |
| 5563 | 818 { |
| 10740 | 819 GaimPlugin *prpl; |
| 820 GaimPluginProtocolInfo *prpl_info; | |
| 821 const char *password; | |
| 822 | |
| 823 g_return_if_fail(account != NULL); | |
| 5563 | 824 |
| 10740 | 825 gaim_debug_info("account", "Connecting to account %s\n", |
| 826 gaim_account_get_username(account)); | |
| 5563 | 827 |
| 10740 | 828 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); |
| 829 if (prpl == NULL) | |
| 830 { | |
| 831 gchar *message; | |
| 6036 | 832 |
| 10740 | 833 message = g_strdup_printf(_("Missing protocol plugin for %s"), |
| 834 gaim_account_get_username(account)); | |
| 10758 | 835 gaim_notify_error(account, _("Connection Error"), message, NULL); |
| 10740 | 836 g_free(message); |
| 837 return; | |
| 838 } | |
| 5563 | 839 |
| 10740 | 840 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); |
| 841 password = gaim_account_get_password(account); | |
| 842 if ((password == NULL) && | |
| 843 !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && | |
| 844 !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) | |
| 845 request_password(account); | |
| 846 else | |
| 847 gaim_connection_new(account, FALSE, password); | |
| 5563 | 848 } |
| 849 | |
| 850 void | |
| 851 gaim_account_disconnect(GaimAccount *account) | |
| 852 { | |
|
5926
6c22d37c6a3c
[gaim-migrate @ 6366]
Christian Hammond <chipx86@chipx86.com>
parents:
5879
diff
changeset
|
853 GaimConnection *gc; |
|
6c22d37c6a3c
[gaim-migrate @ 6366]
Christian Hammond <chipx86@chipx86.com>
parents:
5879
diff
changeset
|
854 |
| 5563 | 855 g_return_if_fail(account != NULL); |
| 856 g_return_if_fail(gaim_account_is_connected(account)); | |
| 857 | |
| 9944 | 858 gaim_debug_info("account", "Disconnecting account %p\n", account); |
|
5930
03f1d6cd784c
[gaim-migrate @ 6370]
Christian Hammond <chipx86@chipx86.com>
parents:
5926
diff
changeset
|
859 |
| 10384 | 860 account->disconnecting = TRUE; |
| 5563 | 861 |
| 10742 | 862 gc = gaim_account_get_connection(account); |
| 863 gaim_connection_destroy(gc); | |
| 864 gaim_account_set_connection(account, NULL); | |
| 10384 | 865 |
| 866 account->disconnecting = FALSE; | |
| 5563 | 867 } |
| 868 | |
| 869 void | |
| 7166 | 870 gaim_account_notify_added(GaimAccount *account, const char *id, |
| 871 const char *remote_user, const char *alias, | |
|
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
872 const char *message) |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
873 { |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
874 GaimAccountUiOps *ui_ops; |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
875 |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
876 g_return_if_fail(account != NULL); |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
877 g_return_if_fail(remote_user != NULL); |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
878 |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
879 ui_ops = gaim_accounts_get_ui_ops(); |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
880 |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
881 if (ui_ops != NULL && ui_ops->notify_added != NULL) |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
882 ui_ops->notify_added(account, remote_user, id, alias, message); |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
883 } |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
884 |
|
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
885 static void |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
886 change_password_cb(GaimAccount *account, GaimRequestFields *fields) |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
887 { |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
888 const char *orig_pass, *new_pass_1, *new_pass_2; |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
889 |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
890 orig_pass = gaim_request_fields_get_string(fields, "password"); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
891 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
|
892 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
|
893 |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
894 if (g_utf8_collate(new_pass_1, new_pass_2)) |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
895 { |
| 10758 | 896 gaim_notify_error(account, NULL, |
|
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
897 _("New passwords do not match."), NULL); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
898 |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
899 return; |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
900 } |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
901 |
| 8638 | 902 if (orig_pass == NULL || new_pass_1 == NULL || new_pass_2 == NULL || |
| 903 *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
|
904 { |
| 10758 | 905 gaim_notify_error(account, NULL, |
|
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
906 _("Fill out all fields completely."), NULL); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
907 return; |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
908 } |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
909 |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
910 serv_change_passwd(gaim_account_get_connection(account), |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
911 orig_pass, new_pass_1); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
912 gaim_account_set_password(account, new_pass_1); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
913 } |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
914 |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
915 void |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
916 gaim_account_request_change_password(GaimAccount *account) |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
917 { |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
918 GaimRequestFields *fields; |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
919 GaimRequestFieldGroup *group; |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
920 GaimRequestField *field; |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
921 char primary[256]; |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
922 |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
923 g_return_if_fail(account != NULL); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
924 g_return_if_fail(gaim_account_is_connected(account)); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
925 |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
926 fields = gaim_request_fields_new(); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
927 |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
928 group = gaim_request_field_group_new(NULL); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
929 gaim_request_fields_add_group(fields, group); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
930 |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
931 field = gaim_request_field_string_new("password", _("Original password"), |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
932 NULL, FALSE); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
933 gaim_request_field_string_set_masked(field, TRUE); |
| 8638 | 934 gaim_request_field_set_required(field, TRUE); |
|
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
935 gaim_request_field_group_add_field(group, field); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
936 |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
937 field = gaim_request_field_string_new("new_password_1", |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
938 _("New password"), |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
939 NULL, FALSE); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
940 gaim_request_field_string_set_masked(field, TRUE); |
| 8638 | 941 gaim_request_field_set_required(field, TRUE); |
|
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
942 gaim_request_field_group_add_field(group, field); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
943 |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
944 field = gaim_request_field_string_new("new_password_2", |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
945 _("New password (again)"), |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
946 NULL, FALSE); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
947 gaim_request_field_string_set_masked(field, TRUE); |
| 8638 | 948 gaim_request_field_set_required(field, TRUE); |
|
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
949 gaim_request_field_group_add_field(group, field); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
950 |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
951 g_snprintf(primary, sizeof(primary), _("Change password for %s"), |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
952 gaim_account_get_username(account)); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
953 |
| 7755 | 954 /* I'm sticking this somewhere in the code: bologna */ |
| 955 | |
|
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
956 gaim_request_fields(gaim_account_get_connection(account), |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
957 NULL, |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
958 primary, |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
959 _("Please enter your current password and your " |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
960 "new password."), |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
961 fields, |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
962 _("OK"), G_CALLBACK(change_password_cb), |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
963 _("Cancel"), NULL, |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
964 account); |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
965 } |
|
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
966 |
|
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
967 static void |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
968 set_user_info_cb(GaimAccount *account, const char *user_info) |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
969 { |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
970 GaimConnection *gc; |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
971 |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
972 gaim_account_set_user_info(account, user_info); |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
973 |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
974 gc = gaim_account_get_connection(account); |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
975 |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
976 if (gc != NULL) |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
977 serv_set_info(gaim_account_get_connection(account), user_info); |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
978 } |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
979 |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
980 void |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
981 gaim_account_request_change_user_info(GaimAccount *account) |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
982 { |
| 8697 | 983 GaimConnection *gc; |
|
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
984 char primary[256]; |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
985 |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
986 g_return_if_fail(account != NULL); |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
987 g_return_if_fail(gaim_account_is_connected(account)); |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
988 |
| 8697 | 989 gc = gaim_account_get_connection(account); |
| 990 | |
|
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
991 g_snprintf(primary, sizeof(primary), |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
992 _("Change user information for %s"), |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
993 gaim_account_get_username(account)); |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
994 |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
995 gaim_request_input(gaim_account_get_connection(account), |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
996 NULL, primary, NULL, |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
997 gaim_account_get_user_info(account), |
| 8697 | 998 TRUE, FALSE, ((gc != NULL) && |
| 999 (gc->flags & GAIM_CONNECTION_HTML) ? "html" : NULL), | |
|
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1000 _("Save"), G_CALLBACK(set_user_info_cb), |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1001 _("Cancel"), NULL, account); |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1002 } |
|
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
1003 |
|
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1004 void |
| 5563 | 1005 gaim_account_set_username(GaimAccount *account, const char *username) |
| 1006 { | |
|
5711
e33778b9d395
[gaim-migrate @ 6132]
Christian Hammond <chipx86@chipx86.com>
parents:
5710
diff
changeset
|
1007 g_return_if_fail(account != NULL); |
| 5563 | 1008 |
| 10740 | 1009 g_free(account->username); |
| 5563 | 1010 account->username = (username == NULL ? NULL : g_strdup(username)); |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1011 |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1012 schedule_accounts_save(); |
| 5563 | 1013 } |
| 1014 | |
| 1015 void | |
| 1016 gaim_account_set_password(GaimAccount *account, const char *password) | |
| 1017 { | |
|
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1018 g_return_if_fail(account != NULL); |
| 5563 | 1019 |
| 10740 | 1020 g_free(account->password); |
| 1021 account->password = NULL; | |
| 1022 | |
| 1023 if (!gaim_account_get_remember_password(account)) | |
| 1024 return; | |
| 5563 | 1025 |
| 1026 account->password = (password == NULL ? NULL : g_strdup(password)); | |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1027 |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1028 schedule_accounts_save(); |
| 5563 | 1029 } |
| 1030 | |
| 1031 void | |
| 1032 gaim_account_set_alias(GaimAccount *account, const char *alias) | |
| 1033 { | |
| 1034 g_return_if_fail(account != NULL); | |
| 1035 | |
| 10740 | 1036 g_free(account->alias); |
| 5563 | 1037 account->alias = (alias == NULL ? NULL : g_strdup(alias)); |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1038 |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1039 schedule_accounts_save(); |
| 5563 | 1040 } |
| 1041 | |
| 1042 void | |
| 1043 gaim_account_set_user_info(GaimAccount *account, const char *user_info) | |
| 1044 { | |
|
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1045 g_return_if_fail(account != NULL); |
| 5563 | 1046 |
| 10740 | 1047 g_free(account->user_info); |
| 5563 | 1048 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
|
1049 |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1050 schedule_accounts_save(); |
| 5563 | 1051 } |
| 1052 | |
| 1053 void | |
| 1054 gaim_account_set_buddy_icon(GaimAccount *account, const char *icon) | |
| 1055 { | |
| 1056 g_return_if_fail(account != NULL); | |
| 1057 | |
| 10740 | 1058 g_free(account->buddy_icon); |
| 5563 | 1059 account->buddy_icon = (icon == NULL ? NULL : g_strdup(icon)); |
| 10740 | 1060 if (gaim_account_is_connected(account)) |
| 10742 | 1061 serv_set_buddyicon(gaim_account_get_connection(account), icon); |
| 10418 | 1062 |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1063 schedule_accounts_save(); |
| 5563 | 1064 } |
| 1065 | |
| 1066 void | |
|
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1067 gaim_account_set_protocol_id(GaimAccount *account, const char *protocol_id) |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1068 { |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1069 g_return_if_fail(account != NULL); |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1070 g_return_if_fail(protocol_id != NULL); |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1071 |
| 10740 | 1072 g_free(account->protocol_id); |
|
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1073 account->protocol_id = g_strdup(protocol_id); |
|
5665
132a30783c3d
[gaim-migrate @ 6081]
Christian Hammond <chipx86@chipx86.com>
parents:
5659
diff
changeset
|
1074 |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1075 schedule_accounts_save(); |
| 5563 | 1076 } |
| 1077 | |
| 1078 void | |
| 1079 gaim_account_set_connection(GaimAccount *account, GaimConnection *gc) | |
| 1080 { | |
| 1081 g_return_if_fail(account != NULL); | |
| 1082 | |
| 1083 account->gc = gc; | |
| 1084 } | |
| 1085 | |
| 1086 void | |
| 1087 gaim_account_set_remember_password(GaimAccount *account, gboolean value) | |
| 1088 { | |
| 1089 g_return_if_fail(account != NULL); | |
| 1090 | |
| 1091 account->remember_pass = value; | |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1092 |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1093 schedule_accounts_save(); |
| 5563 | 1094 } |
| 1095 | |
| 1096 void | |
|
5659
6b3214ab8632
[gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents:
5643
diff
changeset
|
1097 gaim_account_set_check_mail(GaimAccount *account, gboolean value) |
|
6b3214ab8632
[gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents:
5643
diff
changeset
|
1098 { |
|
6b3214ab8632
[gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents:
5643
diff
changeset
|
1099 g_return_if_fail(account != NULL); |
|
6b3214ab8632
[gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents:
5643
diff
changeset
|
1100 |
|
5977
2d34c02d2031
[gaim-migrate @ 6424]
Christian Hammond <chipx86@chipx86.com>
parents:
5953
diff
changeset
|
1101 gaim_account_set_bool(account, "check-mail", value); |
|
5659
6b3214ab8632
[gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents:
5643
diff
changeset
|
1102 } |
|
6b3214ab8632
[gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents:
5643
diff
changeset
|
1103 |
|
6b3214ab8632
[gaim-migrate @ 6073]
Christian Hammond <chipx86@chipx86.com>
parents:
5643
diff
changeset
|
1104 void |
| 10400 | 1105 gaim_account_set_enabled(GaimAccount *account, const char *ui, |
| 1106 gboolean value) | |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1107 { |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1108 g_return_if_fail(account != NULL); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1109 g_return_if_fail(ui != NULL); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1110 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1111 gaim_account_set_ui_bool(account, ui, "auto-login", value); |
| 10862 | 1112 if (gaim_presence_is_online(account->presence)) |
| 1113 gaim_account_connect(account); | |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1114 } |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1115 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1116 void |
|
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1117 gaim_account_set_proxy_info(GaimAccount *account, GaimProxyInfo *info) |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1118 { |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1119 g_return_if_fail(account != NULL); |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1120 |
|
5695
e42535701e25
[gaim-migrate @ 6116]
Christian Hammond <chipx86@chipx86.com>
parents:
5694
diff
changeset
|
1121 if (account->proxy_info != NULL) |
|
e42535701e25
[gaim-migrate @ 6116]
Christian Hammond <chipx86@chipx86.com>
parents:
5694
diff
changeset
|
1122 gaim_proxy_info_destroy(account->proxy_info); |
|
e42535701e25
[gaim-migrate @ 6116]
Christian Hammond <chipx86@chipx86.com>
parents:
5694
diff
changeset
|
1123 |
|
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1124 account->proxy_info = info; |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1125 |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1126 schedule_accounts_save(); |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1127 } |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1128 |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1129 void |
| 9944 | 1130 gaim_account_set_status_types(GaimAccount *account, GList *status_types) |
| 1131 { | |
| 1132 g_return_if_fail(account != NULL); | |
| 1133 | |
| 10005 | 1134 /* Old with the old... */ |
| 9944 | 1135 if (account->status_types != NULL) |
| 1136 { | |
| 1137 GList *l; | |
| 1138 | |
| 1139 for (l = account->status_types; l != NULL; l = l->next) | |
| 1140 gaim_status_type_destroy((GaimStatusType *)l->data); | |
| 1141 | |
| 1142 g_list_free(account->status_types); | |
| 1143 } | |
| 1144 | |
| 10005 | 1145 /* In with the new... */ |
| 9944 | 1146 account->status_types = status_types; |
| 1147 } | |
| 1148 | |
| 1149 void | |
| 1150 gaim_account_set_status(GaimAccount *account, const char *status_id, | |
| 1151 gboolean active, ...) | |
| 1152 { | |
| 10738 | 1153 va_list args; |
| 1154 | |
| 1155 va_start(args, active); | |
| 1156 gaim_account_set_status_vargs(account, status_id, active, args); | |
| 1157 va_end(args); | |
| 1158 } | |
| 1159 | |
| 1160 void | |
| 1161 gaim_account_set_status_vargs(GaimAccount *account, const char *status_id, | |
| 1162 gboolean active, va_list args) | |
| 1163 { | |
| 9944 | 1164 GaimStatus *status; |
| 1165 | |
| 1166 g_return_if_fail(account != NULL); | |
| 1167 g_return_if_fail(status_id != NULL); | |
| 1168 | |
| 10760 | 1169 gaim_debug_info("account", "Changing status for %s, setting %s to %d\n", |
| 1170 gaim_account_get_username(account), status_id, active); | |
| 1171 | |
| 9944 | 1172 status = gaim_account_get_status(account, status_id); |
| 1173 if (status == NULL) | |
| 1174 { | |
| 10760 | 1175 gaim_debug_error("account", |
| 9944 | 1176 "Invalid status ID %s for account %s (%s)\n", |
| 1177 status_id, gaim_account_get_username(account), | |
| 1178 gaim_account_get_protocol_id(account)); | |
| 1179 return; | |
| 1180 } | |
| 10720 | 1181 |
| 10754 | 1182 if (active || gaim_status_is_independent(status)) |
| 1183 gaim_status_set_active_with_attrs(status, active, args); | |
| 10862 | 1184 |
| 1185 /* | |
| 1186 * Our current statuses are saved to accounts.xml (so that when we | |
| 1187 * reconnect, we go back to the previous status). | |
| 1188 */ | |
| 1189 schedule_accounts_save(); | |
| 9944 | 1190 } |
| 1191 | |
| 1192 void | |
|
5694
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1193 gaim_account_clear_settings(GaimAccount *account) |
|
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1194 { |
|
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1195 g_return_if_fail(account != NULL); |
|
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1196 |
|
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1197 g_hash_table_destroy(account->settings); |
|
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1198 |
|
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1199 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
|
1200 g_free, delete_setting); |
|
5694
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1201 } |
|
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1202 |
|
2d0d96c5a7a7
[gaim-migrate @ 6115]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1203 void |
| 5563 | 1204 gaim_account_set_int(GaimAccount *account, const char *name, int value) |
| 1205 { | |
| 1206 GaimAccountSetting *setting; | |
| 1207 | |
| 1208 g_return_if_fail(account != NULL); | |
| 1209 g_return_if_fail(name != NULL); | |
| 1210 | |
| 1211 setting = g_new0(GaimAccountSetting, 1); | |
| 1212 | |
| 1213 setting->type = GAIM_PREF_INT; | |
| 1214 setting->value.integer = value; | |
| 1215 | |
| 1216 g_hash_table_insert(account->settings, g_strdup(name), setting); | |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1217 |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1218 schedule_accounts_save(); |
| 5563 | 1219 } |
| 1220 | |
| 1221 void | |
| 1222 gaim_account_set_string(GaimAccount *account, const char *name, | |
| 1223 const char *value) | |
| 1224 { | |
| 1225 GaimAccountSetting *setting; | |
| 1226 | |
| 1227 g_return_if_fail(account != NULL); | |
| 1228 g_return_if_fail(name != NULL); | |
| 1229 | |
| 1230 setting = g_new0(GaimAccountSetting, 1); | |
| 1231 | |
| 1232 setting->type = GAIM_PREF_STRING; | |
| 1233 setting->value.string = g_strdup(value); | |
| 1234 | |
| 1235 g_hash_table_insert(account->settings, g_strdup(name), setting); | |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1236 |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1237 schedule_accounts_save(); |
| 5563 | 1238 } |
| 1239 | |
| 1240 void | |
| 1241 gaim_account_set_bool(GaimAccount *account, const char *name, gboolean value) | |
| 1242 { | |
| 1243 GaimAccountSetting *setting; | |
| 1244 | |
| 1245 g_return_if_fail(account != NULL); | |
| 1246 g_return_if_fail(name != NULL); | |
| 1247 | |
| 1248 setting = g_new0(GaimAccountSetting, 1); | |
| 1249 | |
| 1250 setting->type = GAIM_PREF_BOOLEAN; | |
| 1251 setting->value.bool = value; | |
| 1252 | |
| 1253 g_hash_table_insert(account->settings, g_strdup(name), setting); | |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1254 |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1255 schedule_accounts_save(); |
| 5563 | 1256 } |
| 1257 | |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1258 static GHashTable * |
|
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5792
diff
changeset
|
1259 get_ui_settings_table(GaimAccount *account, const char *ui) |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1260 { |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1261 GHashTable *table; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1262 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1263 table = g_hash_table_lookup(account->ui_settings, ui); |
|
5979
49ae70ffcea5
[gaim-migrate @ 6426]
Christian Hammond <chipx86@chipx86.com>
parents:
5977
diff
changeset
|
1264 |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1265 if (table == NULL) { |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1266 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
|
1267 delete_setting); |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1268 g_hash_table_insert(account->ui_settings, g_strdup(ui), table); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1269 } |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1270 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1271 return table; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1272 } |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1273 |
|
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1274 void |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1275 gaim_account_set_ui_int(GaimAccount *account, const char *ui, |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1276 const char *name, int value) |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1277 { |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1278 GaimAccountSetting *setting; |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1279 GHashTable *table; |
|
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1280 |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1281 g_return_if_fail(account != NULL); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1282 g_return_if_fail(ui != NULL); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1283 g_return_if_fail(name != NULL); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1284 |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1285 setting = g_new0(GaimAccountSetting, 1); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1286 |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1287 setting->type = GAIM_PREF_INT; |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1288 setting->ui = g_strdup(ui); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1289 setting->value.integer = value; |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1290 |
|
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5792
diff
changeset
|
1291 table = get_ui_settings_table(account, ui); |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1292 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1293 g_hash_table_insert(table, g_strdup(name), setting); |
|
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1294 |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1295 schedule_accounts_save(); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1296 } |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1297 |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1298 void |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1299 gaim_account_set_ui_string(GaimAccount *account, const char *ui, |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1300 const char *name, const char *value) |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1301 { |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1302 GaimAccountSetting *setting; |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1303 GHashTable *table; |
|
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1304 |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1305 g_return_if_fail(account != NULL); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1306 g_return_if_fail(ui != NULL); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1307 g_return_if_fail(name != NULL); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1308 |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1309 setting = g_new0(GaimAccountSetting, 1); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1310 |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1311 setting->type = GAIM_PREF_STRING; |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1312 setting->ui = g_strdup(ui); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1313 setting->value.string = g_strdup(value); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1314 |
|
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5792
diff
changeset
|
1315 table = get_ui_settings_table(account, ui); |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1316 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1317 g_hash_table_insert(table, g_strdup(name), setting); |
|
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1318 |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1319 schedule_accounts_save(); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1320 } |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1321 |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1322 void |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1323 gaim_account_set_ui_bool(GaimAccount *account, const char *ui, |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1324 const char *name, gboolean value) |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1325 { |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1326 GaimAccountSetting *setting; |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1327 GHashTable *table; |
|
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1328 |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1329 g_return_if_fail(account != NULL); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1330 g_return_if_fail(ui != NULL); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1331 g_return_if_fail(name != NULL); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1332 |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1333 setting = g_new0(GaimAccountSetting, 1); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1334 |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1335 setting->type = GAIM_PREF_BOOLEAN; |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1336 setting->ui = g_strdup(ui); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1337 setting->value.bool = value; |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1338 |
|
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5792
diff
changeset
|
1339 table = get_ui_settings_table(account, ui); |
|
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 g_hash_table_insert(table, g_strdup(name), setting); |
|
5777
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1342 |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1343 schedule_accounts_save(); |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1344 } |
|
1f786fb43ee6
[gaim-migrate @ 6202]
Christian Hammond <chipx86@chipx86.com>
parents:
5742
diff
changeset
|
1345 |
| 5563 | 1346 gboolean |
| 1347 gaim_account_is_connected(const GaimAccount *account) | |
| 1348 { | |
| 9019 | 1349 GaimConnection *gc; |
| 1350 | |
| 5563 | 1351 g_return_val_if_fail(account != NULL, FALSE); |
| 1352 | |
| 9019 | 1353 gc = gaim_account_get_connection(account); |
| 1354 | |
| 10428 | 1355 /* TODO: The first way is better... but it doesn't work quite right yet */ |
| 9021 | 1356 /* return ((gc != NULL) && GAIM_CONNECTION_IS_CONNECTED(gc)); */ |
| 1357 return ((gc != NULL) && gaim_connection_get_state(gc) != GAIM_DISCONNECTED); | |
| 5563 | 1358 } |
| 1359 | |
| 1360 const char * | |
| 1361 gaim_account_get_username(const GaimAccount *account) | |
| 1362 { | |
| 1363 g_return_val_if_fail(account != NULL, NULL); | |
| 1364 | |
| 1365 return account->username; | |
| 1366 } | |
| 1367 | |
| 1368 const char * | |
| 1369 gaim_account_get_password(const GaimAccount *account) | |
| 1370 { | |
| 1371 g_return_val_if_fail(account != NULL, NULL); | |
| 1372 | |
| 1373 return account->password; | |
| 1374 } | |
| 1375 | |
| 1376 const char * | |
| 1377 gaim_account_get_alias(const GaimAccount *account) | |
| 1378 { | |
| 1379 g_return_val_if_fail(account != NULL, NULL); | |
| 1380 | |
| 1381 return account->alias; | |
| 1382 } | |
| 1383 | |
| 1384 const char * | |
| 1385 gaim_account_get_user_info(const GaimAccount *account) | |
| 1386 { | |
| 1387 g_return_val_if_fail(account != NULL, NULL); | |
| 1388 | |
| 1389 return account->user_info; | |
| 1390 } | |
| 1391 | |
| 1392 const char * | |
| 1393 gaim_account_get_buddy_icon(const GaimAccount *account) | |
| 1394 { | |
| 1395 g_return_val_if_fail(account != NULL, NULL); | |
| 1396 | |
| 1397 return account->buddy_icon; | |
| 1398 } | |
| 1399 | |
|
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1400 const char * |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1401 gaim_account_get_protocol_id(const GaimAccount *account) |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1402 { |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1403 g_return_val_if_fail(account != NULL, NULL); |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1404 |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1405 return account->protocol_id; |
| 5563 | 1406 } |
| 1407 | |
| 9699 | 1408 const char * |
| 1409 gaim_account_get_protocol_name(const GaimAccount *account) | |
| 1410 { | |
| 9720 | 1411 GaimPlugin *p; |
| 1412 | |
| 9699 | 1413 g_return_val_if_fail(account != NULL, NULL); |
| 1414 | |
| 9989 | 1415 p = gaim_find_prpl(gaim_account_get_protocol_id(account)); |
| 9988 | 1416 |
| 1417 return ((p && p->info->name) ? _(p->info->name) : _("Unknown")); | |
| 1418 } | |
| 1419 | |
| 5563 | 1420 GaimConnection * |
| 1421 gaim_account_get_connection(const GaimAccount *account) | |
| 1422 { | |
| 1423 g_return_val_if_fail(account != NULL, NULL); | |
| 1424 | |
| 1425 return account->gc; | |
| 1426 } | |
| 1427 | |
| 1428 gboolean | |
| 1429 gaim_account_get_remember_password(const GaimAccount *account) | |
| 1430 { | |
| 1431 g_return_val_if_fail(account != NULL, FALSE); | |
| 1432 | |
| 1433 return account->remember_pass; | |
| 1434 } | |
| 1435 | |
|
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1436 gboolean |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1437 gaim_account_get_check_mail(const GaimAccount *account) |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1438 { |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1439 g_return_val_if_fail(account != NULL, FALSE); |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1440 |
|
5977
2d34c02d2031
[gaim-migrate @ 6424]
Christian Hammond <chipx86@chipx86.com>
parents:
5953
diff
changeset
|
1441 return gaim_account_get_bool(account, "check-mail", FALSE); |
|
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1442 } |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1443 |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1444 gboolean |
| 10400 | 1445 gaim_account_get_enabled(const GaimAccount *account, const char *ui) |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1446 { |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1447 g_return_val_if_fail(account != NULL, FALSE); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1448 g_return_val_if_fail(ui != NULL, FALSE); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1449 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1450 return gaim_account_get_ui_bool(account, ui, "auto-login", FALSE); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1451 } |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1452 |
|
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1453 GaimProxyInfo * |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1454 gaim_account_get_proxy_info(const GaimAccount *account) |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1455 { |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1456 g_return_val_if_fail(account != NULL, NULL); |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1457 |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1458 return account->proxy_info; |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1459 } |
|
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5666
diff
changeset
|
1460 |
| 9944 | 1461 GaimStatus * |
| 10738 | 1462 gaim_account_get_active_status(const GaimAccount *account) |
| 1463 { | |
| 1464 g_return_val_if_fail(account != NULL, NULL); | |
| 1465 | |
| 1466 return gaim_presence_get_active_status(account->presence); | |
| 1467 } | |
| 1468 | |
| 1469 GaimStatus * | |
| 9944 | 1470 gaim_account_get_status(const GaimAccount *account, const char *status_id) |
| 1471 { | |
| 1472 g_return_val_if_fail(account != NULL, NULL); | |
| 1473 g_return_val_if_fail(status_id != NULL, NULL); | |
| 1474 | |
| 1475 return gaim_presence_get_status(account->presence, status_id); | |
| 1476 } | |
| 1477 | |
| 1478 GaimStatusType * | |
| 1479 gaim_account_get_status_type(const GaimAccount *account, const char *id) | |
| 1480 { | |
| 1481 const GList *l; | |
| 1482 | |
| 1483 g_return_val_if_fail(account != NULL, NULL); | |
| 1484 g_return_val_if_fail(id != NULL, NULL); | |
| 1485 | |
| 1486 for (l = gaim_account_get_status_types(account); l != NULL; l = l->next) | |
| 1487 { | |
| 1488 GaimStatusType *status_type = (GaimStatusType *)l->data; | |
| 1489 | |
| 1490 if (!strcmp(gaim_status_type_get_id(status_type), id)) | |
| 1491 return status_type; | |
| 1492 } | |
| 1493 | |
| 1494 return NULL; | |
| 1495 } | |
| 1496 | |
| 1497 GaimPresence * | |
| 1498 gaim_account_get_presence(const GaimAccount *account) | |
| 1499 { | |
| 1500 g_return_val_if_fail(account != NULL, NULL); | |
| 1501 | |
| 1502 return account->presence; | |
| 1503 } | |
| 1504 | |
| 1505 gboolean | |
| 1506 gaim_account_is_status_active(const GaimAccount *account, | |
| 1507 const char *status_id) | |
| 1508 { | |
| 1509 g_return_val_if_fail(account != NULL, FALSE); | |
| 1510 g_return_val_if_fail(status_id != NULL, FALSE); | |
| 1511 | |
| 1512 return gaim_presence_is_status_active(account->presence, status_id); | |
| 1513 } | |
| 1514 | |
| 1515 const GList * | |
| 1516 gaim_account_get_status_types(const GaimAccount *account) | |
| 1517 { | |
| 1518 g_return_val_if_fail(account != NULL, NULL); | |
| 1519 | |
| 1520 return account->status_types; | |
| 1521 } | |
| 1522 | |
| 5563 | 1523 int |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1524 gaim_account_get_int(const GaimAccount *account, const char *name, |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1525 int default_value) |
| 5563 | 1526 { |
| 1527 GaimAccountSetting *setting; | |
| 1528 | |
|
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1529 g_return_val_if_fail(account != NULL, default_value); |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1530 g_return_val_if_fail(name != NULL, default_value); |
| 5563 | 1531 |
| 1532 setting = g_hash_table_lookup(account->settings, name); | |
| 1533 | |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1534 if (setting == NULL) |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1535 return default_value; |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1536 |
|
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1537 g_return_val_if_fail(setting->type == GAIM_PREF_INT, default_value); |
| 5563 | 1538 |
| 1539 return setting->value.integer; | |
| 1540 } | |
| 1541 | |
| 1542 const char * | |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1543 gaim_account_get_string(const GaimAccount *account, const char *name, |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1544 const char *default_value) |
| 5563 | 1545 { |
| 1546 GaimAccountSetting *setting; | |
| 1547 | |
|
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1548 g_return_val_if_fail(account != NULL, default_value); |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1549 g_return_val_if_fail(name != NULL, default_value); |
| 5563 | 1550 |
| 1551 setting = g_hash_table_lookup(account->settings, name); | |
| 1552 | |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1553 if (setting == NULL) |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1554 return default_value; |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1555 |
|
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1556 g_return_val_if_fail(setting->type == GAIM_PREF_STRING, default_value); |
| 5563 | 1557 |
| 1558 return setting->value.string; | |
| 1559 } | |
| 1560 | |
| 1561 gboolean | |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1562 gaim_account_get_bool(const GaimAccount *account, const char *name, |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1563 gboolean default_value) |
| 5563 | 1564 { |
| 1565 GaimAccountSetting *setting; | |
| 1566 | |
|
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1567 g_return_val_if_fail(account != NULL, default_value); |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1568 g_return_val_if_fail(name != NULL, default_value); |
| 5563 | 1569 |
| 1570 setting = g_hash_table_lookup(account->settings, name); | |
| 1571 | |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1572 if (setting == NULL) |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1573 return default_value; |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1574 |
|
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1575 g_return_val_if_fail(setting->type == GAIM_PREF_BOOLEAN, default_value); |
| 5563 | 1576 |
| 1577 return setting->value.bool; | |
| 1578 } | |
| 1579 | |
|
5779
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1580 int |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1581 gaim_account_get_ui_int(const GaimAccount *account, const char *ui, |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1582 const char *name, int default_value) |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1583 { |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1584 GaimAccountSetting *setting; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1585 GHashTable *table; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1586 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1587 g_return_val_if_fail(account != NULL, default_value); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1588 g_return_val_if_fail(ui != NULL, default_value); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1589 g_return_val_if_fail(name != NULL, default_value); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1590 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1591 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL) |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1592 return default_value; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1593 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1594 if ((setting = g_hash_table_lookup(table, name)) == NULL) |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1595 return default_value; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1596 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1597 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
|
1598 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1599 return setting->value.integer; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1600 } |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1601 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1602 const char * |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1603 gaim_account_get_ui_string(const GaimAccount *account, const char *ui, |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1604 const char *name, const char *default_value) |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1605 { |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1606 GaimAccountSetting *setting; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1607 GHashTable *table; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1608 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1609 g_return_val_if_fail(account != NULL, default_value); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1610 g_return_val_if_fail(ui != NULL, default_value); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1611 g_return_val_if_fail(name != NULL, default_value); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1612 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1613 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL) |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1614 return default_value; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1615 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1616 if ((setting = g_hash_table_lookup(table, name)) == NULL) |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1617 return default_value; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1618 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1619 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
|
1620 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1621 return setting->value.string; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1622 } |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1623 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1624 gboolean |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1625 gaim_account_get_ui_bool(const GaimAccount *account, const char *ui, |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1626 const char *name, gboolean default_value) |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1627 { |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1628 GaimAccountSetting *setting; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1629 GHashTable *table; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1630 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1631 g_return_val_if_fail(account != NULL, default_value); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1632 g_return_val_if_fail(ui != NULL, default_value); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1633 g_return_val_if_fail(name != NULL, default_value); |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1634 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1635 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL) |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1636 return default_value; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1637 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1638 if ((setting = g_hash_table_lookup(table, name)) == NULL) |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1639 return default_value; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1640 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1641 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
|
1642 |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1643 return setting->value.bool; |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1644 } |
|
758fa27534b3
[gaim-migrate @ 6204]
Christian Hammond <chipx86@chipx86.com>
parents:
5777
diff
changeset
|
1645 |
| 8573 | 1646 GaimLog * |
| 1647 gaim_account_get_log(GaimAccount *account) | |
| 1648 { | |
| 1649 g_return_val_if_fail(account != NULL, NULL); | |
| 1650 | |
| 1651 if(!account->system_log){ | |
| 8658 | 1652 GaimConnection *gc; |
| 1653 | |
| 1654 gc = gaim_account_get_connection(account); | |
| 1655 | |
| 8635 | 1656 account->system_log = gaim_log_new(GAIM_LOG_SYSTEM, |
| 1657 gaim_account_get_username(account), account, | |
| 11014 | 1658 (gc != NULL && gc->login_time != 0) ? gc->login_time : time(NULL)); |
| 8573 | 1659 } |
| 1660 | |
| 1661 return account->system_log; | |
| 1662 } | |
| 1663 | |
| 1664 void | |
| 1665 gaim_account_destroy_log(GaimAccount *account) | |
| 1666 { | |
| 1667 g_return_if_fail(account != NULL); | |
| 1668 | |
| 1669 if(account->system_log){ | |
| 1670 gaim_log_free(account->system_log); | |
| 1671 account->system_log = NULL; | |
| 1672 } | |
| 1673 } | |
| 1674 | |
|
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1675 void |
|
5710
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1676 gaim_accounts_add(GaimAccount *account) |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1677 { |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1678 g_return_if_fail(account != NULL); |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1679 |
|
5867
db4df0be06fd
[gaim-migrate @ 6298]
Christian Hammond <chipx86@chipx86.com>
parents:
5865
diff
changeset
|
1680 if (g_list_find(accounts, account) != NULL) |
|
db4df0be06fd
[gaim-migrate @ 6298]
Christian Hammond <chipx86@chipx86.com>
parents:
5865
diff
changeset
|
1681 return; |
|
db4df0be06fd
[gaim-migrate @ 6298]
Christian Hammond <chipx86@chipx86.com>
parents:
5865
diff
changeset
|
1682 |
|
5710
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1683 accounts = g_list_append(accounts, account); |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1684 |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1685 schedule_accounts_save(); |
| 8134 | 1686 |
| 1687 gaim_signal_emit(gaim_accounts_get_handle(), "account-added", account); | |
|
5710
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1688 } |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1689 |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1690 void |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1691 gaim_accounts_remove(GaimAccount *account) |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1692 { |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1693 g_return_if_fail(account != NULL); |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1694 |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1695 accounts = g_list_remove(accounts, account); |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1696 |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1697 schedule_accounts_save(); |
| 8134 | 1698 |
| 1699 gaim_signal_emit(gaim_accounts_get_handle(), "account-removed", account); | |
|
6368
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
1700 } |
|
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
1701 |
|
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
1702 void |
|
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
1703 gaim_accounts_delete(GaimAccount *account) |
|
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
1704 { |
| 6695 | 1705 GaimBlistNode *gnode, *cnode, *bnode; |
|
6368
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
1706 |
|
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
1707 g_return_if_fail(account != NULL); |
|
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
1708 |
| 10758 | 1709 gaim_notify_close_with_handle(account); |
| 1710 gaim_request_close_with_handle(account); | |
| 1711 | |
|
6368
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
1712 gaim_accounts_remove(account); |
|
6367
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
1713 |
| 8235 | 1714 /* Remove this account's buddies */ |
|
6367
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
1715 for (gnode = gaim_get_blist()->root; gnode != NULL; gnode = gnode->next) { |
|
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
1716 if (!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
|
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
1717 continue; |
|
10106
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
1718 |
|
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
1719 cnode = gnode->child; |
|
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
1720 while (cnode) { |
|
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
1721 GaimBlistNode *cnode_next = cnode->next; |
|
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
1722 |
| 6695 | 1723 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) { |
|
10106
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
1724 bnode = cnode->child; |
|
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
1725 while (bnode) { |
|
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
1726 GaimBlistNode *bnode_next = bnode->next; |
|
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
1727 |
| 6695 | 1728 if (GAIM_BLIST_NODE_IS_BUDDY(bnode)) { |
| 1729 GaimBuddy *b = (GaimBuddy *)bnode; | |
|
6367
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
1730 |
| 6695 | 1731 if (b->account == account) |
| 1732 gaim_blist_remove_buddy(b); | |
| 1733 } | |
|
10106
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
1734 bnode = bnode_next; |
| 6695 | 1735 } |
| 1736 } else if (GAIM_BLIST_NODE_IS_CHAT(cnode)) { | |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
1737 GaimChat *c = (GaimChat *)cnode; |
|
6367
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
1738 |
|
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
1739 if (c->account == account) |
|
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
1740 gaim_blist_remove_chat(c); |
|
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
1741 } |
|
10106
131f70fc53c1
[gaim-migrate @ 11138]
Luke Schierer <lschiere@pidgin.im>
parents:
10067
diff
changeset
|
1742 cnode = cnode_next; |
|
6367
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
1743 } |
|
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
1744 } |
|
9fd154ca6a94
[gaim-migrate @ 6872]
Christian Hammond <chipx86@chipx86.com>
parents:
6366
diff
changeset
|
1745 |
| 8235 | 1746 /* Remove this account's pounces */ |
| 1747 gaim_pounce_destroy_all_by_account(account); | |
|
6368
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
1748 |
|
41e6d15f4687
[gaim-migrate @ 6873]
Christian Hammond <chipx86@chipx86.com>
parents:
6367
diff
changeset
|
1749 gaim_account_destroy(account); |
|
5710
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1750 } |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1751 |
|
dbac958d8937
[gaim-migrate @ 6131]
Christian Hammond <chipx86@chipx86.com>
parents:
5707
diff
changeset
|
1752 void |
|
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1753 gaim_accounts_reorder(GaimAccount *account, size_t new_index) |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1754 { |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1755 size_t index; |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1756 GList *l; |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1757 |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1758 g_return_if_fail(account != NULL); |
|
5620
c9724982ce45
[gaim-migrate @ 6027]
Christian Hammond <chipx86@chipx86.com>
parents:
5610
diff
changeset
|
1759 g_return_if_fail(new_index >= 0 && new_index <= g_list_length(accounts)); |
|
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1760 |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1761 index = g_list_index(accounts, account); |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1762 |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1763 if (index == -1) { |
| 10760 | 1764 gaim_debug_error("account", |
|
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1765 "Unregistered account (%s) discovered during reorder!\n", |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1766 gaim_account_get_username(account)); |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1767 return; |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1768 } |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1769 |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1770 l = g_list_nth(accounts, index); |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1771 |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1772 if (new_index > index) |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1773 new_index--; |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1774 |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1775 /* Remove the old one. */ |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1776 accounts = g_list_delete_link(accounts, l); |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1777 |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1778 /* Insert it where it should go. */ |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1779 accounts = g_list_insert(accounts, account, new_index); |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1780 |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1781 schedule_accounts_save(); |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5574
diff
changeset
|
1782 } |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
1783 |
| 5563 | 1784 GList * |
| 1785 gaim_accounts_get_all(void) | |
| 1786 { | |
| 1787 return accounts; | |
| 1788 } | |
|
5874
964e4f94fc56
[gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1789 |
|
11053
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1790 GList * |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1791 gaim_accounts_get_all_active(void) |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1792 { |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1793 GList *list = NULL; |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1794 GList *all = gaim_accounts_get_all(); |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1795 |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1796 while (all != NULL) { |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1797 GaimAccount *account = all->data; |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1798 |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1799 if (gaim_account_get_enabled(account, gaim_core_get_ui())) |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1800 list = g_list_append(list, account); |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1801 |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1802 all = all->next; |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1803 } |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1804 |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1805 return list; |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1806 } |
|
da05145441ca
[gaim-migrate @ 12991]
Richard Laager <rlaager@wiktel.com>
parents:
11042
diff
changeset
|
1807 |
|
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1808 GaimAccount * |
| 7132 | 1809 gaim_accounts_find(const char *name, const char *protocol_id) |
|
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1810 { |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1811 GaimAccount *account = NULL; |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1812 GList *l; |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1813 char *who; |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1814 |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1815 g_return_val_if_fail(name != NULL, NULL); |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1816 |
| 7261 | 1817 who = g_strdup(gaim_normalize(NULL, name)); |
|
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1818 |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1819 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1820 account = (GaimAccount *)l->data; |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1821 |
| 7261 | 1822 if (!strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who) && |
| 7132 | 1823 (!protocol_id || !strcmp(account->protocol_id, protocol_id))) { |
|
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1824 |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1825 break; |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1826 } |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1827 |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1828 account = NULL; |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1829 } |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1830 |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1831 g_free(who); |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1832 |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1833 return account; |
|
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5942
diff
changeset
|
1834 } |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1835 |
|
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1836 void |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1837 gaim_accounts_set_ui_ops(GaimAccountUiOps *ops) |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1838 { |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1839 account_ui_ops = ops; |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1840 } |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1841 |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1842 GaimAccountUiOps * |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1843 gaim_accounts_get_ui_ops(void) |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1844 { |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1845 return account_ui_ops; |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1846 } |
|
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1847 |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1848 void * |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1849 gaim_accounts_get_handle(void) |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1850 { |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1851 static int handle; |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1852 |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1853 return &handle; |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1854 } |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1855 |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1856 void |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1857 gaim_accounts_init(void) |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1858 { |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1859 void *handle = gaim_accounts_get_handle(); |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1860 |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11014
diff
changeset
|
1861 gaim_debug_register_category("account"); |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11014
diff
changeset
|
1862 |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1863 gaim_signal_register(handle, "account-connecting", |
|
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1864 gaim_marshal_VOID__POINTER, NULL, 1, |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1865 gaim_value_new(GAIM_TYPE_SUBTYPE, |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1866 GAIM_SUBTYPE_ACCOUNT)); |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1867 |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1868 gaim_signal_register(handle, "account-away", |
|
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1869 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1870 gaim_value_new(GAIM_TYPE_SUBTYPE, |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1871 GAIM_SUBTYPE_ACCOUNT), |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1872 gaim_value_new(GAIM_TYPE_STRING), |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1873 gaim_value_new(GAIM_TYPE_STRING)); |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1874 |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1875 gaim_signal_register(handle, "account-setting-info", |
|
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1876 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1877 gaim_value_new(GAIM_TYPE_SUBTYPE, |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1878 GAIM_SUBTYPE_ACCOUNT), |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1879 gaim_value_new(GAIM_TYPE_STRING)); |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1880 |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1881 gaim_signal_register(handle, "account-set-info", |
|
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1882 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1883 gaim_value_new(GAIM_TYPE_SUBTYPE, |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1884 GAIM_SUBTYPE_ACCOUNT), |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1885 gaim_value_new(GAIM_TYPE_STRING)); |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1886 |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1887 gaim_signal_register(handle, "account-warned", |
|
6564
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1888 gaim_marshal_VOID__POINTER_POINTER_UINT, NULL, 3, |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1889 gaim_value_new(GAIM_TYPE_SUBTYPE, |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1890 GAIM_SUBTYPE_ACCOUNT), |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1891 gaim_value_new(GAIM_TYPE_STRING), |
|
800ef4a51096
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1892 gaim_value_new(GAIM_TYPE_UINT)); |
| 8134 | 1893 |
| 1894 gaim_signal_register(handle, "account-added", | |
| 10447 | 1895 gaim_marshal_VOID__POINTER, NULL, 1, |
| 1896 gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_ACCOUNT)); | |
| 8134 | 1897 |
| 1898 gaim_signal_register(handle, "account-removed", | |
| 10447 | 1899 gaim_marshal_VOID__POINTER, NULL, 1, |
| 1900 gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_ACCOUNT)); | |
| 10490 | 1901 |
| 1902 load_accounts(); | |
| 1903 | |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1904 } |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1905 |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1906 void |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1907 gaim_accounts_uninit(void) |
|
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1908 { |
| 10428 | 1909 if (save_timer != 0) |
| 10427 | 1910 { |
| 10428 | 1911 gaim_timeout_remove(save_timer); |
| 1912 save_timer = 0; | |
| 10427 | 1913 sync_accounts(); |
| 8235 | 1914 } |
| 1915 | |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1916 gaim_signals_unregister_by_instance(gaim_accounts_get_handle()); |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11014
diff
changeset
|
1917 |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11014
diff
changeset
|
1918 gaim_debug_unregister_category("account"); |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6368
diff
changeset
|
1919 } |
