Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/otr.c @ 2215:ba1a770dd632
Fix changeset 0c78d31c753d
If encryption is not required, send the original message.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 05 Nov 2015 20:54:22 +0100 |
parents | 0c78d31c753d |
children | c9640971beec |
comparison
equal
deleted
inserted
replaced
2214:ae1cb5b25e51 | 2215:ba1a770dd632 |
---|---|
634 NULL, NULL, NULL); | 634 NULL, NULL, NULL); |
635 #endif | 635 #endif |
636 g_free(htmlmsg); | 636 g_free(htmlmsg); |
637 } | 637 } |
638 | 638 |
639 if (err || !newmessage) | 639 if (err) |
640 return NULL; /* something went wrong, don't send the plain-message! */ | 640 return NULL; /* something went wrong, don't send the plain-message! */ |
641 | 641 |
642 if (cb_policy(NULL, ctx) & OTRL_POLICY_REQUIRE_ENCRYPTION || | 642 if (cb_policy(NULL, ctx) & OTRL_POLICY_REQUIRE_ENCRYPTION || |
643 ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) | 643 ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) |
644 *encryption_status = 1; | 644 *encryption_status = 1; |
645 | |
646 if (!newmessage) { | |
647 if (*encryption_status == 1) | |
648 return NULL; // This message should have been encrypted | |
649 | |
650 // If not, the encryption was not required - send the original message | |
651 return g_strdup(msg); | |
652 } | |
645 | 653 |
646 /* Check the new message is not empty */ | 654 /* Check the new message is not empty */ |
647 if (newmessage[0] || !msg[0]) { | 655 if (newmessage[0] || !msg[0]) { |
648 rmsg = g_strdup(newmessage); | 656 rmsg = g_strdup(newmessage); |
649 } else { | 657 } else { |