[pkg-otr-team] [irssi-plugin-otr] 08/167: * otr-plugin.c: Disconnect all contexts when gaim is about to quit.

Holger Levsen holger at moszumanska.debian.org
Mon Mar 3 21:55:28 UTC 2014


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to tag 4.0.0
in repository irssi-plugin-otr.

commit b502e7a92fb2479d3a1bbb95e727d7d1b1625a49
Author: cypherpunk <cypherpunk>
Date:   Thu Aug 4 17:37:34 2005 +0000

    	* otr-plugin.c: Disconnect all contexts when gaim is about to
    	quit.
---
 ChangeLog    |  5 +++++
 otr-plugin.c | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 688d79e..582bc20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-04
+
+	* otr-plugin.c: Disconnect all contexts when gaim is about to
+	quit.
+
 2005-07-29
 
 	* otr-plugin.c (confirm_fingerprint_cb): Match the changing
diff --git a/otr-plugin.c b/otr-plugin.c
index c3b5a52..4e83b07 100644
--- a/otr-plugin.c
+++ b/otr-plugin.c
@@ -32,6 +32,7 @@
 
 /* gaim headers */
 #include "gaim.h"
+#include "core.h"
 #include "notify.h"
 #include "version.h"
 #include "util.h"
@@ -509,6 +510,17 @@ TrustLevel otrg_plugin_context_to_trust(ConnContext *context)
     return level;
 }
 
+/* Send the OTRL_TLV_DISCONNECTED packets when we're about to quit. */
+static void process_quitting(void)
+{
+    ConnContext *context = otrg_plugin_userstate->context_root;
+    while(context) {
+	ConnContext *next = context->next;
+	otrg_plugin_disconnect(context);
+	context = next;
+    }
+}
+
 static guint button_type_cbid;
 
 static gboolean otr_plugin_load(GaimPlugin *handle)
@@ -518,6 +530,7 @@ static gboolean otr_plugin_load(GaimPlugin *handle)
     void *conv_handle = gaim_conversations_get_handle();
     void *conn_handle = gaim_connections_get_handle();
     void *blist_handle = gaim_blist_get_handle();
+    void *core_handle = gaim_get_core();
 
     if (!privkeyfile || !storefile) {
 	g_free(privkeyfile);
@@ -538,6 +551,8 @@ static gboolean otr_plugin_load(GaimPlugin *handle)
 
     otrg_ui_update_fingerprint();
 
+    gaim_signal_connect(core_handle, "quitting", otrg_plugin_handle,
+	    GAIM_CALLBACK(process_quitting), NULL);
     gaim_signal_connect(conv_handle, "sending-im-msg", otrg_plugin_handle,
             GAIM_CALLBACK(process_sending_im), NULL);
     gaim_signal_connect(conv_handle, "receiving-im-msg", otrg_plugin_handle,
@@ -564,11 +579,14 @@ static gboolean otr_plugin_unload(GaimPlugin *handle)
     void *conv_handle = gaim_conversations_get_handle();
     void *conn_handle = gaim_connections_get_handle();
     void *blist_handle = gaim_blist_get_handle();
+    void *core_handle = gaim_get_core();
 
     /* Clean up all of our state. */
     otrl_userstate_free(otrg_plugin_userstate);
     otrg_plugin_userstate = NULL;
 
+    gaim_signal_disconnect(core_handle, "quitting", otrg_plugin_handle,
+	    GAIM_CALLBACK(process_quitting));
     gaim_signal_disconnect(conv_handle, "sending-im-msg", otrg_plugin_handle,
             GAIM_CALLBACK(process_sending_im));
     gaim_signal_disconnect(conv_handle, "receiving-im-msg", otrg_plugin_handle,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-otr/packages/irssi-plugin-otr.git



More information about the Pkg-otr-team mailing list