# HG changeset patch # User Elliott Sales de Andrade # Date 1272230588 0 # Node ID 0bc8e250ae0d0f44f32ea3903887be82dc5aba42 # Parent afc9cec164e41c27748b2139bef4e3352a99ecc2 Thumbnail formats should be chosen in the order specified by the prpl. diff -r afc9cec164e4 -r 0bc8e250ae0d pidgin/gtkft.c --- a/pidgin/gtkft.c Sun Apr 25 21:09:34 2010 +0000 +++ b/pidgin/gtkft.c Sun Apr 25 21:23:08 2010 +0000 @@ -1176,36 +1176,27 @@ 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 @@ 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);