changeset 8562:e3c059c3d92d

[gaim-migrate @ 9306] " This patch adds a call-back slot to the GaimPluginProtocolInfo structure which allows a prpl to receive notification when a chat invitation has been rejected by the local user. The patch modifies server.c to trigger the call-back, and adds NULL entries into the existing protocols to make them match the updated ABI. This is necessary for a protocol plugin which I have written, as the protocol needs to take action in the event of a conference rejection. It is my understanding that the Yahoo prpl may also benefit from this patch (it's supposed to be sending the rejection upstream to the server too, as I understand it)" --Christopher (siege) O'Brien committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 02 Apr 2004 06:54:52 +0000
parents 2d4ccd94e298
children 713b10dfd5ff
files COPYRIGHT src/protocols/gg/gg.c src/protocols/irc/irc.c src/protocols/jabber/jabber.c src/protocols/msn/msn.c src/protocols/napster/napster.c src/protocols/oscar/oscar.c src/protocols/toc/toc.c src/protocols/trepia/trepia.c src/protocols/yahoo/yahoo.c src/protocols/zephyr/zephyr.c src/prpl.h src/server.c src/server.h
diffstat 14 files changed, 35 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Fri Apr 02 06:18:14 2004 +0000
+++ b/COPYRIGHT	Fri Apr 02 06:54:52 2004 +0000
@@ -84,6 +84,7 @@
 Arkadiusz Miskiewicz
 Andrew Molloy
 Padraig O'Briain
+Christopher (siege) O'Brien
 Nathan (pianocomp81) Owens
 Matt Pandina
 Ricardo Fernandez Pascual
--- a/src/protocols/gg/gg.c	Fri Apr 02 06:18:14 2004 +0000
+++ b/src/protocols/gg/gg.c	Fri Apr 02 06:54:52 2004 +0000
@@ -1,6 +1,6 @@
 /*
  * gaim - Gadu-Gadu Protocol Plugin
- * $Id: gg.c 9172 2004-03-14 05:42:56Z lschiere $
+ * $Id: gg.c 9306 2004-04-02 06:54:52Z lschiere $
  *
  * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
  *
@@ -1345,6 +1345,7 @@
 	NULL,
 	NULL,
 	NULL,
+	NULL,
 	agg_keepalive,
 	NULL,
 	NULL,
--- a/src/protocols/irc/irc.c	Fri Apr 02 06:18:14 2004 +0000
+++ b/src/protocols/irc/irc.c	Fri Apr 02 06:54:52 2004 +0000
@@ -571,6 +571,7 @@
 	NULL,
 	NULL,
 	irc_chat_join,
+	NULL,  /* reject chat invite */
 	irc_chat_invite,
 	irc_chat_leave,
 	NULL,
--- a/src/protocols/jabber/jabber.c	Fri Apr 02 06:18:14 2004 +0000
+++ b/src/protocols/jabber/jabber.c	Fri Apr 02 06:54:52 2004 +0000
@@ -1308,6 +1308,7 @@
 	NULL,
 	NULL,
 	jabber_chat_join,
+	NULL,
 	jabber_chat_invite,
 	jabber_chat_leave,
 	NULL,
--- a/src/protocols/msn/msn.c	Fri Apr 02 06:18:14 2004 +0000
+++ b/src/protocols/msn/msn.c	Fri Apr 02 06:54:52 2004 +0000
@@ -1633,6 +1633,7 @@
 	msn_set_permit_deny,
 	NULL,
 	NULL,
+	NULL, /* reject chat invite */
 	msn_chat_invite,
 	msn_chat_leave,
 	NULL,
--- a/src/protocols/napster/napster.c	Fri Apr 02 06:18:14 2004 +0000
+++ b/src/protocols/napster/napster.c	Fri Apr 02 06:54:52 2004 +0000
@@ -599,6 +599,7 @@
 	NULL,
 	NULL,
 	nap_join_chat,
+	NULL, /* reject chat invite */
 	NULL,
 	nap_chat_leave,
 	NULL,
--- a/src/protocols/oscar/oscar.c	Fri Apr 02 06:18:14 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Fri Apr 02 06:54:52 2004 +0000
@@ -6946,6 +6946,7 @@
 	oscar_set_permit_deny,
 	oscar_warn,
 	oscar_join_chat,
+	NULL, /* reject chat invite */
 	oscar_chat_invite,
 	oscar_chat_leave,
 	NULL,
