Browse Source

IOSAD-134 New: queryKeySyncEnabled.

IOSAD-134
Dirk Zimmermann 3 years ago
parent
commit
90d4bb36f8
3 changed files with 42 additions and 0 deletions
  1. +23
    -0
      pEpObjCAdapter/PEPInternalSession.m
  2. +8
    -0
      pEpObjCAdapter/PEPSession.m
  3. +11
    -0
      pEpObjCAdapterFramework/PEPSessionProtocol.h

+ 23
- 0
pEpObjCAdapter/PEPInternalSession.m View File

@ -682,6 +682,29 @@ typedef PEP_STATUS (* rating_function_type)(PEP_SESSION session, message *msg, P
return YES;
}
- (NSNumber * _Nullable)queryKeySyncEnabledForIdentity:(PEPIdentity * _Nonnull)identity
error:(NSError * _Nullable * _Nullable)error
{
pEp_identity *ident = PEP_identityToStruct(identity);
PEPStatus status = (PEPStatus) myself(_session, ident);
if ([NSError setError:error fromPEPStatus:status]) {
free_identity(ident);
return NO;
}
identity_flags_t flags = ident->flags;
free_identity(ident);
if (flags & PEP_idf_not_for_sync) {
return [NSNumber numberWithBool:NO];
} else {
return [NSNumber numberWithBool:YES];
}
}
- (NSArray<PEPIdentity *> * _Nullable)importKey:(NSString * _Nonnull)keydata
error:(NSError * _Nullable * _Nullable)error
{


+ 8
- 0
pEpObjCAdapter/PEPSession.m View File

@ -310,6 +310,14 @@
return [session disableSyncForIdentity:identity error:error];
}
- (NSNumber * _Nullable)queryKeySyncEnabledForIdentity:(PEPIdentity * _Nonnull)identity
error:(NSError * _Nullable * _Nullable)error
{
PEPInternalSession *session = [PEPSessionProvider session];
RETURN_ON_ERROR(session, error, nil);
return [session queryKeySyncEnabledForIdentity:identity error:error];
}
#pragma mark Internal API (testing etc.)
- (NSArray * _Nullable)importKey:(NSString * _Nonnull)keydata


+ 11
- 0
pEpObjCAdapterFramework/PEPSessionProtocol.h View File

@ -204,6 +204,17 @@
- (BOOL)disableSyncForIdentity:(PEPIdentity * _Nonnull)identity
error:(NSError * _Nullable * _Nullable)error;
/**
Queries the given own identity on whether it has key sync enabled or not.
@param identity The (own) identity to query.
@param error The usual cocoa error handling.
@return An NSNumber containing a boolean denoting whether key sync is enabled or not, or
nil on error.
*/
- (NSNumber * _Nullable)queryKeySyncEnabledForIdentity:(PEPIdentity * _Nonnull)identity
error:(NSError * _Nullable * _Nullable)error;
#pragma mark -- Internal API (testing etc.)
/** For testing purpose, manual key import */


Loading…
Cancel
Save