30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#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];
|
|
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#ifdef OF_HAVE_BLOCKS
+ (instancetype)callbackWithBlock: (xmpp_callback_block_t)block
{
return [[(XMPPCallback *)[self alloc]
initWithBlock: block] autorelease];
}
- (instancetype)initWithBlock: (xmpp_callback_block_t)block
{
self = [super init];
@try {
_block = [block copy];
} @catch (id e) {
[self release];
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
+ (instancetype)callbackWithTarget: (id)target
selector: (SEL)selector
{
return [[[self alloc] initWithTarget: target
selector: selector] autorelease];
}
- initWithTarget: (id)target
selector: (SEL)selector
{
self = [super init];
_target = [target retain];
_selector = selector;
return self;
|
|
|
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
+ (instancetype)callbackWithTarget: (id)target
selector: (SEL)selector
{
return [[[self alloc] initWithTarget: target
selector: selector] autorelease];
}
- (instancetype)initWithTarget: (id)target
selector: (SEL)selector
{
self = [super init];
_target = [target retain];
_selector = selector;
return self;
|