# HG changeset patch # User Mark Doliner # Date 1111382529 0 # Node ID ad57a8b5495eed4374f5af512135e352b38abd2d # Parent 7d4ca0d36f2520902eee617f32b5038bb4165e98 [gaim-migrate @ 12308] Some minor status changes. * Using the "enable?" checkbox in the account window will now sign on an account if it was offline. I'm starting to get a feel for how some of this stuff should work... * Signing on an account that doesn't support available messages no longer shows some warnings. committer: Tailor Script diff -r 7d4ca0d36f25 -r ad57a8b5495e src/account.c --- a/src/account.c Mon Mar 21 04:17:21 2005 +0000 +++ b/src/account.c Mon Mar 21 05:22:09 2005 +0000 @@ -991,6 +991,7 @@ gboolean active, ...) { GaimStatus *status; + GaimStatusType *status_type; va_list args; g_return_if_fail(account != NULL); @@ -1010,6 +1011,17 @@ va_start(args, active); gaim_status_set_active_with_attrs(status, active, args); va_end(args); + + /* + * If this account should be connected, but is not, then connect. + */ + status_type = gaim_status_get_type(status); + if (active && + (gaim_status_type_get_primitive(status_type) != GAIM_STATUS_OFFLINE) && + !gaim_account_is_connected(account)) + { + gaim_account_connect(account, status); + } } void diff -r 7d4ca0d36f25 -r ad57a8b5495e src/gtkaccount.c --- a/src/gtkaccount.c Mon Mar 21 04:17:21 2005 +0000 +++ b/src/gtkaccount.c Mon Mar 21 05:22:09 2005 +0000 @@ -2044,10 +2044,26 @@ if (enabled) { gaim_account_disconnect(account); } else { - GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist(); - const char *type = gtk_gaim_status_box_get_active_type(GTK_GAIM_STATUS_BOX(gtkblist->statusbox)); - const char *message = gtk_gaim_status_box_get_message(GTK_GAIM_STATUS_BOX(gtkblist->statusbox)); - gaim_account_set_status(account, type, TRUE, "message", message, NULL); + GaimGtkBuddyList *gtkblist; + const char *type; + GaimStatus *status; + GaimStatusType *status_type; + + gtkblist = gaim_gtk_blist_get_default_gtk_blist(); + type = gtk_gaim_status_box_get_active_type(GTK_GAIM_STATUS_BOX(gtkblist->statusbox)); + status = gaim_account_get_status(account, type); + status_type = gaim_status_get_type(status); + + if (gaim_status_type_get_attr(status_type, "message") != NULL) + { + const char *message; + message = gtk_gaim_status_box_get_message(GTK_GAIM_STATUS_BOX(gtkblist->statusbox)); + gaim_account_set_status(account, type, TRUE, "message", message, NULL); + } + else + { + gaim_account_set_status(account, type, TRUE, NULL); + } } gaim_account_set_enabled(account, GAIM_GTK_UI, !enabled); diff -r 7d4ca0d36f25 -r ad57a8b5495e src/status.c --- a/src/status.c Mon Mar 21 04:17:21 2005 +0000 +++ b/src/status.c Mon Mar 21 05:22:09 2005 +0000 @@ -775,6 +775,8 @@ gboolean changed = FALSE; const gchar *id; + g_return_if_fail(status != NULL); + if (!active && gaim_status_is_exclusive(status)) { gaim_debug_error("status", @@ -783,8 +785,6 @@ return; } - g_return_if_fail(status != NULL); - if (status->active != active) changed = TRUE; @@ -798,7 +798,7 @@ if (value == NULL) { gaim_debug_warning("status", "The attribute \"%s\" on the status \"%s\" is " - "not supported.\n", id, status->title); + "not supported.\n", id, status->type->name); /* Skip over the data and move on to the next attribute */ va_arg(args, void *); continue;