# HG changeset patch # User Mikael Berthe # Date 1446753262 -3600 # Node ID ba1a770dd632ae7ac3dee00219ba5a9c1d561ee1 # Parent ae1cb5b25e51d71845efbe5cddb30dcf4c4ee2f0 Fix changeset 0c78d31c753d If encryption is not required, send the original message. diff -r ae1cb5b25e51 -r ba1a770dd632 mcabber/mcabber/otr.c --- a/mcabber/mcabber/otr.c Thu Nov 05 19:47:59 2015 +0100 +++ b/mcabber/mcabber/otr.c Thu Nov 05 20:54:22 2015 +0100 @@ -636,13 +636,21 @@ g_free(htmlmsg); } - if (err || !newmessage) + if (err) return NULL; /* something went wrong, don't send the plain-message! */ if (cb_policy(NULL, ctx) & OTRL_POLICY_REQUIRE_ENCRYPTION || ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) *encryption_status = 1; + if (!newmessage) { + if (*encryption_status == 1) + return NULL; // This message should have been encrypted + + // If not, the encryption was not required - send the original message + return g_strdup(msg); + } + /* Check the new message is not empty */ if (newmessage[0] || !msg[0]) { rmsg = g_strdup(newmessage);