implementing keep_sync_msg flag keysync
authorVolker Birk <vb@pep.foundation>
Thu, 01 Sep 2016 17:54:33 +0200
branchkeysync
changeset 1110d37d730fa8e5
parent 1109 6be9dc59517d
child 1111 3c46dc58096d
implementing keep_sync_msg flag
src/pEpEngine.c
src/pEpEngine.h
src/pEp_internal.h
src/sync_impl.c
     1.1 --- a/src/pEpEngine.c	Thu Sep 01 17:51:29 2016 +0200
     1.2 +++ b/src/pEpEngine.c	Thu Sep 01 17:54:33 2016 +0200
     1.3 @@ -657,10 +657,10 @@
     1.4      session->use_only_own_private_keys = enable;
     1.5  }
     1.6  
     1.7 -DYNAMIC_API void config_dont_remove_sync_msg(PEP_SESSION session, bool enable)
     1.8 +DYNAMIC_API void config_keep_sync_msg(PEP_SESSION session, bool enable)
     1.9  {
    1.10      assert(session);
    1.11 -    session->dont_remove_sync_msg = enable;
    1.12 +    session->keep_sync_msg = enable;
    1.13  }
    1.14  
    1.15  DYNAMIC_API PEP_STATUS log_event(
     2.1 --- a/src/pEpEngine.h	Thu Sep 01 17:51:29 2016 +0200
     2.2 +++ b/src/pEpEngine.h	Thu Sep 01 17:54:33 2016 +0200
     2.3 @@ -168,12 +168,12 @@
     2.4  DYNAMIC_API void config_use_only_own_private_keys(PEP_SESSION session, bool enable);
     2.5  
     2.6  
     2.7 -// config_dont_remove_sync_msg() - do not remove sync messages (for debugging purposes)
     2.8 +// config_keep_sync_msg() - do not remove sync messages (for debugging purposes)
     2.9  //
    2.10  //      session (in)    session handle
    2.11  //      enable (in)     flag if enabled or disabled
    2.12  
    2.13 -DYNAMIC_API void config_dont_remove_sync_msg(PEP_SESSION session, bool enable);
    2.14 +DYNAMIC_API void config_keep_sync_msg(PEP_SESSION session, bool enable);
    2.15  
    2.16  
    2.17  // decrypt_and_verify() - decrypt and/or verify a message
     3.1 --- a/src/pEp_internal.h	Thu Sep 01 17:51:29 2016 +0200
     3.2 +++ b/src/pEp_internal.h	Thu Sep 01 17:54:33 2016 +0200
     3.3 @@ -145,7 +145,7 @@
     3.4      bool passive_mode;
     3.5      bool unencrypted_subject;
     3.6      bool use_only_own_private_keys;
     3.7 -    bool dont_remove_sync_msg;
     3.8 +    bool keep_sync_msg;
     3.9      
    3.10  } pEpSession;
    3.11  
     4.1 --- a/src/sync_impl.c	Thu Sep 01 17:51:29 2016 +0200
     4.2 +++ b/src/sync_impl.c	Thu Sep 01 17:54:33 2016 +0200
     4.3 @@ -117,14 +117,19 @@
     4.4                  }
     4.5              }
     4.6  
     4.7 -            bloblist_t *blob = bl;
     4.8 -            if (last)
     4.9 -                last->next = bl->next;
    4.10 -            else
    4.11 -                src->attachments = bl->next;
    4.12 +            if (!session->keep_sync_msg) {
    4.13 +                bloblist_t *blob = bl;
    4.14 +                if (last)
    4.15 +                    last->next = bl->next;
    4.16 +                else
    4.17 +                    src->attachments = bl->next;
    4.18  
    4.19 -            blob->next = NULL;
    4.20 -            free_bloblist(blob);
    4.21 +                blob->next = NULL;
    4.22 +                free_bloblist(blob);
    4.23 +            }
    4.24 +            else {
    4.25 +                last = bl;
    4.26 +            }
    4.27          }
    4.28          else {
    4.29  skip:
    4.30 @@ -132,7 +137,7 @@
    4.31          }
    4.32      }
    4.33  
    4.34 -    if (found) {
    4.35 +    if (found && !keep_sync_msg) {
    4.36          for (stringpair_list_t *spl = src->opt_fields ; spl && spl->value ;
    4.37                  spl = spl->next) {
    4.38              if (spl->value->key &&