talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit fc74130e7290940b8128cd086d342b7c57144263
parent 5ac71948fc34551c061d0b4af65150507f4ed845
Author: Colin Leroy <colin@colino.net>
Date:   Wed, 30 Apr 2014 20:35:47 +0200

Don't save libravatarr avatars to addressbook

Diffstat:
Msrc/avatars.c | 3+++
Msrc/avatars.h | 1+
Msrc/plugins/libravatar/libravatar.c | 2++
Msrc/textview.c | 7+++++++
Msrc/textview.h | 1+
5 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/avatars.c b/src/avatars.c @@ -39,6 +39,7 @@ AvatarRender *avatars_avatarrender_new(MsgInfo *msginfo) AvatarRender *ar = g_new0(AvatarRender, 1); ar->full_msginfo = msginfo; ar->image = NULL; + ar->type = 0; return ar; } @@ -76,12 +77,14 @@ gboolean avatars_internal_rendering_hook(gpointer source, gpointer data) aface = procmsg_msginfo_get_avatar(avatarr->full_msginfo, AVATAR_FACE); if (aface) { avatarr->image = face_get_from_header(aface); + avatarr->type = AVATAR_FACE; } #if HAVE_LIBCOMPFACE else { aface = procmsg_msginfo_get_avatar(avatarr->full_msginfo, AVATAR_XFACE); if (aface) { avatarr->image = xface_get_from_header(aface); + avatarr->type = AVATAR_XFACE; } } #endif diff --git a/src/avatars.h b/src/avatars.h @@ -33,6 +33,7 @@ struct _AvatarRender { MsgInfo *full_msginfo; GtkWidget *image; + gint type; }; AvatarRender *avatars_avatarrender_new (MsgInfo *msginfo); diff --git a/src/plugins/libravatar/libravatar.c b/src/plugins/libravatar/libravatar.c @@ -275,6 +275,7 @@ static gboolean libravatar_image_render_hook(gpointer source, gpointer data) if (ar->image) /* previous plugin set one */ gtk_widget_destroy(ar->image); ar->image = image; + ar->type = AVATAR_LIBRAVATAR; return FALSE; } /* not cached copy: try network */ @@ -291,6 +292,7 @@ static gboolean libravatar_image_render_hook(gpointer source, gpointer data) if (ar->image) /* previous plugin set one */ gtk_widget_destroy(ar->image); ar->image = image; + ar->type = AVATAR_LIBRAVATAR; } } g_free(base); diff --git a/src/textview.c b/src/textview.c @@ -1757,6 +1757,7 @@ void textview_clear(TextView *textview) if (textview->image) gtk_widget_destroy(textview->image); textview->image = NULL; + textview->avatar_type = 0; if (textview->messageview->mainwin->cursor_count == 0) { textview_set_cursor(window, text_cursor); @@ -1987,6 +1988,7 @@ static void textview_show_avatar(TextView *textview) gtk_widget_destroy(textview->image); textview->image = avatarr->image; + textview->avatar_type = avatarr->type; avatarr->image = NULL; /* avoid destroying */ avatars_avatarrender_free(avatarr); @@ -2005,6 +2007,7 @@ bail: if (textview->image) gtk_widget_destroy(textview->image); textview->image = NULL; + textview->avatar_type = 0; } void textview_show_icon(TextView *textview, const gchar *stock_id) @@ -2044,6 +2047,9 @@ static void textview_save_contact_pic(TextView *textview) if (!msginfo->extradata || !msginfo->extradata->avatars) return; + if (textview->avatar_type > AVATAR_FACE) + return; + if (textview->image) picture = gtk_image_get_pixbuf(GTK_IMAGE(textview->image)); @@ -2132,6 +2138,7 @@ bail: if (textview->image) gtk_widget_destroy(textview->image); textview->image = NULL; + textview->avatar_type = 0; #else /* new address book */ #endif diff --git a/src/textview.h b/src/textview.h @@ -78,6 +78,7 @@ struct _TextView GtkTextIter uri_hover_start_iter; GtkTextIter uri_hover_end_iter; GtkWidget *image; + gint avatar_type; gboolean loading; gboolean stop_loading; gint prev_quote_level;