IOSAD-123 Further enforce userID != nil. IOSAD-123
authorDirk Zimmermann <dz@pep.security>
Tue, 23 Jul 2019 15:03:28 +0200
branchIOSAD-123
changeset 1087167f9d4b54aa
parent 1086 52ff9d05f7d9
child 1088 1820c2703e7d
IOSAD-123 Further enforce userID != nil.
pEpObjCAdapter/PEPIdentity.m
pEpObjCAdapter/PEPMessageUtil.m
pEpObjCAdapterFramework/PEPIdentity.h
     1.1 --- a/pEpObjCAdapter/PEPIdentity.m	Tue Jul 23 15:03:28 2019 +0200
     1.2 +++ b/pEpObjCAdapter/PEPIdentity.m	Tue Jul 23 15:03:28 2019 +0200
     1.3 @@ -18,7 +18,7 @@
     1.4  @implementation PEPIdentity
     1.5  
     1.6  - (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address
     1.7 -                                 userID:(NSString * _Nullable)userID
     1.8 +                                 userID:(NSString * _Nonnull)userID
     1.9                                 userName:(NSString * _Nullable)userName
    1.10                                    isOwn:(BOOL)isOwn
    1.11                              fingerPrint:(NSString * _Nullable)fingerPrint
    1.12 @@ -37,7 +37,7 @@
    1.13  }
    1.14  
    1.15  - (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address
    1.16 -                                 userID:(NSString * _Nullable)userID
    1.17 +                                 userID:(NSString * _Nonnull)userID
    1.18                                 userName:(NSString * _Nullable)userName
    1.19                                    isOwn:(BOOL)isOwn
    1.20                              fingerPrint:(NSString * _Nullable)fingerPrint
    1.21 @@ -47,7 +47,7 @@
    1.22  }
    1.23  
    1.24  - (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address
    1.25 -                                 userID:(NSString * _Nullable)userID
    1.26 +                                 userID:(NSString * _Nonnull)userID
    1.27                                 userName:(NSString * _Nullable)userName
    1.28                                    isOwn:(BOOL)isOwn
    1.29  {
    1.30 @@ -56,8 +56,9 @@
    1.31  }
    1.32  
    1.33  - (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address
    1.34 +                                 userID:(NSString * _Nonnull)userID
    1.35  {
    1.36 -    return [self initWithAddress:address userID:nil userName:nil isOwn:NO fingerPrint:nil
    1.37 +    return [self initWithAddress:address userID:userID userName:nil isOwn:NO fingerPrint:nil
    1.38                          commType:PEPCommTypeUnknown language:nil];
    1.39  }
    1.40  
     2.1 --- a/pEpObjCAdapter/PEPMessageUtil.m	Tue Jul 23 15:03:28 2019 +0200
     2.2 +++ b/pEpObjCAdapter/PEPMessageUtil.m	Tue Jul 23 15:03:28 2019 +0200
     2.3 @@ -212,19 +212,16 @@
     2.4  PEPIdentity *PEP_identityFromStruct(pEp_identity *ident)
     2.5  {
     2.6      PEPIdentity *identity = nil;
     2.7 -    if (ident->address && ident->address[0]) {
     2.8 +    if (ident->address && ident->address[0] && ident->user_id && ident->user_id[0]) {
     2.9          identity = [[PEPIdentity alloc]
    2.10 -                    initWithAddress:[NSString stringWithUTF8String:ident->address]];
    2.11 +                    initWithAddress:[NSString stringWithUTF8String:ident->address]
    2.12 +                    userID:[NSString stringWithUTF8String:ident->user_id]];
    2.13      }
    2.14  
    2.15      if (ident->fpr && ident->fpr[0]) {
    2.16          identity.fingerPrint = [NSString stringWithUTF8String:ident->fpr];
    2.17      }
    2.18  
    2.19 -    if (ident->user_id && ident->user_id[0]) {
    2.20 -        identity.userID = [NSString stringWithUTF8String:ident->user_id];
    2.21 -    }
    2.22 -
    2.23      if (ident->username && ident->username[0]) {
    2.24          identity.userName = [NSString stringWithUTF8String:ident->username];
    2.25      }
     3.1 --- a/pEpObjCAdapterFramework/PEPIdentity.h	Tue Jul 23 15:03:28 2019 +0200
     3.2 +++ b/pEpObjCAdapterFramework/PEPIdentity.h	Tue Jul 23 15:03:28 2019 +0200
     3.3 @@ -55,7 +55,7 @@
     3.4  @property (readonly) BOOL isConfirmed;
     3.5  
     3.6  - (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address
     3.7 -                                 userID:(NSString * _Nullable)userID
     3.8 +                                 userID:(NSString * _Nonnull)userID
     3.9                                 userName:(NSString * _Nullable)userName
    3.10                                    isOwn:(BOOL)isOwn
    3.11                              fingerPrint:(NSString * _Nullable)fingerPrint
    3.12 @@ -63,17 +63,18 @@
    3.13                                 language:(NSString * _Nullable)language;
    3.14  
    3.15  - (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address
    3.16 -                                 userID:(NSString * _Nullable)userID
    3.17 +                                 userID:(NSString * _Nonnull)userID
    3.18                                 userName:(NSString * _Nullable)userName
    3.19                                    isOwn:(BOOL)isOwn
    3.20                              fingerPrint:(NSString * _Nullable)fingerPrint;
    3.21  
    3.22  - (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address
    3.23 -                                 userID:(NSString * _Nullable)userID
    3.24 +                                 userID:(NSString * _Nonnull)userID
    3.25                                 userName:(NSString * _Nullable)userName
    3.26                                    isOwn:(BOOL)isOwn;
    3.27  
    3.28 -- (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address;
    3.29 +- (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address
    3.30 +                                 userID:(NSString * _Nonnull)userID;
    3.31  
    3.32  - (nonnull instancetype)initWithDictionary:(NSDictionary * _Nonnull)dictionary;
    3.33