diff src/util.c @ 1254:9da444224f0e

[gaim-migrate @ 1264] bmiller's away-on-signon patch. does --away=mesg use "mesg" or the away message titled "mesg"? i didn't look hehe. but if it uses "mesg" instead of the away message titled "mesg" then i'm not sure it works.... i figured someone would report a bug if it didn't work committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 14 Dec 2000 00:11:59 +0000
parents 46c09828e929
children 677e2c9e8baf
line wrap: on
line diff
--- a/src/util.c	Wed Dec 13 23:59:46 2000 +0000
+++ b/src/util.c	Thu Dec 14 00:11:59 2000 +0000
@@ -1103,6 +1103,8 @@
 	case 0:		/* full help text */
 		printf("Usage: %s [OPTION]...\n\n"
 		       "  -a, --acct          display account editor window\n"
+		       "  -w, --away[=MESG]   make away on signon (optional argument MESG specifies\n"
+		       "                      name of away message to use)\n"
 		       "  -l, --login[=NAME]  automatically login (optional argument NAME specifies\n"
 		       "                      account(s) to use)\n"
 		       "  -u, --user=NAME     use account NAME\n"
@@ -1270,3 +1272,33 @@
 			*dest++ = *src++;
 	}
 }
+
+
+void away_on_login (char *mesg)
+{
+	GSList *awy = away_messages;
+	struct away_message *a, *message = NULL;
+	
+	if (!blist) {
+		return;
+	}
+
+	if (mesg == NULL) {
+		/* Use default message */
+		do_away_message((GtkWidget*)NULL, default_away);
+	} else {
+		/* Use argument */
+		while (awy) {
+			a = (struct away_message *)awy->data;
+			if (strcmp (a->name, mesg) == 0) {
+				message = a;
+				break;
+			}
+			awy = awy->next;
+		}
+		if (message == NULL)
+			message = default_away;
+		do_away_message((GtkWidget*)NULL, message);
+	}
+	return;
+}