ObjXMPP  Diff

Differences From Artifact [405f29fa95]:

To Artifact [427c4ecc5d]:


46
47
48
49
50
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
- (void)dealloc
{
	[delegates release];

	[super dealloc];
}

- (void)addDelegate: (id <XMPPConnectionDelegate>)delegate
{
	[delegates addItem: &delegate];
}

- (void)removeDelegate: (id<XMPPConnectionDelegate>)delegate
{
	id *cArray = [delegates cArray];
	size_t i, count = [delegates count];

	for (i = 0; i < count; i++) {
		if (cArray[i] == delegate) {
			[delegates removeItemAtIndex: i];
			return;
		}
	}
}

- (BOOL)broadcastSelector: (SEL)selector
	    forConnection: (XMPPConnection*)connection
{
	id *cArray = [delegates cArray];
	size_t i, count = [delegates count];
	BOOL handled = NO;

	for (i = 0; i < count; i++) {
		if (![cArray[i] respondsToSelector: selector])
			continue;

		BOOL (*imp)(id, SEL, id) = (BOOL(*)(id, SEL, id))
		    [cArray[i] methodForSelector: selector];

		handled |= imp(cArray[i], selector, connection);
	}

	return handled;
}

- (BOOL)broadcastSelector: (SEL)selector
	    forConnection: (XMPPConnection*)connection
	       withObject: (id)object
{
	id *cArray = [delegates cArray];
	size_t i, count = [delegates count];
	BOOL handled = NO;

	for (i = 0; i < count; i++) {
		if (![cArray[i] respondsToSelector: selector])
			continue;

		BOOL (*imp)(id, SEL, id, id) = (BOOL(*)(id, SEL, id, id))
		    [cArray[i] methodForSelector: selector];

		handled |= imp(cArray[i], selector, connection, object);
	}

	return handled;
}
@end







|




|













|












|






|
|












|





46
47
48
49
50
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
- (void)dealloc
{
	[delegates release];

	[super dealloc];
}

- (void)addDelegate: (id)delegate
{
	[delegates addItem: &delegate];
}

- (void)removeDelegate: (id)delegate
{
	id *cArray = [delegates cArray];
	size_t i, count = [delegates count];

	for (i = 0; i < count; i++) {
		if (cArray[i] == delegate) {
			[delegates removeItemAtIndex: i];
			return;
		}
	}
}

- (BOOL)broadcastSelector: (SEL)selector
	       withObject: (id)object
{
	id *cArray = [delegates cArray];
	size_t i, count = [delegates count];
	BOOL handled = NO;

	for (i = 0; i < count; i++) {
		if (![cArray[i] respondsToSelector: selector])
			continue;

		BOOL (*imp)(id, SEL, id) = (BOOL(*)(id, SEL, id))
		    [cArray[i] methodForSelector: selector];

		handled |= imp(cArray[i], selector, object);
	}

	return handled;
}

- (BOOL)broadcastSelector: (SEL)selector
	       withObject: (id)object1
	       withObject: (id)object2
{
	id *cArray = [delegates cArray];
	size_t i, count = [delegates count];
	BOOL handled = NO;

	for (i = 0; i < count; i++) {
		if (![cArray[i] respondsToSelector: selector])
			continue;

		BOOL (*imp)(id, SEL, id, id) = (BOOL(*)(id, SEL, id, id))
		    [cArray[i] methodForSelector: selector];

		handled |= imp(cArray[i], selector, object1, object2);
	}

	return handled;
}
@end