Fix changeset 0c78d31c753d
If encryption is not required, send the original message.
--- 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);