changeset 1676:a3d857c8984e

[gaim-migrate @ 1686] IRC got away message support. committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Sat, 31 Mar 2001 22:46:54 +0000
parents 3232467ae220
children 27e5acfe2ed5
files ChangeLog plugins/irc.c
diffstat 2 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Mar 31 07:06:55 2001 +0000
+++ b/ChangeLog	Sat Mar 31 22:46:54 2001 +0000
@@ -5,6 +5,7 @@
 	* Can choose to not send away auto-response (thanks phzzzt)
 	* Uh... Oscar works? For now?
 	* IRC Plugin can do whois (right click and info)
+	* IRC Plugin got away message support
 
 version 0.11.0-pre9 (03/26/2001):
 	* Can register Jabber accounts (load the Jabber plugin and click
--- a/plugins/irc.c	Sat Mar 31 07:06:55 2001 +0000
+++ b/plugins/irc.c	Sat Mar 31 22:46:54 2001 +0000
@@ -450,6 +450,18 @@
 		g_strfreev(res);
 	}
 
+	/* Autoresponse to an away message */
+	if (((strstr(buf, " 301 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) {
+		char **res;
+
+		res = g_strsplit(buf, " ", 5);
+
+		if (!strcmp(res[1], "301"))
+			serv_got_im(gc, res[3], res[4] + 1, 1);
+
+		g_strfreev(res);
+	}
+
 	/* Parse the list of names that we receive when we first sign on to
 	 * a channel */
 
@@ -1254,6 +1266,19 @@
 }
 
 
+static void irc_set_away(struct gaim_connection *gc, char *state, char *msg)
+{
+	struct irc_data *idata = (struct irc_data *)gc->proto_data;
+	char buf[BUF_LEN];
+
+	if (msg)
+		g_snprintf(buf, BUF_LEN, "AWAY :%s\n", msg);		
+	else
+		g_snprintf(buf, BUF_LEN, "AWAY\n");		
+
+	write(idata->fd, buf, strlen(buf));
+}
+
 static struct prpl *my_protocol = NULL;
 
 static void irc_init(struct prpl *ret)
@@ -1270,6 +1295,7 @@
 	ret->chat_leave = irc_chat_leave;
 	ret->chat_send = irc_chat_send;
 	ret->get_info = irc_get_info;
+	ret->set_away = irc_set_away;
 
 	my_protocol = ret;
 }