Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/otr.c @ 2219:3958793d0d03
otr_send: Fix my previous fix and abort if the initial message is empty
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 05 Nov 2015 23:34:23 +0100 |
parents | b56be18d5a04 |
children | f3bd1564fa70 |
comparison
equal
deleted
inserted
replaced
2218:b56be18d5a04 | 2219:3958793d0d03 |
---|---|
611 gcry_error_t err; | 611 gcry_error_t err; |
612 char *newmessage = NULL; | 612 char *newmessage = NULL; |
613 char *htmlmsg, *rmsg; | 613 char *htmlmsg, *rmsg; |
614 ConnContext *ctx = otr_get_context(buddy); | 614 ConnContext *ctx = otr_get_context(buddy); |
615 | 615 |
616 if (!encryption_status) | |
617 return NULL; | |
618 | |
616 *encryption_status = 0; | 619 *encryption_status = 0; |
617 | 620 |
618 if (!msg || !buddy || !*encryption_status) | 621 if (!buddy || !msg || !msg[0]) |
619 return NULL; | 622 return NULL; |
620 | 623 |
621 if (ctx->msgstate == OTRL_MSGSTATE_PLAINTEXT) | 624 if (ctx->msgstate == OTRL_MSGSTATE_PLAINTEXT) |
622 err = otrl_message_sending(userstate, &ops, NULL, ctx->accountname, | 625 err = otrl_message_sending(userstate, &ops, NULL, ctx->accountname, |
623 #ifdef HAVE_LIBOTR3 | 626 #ifdef HAVE_LIBOTR3 |
658 /* If not, the encryption was not required - send the original message */ | 661 /* If not, the encryption was not required - send the original message */ |
659 return g_strdup(msg); | 662 return g_strdup(msg); |
660 } | 663 } |
661 | 664 |
662 /* Check the new message is not empty */ | 665 /* Check the new message is not empty */ |
663 if (newmessage[0] || !msg[0]) { | 666 if (newmessage[0]) { |
664 rmsg = g_strdup(newmessage); | 667 rmsg = g_strdup(newmessage); |
665 } else { | 668 } else { |
666 rmsg = NULL; | 669 rmsg = NULL; |
667 *encryption_status = 0; | 670 *encryption_status = 0; |
668 } | 671 } |