im.pidgin.pidgin.2.2.2: 98b8aa96dfe4f472880a3b780c29e4a73a4550ee

lschiere at pidgin.im lschiere at pidgin.im
Fri Oct 19 17:13:28 EDT 2007


-----------------------------------------------------------------
Revision: 98b8aa96dfe4f472880a3b780c29e4a73a4550ee
Ancestor: 1c3546a40030afadd1a63a06c540082ba1acb320
Author: lschiere at pidgin.im
Date: 2007-10-19T18:27:12
Branch: im.pidgin.pidgin.2.2.2

Modified files:
        libpurple/plugins/log_reader.c
        libpurple/plugins/ssl/ssl-gnutls.c
        libpurple/protocols/bonjour/parser.c
        libpurple/protocols/jabber/parser.c libpurple/xmlnode.c

ChangeLog: 

applied changes from 4d50bf3b08569aa2108a9f5da47fb1548d0c7dd9
             through 525a410c03e7e16535f3fe683f9651283109265d

applied changes from 525a410c03e7e16535f3fe683f9651283109265d
             through d4b316d73ebaf93803ca2642e78b8821c3b5d5c7

-------------- next part --------------
============================================================
--- libpurple/plugins/log_reader.c	898ea335396fa8bb09acb418528cbff1499627cc
+++ libpurple/plugins/log_reader.c	b9efb34aa6dd084cdb8a93deb9554017c3347ce4
@@ -1939,13 +1939,11 @@ static char *qip_logger_read(PurpleLog *
 	g_return_val_if_fail(data->path != NULL, g_strdup(""));
 	g_return_val_if_fail(data->length > 0, g_strdup(""));
 
-	error = NULL;
-	
+	file = g_fopen(data->path, "rb");
+	g_return_val_if_fail(file != NULL, g_strdup(""));
+
 	contents = g_malloc(data->length + 2);
 
-	file = g_fopen(data->path, "rb");
-	g_return_val_if_fail(file != NULL, g_strdup(""));
-	
 	fseek(file, data->offset, SEEK_SET);
 	fread(contents, data->length, 1, file);
 	fclose(file);
@@ -2026,7 +2024,7 @@ static char *qip_logger_read(PurpleLog *
 					g_string_append(formatted, "</font> ");
 
 					if (is_in_message) {
-						if (buddy_name != NULL && buddy->alias) {
+						if (buddy_name != NULL && buddy != NULL && buddy->alias) {
 							g_string_append_printf(formatted,
 								"<span style=\"color: #A82F2F;\">"
 								"<b>%s</b></span>: ", buddy->alias);
@@ -2056,7 +2054,9 @@ static char *qip_logger_read(PurpleLog *
 				g_string_append(formatted, line);
 				g_string_append(formatted, "<br>");
 			}
-			line = ++c;
+
+			if (c)
+				line = ++c;
 		}
 	}
 	g_free(contents);
============================================================
--- libpurple/plugins/ssl/ssl-gnutls.c	0c07158072e7eccbb72182ff5c11fbbf364fcaf4
+++ libpurple/plugins/ssl/ssl-gnutls.c	57f7fcd10b49eb8df0ba340ebc862041ca9b9d85
@@ -884,8 +884,8 @@ x509_times (PurpleCertificate *crt, time
 	gnutls_x509_crt crt_dat;
 	/* GnuTLS time functions return this on error */
 	const time_t errval = (time_t) (-1);
+	gboolean success = TRUE;
 
-
 	g_return_val_if_fail(crt, FALSE);
 	g_return_val_if_fail(crt->scheme == &x509_gnutls, FALSE);
 
@@ -893,16 +893,16 @@ x509_times (PurpleCertificate *crt, time
 
 	if (activation) {
 		*activation = gnutls_x509_crt_get_activation_time(crt_dat);
+		if (*activation == errval)
+			success = FALSE;
 	}
 	if (expiration) {
 		*expiration = gnutls_x509_crt_get_expiration_time(crt_dat);
+		if (*expiration == errval)
+			success = FALSE;
 	}
 
-	if (*activation == errval || *expiration == errval) {
-		return FALSE;
-	}
-
-	return TRUE;
+	return success;
 }
 
 /* X.509 certificate operations provided by this plugin */
============================================================
--- libpurple/protocols/bonjour/parser.c	d5decc6fae95d542db0e4f7c7d9c5d50240881e4
+++ libpurple/protocols/bonjour/parser.c	e0107a8afc655564ba4a1c424820b37e7d31dab4
@@ -64,7 +64,7 @@ bonjour_parser_element_start_libxml(void
 			char *attrib_ns = NULL;
 
 			if (attributes[i+2]) {
-				attrib_ns = g_strdup((char*)attributes[i+2]);;
+				attrib_ns = g_strdup((char*)attributes[i+2]);
 			}
 
 			memcpy(attrib, attributes[i+3], attrib_len);
============================================================
--- libpurple/protocols/jabber/parser.c	1b318b9d587444798232cf9664a84dae8b5b66af
+++ libpurple/protocols/jabber/parser.c	73f43838a4284923f4f621273894ee6f02654fd5
@@ -80,7 +80,7 @@ jabber_parser_element_start_libxml(void 
 			char *attrib_ns = NULL;
 
 			if (attributes[i+2]) {
-				attrib_ns = g_strdup((char*)attributes[i+2]);;
+				attrib_ns = g_strdup((char*)attributes[i+2]);
 			}
 
 			memcpy(attrib, attributes[i+3], attrib_len);
============================================================
--- libpurple/xmlnode.c	0a452bfe79ea0fea36de8bfe946cdb3097f066a5
+++ libpurple/xmlnode.c	301d2cff5e70a31ea398472724dbd6d27e73a3ea
@@ -146,7 +146,20 @@ xmlnode_remove_attrib(xmlnode *node, con
 	}
 }
 
+/* Compare two nullable xmlns strings.
+ * They are considered equal if they're both NULL or the strings are equal
+ */
+static gboolean _xmlnode_compare_xmlns(const char *xmlns1, const char *xmlns2) {
+	gboolean equal = FALSE;
 
+	if (xmlns1 == NULL && xmlns2 == NULL)
+		equal = TRUE;
+	else if (xmlns1 != NULL && xmlns2 != NULL && !strcmp(xmlns1, xmlns2))
+		equal = TRUE;
+
+	return equal;
+}
+
 void
 xmlnode_remove_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns)
 {
@@ -159,7 +172,7 @@ xmlnode_remove_attrib_with_namespace(xml
 	{
 		if(attr_node->type == XMLNODE_TYPE_ATTRIB &&
 		   !strcmp(attr_node->name, attr) &&
-		   !strcmp(attr_node->xmlns, xmlns))
+		   _xmlnode_compare_xmlns(xmlns, attr_node->xmlns))
 		{
 			if(node->child == attr_node) {
 				node->child = attr_node->next;
@@ -238,7 +251,8 @@ xmlnode_get_attrib_with_namespace(xmlnod
 
 	for(x = node->child; x; x = x->next) {
 		if(x->type == XMLNODE_TYPE_ATTRIB &&
-		   !strcmp(attr, x->name) && !strcmp(x->xmlns, xmlns)) {
+		   !strcmp(attr, x->name) &&
+		   _xmlnode_compare_xmlns(xmlns, x->xmlns)) {
 			return x->data;
 		}
 	}
@@ -326,6 +340,7 @@ xmlnode_get_child_with_namespace(const x
 	child_name = names[1];
 
 	for(x = parent->child; x; x = x->next) {
+		/* XXX: Is it correct to ignore the namespace for the match if none was specified? */
 		const char *xmlns = NULL;
 		if(ns)
 			xmlns = xmlnode_get_namespace(x);
@@ -673,6 +688,7 @@ xmlnode_get_next_twin(xmlnode *node)
 	g_return_val_if_fail(node->type == XMLNODE_TYPE_TAG, NULL);
 
 	for(sibling = node->next; sibling; sibling = sibling->next) {
+		/* XXX: Is it correct to ignore the namespace for the match if none was specified? */
 		const char *xmlns = NULL;
 		if(ns)
 			xmlns = xmlnode_get_namespace(sibling);


More information about the Commits mailing list