Commit 3b28f835 authored by cypherpunk's avatar cypherpunk
Browse files

Reinstate sending of TLV_DISCONNECT at gaim quit time, but only for v2

sessions (which can handle it).
parent c4f9bd72
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment