pEpObjCAdapter/PEPSync.m
author Dirk Zimmermann <dirk@pep-project.org>
Fri, 05 Oct 2018 12:09:01 +0200
branchIOSAD-103
changeset 688 1b3d9f1481df
parent 686 fec1eae409cd
child 689 e14aa984e320
permissions -rw-r--r--
IOSAD-103 delegate any message to send
     1 //
     2 //  PEPSync.m
     3 //  pEpObjCAdapter
     4 //
     5 //  Created by Dirk Zimmermann on 04.10.18.
     6 //  Copyright © 2018 p≡p. All rights reserved.
     7 //
     8 
     9 #import "PEPSync.h"
    10 
    11 #import "PEPSyncSendMessageDelegate.h"
    12 #import "PEPMessageUtil.h"
    13 #import "PEPMessage.h"
    14 
    15 PEP_STATUS messageToSendObjc(struct _message *msg)
    16 {
    17     PEPSyncSendMessageDelegate *delegate = [PEPSync syncSendMessageDelegate];
    18     if (delegate) {
    19         PEPMessage *theMessage = pEpMessageFromStruct(msg);
    20         return [delegate sendMessage:theMessage];
    21     }
    22 
    23     return PEP_STATUS_OK;
    24 }
    25 
    26 int inject_sync_eventObjc(SYNC_EVENT ev, void *management)
    27 {
    28     return 0;
    29 }
    30 
    31 static __weak PEPSyncSendMessageDelegate *s_PEPSyncSendMessageDelegate;
    32 
    33 @implementation PEPSync
    34 
    35 + (void)setPEPSyncSendMessageDelegate:
    36 (PEPSyncSendMessageDelegate * _Nullable)syncSendMessageDelegate
    37 {
    38     s_PEPSyncSendMessageDelegate = syncSendMessageDelegate;
    39 }
    40 
    41 + (PEPSyncSendMessageDelegate * _Nullable)syncSendMessageDelegate
    42 {
    43     return s_PEPSyncSendMessageDelegate;
    44 }
    45 
    46 - (void)setSyncSendMessageDelegate:(PEPSyncSendMessageDelegate *)syncSendMessageDelegate
    47 {
    48     [PEPSync setPEPSyncSendMessageDelegate:syncSendMessageDelegate];
    49 }
    50 
    51 - (PEPSyncSendMessageDelegate *)syncSendMessageDelegate
    52 {
    53     return [PEPSync syncSendMessageDelegate];
    54 }
    55 
    56 @end