1.1 --- a/src/message_api.c Thu May 07 22:48:54 2015 +0200
1.2 +++ b/src/message_api.c Fri May 08 10:27:54 2015 +0200
1.3 @@ -105,20 +105,25 @@
1.4 msg->attachments = bl;
1.5 }
1.6
1.7 -void determine_encryption_format(message *msg)
1.8 +PEP_cryptotech determine_encryption_format(message *msg)
1.9 {
1.10 assert(msg);
1.11
1.12 - if (msg->enc_format != PEP_enc_none)
1.13 - return;
1.14 -
1.15 - if (is_PGP_message_text(msg->longmsg))
1.16 + if (is_PGP_message_text(msg->longmsg)) {
1.17 msg->enc_format = PEP_enc_pieces;
1.18 + return PEP_crypt_OpenPGP;
1.19 + }
1.20 else if (msg->attachments && msg->attachments->next &&
1.21 is_mime_type(msg->attachments, "multipart/encrypted") &&
1.22 is_PGP_message_text(msg->attachments->next->data)
1.23 - )
1.24 + ) {
1.25 msg->enc_format = PEP_enc_PGP_MIME;
1.26 + return PEP_crypt_OpenPGP;
1.27 + }
1.28 + else {
1.29 + msg->enc_format = PEP_enc_none;
1.30 + return PEP_crypt_none;
1.31 + }
1.32 }
1.33
1.34 static char * combine_short_and_long(const char *shortmsg, const char *longmsg)
1.35 @@ -817,16 +822,16 @@
1.36
1.37 if (!is_PGP_message_text(src->longmsg)) {
1.38 status = PEP_UNENCRYPTED;
1.39 - goto pep_error;
1.40 }
1.41 + else {
1.42 + ctext = src->longmsg;
1.43 + csize = strlen(src->longmsg);
1.44
1.45 - ctext = src->longmsg;
1.46 - csize = strlen(src->longmsg);
1.47 -
1.48 - status = decrypt_and_verify(session, ctext, csize, &ptext, &psize,
1.49 - &_keylist);
1.50 - if (status > PEP_CANNOT_DECRYPT_UNKNOWN)
1.51 - goto pep_error;
1.52 + status = decrypt_and_verify(session, ctext, csize, &ptext, &psize,
1.53 + &_keylist);
1.54 + if (status > PEP_CANNOT_DECRYPT_UNKNOWN)
1.55 + goto pep_error;
1.56 + }
1.57
1.58 *color = decrypt_color(status);
1.59 if (*color != PEP_rating_under_attack && _keylist) {
2.1 --- a/src/message_api.h Thu May 07 22:48:54 2015 +0200
2.2 +++ b/src/message_api.h Fri May 08 10:27:54 2015 +0200
2.3 @@ -11,7 +11,7 @@
2.4
2.5 void import_attached_keys(PEP_SESSION session, const message *msg);
2.6 void attach_own_key(PEP_SESSION session, message *msg);
2.7 -
2.8 +PEP_cryptotech determine_encryption_format(message *msg);
2.9
2.10 // encrypt_message() - encrypt message in memory
2.11 //