src/message_api.c
branchsync
changeset 3413 206593c06991
parent 3404 8b7d693bebfe
child 3475 71e0a8ae558f
     1.1 --- a/src/message_api.c	Thu Mar 28 06:55:06 2019 +0100
     1.2 +++ b/src/message_api.c	Thu Mar 28 13:44:04 2019 +0100
     1.3 @@ -3825,6 +3825,12 @@
     1.4      return status;
     1.5  }
     1.6  
     1.7 +static bool _own_sync_beacon(PEP_STATUS status, const char *sync_fpr,
     1.8 +        const char *from_fpr) {
     1.9 +    return status == PEP_UNENCRYPTED && sync_fpr && sync_fpr[0] &&
    1.10 +        from_fpr && from_fpr[0] && strcmp(sync_fpr, from_fpr) == 0;
    1.11 +}
    1.12 +
    1.13  DYNAMIC_API PEP_STATUS decrypt_message(
    1.14          PEP_SESSION session,
    1.15          message *src,
    1.16 @@ -3857,8 +3863,10 @@
    1.17          const char *data;
    1.18          char *sync_fpr = NULL;
    1.19          PEP_STATUS tmpstatus = base_extract_message(session, msg, &size, &data, &sync_fpr);
    1.20 -        if (!tmpstatus && size && data)
    1.21 -            signal_Sync_message(session, *rating, data, size, msg->from, sync_fpr);
    1.22 +        if (!tmpstatus && size && data) {
    1.23 +            if (!_own_sync_beacon(status, sync_fpr, msg->from->fpr))
    1.24 +                signal_Sync_message(session, *rating, data, size, msg->from, sync_fpr);
    1.25 +        }
    1.26          free(sync_fpr);
    1.27      }
    1.28