Mercurial > pidgin.yaz
changeset 30248:834038426c38
Minor cleanup.
* g_free is NULL-safe.
* No need for an extra * on the gpointer.
* Adium doesn't like / in their <img> tags.
* purple_xfer_set_thumbnail should free previous data.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 25 Apr 2010 20:38:17 +0000 |
parents | 2ab17571bf42 |
children | 905e291986bc |
files | libpurple/ft.c |
diffstat | 1 files changed, 12 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/ft.c Sat Apr 24 14:59:13 2010 +0000 +++ b/libpurple/ft.c Sun Apr 25 20:38:17 2010 +0000 @@ -76,11 +76,9 @@ if (priv->buffer) g_byte_array_free(priv->buffer, TRUE); - if (priv->thumbnail_data) - g_free(priv->thumbnail_data); + g_free(priv->thumbnail_data); - if (priv->thumbnail_mimetype) - g_free(priv->thumbnail_mimetype); + g_free(priv->thumbnail_mimetype); g_free(priv); } @@ -283,7 +281,7 @@ PurpleConversation *conv = NULL; PurpleMessageFlags flags = PURPLE_MESSAGE_SYSTEM; char *escaped; - const gpointer *thumbnail_data = purple_xfer_get_thumbnail_data(xfer); + gconstpointer thumbnail_data = purple_xfer_get_thumbnail_data(xfer); g_return_if_fail(xfer != NULL); g_return_if_fail(message != NULL); @@ -306,7 +304,7 @@ int id = purple_imgstore_add_with_id(data, size, NULL); message_with_img = - g_strdup_printf("<img id='%d'/> %s", id, escaped); + g_strdup_printf("<img id='%d'> %s", id, escaped); purple_conversation_write(conv, NULL, message_with_img, flags, time(NULL)); purple_imgstore_unref_by_id(id); @@ -324,7 +322,7 @@ purple_xfer_conversation_write_internal(xfer, message, is_error, FALSE); } -/* maybe this one should be exported puplically? */ +/* maybe this one should be exported publically? */ static void purple_xfer_conversation_write_with_thumbnail(PurpleXfer *xfer, const gchar *message) @@ -1662,10 +1660,17 @@ { PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer); + g_free(priv->thumbnail_data); + g_free(priv->thumbnail_mimetype); + if (thumbnail && size > 0) { priv->thumbnail_data = g_memdup(thumbnail, size); priv->thumbnail_size = size; priv->thumbnail_mimetype = g_strdup(mimetype); + } else { + priv->thumbnail_data = NULL; + priv->thumbnail_size = 0; + priv->thumbnail_mimetype = NULL; } }