/soc/2015/koosha/main: 167e69a881ee: Define a new signal 'jabber...

Koosha Khajehmoogahi koosha at posteo.de
Fri Jun 26 19:58:17 EDT 2015


Changeset: 167e69a881eee19d12cd750a0e6fc6bea28e4daa
Author:	 Koosha Khajehmoogahi <koosha at posteo.de>
Date:	 2015-06-23 04:19 +0200
Branch:	 default
URL: https://hg.pidgin.im/soc/2015/koosha/main/rev/167e69a881ee

Description:

Define a new signal 'jabber-message-delivered'

diffstat:

 libpurple/plugins/signals-test.c     |  8 ++++++++
 libpurple/protocols/jabber/jabber.c  |  6 ++++++
 libpurple/protocols/jabber/message.c |  1 +
 3 files changed, 15 insertions(+), 0 deletions(-)

diffs (52 lines):

diff --git a/libpurple/plugins/signals-test.c b/libpurple/plugins/signals-test.c
--- a/libpurple/plugins/signals-test.c
+++ b/libpurple/plugins/signals-test.c
@@ -692,6 +692,12 @@ jabber_watched_iq(PurpleConnection *pc, 
 	return TRUE;
 }
 
+static void
+jabber_message_delivered(PurpleConnection *pc, const char *id)
+{
+	purple_debug_misc("signals test", "jabber message delivered (id=%s)\n", id);
+}
+
 /**************************************************************************
  * Plugin stuff
  **************************************************************************/
@@ -888,6 +894,8 @@ plugin_load(PurplePlugin *plugin, GError
 
 		purple_signal_connect(jabber_handle, "jabber-watched-iq", plugin,
 		                      PURPLE_CALLBACK(jabber_watched_iq), NULL);
+		purple_signal_connect(jabber_handle, "jabber-message-delivered", plugin,
+		                      PURPLE_CALLBACK(jabber_message_delivered), NULL);
 	}
 
 	return TRUE;
diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c
--- a/libpurple/protocols/jabber/jabber.c
+++ b/libpurple/protocols/jabber/jabber.c
@@ -4122,6 +4122,12 @@ static void jabber_init_protocol(PurpleP
 			G_TYPE_STRING, /* type */
 			G_TYPE_STRING, /* from */
 			PURPLE_TYPE_XMLNODE);
+
+	purple_signal_register(protocol, "jabber-message-delivered",
+			purple_marshal_VOID__POINTER_POINTER,
+			G_TYPE_NONE, 2,
+			PURPLE_TYPE_CONNECTION,
+			G_TYPE_STRING); /* id */
 }
 
 static void jabber_uninit_protocol(PurpleProtocol *protocol)
diff --git a/libpurple/protocols/jabber/message.c b/libpurple/protocols/jabber/message.c
--- a/libpurple/protocols/jabber/message.c
+++ b/libpurple/protocols/jabber/message.c
@@ -77,6 +77,7 @@ static gboolean remove_pending_receipt(J
 	pending_msg = (JabberMessage *) g_hash_table_lookup(pending_receipts, jm->id);
 	if (pending_msg != NULL) {
 		g_hash_table_remove(pending_receipts, jm->id);
+		purple_signal_emit(purple_connection_get_protocol(jm->js->gc), "jabber-message-delivered", jm->js->gc, jm->id);
 		return TRUE;
 	}
 



More information about the Commits mailing list