ObjXMPP  Check-in [346032e34b]

Overview
Comment:Coding style.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 346032e34b789362010d84376068f08c472902018682fd103f9d8bbd391ca698
User & Date: js on 2013-03-31 10:23:39
Other Links: manifest | tags
Context
2013-04-03
21:16
Add caps namespace to namespaces.h check-in: 50a225298f user: florob@babelmonkeys.de tags: trunk
2013-03-31
10:23
Coding style. check-in: 346032e34b user: js tags: trunk
10:16
Adjust to ObjOpenSSL changes. check-in: 7d9b6a0cdf user: js tags: trunk
Changes

Modified src/XMPPDiscoEntity.h from [feea2c657c] to [2a4c622dd5].

33
34
35
36
37
38
39

40
41
42
43
44
45
46
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47







+







 */
@interface XMPPDiscoEntity: XMPPDiscoNode <XMPPConnectionDelegate>
{
	OFMutableDictionary *_discoNodes;
	XMPPConnection *_connection;
	OFString *_capsNode;
}

#ifdef OF_HAVE_PROPERTIES
/**
 * \brief The XMPPDiscoNodes this entity provides Services Discovery
 *	  responses for
 *
 * This usually contains at least all immediate child nodes, but may contain
 * any number of nodes nested more deeply.

Modified src/XMPPDiscoIdentity.m from [886ac061d4] to [5bede0ee0a].

24
25
26
27
28
29
30
31

32
33
34
35
36
37
38
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38







-
+








@implementation XMPPDiscoIdentity
+ identityWithCategory: (OFString*)category
		  type: (OFString*)type
		  name: (OFString*)name
{
	return [[[self alloc] initWithCategory: category
					  type: type 
					  type: type
					  name: name] autorelease];
}

+ identityWithCategory: (OFString*)category
		  type: (OFString*)type
{
	return [[[self alloc] initWithCategory: category

Modified src/XMPPDiscoNode.h from [f9cb5ba330] to [7742e7e268].

33
34
35
36
37
38
39

40
41
42
43
44
45
46
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47







+







	XMPPJID *_JID;
	OFString *_node;
	OFString *_name;
	OFSortedList *_identities;
	OFSortedList *_features;
	OFMutableDictionary *_childNodes;
}

#ifdef OF_HAVE_PROPERTIES
/// \brief The JID this node lives on
@property (readonly) XMPPJID *JID;
/// \brief The node's opaque name of the node
@property (readonly) OFString *node;
/// \brief The node's human friendly name (may be unspecified)
@property (readonly) OFString *name;

Modified src/XMPPMulticastDelegate.h from [ec802f6688] to [9827e55a83].

26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40







-
+








/**
 * \brief A class to provide multiple delegates in a single class
 */
@interface XMPPMulticastDelegate: OFObject
{
	OFDataArray *_delegates;
	size_t handlerIndex;
	size_t _handlerIndex;
}

/**
 * \brief Adds a delegate which should receive the broadcasts.
 *
 * \param delegate The delegate to add
 */

Modified src/XMPPMulticastDelegate.m from [8c2482d4cf] to [f678339c69].

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
112
113
114
115


116
117



118
119
120
121
122
123
124
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
112


113
114
115
116
117
118
119
120
121
122
123
124


125
126
127
128
129
130
131
132
133
134







+
-
-
+
+
+











-
-
+
+
+







+
+
-
-
+
+
+















-
-
+
+
+







+
+
-
-
+
+
+







	size_t i, count = [_delegates count];

	for (i = 0; i < count; i++) {
		if (items[i] != delegate)
			continue;

		[_delegates removeItemAtIndex: i];

		if (i <= handlerIndex)
			handlerIndex--;
		if (i <= _handlerIndex)
			_handlerIndex--;

		return;
	}
}

- (BOOL)broadcastSelector: (SEL)selector
	       withObject: (id)object
{
	size_t count = [_delegates count];
	id *items = [_delegates items];
	BOOL handled = NO;

	for (handlerIndex = 0; handlerIndex < count; handlerIndex++) {
		id responder = items[handlerIndex];
	for (_handlerIndex = 0; _handlerIndex < count; _handlerIndex++) {
		id responder = items[_handlerIndex];

		if (![responder respondsToSelector: selector])
			continue;

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

		handled |= imp(responder, selector, object);

		/*
		// Update count and items, since the handler might have
		// changed them.
		 * Update count and items, since the handler might have changed
		 * them.
		 */
		count = [_delegates count];
		items = [_delegates items];
	}

	return handled;
}

- (BOOL)broadcastSelector: (SEL)selector
	       withObject: (id)object1
	       withObject: (id)object2
{
	size_t count = [_delegates count];
	id *items = [_delegates items];
	BOOL handled = NO;

	for (handlerIndex = 0; handlerIndex < count; handlerIndex++) {
		id responder = items[handlerIndex];
	for (_handlerIndex = 0; _handlerIndex < count; _handlerIndex++) {
		id responder = items[_handlerIndex];

		if (![responder respondsToSelector: selector])
			continue;

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

		handled |= imp(responder, selector, object1, object2);

		/*
		// Update count and items, since the handler might have
		// changed them.
		 * Update count and items, since the handler might have changed
		 * them.
		 */
		count = [_delegates count];
		items = [_delegates items];
	}

	return handled;
}
@end

Modified tests/test.m from [50ffe289bb] to [346e30a037].

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
150
151
152
153
154
155
156

157
158
159
160
161
162
163







-








- (void)connection: (XMPPConnection*)conn_
     wasBoundToJID: (XMPPJID*)jid
{
	of_log(@"Bound to JID: %@", [jid fullJID]);
	of_log(@"Supports SM: %@",
	    [conn_ supportsStreamManagement] ? @"YES" : @"NO");


	XMPPDiscoEntity *discoEntity =
	    [[XMPPDiscoEntity alloc] initWithConnection: conn];

	[discoEntity addIdentity:
	    [XMPPDiscoIdentity identityWithCategory: @"client"
					       type: @"pc"