1.1 --- a/src/message_api.c Tue Apr 26 11:44:14 2016 +0200
1.2 +++ b/src/message_api.c Wed Apr 27 01:09:07 2016 +0200
1.3 @@ -963,13 +963,25 @@
1.4 PEP_comm_type max_comm_type = PEP_ct_pEp;
1.5
1.6 identity_list * _il;
1.7 - for (_il = src->to; _il && _il->ident; _il = _il->next) {
1.8 +
1.9 + if ((_il = src->bcc) && _il->ident)
1.10 + {
1.11 + // BCC limited support:
1.12 + // - App splits mails with BCC in multiple mails.
1.13 + // - Each email is encrypted separately
1.14 +
1.15 + if(_il->next || src->to || src->cc)
1.16 + {
1.17 + // Only one Bcc with no other recipient allowed for now
1.18 + return PEP_ILLEGAL_VALUE;
1.19 + }
1.20 +
1.21 PEP_STATUS _status = update_identity(session, _il->ident);
1.22 if (_status != PEP_STATUS_OK) {
1.23 status = _status;
1.24 goto pep_error;
1.25 }
1.26 -
1.27 +
1.28 if (_il->ident->fpr && _il->ident->fpr[0]) {
1.29 _k = stringlist_add(_k, _il->ident->fpr);
1.30 if (_k == NULL)
1.31 @@ -980,27 +992,49 @@
1.32 else {
1.33 dest_keys_found = false;
1.34 status = PEP_KEY_NOT_FOUND;
1.35 - }
1.36 + }
1.37 }
1.38 + else
1.39 + {
1.40 + for (_il = src->to; _il && _il->ident; _il = _il->next) {
1.41 + PEP_STATUS _status = update_identity(session, _il->ident);
1.42 + if (_status != PEP_STATUS_OK) {
1.43 + status = _status;
1.44 + goto pep_error;
1.45 + }
1.46
1.47 - for (_il = src->cc; _il && _il->ident; _il = _il->next) {
1.48 - PEP_STATUS _status = update_identity(session, _il->ident);
1.49 - if (_status != PEP_STATUS_OK)
1.50 - {
1.51 - status = _status;
1.52 - goto pep_error;
1.53 + if (_il->ident->fpr && _il->ident->fpr[0]) {
1.54 + _k = stringlist_add(_k, _il->ident->fpr);
1.55 + if (_k == NULL)
1.56 + goto enomem;
1.57 + max_comm_type = _get_comm_type(session, max_comm_type,
1.58 + _il->ident);
1.59 + }
1.60 + else {
1.61 + dest_keys_found = false;
1.62 + status = PEP_KEY_NOT_FOUND;
1.63 + }
1.64 }
1.65
1.66 - if (_il->ident->fpr && _il->ident->fpr[0]) {
1.67 - _k = stringlist_add(_k, _il->ident->fpr);
1.68 - if (_k == NULL)
1.69 - goto enomem;
1.70 - max_comm_type = _get_comm_type(session, max_comm_type,
1.71 - _il->ident);
1.72 - }
1.73 - else {
1.74 - dest_keys_found = false;
1.75 - status = PEP_KEY_NOT_FOUND;
1.76 + for (_il = src->cc; _il && _il->ident; _il = _il->next) {
1.77 + PEP_STATUS _status = update_identity(session, _il->ident);
1.78 + if (_status != PEP_STATUS_OK)
1.79 + {
1.80 + status = _status;
1.81 + goto pep_error;
1.82 + }
1.83 +
1.84 + if (_il->ident->fpr && _il->ident->fpr[0]) {
1.85 + _k = stringlist_add(_k, _il->ident->fpr);
1.86 + if (_k == NULL)
1.87 + goto enomem;
1.88 + max_comm_type = _get_comm_type(session, max_comm_type,
1.89 + _il->ident);
1.90 + }
1.91 + else {
1.92 + dest_keys_found = false;
1.93 + status = PEP_KEY_NOT_FOUND;
1.94 + }
1.95 }
1.96 }
1.97
1.98 @@ -1372,8 +1406,10 @@
1.99 if (status != PEP_STATUS_OK)
1.100 return status;
1.101
1.102 - for (il = msg->to; il != NULL; il = il->next) {
1.103 - if (il->ident) {
1.104 + for (il = msg->to; il != NULL; il = il->next)
1.105 + {
1.106 + if (il->ident)
1.107 + {
1.108 update_identity(session, il->ident);
1.109 max_comm_type = _get_comm_type(session, max_comm_type,
1.110 il->ident);
1.111 @@ -1381,14 +1417,27 @@
1.112 }
1.113 }
1.114
1.115 - for (il = msg->cc; il != NULL; il = il->next) {
1.116 - if (il->ident) {
1.117 + for (il = msg->cc; il != NULL; il = il->next)
1.118 + {
1.119 + if (il->ident)
1.120 + {
1.121 update_identity(session, il->ident);
1.122 max_comm_type = _get_comm_type(session, max_comm_type,
1.123 il->ident);
1.124 comm_type_determined = true;
1.125 }
1.126 }
1.127 +
1.128 + for (il = msg->bcc; il != NULL; il = il->next)
1.129 + {
1.130 + if (il->ident)
1.131 + {
1.132 + update_identity(session, il->ident);
1.133 + max_comm_type = _get_comm_type(session, max_comm_type,
1.134 + il->ident);
1.135 + comm_type_determined = true;
1.136 + }
1.137 + }
1.138
1.139 if (comm_type_determined == false)
1.140 *color = PEP_rating_undefined;