Merge with sync sequoia_windows
authorThomas
Mon, 12 Aug 2019 07:33:19 +0200
branchsequoia_windows
changeset 3993ef96c3b93658
parent 3992 8bbc10703e00
parent 3991 7ca5149ea5b4
child 4007 3d1380b469e3
Merge with sync
     1.1 --- a/src/message_api.c	Fri Aug 09 14:39:33 2019 +0200
     1.2 +++ b/src/message_api.c	Mon Aug 12 07:33:19 2019 +0200
     1.3 @@ -3414,36 +3414,31 @@
     1.4  
     1.5      /*** End init ***/
     1.6  
     1.7 -    // KB: FIXME - we should do this once we've seen an inner message in the case 
     1.8 -    // of pEp users. Since we've not used 1.0 in a billion years (but will receive 
     1.9 -    // 1.0 messages from pEp users who don't yet know WE are pEp users), we should 
    1.10 -    // sort this out sanely, not upfront.
    1.11 -    //
    1.12 -    // Was: Ok, before we do anything, if it's a pEp message, regardless of whether it's
    1.13 +    // Ok, before we do anything, if it's a pEp message, regardless of whether it's
    1.14      // encrypted or not, we set the sender as a pEp user. This has NOTHING to do
    1.15      // with the key.
    1.16 -    // if (src->from && !(is_me(session, src->from))) {
    1.17 -    //     if (is_pEp_msg) {
    1.18 -    //         pEp_identity* tmp_from = src->from;
    1.19 -    // 
    1.20 -    //         // Ensure there's a user id
    1.21 -    //         if (EMPTYSTR(tmp_from->user_id) && tmp_from->address) {
    1.22 -    //             status = update_identity(session, tmp_from);
    1.23 -    //             if (status == PEP_CANNOT_FIND_IDENTITY) {
    1.24 -    //                 tmp_from->user_id = calloc(1, strlen(tmp_from->address) + 6);
    1.25 -    //                 if (!tmp_from->user_id)
    1.26 -    //                     return PEP_OUT_OF_MEMORY;
    1.27 -    //                 snprintf(tmp_from->user_id, strlen(tmp_from->address) + 6,
    1.28 -    //                          "TOFU_%s", tmp_from->address);        
    1.29 -    //                 status = PEP_STATUS_OK;
    1.30 -    //             }
    1.31 -    //         }
    1.32 -    //         if (status == PEP_STATUS_OK) {
    1.33 -    //             // Now set user as PEP (may also create an identity if none existed yet)
    1.34 -    //             status = set_as_pEp_user(session, tmp_from);
    1.35 -    //         }
    1.36 -    //     }
    1.37 -    // }
    1.38 +    if (src->from && !(is_me(session, src->from))) {
    1.39 +        if (is_pEp_msg) {
    1.40 +            pEp_identity* tmp_from = src->from;
    1.41 +    
    1.42 +            // Ensure there's a user id
    1.43 +            if (EMPTYSTR(tmp_from->user_id) && tmp_from->address) {
    1.44 +                status = update_identity(session, tmp_from);
    1.45 +                if (status == PEP_CANNOT_FIND_IDENTITY) {
    1.46 +                    tmp_from->user_id = calloc(1, strlen(tmp_from->address) + 6);
    1.47 +                    if (!tmp_from->user_id)
    1.48 +                        return PEP_OUT_OF_MEMORY;
    1.49 +                    snprintf(tmp_from->user_id, strlen(tmp_from->address) + 6,
    1.50 +                             "TOFU_%s", tmp_from->address);        
    1.51 +                    status = PEP_STATUS_OK;
    1.52 +                }
    1.53 +            }
    1.54 +            if (status == PEP_STATUS_OK) {
    1.55 +                // Now set user as PEP (may also create an identity if none existed yet)
    1.56 +                status = set_as_pEp_user(session, tmp_from);
    1.57 +            }
    1.58 +        }
    1.59 +    }
    1.60      // We really need key used in signing to do anything further on the pEp comm_type.
    1.61      // So we can't adjust the rating of the sender just yet.
    1.62