cpw.malu.ft_thumbnails: 02d06680: Thumbnail formats should be chosen in th...

qulogic at pidgin.im qulogic at pidgin.im
Sun Apr 25 17:50:43 EDT 2010


-----------------------------------------------------------------
Revision: 02d066801a36e42efbe6acb06132032446753f24
Ancestor: 5d131ae9721badef442e1be4b0ac14e1edd52231
Author: qulogic at pidgin.im
Date: 2010-04-25T21:23:08
Branch: im.pidgin.cpw.malu.ft_thumbnails
URL: http://d.pidgin.im/viewmtn/revision/info/02d066801a36e42efbe6acb06132032446753f24

Modified files:
        pidgin/gtkft.c

ChangeLog: 

Thumbnail formats should be chosen in the order specified by the prpl.

-------------- next part --------------
============================================================
--- pidgin/gtkft.c	b922d0b77bae4ec1af690151244d9a6c25585cba
+++ pidgin/gtkft.c	e86f27accd091edf7152476a4fa5059ab8c9a900
@@ -1176,36 +1176,27 @@ pidgin_xfer_add_thumbnail(PurpleXfer *xf
 			gsize size;
 			char *option_keys[2] = {NULL, NULL};
 			char *option_values[2] = {NULL, NULL};
-			gboolean supports_jpeg = FALSE;
-			gboolean supports_png = FALSE;
 			int i;
 			gchar *format = NULL;
 			
-			for (i = 0 ; formats_split[i] ; i++) {
+			for (i = 0; formats_split[i]; i++) {
 				if (purple_strequal(formats_split[i], "jpeg")) {
-					supports_jpeg = TRUE;
+					purple_debug_info("pidgin", "creating JPEG thumbnail\n");
+					option_keys[0] = "quality";
+					option_values[0] = "90";
+					format = "jpeg";
+					break;
 				} else if (purple_strequal(formats_split[i], "png")) {
-					supports_png = TRUE;
+					purple_debug_info("pidgin", "creating PNG thumbnail\n");
+					option_keys[0] = "compression";
+					option_values[0] = "9";
+					format = "png";
+					break;
 				}
 			}
 
-			/* prefer JPEG, then PNG, otherwise try the first format given
-			 by the PRPL without options */
-			if (supports_jpeg) {
-				purple_debug_info("pidgin", "creating JPEG thumbnail\n");
-				option_keys[0] = "quality";
-				option_keys[1] = NULL;
-				option_values[0] = "90";
-				option_values[1] = NULL;
-				format = "jpeg";
-			} else if (supports_png) {
-				purple_debug_info("pidgin", "creating PNG thumbnail\n");
-				option_keys[0] = "compression";
-				option_keys[1] = NULL;
-				option_values[0] = "9";
-				option_values[1] = NULL;
-				format = "png";
-			} else {
+			/* Try the first format given by the PRPL without options */
+			if (format == NULL) {
 				purple_debug_info("pidgin",
 				    "creating thumbnail of format %s as demanded by PRPL\n",
 				    formats_split[0]);
@@ -1216,7 +1207,7 @@ pidgin_xfer_add_thumbnail(PurpleXfer *xf
 				option_keys, option_values, NULL);
 
 			if (buffer) {
-				const gchar *mimetype = g_strdup_printf("image/%s", format);				
+				gchar *mimetype = g_strdup_printf("image/%s", format);				
 				purple_debug_info("pidgin",
 				                  "created thumbnail of %" G_GSIZE_FORMAT " bytes\n",
 					size);


More information about the Commits mailing list