comparison libpurple/protocols/jabber/parser.c @ 29562:32fe87f58d06

jabber: Backward compatibility in case any servers advertise other random 0.## versions
author Paul Aurich <paul@darkrain42.org>
date Tue, 09 Mar 2010 23:11:46 +0000
parents 618c4165d4f8
children 08c29a5c452a
comparison
equal deleted inserted replaced
29561:618c4165d4f8 29562:32fe87f58d06
53 if(!xmlStrcmp(attributes[i], (xmlChar*) "version")) { 53 if(!xmlStrcmp(attributes[i], (xmlChar*) "version")) {
54 const char *dot = strchr(attrib, '.'); 54 const char *dot = strchr(attrib, '.');
55 55
56 js->protocol_version.major = atoi(attrib); 56 js->protocol_version.major = atoi(attrib);
57 js->protocol_version.minor = dot ? atoi(dot + 1) : 0; 57 js->protocol_version.minor = dot ? atoi(dot + 1) : 0;
58 g_free(attrib);
59 58
60 /* TODO: Check this against the spec; I'm not sure if the check 59 /* TODO: Check this against the spec; I'm not sure if the check
61 * against minor is accurate. 60 * against minor is accurate.
62 */ 61 */
63 if (js->protocol_version.major > 1 || js->protocol_version.minor > 0) 62 if (js->protocol_version.major > 1 || js->protocol_version.minor > 0)
64 purple_connection_error_reason(js->gc, 63 purple_connection_error_reason(js->gc,
65 PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, 64 PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE,
66 _("XMPP Version Mismatch")); 65 _("XMPP Version Mismatch"));
66
67 if (js->protocol_version.major == 0 && js->protocol_version.minor != 9) {
68 purple_debug_warning("jabber", "Treating version %s as 0.9 for backward "
69 "compatibility\n", attrib);
70 }
71 g_free(attrib);
67 } else if(!xmlStrcmp(attributes[i], (xmlChar*) "id")) { 72 } else if(!xmlStrcmp(attributes[i], (xmlChar*) "id")) {
68 g_free(js->stream_id); 73 g_free(js->stream_id);
69 js->stream_id = attrib; 74 js->stream_id = attrib;
70 } else { 75 } else {
71 g_free(attrib); 76 g_free(attrib);