changeset 2847:e49bd1479edd

[gaim-migrate @ 2860] apathy by seanegan. i mean. apache by seanegan. i'm so lame. a patch by seanegan. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 05 Dec 2001 10:15:18 +0000
parents 4b3f17ca66bf
children de0d75f84a37
files src/protocols/irc/irc.c
diffstat 1 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/irc/irc.c	Wed Dec 05 09:48:56 2001 +0000
+++ b/src/protocols/irc/irc.c	Wed Dec 05 10:15:18 2001 +0000
@@ -866,7 +866,9 @@
 			nick[ex - pdibuf] = 0; /* cut the buffer at the '!' */
 	}
 
-	if (!strcmp(cmd, "INVITE")) { /* */
+	if (!strcmp(cmd, "INVITE")) {
+		char *chan = g_strdup(word[4]);
+		serv_got_chat_invite(gc, chan + 1, nick, NULL, g_list_append(NULL, chan));
 	} else if (!strcmp(cmd, "JOIN")) {
 		char *chan = *word[3] == ':' ? word[3] + 1 : word[3];
 		if (!g_strcasecmp(gc->displayname, nick)) {
@@ -1282,6 +1284,10 @@
 		g_snprintf(buf, sizeof(buf), "PRIVMSG %s :\001ACTION %s\001\r\n", who, word_eol[2]);
 		irc_write(id->fd, buf, strlen(buf));
 		return 1;
+	} else if (!g_strcasecmp(pdibuf, "INVITE")) {
+		char buf[IRC_BUF_LEN];
+		g_snprintf(buf, sizeof(buf), "INVITE %s\r\n", word_eol[2]);
+		irc_write(id->fd, buf, strlen(buf));
 	} else if (!g_strcasecmp(pdibuf, "TOPIC")) {
 		if (!*word_eol[2])
 			return -EINVAL;
@@ -1367,9 +1373,10 @@
 		if (!c)
 			return -EINVAL;
 		write_to_conv(c, "<B>Currently supported commands:<BR>"
-				 "JOIN PART LIST TOPIC WHOIS<BR>"
-				 "OP DEOP VOICE DEVOICE KICK<BR>"
-				 "NICK ME MSG QUOTE SAY</B>",
+				 "WHOIS INVITE NICK LIST<BR>"
+				 "JOIN PART TOPIC KICK<BR>"
+				 "OP DEOP VOICE DEVOICE<BR>"
+				 "ME MSG QUOTE SAY</B>",
 				 WFLAG_NOLOG, NULL, time(NULL));
 	} else {
 		struct conversation *c = NULL;
@@ -1408,6 +1415,14 @@
 		return handle_command(gc, who, what);
 }
 
+static void irc_chat_invite(struct gaim_connection *gc, int idn, char *message, char *name) {
+	char buf[IRC_BUF_LEN]; 
+	struct irc_data *id = gc->proto_data;
+	struct conversation *c = irc_find_chat_by_id(gc, idn);
+	g_snprintf(buf, sizeof(buf), "INVITE %s %s\r\n", name, c->name);
+	irc_write(id->fd, buf, strlen(buf));
+}
+
 static int irc_send_im(struct gaim_connection *gc, char *who, char *what, int flags)
 {
 	if (*who == '@' || *who == '+')
@@ -1550,6 +1565,7 @@
 	ret->set_away = irc_set_away;
 	ret->get_info = irc_get_info;
 	ret->buddy_menu = irc_buddy_menu;
+	ret->chat_invite = irc_chat_invite;
 	my_protocol = ret;
 }