IOSAD-61 PEPIdentity.dictionary IOSAD-61
authorDirk Zimmermann <dirk@pep-project.org>
Fri, 03 Nov 2017 13:23:44 +0100
branchIOSAD-61
changeset 328e6f2c52c4e0c
parent 327 dae33f5f1f65
child 329 4a32986fcbfa
IOSAD-61 PEPIdentity.dictionary
pEpObjCAdapter/PEPIdentity.h
pEpObjCAdapter/PEPIdentity.m
     1.1 --- a/pEpObjCAdapter/PEPIdentity.h	Fri Nov 03 12:22:34 2017 +0100
     1.2 +++ b/pEpObjCAdapter/PEPIdentity.h	Fri Nov 03 13:23:44 2017 +0100
     1.3 @@ -66,6 +66,15 @@
     1.4  
     1.5  - (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address;
     1.6  
     1.7 +/**
     1.8 + Does this identity contain a PGP comm type? This can be used for determining
     1.9 + if a communication partner is a pEp user or not.
    1.10 + */
    1.11  - (BOOL)containsPGPCommType;
    1.12  
    1.13 +/**
    1.14 + Returns an old-style directory from the times there was no PEPIdentity.
    1.15 + */
    1.16 +- (nonnull NSMutableDictionary *)dictionary;
    1.17 +
    1.18  @end
     2.1 --- a/pEpObjCAdapter/PEPIdentity.m	Fri Nov 03 12:22:34 2017 +0100
     2.2 +++ b/pEpObjCAdapter/PEPIdentity.m	Fri Nov 03 13:23:44 2017 +0100
     2.3 @@ -9,6 +9,7 @@
     2.4  #import "PEPIdentity.h"
     2.5  
     2.6  #import "pEpEngine.h"
     2.7 +#import "PEPMessage.h"
     2.8  
     2.9  @implementation PEPIdentity
    2.10  
    2.11 @@ -70,6 +71,18 @@
    2.12      val == PEP_ct_OpenPGP;
    2.13  }
    2.14  
    2.15 +- (nonnull NSMutableDictionary *)dictionary
    2.16 +{
    2.17 +    return [@{
    2.18 +              kPepAddress: self.address,
    2.19 +              kPepUserID: self.userID,
    2.20 +              kPepUsername: self.userName,
    2.21 +              kPepCommType: [NSNumber numberWithInteger:self.commType],
    2.22 +              kPepFingerprint: self.fingerPrint,
    2.23 +              }
    2.24 +            mutableCopy];
    2.25 +}
    2.26 +
    2.27  // MARK: - Equality
    2.28  
    2.29  - (BOOL)isEqual:(id)other