NETPGP-20 decrypt outputs plist of original message
authorDirk Zimmermann <dirk@pep-project.org>
Mon, 04 Sep 2017 18:48:17 +0200
changeset 216f3f9abeb7c2b
parent 215 35d652fb8393
child 217 cf53be721e7b
NETPGP-20 decrypt outputs plist of original message
pEpObjCAdapter/NSDictionary+Extension.h
pEpObjCAdapter/NSDictionary+Extension.m
pEpObjCAdapter/PEPSession.m
     1.1 --- a/pEpObjCAdapter/NSDictionary+Extension.h	Mon Sep 04 17:28:50 2017 +0200
     1.2 +++ b/pEpObjCAdapter/NSDictionary+Extension.h	Mon Sep 04 18:48:17 2017 +0200
     1.3 @@ -10,7 +10,6 @@
     1.4  
     1.5  @interface NSDictionary (Extension)
     1.6  
     1.7 -- (void)debugSaveToBasePath:(NSString * _Nonnull)basePath fileName:(NSString * _Nonnull)fileName
     1.8 -               theExtension:(NSString * _Nonnull)theExtension;
     1.9 +- (void)debugSaveToFilePath:(NSString * _Nonnull)filePath;
    1.10  
    1.11  @end
     2.1 --- a/pEpObjCAdapter/NSDictionary+Extension.m	Mon Sep 04 17:28:50 2017 +0200
     2.2 +++ b/pEpObjCAdapter/NSDictionary+Extension.m	Mon Sep 04 18:48:17 2017 +0200
     2.3 @@ -12,15 +12,20 @@
     2.4  
     2.5  @implementation NSDictionary (Extension)
     2.6  
     2.7 -- (void)debugSaveToBasePath:(NSString * _Nonnull)basePath fileName:(NSString * _Nonnull)fileName
     2.8 -theExtension:(NSString * _Nonnull)theExtension
     2.9 +- (void)debugSaveToFilePath:(NSString * _Nonnull)filePath
    2.10  {
    2.11 +    NSFileManager *fileManager = [NSFileManager defaultManager];
    2.12 +    NSURL *parentPath = [[fileManager
    2.13 +                       URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask]
    2.14 +                      firstObject];
    2.15 +
    2.16      NSDate *now = [NSDate date];
    2.17      NSString *nowDesc = [now description];
    2.18 -    NSString *filePath = [NSString stringWithFormat:@"%@/%@_%@.%@",
    2.19 -                          basePath, fileName, nowDesc, theExtension];
    2.20 -    NSURL *url = [NSURL fileURLWithPath:filePath];
    2.21 -    [self writeToURL:url atomically:YES];
    2.22 +    NSString *fileName = [NSString stringWithFormat:@"%@_%@.%@",
    2.23 +                          filePath, nowDesc, @"plist"];
    2.24 +
    2.25 +    NSURL *writeURL = [NSURL fileURLWithPath:fileName relativeToURL:parentPath];
    2.26 +    [self writeToURL:writeURL atomically:YES];
    2.27  }
    2.28  
    2.29  @end
     3.1 --- a/pEpObjCAdapter/PEPSession.m	Mon Sep 04 17:28:50 2017 +0200
     3.2 +++ b/pEpObjCAdapter/PEPSession.m	Mon Sep 04 18:48:17 2017 +0200
     3.3 @@ -14,6 +14,7 @@
     3.4  #import "PEPLanguage.h"
     3.5  #import "PEPCSVScanner.h"
     3.6  #import "NSArray+Extension.h"
     3.7 +#import "NSDictionary+Extension.h"
     3.8  
     3.9  @implementation PEPSession
    3.10  
    3.11 @@ -78,10 +79,23 @@
    3.12      release(_session);
    3.13  }
    3.14  
    3.15 +- (void)debugOutPutMessageDict:(nonnull PEPDict *)src
    3.16 +{
    3.17 +    NSString *from = src[kPepFrom][kPepAddress];
    3.18 +    NSArray *tos = src[kPepTo];
    3.19 +    NSString *to = tos[0][kPepAddress];
    3.20 +    NSString *msgID = src[kPepID];
    3.21 +    NSString *fileName = [NSString stringWithFormat:@"from(%@)_to(%@)_(%@)",
    3.22 +                          from, to, msgID];
    3.23 +    [src debugSaveToFilePath:fileName];
    3.24 +}
    3.25 +
    3.26  - (PEP_rating)decryptMessageDict:(nonnull PEPDict *)src
    3.27                              dest:(PEPDict * _Nullable * _Nullable)dst
    3.28                              keys:(PEPStringList * _Nullable * _Nullable)keys
    3.29  {
    3.30 +    [self debugOutPutMessageDict:src];
    3.31 +
    3.32      message * _src = PEP_messageDictToStruct(src);
    3.33      message * _dst = NULL;
    3.34      stringlist_t * _keys = NULL;