Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/bosh.c @ 25789:b78c8ab5de2b
Jabber BOSH: Try to continue with no BOSH version attribute
Punjab doesn't return a version attribute, so try to continue w/o one...
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 18 Jan 2009 04:11:15 +0000 |
parents | e7f20c859519 |
children | 4e624cc0c4a5 |
comparison
equal
deleted
inserted
replaced
25788:e7f20c859519 | 25789:b78c8ab5de2b |
---|---|
318 } | 318 } |
319 } | 319 } |
320 | 320 |
321 static void boot_response_cb(PurpleBOSHConnection *conn, xmlnode *node) { | 321 static void boot_response_cb(PurpleBOSHConnection *conn, xmlnode *node) { |
322 const char *sid, *version; | 322 const char *sid, *version; |
323 xmlnode *packet; | |
323 | 324 |
324 g_return_if_fail(node != NULL); | 325 g_return_if_fail(node != NULL); |
325 if (jabber_bosh_connection_error_check(conn, node)) | 326 if (jabber_bosh_connection_error_check(conn, node)) |
326 return; | 327 return; |
327 | 328 |
342 int major = atoi(version); | 343 int major = atoi(version); |
343 int minor = atoi(dot + 1); | 344 int minor = atoi(dot + 1); |
344 | 345 |
345 purple_debug_info("jabber", "BOSH connection manager version %s\n", version); | 346 purple_debug_info("jabber", "BOSH connection manager version %s\n", version); |
346 | 347 |
347 /* TODO: Are major increments incompatible? */ | 348 if (major != 1 || minor < 6) { |
348 if (major > 1 || (major == 1 && minor >= 6)) { | |
349 xmlnode *packet = xmlnode_get_child(node, "features"); | |
350 conn->js->use_bosh = TRUE; | |
351 conn->receive_cb = auth_response_cb; | |
352 jabber_stream_features_parse(conn->js, packet); | |
353 } else { | |
354 purple_connection_error_reason(conn->js->gc, | 349 purple_connection_error_reason(conn->js->gc, |
355 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 350 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
356 _("Unsupported version of BOSH protocol")); | 351 _("Unsupported version of BOSH protocol")); |
352 return; | |
357 } | 353 } |
358 } else { | 354 } else { |
359 purple_debug_info("jabber", "Missing version in BOSH initiation\n"); | 355 purple_debug_info("jabber", "Missing version in BOSH initiation\n"); |
360 } | 356 } |
357 | |
358 /* FIXME: Depending on receiving features might break with some hosts */ | |
359 packet = xmlnode_get_child(node, "features"); | |
360 conn->js->use_bosh = TRUE; | |
361 conn->receive_cb = auth_response_cb; | |
362 jabber_stream_features_parse(conn->js, packet); | |
361 } | 363 } |
362 | 364 |
363 static void jabber_bosh_connection_boot(PurpleBOSHConnection *conn) { | 365 static void jabber_bosh_connection_boot(PurpleBOSHConnection *conn) { |
364 xmlnode *init = xmlnode_new("body"); | 366 xmlnode *init = xmlnode_new("body"); |
365 /* XEP-0124: The rid must not exceed 16 characters */ | 367 /* XEP-0124: The rid must not exceed 16 characters */ |