diff src/gtkaccount.c @ 10714:ad57a8b5495e

[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 <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 21 Mar 2005 05:22:09 +0000
parents 61930cadca7c
children 0e017707532f
line wrap: on
line diff
--- 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);