Also shut down sync for individual key reset sync
authorThomas
Fri, 22 Nov 2019 09:35:27 +0100
branchsync
changeset 377f3db78b86204
parent 376 c29ae3e408a8
child 378 4e1795946472
Also shut down sync for individual key reset
CpEpEngine.cpp
pEp_utility.cpp
     1.1 --- a/CpEpEngine.cpp	Thu Nov 21 17:27:18 2019 +0100
     1.2 +++ b/CpEpEngine.cpp	Fri Nov 22 09:35:27 2019 +0100
     1.3 @@ -789,8 +789,15 @@
     1.4  
     1.5      string _fpr = utf8_string(fpr);
     1.6  
     1.7 +    // For an own identity, we have to stop sync before resetting all own keys and enable it again afterwards
     1.8 +    if (ident.Me)
     1.9 +        ShutDownSync();
    1.10 +
    1.11      PEP_STATUS status = ::key_reset_identity(session(), _ident, _fpr.c_str());
    1.12  
    1.13 +    if (ident.Me)
    1.14 +        Startup();
    1.15 +
    1.16      free_identity(_ident);
    1.17  
    1.18      if (status == PEP_OUT_OF_MEMORY)
    1.19 @@ -810,8 +817,17 @@
    1.20      string _userId = utf8_string(userId);
    1.21      string _fpr = utf8_string(fpr);
    1.22  
    1.23 +    // For an own identity, we have to stop sync before resetting all own keys and enable it again afterwards
    1.24 +    bool ownIdentity = (_userId.compare(PEP_OWN_USERID) == 0);
    1.25 +
    1.26 +    if (ownIdentity)
    1.27 +        ShutDownSync();
    1.28 +
    1.29      PEP_STATUS status = ::key_reset_user(session(), _userId.c_str(), _fpr.c_str());
    1.30  
    1.31 +    if (ownIdentity)
    1.32 +        Startup();
    1.33 +
    1.34      if (status == PEP_OUT_OF_MEMORY)
    1.35          return E_OUTOFMEMORY;
    1.36  
     2.1 --- a/pEp_utility.cpp	Thu Nov 21 17:27:18 2019 +0100
     2.2 +++ b/pEp_utility.cpp	Fri Nov 22 09:35:27 2019 +0100
     2.3 @@ -20,7 +20,7 @@
     2.4                  username = _ident->username;
     2.5              comm_type = (pEpComType)_ident->comm_type;
     2.6              lang = _ident->lang;
     2.7 -			me = _ident->me;
     2.8 +            me = _ident->me;
     2.9              flags = (int)_ident->flags;
    2.10          }
    2.11  
    2.12 @@ -40,7 +40,7 @@
    2.13              comm_type = _ident->CommType;
    2.14              if (_ident->Lang)
    2.15                  lang = utf8_string(_ident->Lang);
    2.16 -			me = _ident->UserName;
    2.17 +            me = _ident->UserName;
    2.18              flags = (int)_ident->Flags;
    2.19          }
    2.20  
    2.21 @@ -60,7 +60,7 @@
    2.22                  _ident->lang[1] = this->lang[1];
    2.23              }
    2.24  
    2.25 -			_ident->me = this->me;
    2.26 +            _ident->me = this->me;
    2.27              _ident->flags = (identity_flags) this->flags;
    2.28  
    2.29              return _ident;
    2.30 @@ -79,7 +79,7 @@
    2.31              _ident->Lang = utf16_bstr(this->lang);
    2.32              _ident->UserName = utf16_bstr(this->username);
    2.33              _ident->UserId = utf16_bstr(this->user_id);
    2.34 -			_ident->Me = this->me;
    2.35 +            _ident->Me = this->me;
    2.36              _ident->Flags = (pEpIdentityFlags) this->flags;
    2.37  
    2.38              return _ident;
    2.39 @@ -104,7 +104,7 @@
    2.40                  ident_s->CommType = (pEpComType)ident->comm_type;
    2.41                  if (ident->lang)
    2.42                      ident_s->Lang = utf16_bstr(ident->lang);
    2.43 -				ident_s->Me = ident->me;
    2.44 +                ident_s->Me = ident->me;
    2.45                  ident_s->Flags = (pEpIdentityFlags)ident->flags;
    2.46              }
    2.47          }
    2.48 @@ -165,7 +165,7 @@
    2.49                  }
    2.50              }
    2.51  
    2.52 -			_ident->me = ident->Me;
    2.53 +            _ident->me = ident->Me;
    2.54              _ident->flags = (identity_flags_t)ident->Flags;
    2.55  
    2.56              return _ident;