--- a/src/protocols/toc/toc.c	Fri Apr 02 06:18:14 2004 +0000
+++ b/src/protocols/toc/toc.c	Fri Apr 02 06:54:52 2004 +0000
@@ -2127,6 +2127,7 @@
 	toc_set_permit_deny,
 	toc_warn,
 	toc_join_chat,
+	NULL, /* reject chat invite */
 	toc_chat_invite,
 	toc_chat_leave,
 	toc_chat_whisper,
--- a/src/protocols/trepia/trepia.c	Fri Apr 02 06:18:14 2004 +0000
+++ b/src/protocols/trepia/trepia.c	Fri Apr 02 06:54:52 2004 +0000
@@ -1298,6 +1298,7 @@
 	NULL,
 	NULL,
 	NULL,
+	NULL,
 	trepia_register_user,
 	NULL,
 	NULL,
--- a/src/protocols/yahoo/yahoo.c	Fri Apr 02 06:18:14 2004 +0000
+++ b/src/protocols/yahoo/yahoo.c	Fri Apr 02 06:54:52 2004 +0000
@@ -3248,6 +3248,7 @@
 	yahoo_set_permit_deny,
 	NULL, /* warn */
 	yahoo_c_join,
+	NULL, /* reject chat invite */
 	yahoo_c_invite,
 	yahoo_c_leave,
 	NULL, /* chat whisper */
--- a/src/protocols/zephyr/zephyr.c	Fri Apr 02 06:18:14 2004 +0000
+++ b/src/protocols/zephyr/zephyr.c	Fri Apr 02 06:54:52 2004 +0000
@@ -1360,6 +1360,7 @@
 	NULL,
 	NULL,
 	zephyr_join_chat,
+        NULL, /* reject chat invite */
 	NULL,
 	zephyr_chat_leave,
 	NULL,
--- a/src/prpl.h	Fri Apr 02 06:18:14 2004 +0000
+++ b/src/prpl.h	Fri Apr 02 06:54:52 2004 +0000
@@ -281,6 +281,7 @@
 	void (*set_permit_deny)(GaimConnection *);
 	void (*warn)(GaimConnection *, const char *who, int anonymous);
 	void (*join_chat)(GaimConnection *, GHashTable *components);
+	void (*reject_chat)(GaimConnection *, GHashTable *components);
 	void (*chat_invite)(GaimConnection *, int id,
 						const char *who, const char *message);
 	void (*chat_leave)(GaimConnection *, int id);
--- a/src/server.c	Fri Apr 02 06:18:14 2004 +0000
+++ b/src/server.c	Fri Apr 02 06:54:52 2004 +0000
@@ -714,6 +714,18 @@
 		prpl_info->join_chat(g, data);
 }
 
+
+void serv_reject_chat(GaimConnection *g, GHashTable *data)
+{
+	GaimPluginProtocolInfo *prpl_info = NULL;
+
+	if (g != NULL && g->prpl != NULL)
+		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl);
+
+	if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->reject_chat)
+		prpl_info->reject_chat(g, data);
+}
+
 void serv_chat_invite(GaimConnection *g, int id, const char *message, const char *name)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
@@ -1323,10 +1335,17 @@
 	g_free(cid);
 }
 
+
+static void chat_invite_reject(struct chat_invite_data *cid)
+{
+	serv_reject_chat(cid->gc, cid->components);
+	chat_invite_data_free(cid);
+}
+
+
 static void chat_invite_accept(struct chat_invite_data *cid)
 {
 	serv_join_chat(cid->gc, cid->components);
-
 	chat_invite_data_free(cid);
 }
 
@@ -1359,7 +1378,7 @@
 	gaim_request_accept_cancel(gc, NULL, _("Accept chat invitation?"),
 							   buf2, 0, cid,
 							   G_CALLBACK(chat_invite_accept),
-							   G_CALLBACK(chat_invite_data_free));
+							   G_CALLBACK(chat_invite_reject));
 }
 
 GaimConversation *serv_got_joined_chat(GaimConnection *gc,
--- a/src/server.h	Fri Apr 02 06:18:14 2004 +0000
+++ b/src/server.h	Fri Apr 02 06:54:52 2004 +0000
@@ -68,6 +68,7 @@
 					 const char *, const char *, const char *, const char *,
 					 const char *, const char *);
 void serv_join_chat(GaimConnection *, GHashTable *);
+void serv_reject_chat(GaimConnection *, GHashTable *);
 void serv_chat_invite(GaimConnection *, int, const char *, const char *);
 void serv_chat_leave(GaimConnection *, int);
 void serv_chat_whisper(GaimConnection *, int, const char *, const char *);