comparison src/savedstatuses.c @ 11724:a8ec0a291d14

[gaim-migrate @ 14015] If you're online, and sitting around, and la-di-da you enable one of your accounts, it will now use the status currently set in your gtkstatusbox instead of whatever the account was set to when it was disabled committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 22 Oct 2005 22:29:40 +0000
parents 723487d07aa0
children 8657ad65e257
comparison
equal deleted inserted replaced
11723:9537977703bb 11724:a8ec0a291d14
496 gaim_savedstatus_has_substatuses(const GaimSavedStatus *saved_status) 496 gaim_savedstatus_has_substatuses(const GaimSavedStatus *saved_status)
497 { 497 {
498 return (saved_status->substatuses != NULL); 498 return (saved_status->substatuses != NULL);
499 } 499 }
500 500
501 void
502 gaim_savedstatus_activate(const GaimSavedStatus *saved_status)
503 {
504 GList *accounts;
505
506 accounts = gaim_accounts_get_all_active();
507
508 while (accounts != NULL)
509 {
510 GaimAccount *account;
511
512 account = accounts->data;
513 gaim_savedstatus_activate_for_account(saved_status, account);
514 accounts = accounts->next;
515 }
516 }
517
518 void
519 gaim_savedstatus_activate_for_account(const GaimSavedStatus *saved_status,
520 GaimAccount *account)
521 {
522 const GList *status_types;
523 GaimStatusType *status_type;
524
525 /* Find the status type that matches the given primitive */
526 status_types = gaim_account_get_status_types(account);
527 while (status_types != NULL)
528 {
529 status_type = status_types->data;
530 if (gaim_status_type_get_primitive(status_type) == saved_status->type)
531 {
532 if (saved_status->message != NULL)
533 gaim_account_set_status(account, gaim_status_type_get_id(status_type),
534 TRUE, "message", saved_status->message, NULL);
535 else
536 gaim_account_set_status(account, gaim_status_type_get_id(status_type),
537 TRUE, NULL);
538 return;
539 }
540 status_types = status_types->next;
541 }
542 }
543
501 void * 544 void *
502 gaim_savedstatuses_get_handle(void) 545 gaim_savedstatuses_get_handle(void)
503 { 546 {
504 static int handle; 547 static int handle;
505 548