changeset 29962: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
files libpurple/protocols/jabber/parser.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/parser.c	Tue Mar 09 23:09:54 2010 +0000
+++ b/libpurple/protocols/jabber/parser.c	Tue Mar 09 23:11:46 2010 +0000
@@ -55,7 +55,6 @@
 
 				js->protocol_version.major = atoi(attrib);
 				js->protocol_version.minor = dot ? atoi(dot + 1) : 0;
-				g_free(attrib);
 
 				/* TODO: Check this against the spec; I'm not sure if the check
 				 * against minor is accurate.
@@ -64,6 +63,12 @@
 					purple_connection_error_reason(js->gc,
 							PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE,
 							_("XMPP Version Mismatch"));
+
+				if (js->protocol_version.major == 0 && js->protocol_version.minor != 9) {
+					purple_debug_warning("jabber", "Treating version %s as 0.9 for backward "
+					                     "compatibility\n", attrib);
+				}
+				g_free(attrib);
 			} else if(!xmlStrcmp(attributes[i], (xmlChar*) "id")) {
 				g_free(js->stream_id);
 				js->stream_id = attrib;