ObjXMPP  Check-in [db8adef472]

Overview
Comment:Add classes to support Service Discovery
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: db8adef472901dcb67d4779dc567f9b124421269f60c76d3c6e4c99cda6eadc0
User & Date: florob@babelmonkeys.de on 2013-03-23 17:21:05
Other Links: manifest | tags
Context
2013-03-23
18:59
Add support for calculating caps hashes check-in: 0d43c61dbc user: florob@babelmonkeys.de tags: trunk
17:21
Add classes to support Service Discovery check-in: db8adef472 user: florob@babelmonkeys.de tags: trunk
2013-03-03
16:30
Fix up -[XMPPJID isEqual:] and -[XMPPJID hash] check-in: 8bc32c2743 user: florob@babelmonkeys.de tags: trunk
Changes

Modified src/Makefile from [ad510f6243] to [db78187a2c].

1
2
3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18
19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22












+
+
+







include ../extra.mk

SHARED_LIB = ${OBJXMPP_SHARED_LIB}
STATIC_LIB = ${OBJXMPP_STATIC_LIB}
LIB_MAJOR = 0
LIB_MINOR = 0

SRCS = XMPPAuthenticator.m	\
       XMPPCallback.m		\
       XMPPConnection.m		\
       XMPPContact.m		\
       XMPPContactManager.m	\
       XMPPDiscoEntity.m	\
       XMPPDiscoIdentity.m	\
       XMPPDiscoNode.m		\
       XMPPExceptions.m		\
       XMPPEXTERNALAuth.m	\
       XMPPIQ.m			\
       XMPPJID.m		\
       XMPPFileStorage.m	\
       XMPPMessage.m		\
       XMPPMulticastDelegate.m	\

Added src/XMPPDiscoEntity.h version [50bb8252e5].

Added src/XMPPDiscoEntity.m version [ada5800aa3].

Added src/XMPPDiscoIdentity.h version [5d9f1df6e9].

Added src/XMPPDiscoIdentity.m version [886ac061d4].

Added src/XMPPDiscoNode.h version [f9cb5ba330].

Added src/XMPPDiscoNode.m version [49dce66da1].

Modified src/XMPPJID.m from [ced62b3025] to [70fd287265].

225
226
227
228
229
230
231
232

233
234
235
236
237
238
239
225
226
227
228
229
230
231

232
233
234
235
236
237
238
239







-
+







}

- (OFString*)description
{
	return [self fullJID];
}

- (BOOL)isEqual: (id)object
- (bool)isEqual: (id)object
{
	XMPPJID *JID;

	if (object == self)
		return YES;

	if (![object isKindOfClass: [XMPPJID class]])

Modified src/namespaces.h from [28e73e8b28] to [ea4713ca5d].

18
19
20
21
22
23
24


25
26
27
28
29
30
31
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33







+
+







 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#define XMPP_NS_BIND @"urn:ietf:params:xml:ns:xmpp-bind"
#define XMPP_NS_CLIENT @"jabber:client"
#define XMPP_NS_DISCO_INFO @"http://jabber.org/protocol/disco#info"
#define XMPP_NS_DISCO_ITEMS @"http://jabber.org/protocol/disco#items"
#define XMPP_NS_ROSTER @"jabber:iq:roster"
#define XMPP_NS_ROSTERVER @"urn:xmpp:features:rosterver"
#define XMPP_NS_SASL @"urn:ietf:params:xml:ns:xmpp-sasl"
#define XMPP_NS_SESSION @"urn:ietf:params:xml:ns:xmpp-session"
#define XMPP_NS_SM @"urn:xmpp:sm:3"
#define XMPP_NS_STARTTLS @"urn:ietf:params:xml:ns:xmpp-tls"
#define XMPP_NS_STANZAS @"urn:ietf:params:xml:ns:xmpp-stanzas"

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

22
23
24
25
26
27
28


29
30
31
32
33
34
35
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37







+
+







 */

#include <assert.h>

#import <ObjFW/ObjFW.h>

#import "XMPPConnection.h"
#import "XMPPDiscoEntity.h"
#import "XMPPDiscoIdentity.h"
#import "XMPPJID.h"
#import "XMPPStanza.h"
#import "XMPPIQ.h"
#import "XMPPMessage.h"
#import "XMPPPresence.h"
#import "XMPPRoster.h"
#import "XMPPStreamManagement.h"
149
150
151
152
153
154
155











































156
157
158
159
160
161
162
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







- (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"
					       name: @"ObjXMPP"]];

	XMPPDiscoNode *nodeMusic =
	    [XMPPDiscoNode discoNodeWithJID: jid
				       node: @"music"
				       name: @"My music"];
	[discoEntity addChildNode: nodeMusic];

	XMPPDiscoNode *nodeRHCP =
	    [XMPPDiscoNode discoNodeWithJID: jid
				       node: @"fa3b6"
				       name: @"Red Hot Chili Peppers"];
	[nodeMusic addChildNode: nodeRHCP];

	XMPPDiscoNode *nodeStop =
	    [XMPPDiscoNode discoNodeWithJID: jid
				       node: @"qwe87"
				       name: @"Can't Stop"];
	[nodeRHCP addChildNode: nodeStop];

	XMPPDiscoNode *nodeClueso = [XMPPDiscoNode discoNodeWithJID: jid
							       node: @"ea386"
							       name: @"Clueso"];
	[nodeMusic addChildNode: nodeClueso];

	XMPPDiscoNode *nodeChicago = [XMPPDiscoNode discoNodeWithJID: jid
							      node: @"qwr87"
							      name: @"Chicago"];
	[nodeClueso addChildNode: nodeChicago];

	[discoEntity addDiscoNode: nodeMusic];
	[discoEntity addDiscoNode: nodeRHCP];
	[discoEntity addDiscoNode: nodeClueso];
	[discoEntity addDiscoNode: nodeStop];
	[discoEntity addDiscoNode: nodeChicago];

	[roster requestRoster];
}

- (void)rosterWasReceived: (XMPPRoster*)roster_
{
	XMPPPresence *pres;