26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#import "XMPPCallback.h"
@implementation XMPPCallback
#ifdef OF_HAVE_BLOCKS
+ (instancetype)callbackWithBlock: (xmpp_callback_block_t)block
{
return [[(XMPPCallback*)[self alloc] initWithBlock: block] autorelease];
}
- initWithBlock: (xmpp_callback_block_t)block
{
self = [super init];
@try {
|
>
|
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#import "XMPPCallback.h"
@implementation XMPPCallback
#ifdef OF_HAVE_BLOCKS
+ (instancetype)callbackWithBlock: (xmpp_callback_block_t)block
{
return [[(XMPPCallback *)[self alloc]
initWithBlock: block] autorelease];
}
- initWithBlock: (xmpp_callback_block_t)block
{
self = [super init];
@try {
|
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#ifdef OF_HAVE_BLOCKS
[_block release];
#endif
[super dealloc];
}
- (void)runWithIQ: (XMPPIQ*)iq
connection: (XMPPConnection*)connection
{
#ifdef OF_HAVE_BLOCKS
if (_block != NULL)
_block(connection, iq);
else
#endif
[_target performSelector: _selector
withObject: connection
withObject: iq];
}
@end
|
|
|
|
|
|
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#ifdef OF_HAVE_BLOCKS
[_block release];
#endif
[super dealloc];
}
- (void)runWithIQ: (XMPPIQ *)IQ
connection: (XMPPConnection *)connection
{
#ifdef OF_HAVE_BLOCKS
if (_block != NULL)
_block(connection, IQ);
else
#endif
[_target performSelector: _selector
withObject: connection
withObject: IQ];
}
@end
|