ObjXMPP  Check-in [38ff5b873e]

Overview
Comment:Do more checking on handling the resource bind
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 38ff5b873e102a724a1476df88daf52253329bd12deeb0b4ee7f9b7161f1f929
User & Date: florob@babelmonkeys.de on 2011-02-12 00:25:33
Other Links: manifest | tags
Context
2011-02-12
16:58
Use self for XMPPStanza's init check-in: 86a0735116 user: florob@babelmonkeys.de tags: trunk
00:25
Do more checking on handling the resource bind check-in: 38ff5b873e user: florob@babelmonkeys.de tags: trunk
00:10
Add clean target to Makefile check-in: 99c48f991e user: florob@babelmonkeys.de tags: trunk
Changes

Modified src/XMPPConnection.m from [309d096214] to [aacb5f2723].

207
208
209
210
211
212
213











214
215
216
217
218
219
220
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231







+
+
+
+
+
+
+
+
+
+
+







{
	XMPPIQ *iq = [XMPPIQ IQWithType: @"set" ID: @"bind0"];
	[iq addChild: [OFXMLElement elementWithName: @"bind"
					  namespace: NS_BIND]];

	[self sendStanza: iq];
}

- (void)_handleResourceBind: (XMPPIQ*)iq
{
	OFXMLElement *bindElem = iq.children.firstObject;
	if ([bindElem.name isEqual: @"bind"] &&
	    [bindElem.namespace isEqual: NS_BIND]) {
		OFXMLElement *jidElem = bindElem.children.firstObject;
		of_log(@"Bound to JID: %@", [jidElem.children.firstObject
				stringValue]);
	}
}

- (void)_handleFeatures: (OFXMLElement*)elem
{
	for (OFXMLElement *child in elem.children) {
		if ([[child name] isEqual: @"mechanisms"] &&
		    [[child namespace] isEqual: NS_SASL])
			[self _addAuthMechanisms: child];
258
259
260
261
262
263
264
265

266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
269
270
271
272
273
274
275

276



277
278
279
280
281
282
283
284
285
286
287
288







-
+
-
-
-












			// FIXME: Handle!
	}

	if ([elem.name isEqual: @"iq"] &&
	    [elem.namespace isEqual: NS_CLIENT]) {
		XMPPIQ *iq = [XMPPIQ stanzaWithElement: elem];
		if ([iq.ID isEqual: @"bind0"] && [iq.type isEqual: @"result"]) {
			OFXMLElement *bindElem = iq.children.firstObject;
			[self _handleResourceBind: iq];
			OFXMLElement *jidElem = bindElem.children.firstObject;
			of_log(@"Bound to JID: %@",
				[jidElem.children.firstObject stringValue]);
		}
	}
}

- (void)elementBuilder: (OFXMLElementBuilder*)b
  didNotExpectCloseTag: (OFString*)name
	    withPrefix: (OFString*)prefix
	     namespace: (OFString*)ns
{
	// TODO
}
@end