Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/otr.c @ 2218:b56be18d5a04
Update OTR comments
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 05 Nov 2015 23:29:59 +0100 |
parents | c9640971beec |
children | 3958793d0d03 |
comparison
equal
deleted
inserted
replaced
2217:c9640971beec | 2218:b56be18d5a04 |
---|---|
544 } | 544 } |
545 } | 545 } |
546 | 546 |
547 #endif /* HAVE_LIBOTR3 */ | 547 #endif /* HAVE_LIBOTR3 */ |
548 | 548 |
549 /* | 549 /* otr_receive |
550 * returns whether a otr_message was received | 550 * Returns whether a otr_message was received. |
551 * sets *otr_data to NULL, when it was an internal otr message | 551 * Sets *otr_data to NULL, when it was an internal otr message. |
552 */ | 552 */ |
553 int otr_receive(char **otr_data, const char *buddy, int *free_msg) | 553 int otr_receive(char **otr_data, const char *buddy, int *free_msg) |
554 { | 554 { |
555 int ignore_message; | 555 int ignore_message; |
556 char *newmessage = NULL; | 556 char *newmessage = NULL; |
596 return 1; | 596 return 1; |
597 } | 597 } |
598 return 0; | 598 return 0; |
599 } | 599 } |
600 | 600 |
601 /* otr_send | |
602 * Returns a newly allocated string, or NULL if no message should be sent. | |
603 * Sets *encryption_status to 1 if "the otr context is encrypted or otr tries | |
604 * to establish a session before the message is sent". | |
605 * (If the session isn't established, but the user choose "otr required", then | |
606 * the string just contains the "initiate session" message, not the message of | |
607 * the user.) | |
608 */ | |
601 char *otr_send(const char *msg, const char *buddy, int *encryption_status) | 609 char *otr_send(const char *msg, const char *buddy, int *encryption_status) |
602 { | 610 { |
603 gcry_error_t err; | 611 gcry_error_t err; |
604 char *newmessage = NULL; | 612 char *newmessage = NULL; |
605 char *htmlmsg, *rmsg; | 613 char *htmlmsg, *rmsg; |
643 ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) | 651 ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) |
644 *encryption_status = 1; | 652 *encryption_status = 1; |
645 | 653 |
646 if (!newmessage) { | 654 if (!newmessage) { |
647 if (*encryption_status == 1) | 655 if (*encryption_status == 1) |
648 return NULL; // This message should have been encrypted | 656 return NULL; /* This message should have been encrypted */ |
649 | 657 |
650 // If not, the encryption was not required - send the original message | 658 /* If not, the encryption was not required - send the original message */ |
651 return g_strdup(msg); | 659 return g_strdup(msg); |
652 } | 660 } |
653 | 661 |
654 /* Check the new message is not empty */ | 662 /* Check the new message is not empty */ |
655 if (newmessage[0] || !msg[0]) { | 663 if (newmessage[0] || !msg[0]) { |