changeset 12001:8bcccf2988fa

[gaim-migrate @ 14294] How does this look? 1. If an IRC account sets itself to "away" but does not enter a message, then use a default away message of "Away" 2. Sign-on-as-away for IRC committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 07 Nov 2005 04:49:23 +0000
parents 77fc8a9f0668
children 06065a4847ff
files src/protocols/irc/irc.c src/protocols/irc/msgs.c
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/irc/irc.c	Mon Nov 07 03:44:30 2005 +0000
+++ b/src/protocols/irc/irc.c	Mon Nov 07 04:49:23 2005 +0000
@@ -450,6 +450,8 @@
 
 	if (!strcmp(status_id, "away")) {
 		args[0] = gaim_status_get_attr_string(status, "message");
+		if ((args[0] == NULL) || (*args[0] == '\0'))
+			args[0] = _("Away");
 		irc_cmd_away(irc, "away", NULL, args);
 	}
 }
--- a/src/protocols/irc/msgs.c	Mon Nov 07 03:44:30 2005 +0000
+++ b/src/protocols/irc/msgs.c	Mon Nov 07 04:49:23 2005 +0000
@@ -437,6 +437,7 @@
 void irc_msg_endmotd(struct irc_conn *irc, const char *name, const char *from, char **args)
 {
 	GaimConnection *gc;
+	GaimStatus *status;
 	GaimBlistNode *gnode, *cnode, *bnode;
 
 	gc = gaim_account_get_connection(irc->account);
@@ -445,6 +446,14 @@
 
 	gaim_connection_set_state(gc, GAIM_CONNECTED);
 
+	/* If we're away then set our away message */
+	status = gaim_account_get_active_status(irc->account);
+	if (!gaim_status_get_type(status) != GAIM_STATUS_AVAILABLE)
+	{
+		GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
+		prpl_info->set_status(irc->account, status);
+	}
+
 	/* this used to be in the core, but it's not now */
 	for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
 		if(!GAIM_BLIST_NODE_IS_GROUP(gnode))