pEpObjCAdapter/PEPAttachment.m
author Dirk Zimmermann <dz@pep.security>
Thu, 12 Sep 2019 16:41:52 +0200
branchIOSAD-141
changeset 1245 cd15ff3a40b9
parent 859 b2ca1a12396c
child 1046 5c889c3d002f
permissions -rw-r--r--
IOSAD-141 Don't share session between threads.
dirk@576
     1
//
dirk@576
     2
//  PEPAttachment.m
dirk@576
     3
//  pEpObjCAdapter
dirk@576
     4
//
dirk@576
     5
//  Created by Dirk Zimmermann on 16.04.18.
dirk@576
     6
//  Copyright © 2018 p≡p. All rights reserved.
dirk@576
     7
//
dirk@576
     8
dirk@576
     9
#import "PEPAttachment.h"
dirk@576
    10
dz@859
    11
#import "bloblist.h"
dz@859
    12
dirk@576
    13
@implementation PEPAttachment
dirk@576
    14
dirk@581
    15
- (instancetype)initWithData:(NSData *)data
dirk@581
    16
{
dirk@581
    17
    if (self = [super init]) {
dirk@581
    18
        self.data = data;
dirk@673
    19
        self.size = data.length;
dirk@581
    20
    }
dirk@581
    21
    return self;
dirk@581
    22
}
dirk@581
    23
dirk@654
    24
- (NSString *)description
dirk@654
    25
{
dirk@654
    26
    NSMutableString *str =
dirk@654
    27
    [NSMutableString
dirk@655
    28
     stringWithFormat:@"<PEPAttachment 0x%u %ld bytes, contentDisposition %d",
dirk@654
    29
     (uint) self, (long) self.size, self.contentDisposition];
dirk@654
    30
dirk@654
    31
    if (self.mimeType) {
dirk@654
    32
        [str appendFormat:@", %@", self.mimeType];
dirk@654
    33
    }
dirk@654
    34
dirk@654
    35
    if (self.filename) {
dirk@654
    36
        [str appendFormat:@", %@", self.filename];
dirk@654
    37
    }
dirk@654
    38
dirk@654
    39
    [str appendString:@">"];
dirk@654
    40
    return str;
dirk@654
    41
}
dirk@654
    42
dirk@576
    43
@end