[pkg-otr-team] [irssi-plugin-otr] 15/167: Reinstate sending of TLV_DISCONNECT at gaim quit time, but only for v2 sessions (which can handle it).

Holger Levsen holger at moszumanska.debian.org
Mon Mar 3 21:55:29 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 3b28f835955047e6da303cfefa9f9791d0b60cf2
Author: cypherpunk <cypherpunk>
Date:   Thu Oct 27 16:01:59 2005 +0000

    Reinstate sending of TLV_DISCONNECT at gaim quit time, but only for v2
    sessions (which can handle it).
---
 otr-plugin.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/otr-plugin.c b/otr-plugin.c
index 4e95d59..761a4e6 100644
--- a/otr-plugin.c
+++ b/otr-plugin.c
@@ -509,6 +509,20 @@ 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;
+	if (context->msgstate == OTRL_MSGSTATE_ENCRYPTED &&
+		context->protocol_version > 1) {
+	    otrg_plugin_disconnect(context);
+	}
+	context = next;
+    }
+}
+
 static guint button_type_cbid;
 
 static gboolean otr_plugin_load(GaimPlugin *handle)
@@ -518,6 +532,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 +553,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 +581,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