# HG changeset patch # User franky # Date 1557436695 -7200 # Node ID 746d72c6e1b915c75e735b6a29cc039dadac1075 # Parent 1e24d93746d69910d47a2a873a7e9af5fb97161e Fix otr disconnected message for otrv4 diff -r 1e24d93746d6 -r 746d72c6e1b9 mcabber/mcabber/otr.c --- 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;