24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# include "config.h"
#endif
#import "XMPPCallback.h"
@implementation XMPPCallback
#ifdef OF_HAVE_BLOCKS
+ callbackWithBlock: (xmpp_callback_block_t)block
{
return [[(XMPPCallback*)[self alloc] initWithBlock: block] autorelease];
}
- initWithBlock: (xmpp_callback_block_t)block
{
self = [super init];
@try {
_block = [block copy];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
#endif
+ callbackWithTarget: (id)target
selector: (SEL)selector
{
return [[[self alloc] initWithTarget: target
selector: selector] autorelease];
}
- initWithTarget: (id)target_
selector: (SEL)selector_
|
|
|
|
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# include "config.h"
#endif
#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 {
_block = [block copy];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
#endif
+ (instancetype)callbackWithTarget: (id)target
selector: (SEL)selector
{
return [[[self alloc] initWithTarget: target
selector: selector] autorelease];
}
- initWithTarget: (id)target_
selector: (SEL)selector_
|