diff libpurple/util.c @ 22311:02eda4bd2b22

Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and Mauro Srgio Ferreira Brasil. I have not applied the bits on MSN yet. I will have to look at it later, but I would rather someone else more familiar with the MSN code look at it first. I changed some bits of the applied patch (whitespacing, camelcasing etc.), and the bit that required a major version bump (in gtkthemes.h). There are a few more things that need to be done for this to be merged back to i.p.p.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 19 Feb 2008 19:41:56 +0000
parents 3634d27ec6f1
children f1475ca224a8
line wrap: on
line diff
--- a/libpurple/util.c	Mon Feb 18 19:22:39 2008 +0000
+++ b/libpurple/util.c	Tue Feb 19 19:41:56 2008 +0000
@@ -921,7 +921,6 @@
 {
 	const char *pln;
 	int len, pound;
-	char temp[2];
 
 	if (!text || *text != '&')
 		return NULL;
@@ -944,9 +943,8 @@
 		pln = "\302\256";      /* or use g_unichar_to_utf8(0xae); */
 	else if(IS_ENTITY("&apos;"))
 		pln = "\'";
-	else if(*(text+1) == '#' &&
-			(sscanf(text, "&#%u%1[;]", &pound, temp) == 2 || sscanf(text, "&#x%x%1[;]", &pound, temp) == 2) &&
-			pound != 0) {
+	else if(*(text+1) == '#' && (sscanf(text, "&#%u;", &pound) == 1) &&
+			pound != 0 && *(text+3+(gint)log10(pound)) == ';') {
 		static char buf[7];
 		int buflen = g_unichar_to_utf8((gunichar)pound, buf);
 		buf[buflen] = '\0';
@@ -2889,7 +2887,7 @@
 }
 
 char *
-purple_util_get_image_filename(gconstpointer image_data, size_t image_len)
+purple_util_get_image_checksum(gconstpointer image_data, size_t image_len)
 {
 	PurpleCipherContext *context;
 	gchar digest[41];
@@ -2910,8 +2908,15 @@
 	}
 	purple_cipher_context_destroy(context);
 
+	return g_strdup(digest);
+}
+
+char *
+purple_util_get_image_filename(gconstpointer image_data, size_t image_len)
+{
 	/* Return the filename */
-	return g_strdup_printf("%s.%s", digest,
+	return g_strdup_printf("%s.%s", 
+	                       purple_util_get_image_checksum(image_data, image_len),
 	                       purple_util_get_image_extension(image_data, image_len));
 }