24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# include "config.h"
#endif
#import "XMPPCallback.h"
@implementation XMPPCallback
#ifdef OF_HAVE_BLOCKS
+ callbackWithCallbackBlock: (xmpp_callback_block)callback
{
return [[[self alloc] initWithCallbackBlock: callback] autorelease];
}
- initWithCallbackBlock: (xmpp_callback_block)callback
{
self = [super init];
object = [callback copy];
return self;
}
|
|
|
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# include "config.h"
#endif
#import "XMPPCallback.h"
@implementation XMPPCallback
#ifdef OF_HAVE_BLOCKS
+ callbackWithCallbackBlock: (xmpp_callback_block_t)callback
{
return [[[self alloc] initWithCallbackBlock: callback] autorelease];
}
- initWithCallbackBlock: (xmpp_callback_block_t)callback
{
self = [super init];
object = [callback copy];
return self;
}
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
}
- initWithCallbackObject: (id)object_
selector: (SEL)selector_
{
self = [super init];
// TODO: Retain or follow delegate paradigm?
object = [object_ retain];
selector = selector_;
return self;
}
- (void)dealloc
{
[object release];
[super dealloc];
}
- (void)runWithIQ: (XMPPIQ*)iq
{
#ifdef OF_HAVE_BLOCKS
if ([object isKindOfClass: [OFBlock class]])
((xmpp_callback_block)object)(iq);
else
#endif
[object performSelector: selector
withObject: iq];
}
@end
|
<
|
<
<
|
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
}
- initWithCallbackObject: (id)object_
selector: (SEL)selector_
{
self = [super init];
object = object_;
selector = selector_;
return self;
}
- (void)dealloc
{
[super dealloc];
}
- (void)runWithIQ: (XMPPIQ*)iq
{
#ifdef OF_HAVE_BLOCKS
if ([object isKindOfClass: [OFBlock class]])
((xmpp_callback_block_t)object)(iq);
else
#endif
[object performSelector: selector
withObject: iq];
}
@end
|