changeset 2329:746d72c6e1b9

Fix otr disconnected message for otrv4
author franky
date Thu, 09 May 2019 23:18:15 +0200
parents 1e24d93746d6
children 3385a4bb62ef
files mcabber/mcabber/otr.c
diffstat 1 files changed, 11 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/otr.c	Thu May 09 21:19:31 2019 +0200
+++ b/mcabber/mcabber/otr.c	Thu May 09 23:18:15 2019 +0200
@@ -552,36 +552,34 @@
 {
   int ignore_message;
   char *newmessage = NULL;
-#ifdef HAVE_LIBOTR3
   OtrlTLV *tlvs = NULL;
   OtrlTLV *tlv = NULL;
-#endif
   ConnContext *ctx;
 
   ctx = otr_get_context(buddy);
   *free_msg = 0;
+
+  if (!ctx)
+    return 0;
+
   ignore_message = otrl_message_receiving(userstate, &ops, NULL,
                                           ctx->accountname, ctx->protocol,
                                           ctx->username, *otr_data,
 #ifdef HAVE_LIBOTR3
                                           &newmessage, &tlvs, NULL, NULL);
+  otr_handle_smp_tlvs(tlvs, ctx);
+#else
+                                          &newmessage, &tlvs, NULL, NULL, NULL);
+#endif
 
   tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
   if (tlv) {
     /* Notify the user that the other side disconnected. */
-    if (ctx) {
-      cb_gone_insecure(NULL, ctx);
-      otr_disconnect(ctx->username);
-    }
+    cb_gone_insecure(NULL, ctx);
+    otr_disconnect(ctx->username);
   }
 
-  otr_handle_smp_tlvs(tlvs, ctx);
-
-  if (tlvs != NULL)
-    otrl_tlv_free(tlvs);
-#else
-                                          &newmessage, NULL, NULL, NULL, NULL);
-#endif
+  otrl_tlv_free(tlvs);
 
   if (ignore_message)
     *otr_data = NULL;