talons

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

commit 14032d64fa7b911223b7639882bbafac2c958ac4
parent 6535e0a41743e2879dea857af5f7832680cb8c62
Author: Oliver Lowe <o@olowe.co>
Date:   Tue,  5 Aug 2025 11:16:46 +0700

Drop compface support

Disabled by default on OpenBSD, and no significant mail client uses
faces anyway :(

Diffstat:
Mconfigure.ac | 22----------------------
Msrc/Makefile.am | 1-
Msrc/avatars.c | 9---------
Msrc/crash.c | 3---
Msrc/gtk/about.c | 10----------
Msrc/gtk/gtkutils.c | 190+++++++++++++++----------------------------------------------------------------
Msrc/gtk/gtkutils.h | 13+++++--------
Msrc/main.c | 6------
Msrc/noticeview.c | 42+++++++++++++++++++-----------------------
Msrc/prefs_customheader.c | 75+++++++++++++++++++++++++++++++++------------------------------------------
Msrc/prefs_message.c | 25+++++++++----------------
Msrc/procheader.c | 46++++++++++++++++++++--------------------------
12 files changed, 121 insertions(+), 321 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -276,10 +276,6 @@ AC_ARG_ENABLE(generic-umpc, [ --enable-generic-umpc Build generic UMPC code], [enable_generic_umpc=$enableval], [enable_generic_umpc=no]) -AC_ARG_ENABLE(compface, - [ --disable-compface Do not build compface support for X-Face], - [enable_compface=$enableval], [enable_compface=yes]) - AC_ARG_ENABLE(pthread, [ --disable-pthread Do not build pthread support], [enable_pthread=$enableval], [enable_pthread=yes]) @@ -592,23 +588,6 @@ if test $enable_generic_umpc = yes; then AC_MSG_RESULT($enable_generic_umpc) fi -dnl Check for X-Face support -AC_MSG_CHECKING([whether to use compface]) -if test x"$enable_compface" = xyes; then - AC_MSG_RESULT(yes) - AC_CHECK_LIB(compface, uncompface, - [AC_DEFINE(HAVE_LIBCOMPFACE, 1, Define if you want compface support.)], - [enable_compface=no]) - if test x"$enable_compface" = xyes; then - COMPFACE_LIBS="-lcompface" - else - COMPFACE_LIBS="" - fi - AC_SUBST(COMPFACE_LIBS) -else - AC_MSG_RESULT(no) -fi - dnl check for pthread support AC_MSG_CHECKING([whether to use pthread]) if test x$enable_pthread = xno; then @@ -1130,7 +1109,6 @@ echo "" echo "gnuTLS : $enable_gnutls" echo "OAuth2 : $enable_oauth2" echo "iconv : $am_cv_func_iconv" -echo "compface : $enable_compface" echo "IPv6 : $enable_ipv6" echo "enchant : $enable_enchant" echo "IMAP4 (libetpan) : $enable_libetpan" diff --git a/src/Makefile.am b/src/Makefile.am @@ -542,7 +542,6 @@ claws_mail_LDADD = \ $(GTK_LIBS) \ $(GNUTLS_LIBS) \ $(NETTLE_LIBS) \ - $(COMPFACE_LIBS) \ $(PTHREAD_LIBS) \ $(SM_LIBS) \ $(LIBICONV) \ diff --git a/src/avatars.c b/src/avatars.c @@ -79,15 +79,6 @@ gboolean avatars_internal_rendering_hook(gpointer source, gpointer data) 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 return FALSE; } diff --git a/src/crash.c b/src/crash.c @@ -421,9 +421,6 @@ static gchar *get_compiled_in_features(void) #if HAVE_ICONV " iconv" #endif -#if HAVE_LIBCOMPFACE - " compface" -#endif #if USE_GNUTLS " GnuTLS" #endif diff --git a/src/gtk/about.c b/src/gtk/about.c @@ -422,16 +422,6 @@ static GtkWidget *about_create_child_page_features(void) stock_pixbuf_gdk(STOCK_PIXMAP_CHECKBOX_ON, &active_pixbuf); stock_pixbuf_gdk(STOCK_PIXMAP_CHECKBOX_OFF, &inactive_pixbuf); -#if HAVE_LIBCOMPFACE - gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf); -#else - gtk_text_buffer_insert_pixbuf(buffer, &iter, inactive_pixbuf); -#endif - gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" compface "), -1, - "bold", NULL); - gtk_text_buffer_insert(buffer, &iter, - (gchar *)C_("compface", "adds support for the X-Face header\n"), -1); - #if USE_ENCHANT gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf); #else diff --git a/src/gtk/gtkutils.c b/src/gtk/gtkutils.c @@ -33,14 +33,6 @@ #include "combobox.h" -#if HAVE_LIBCOMPFACE -# include <compface.h> -#endif - -#if HAVE_LIBCOMPFACE -#define XPM_XFACE_HEIGHT (HEIGHT + 3) /* 3 = 1 header + 2 colors */ -#endif - #if (HAVE_WCTYPE_H && HAVE_WCHAR_H) # include <wchar.h> # include <wctype.h> @@ -354,13 +346,13 @@ gboolean gtkut_ctree_node_is_parent(GtkCMCTreeNode *parent, GtkCMCTreeNode *node cm_return_val_if_fail(node != NULL, FALSE); cm_return_val_if_fail(parent != NULL, FALSE); tmp = node; - + while (tmp) { if(GTK_CMCTREE_ROW(tmp)->parent && GTK_CMCTREE_ROW(tmp)->parent == parent) return TRUE; tmp = GTK_CMCTREE_ROW(tmp)->parent; } - + return FALSE; } @@ -762,7 +754,7 @@ GtkWidget *label_window_create(const gchar *str) manage_window_set_transient(GTK_WINDOW(window)); label = gtk_label_new(str); - + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, FALSE, 0); @@ -770,13 +762,13 @@ GtkWidget *label_window_create(const gchar *str) hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(hbox), wait_progress, TRUE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - + gtk_container_add(GTK_CONTAINER(window), vbox); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_widget_show_all(vbox); gtk_widget_show_now(window); - + if (move_bar_id == 0) { move_bar_id = g_timeout_add(200, move_bar_cb, wait_progress); move_bar = TRUE; @@ -793,7 +785,7 @@ void label_window_destroy(GtkWidget *window) g_source_remove(move_bar_id); move_bar_id = 0; GTK_EVENTS_FLUSH(); - gtk_widget_destroy(window); + gtk_widget_destroy(window); } GtkWidget *gtkut_account_menu_new(GList *ac_list, @@ -806,7 +798,7 @@ GtkWidget *gtkut_account_menu_new(GList *ac_list, GtkTreeIter iter; PrefsAccount *account; gchar *name; - + cm_return_val_if_fail(ac_list != NULL, NULL); optmenu = gtkut_sc_combobox_create(NULL, FALSE); @@ -858,30 +850,30 @@ GtkWidget *gtkut_get_focused_child(GtkContainer *parent) } } } - + /* See if the returned widget is a container itself; if it is, - * see if one of its children is focused. If the focused - * container has no focused child, it is itself a focusable + * see if one of its children is focused. If the focused + * container has no focused child, it is itself a focusable * child, and has focus. */ if (result && GTK_IS_CONTAINER(result)) { - GtkWidget *tmp = gtkut_get_focused_child(GTK_CONTAINER(result)); - - if (tmp) + GtkWidget *tmp = gtkut_get_focused_child(GTK_CONTAINER(result)); + + if (tmp) result = tmp; } else { /* Try the same for each container in the chain */ for (c = child_list; c != NULL && !result; c = g_list_next(c)) { - if (c->data && GTK_IS_WIDGET(c->data) + if (c->data && GTK_IS_WIDGET(c->data) && GTK_IS_CONTAINER(c->data)) { result = gtkut_get_focused_child (GTK_CONTAINER(c->data)); } } - + } - + g_list_free(child_list); - + return result; } @@ -939,7 +931,7 @@ GtkWidget *gtkut_stock_button(const gchar *stock_image, const gchar *label) gtk_button_set_label(GTK_BUTTON(button), _(label)); gtk_button_set_use_underline(GTK_BUTTON(button), TRUE); gtk_button_set_always_show_image(GTK_BUTTON(button), TRUE); - + return button; }; @@ -973,78 +965,6 @@ GtkWidget *gtkut_get_options_frame(GtkWidget *box, GtkWidget **pframe, return vbox; } -#if HAVE_LIBCOMPFACE -static gint create_xpm_from_xface(gchar *xpm[], const gchar *xface) -{ - static gchar *bit_pattern[] = { - "....", - "...#", - "..#.", - "..##", - ".#..", - ".#.#", - ".##.", - ".###", - "#...", - "#..#", - "#.#.", - "#.##", - "##..", - "##.#", - "###.", - "####" - }; - - static gchar *xface_header = "48 48 2 1"; - static gchar *xface_black = "# c #000000"; - static gchar *xface_white = ". c #ffffff"; - - gint i, line = 0; - const guchar *p; - gchar buf[WIDTH * 4 + 1]; /* 4 = strlen("0x0000") */ - - p = xface; - - strcpy(xpm[line++], xface_header); - strcpy(xpm[line++], xface_black); - strcpy(xpm[line++], xface_white); - - for (i = 0; i < HEIGHT; i++) { - gint col; - - buf[0] = '\0'; - - for (col = 0; col < 3; col++) { - gint figure; - - p += 2; /* skip '0x' */ - - for (figure = 0; figure < 4; figure++) { - gint n = 0; - - if ('0' <= *p && *p <= '9') { - n = *p - '0'; - } else if ('a' <= *p && *p <= 'f') { - n = *p - 'a' + 10; - } else if ('A' <= *p && *p <= 'F') { - n = *p - 'A' + 10; - } - - strcat(buf, bit_pattern[n]); - p++; /* skip ',' */ - } - - p++; /* skip '\n' */ - } - - strcpy(xpm[line++], buf); - p++; - } - - return 0; -} -#endif - gboolean get_tag_range(GtkTextIter *iter, GtkTextTag *tag, GtkTextIter *start_iter, @@ -1070,46 +990,6 @@ gboolean get_tag_range(GtkTextIter *iter, return TRUE; } -#if HAVE_LIBCOMPFACE -GtkWidget *xface_get_from_header(const gchar *o_xface) -{ - static gchar *xpm_xface[XPM_XFACE_HEIGHT]; - static gboolean xpm_xface_init = TRUE; - GdkPixbuf *pixbuf; - GtkWidget *ret; - gchar xface[2048]; - - if (o_xface == NULL) - return NULL; - - strncpy(xface, o_xface, sizeof(xface) - 1); - xface[sizeof(xface) - 1] = '\0'; - - if (uncompface(xface) < 0) { - g_warning("uncompface failed"); - return NULL; - } - - if (xpm_xface_init) { - gint i; - - for (i = 0; i < XPM_XFACE_HEIGHT; i++) { - xpm_xface[i] = g_malloc(WIDTH + 1); - *xpm_xface[i] = '\0'; - } - xpm_xface_init = FALSE; - } - - create_xpm_from_xface(xpm_xface, xface); - - pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)xpm_xface); - ret = gtk_image_new_from_pixbuf(pixbuf); - g_object_unref(pixbuf); - - return ret; -} -#endif - GtkWidget *face_get_from_header(const gchar *o_face) { gchar face[2048]; @@ -1119,7 +999,7 @@ GtkWidget *face_get_from_header(const gchar *o_face) GError *error = NULL; GdkPixbufLoader *loader = gdk_pixbuf_loader_new (); GtkWidget *image; - + if (o_face == NULL || strlen(o_face) == 0) return NULL; @@ -1166,7 +1046,7 @@ static gboolean _combobox_separator_func(GtkTreeModel *model, if( txt == NULL ) return TRUE; - + g_free(txt); return FALSE; } @@ -1397,7 +1277,7 @@ gboolean gtkut_tree_model_text_iter_prev(GtkTreeModel *model, valid = gtk_tree_model_iter_next(model, &cur_iter); count++; } - return FALSE; + return FALSE; } gboolean gtkut_tree_model_get_iter_last(GtkTreeModel *model, @@ -1427,8 +1307,8 @@ GtkWidget *gtkut_window_new (GtkWindowType type, return window; } -static gboolean gtkut_tree_iter_comp(GtkTreeModel *model, - GtkTreeIter *iter1, +static gboolean gtkut_tree_iter_comp(GtkTreeModel *model, + GtkTreeIter *iter1, GtkTreeIter *iter2) { GtkTreePath *path1 = gtk_tree_model_get_path(model, iter1); @@ -1439,7 +1319,7 @@ static gboolean gtkut_tree_iter_comp(GtkTreeModel *model, gtk_tree_path_free(path1); gtk_tree_path_free(path2); - + return result; } @@ -1455,13 +1335,13 @@ gint gtkut_list_view_get_selected_row(GtkWidget *list_view) GtkTreeIter iter; int row; - if (n_rows == 0) + if (n_rows == 0) return -1; - + selection = gtk_tree_view_get_selection(view); if (!gtk_tree_selection_get_selected(selection, &model, &iter)) return -1; - + /* get all iterators and compare them... */ for (row = 0; row < n_rows; row++) { GtkTreeIter itern; @@ -1470,7 +1350,7 @@ gint gtkut_list_view_get_selected_row(GtkWidget *list_view) && gtkut_tree_iter_comp(model, &iter, &itern)) return row; } - + return -1; } @@ -1487,13 +1367,13 @@ gboolean gtkut_list_view_select_row(GtkWidget *list, gint row) if (!gtk_tree_model_iter_nth_child(model, &iter, NULL, row)) return FALSE; - + gtk_tree_selection_select_iter(selection, &iter); path = gtk_tree_model_get_path(model, &iter); gtk_tree_view_set_cursor(list_view, path, NULL, FALSE); gtk_tree_path_free(path); - + return TRUE; } @@ -1520,7 +1400,7 @@ struct _ClawsIOClosure gpointer data; }; -static gboolean +static gboolean claws_io_invoke (GIOChannel *source, GIOCondition condition, gpointer data) @@ -1573,7 +1453,7 @@ claws_input_add (gint source, else channel = g_io_channel_win32_new_fd(source); #endif - result = g_io_add_watch_full (channel, G_PRIORITY_DEFAULT, condition, + result = g_io_add_watch_full (channel, G_PRIORITY_DEFAULT, condition, claws_io_invoke, closure, claws_io_destroy); g_io_channel_unref (channel); @@ -1662,7 +1542,7 @@ GdkPixbuf *claws_load_pixbuf_fitting(GdkPixbuf *src_pixbuf, gboolean inline_img, avail_width = box_width-32; avail_height = box_height; - + if (box_width != -1 && box_height != -1 && avail_width - 100 > 0) { if (inline_img || fit_img_height) { if (w > avail_width) { @@ -1679,7 +1559,7 @@ GdkPixbuf *claws_load_pixbuf_fitting(GdkPixbuf *src_pixbuf, gboolean inline_img, w = avail_width; } } - t_pixbuf = gdk_pixbuf_scale_simple(pixbuf, + t_pixbuf = gdk_pixbuf_scale_simple(pixbuf, w, h, GDK_INTERP_BILINEAR); g_object_unref(pixbuf); pixbuf = t_pixbuf; @@ -1981,7 +1861,7 @@ static void get_time_from_combo(GtkComboBox *combo, int *h, int *m) gchar *tmp; gchar **parts; - if (!h || !m) + if (!h || !m) return; tmp = gtk_editable_get_chars(GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(combo))), 0, -1); diff --git a/src/gtk/gtkutils.h b/src/gtk/gtkutils.h @@ -131,7 +131,7 @@ GtkCMCTreeNode *gtkut_ctree_find_collapsed_parent GtkCMCTreeNode *node); void gtkut_ctree_expand_parent_all (GtkCMCTree *ctree, GtkCMCTreeNode *node); -gboolean gtkut_ctree_node_is_parent (GtkCMCTreeNode *parent, +gboolean gtkut_ctree_node_is_parent (GtkCMCTreeNode *parent, GtkCMCTreeNode *node); void gtkut_ctree_set_focus_row (GtkCMCTree *ctree, GtkCMCTreeNode *node); @@ -174,9 +174,6 @@ GtkWidget *gtkut_get_browse_directory_btn(const gchar *label); GtkWidget *gtkut_get_replace_btn(const gchar *label); GtkWidget *gtkut_stock_button(const gchar *stock_image, const gchar *label); GtkWidget *gtkut_get_options_frame(GtkWidget *box, GtkWidget **frame, const gchar *frame_label); -#if HAVE_LIBCOMPFACE -GtkWidget *xface_get_from_header(const gchar *o_xface); -#endif gboolean get_tag_range(GtkTextIter *iter, GtkTextTag *tag, GtkTextIter *start_iter, @@ -185,11 +182,11 @@ gboolean get_tag_range(GtkTextIter *iter, GtkWidget *face_get_from_header(const gchar *o_face); GtkWidget *gtkut_sc_combobox_create(GtkWidget *eventbox, gboolean focus_on_click); -void gtkutils_scroll_one_line (GtkWidget *widget, - GtkAdjustment *vadj, +void gtkutils_scroll_one_line (GtkWidget *widget, + GtkAdjustment *vadj, gboolean up); -gboolean gtkutils_scroll_page (GtkWidget *widget, - GtkAdjustment *vadj, +gboolean gtkutils_scroll_page (GtkWidget *widget, + GtkAdjustment *vadj, gboolean up); gboolean gtkut_tree_model_text_iter_prev(GtkTreeModel *model, diff --git a/src/main.c b/src/main.c @@ -815,12 +815,6 @@ static void main_dump_features_list(gboolean show_debug_only) debug_print("Compiled-in features:\n"); else g_print("Compiled-in features:\n"); -#if HAVE_LIBCOMPFACE - if (show_debug_only) - debug_print(" compface\n"); - else - g_print(" compface\n"); -#endif #if USE_ENCHANT if (show_debug_only) debug_print(" Enchant\n"); diff --git a/src/noticeview.c b/src/noticeview.c @@ -1,4 +1,4 @@ -/* +/* * Claws Mail -- a GTK based, lightweight, and fast e-mail client * Copyright (C) 2002-2025 the Claws Mail Team * @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * */ #ifdef HAVE_CONFIG_H @@ -31,10 +31,6 @@ #include <string.h> #include <time.h> -#if HAVE_LIBCOMPFACE -# include <compface.h> -#endif - #include "prefs_common.h" #include "gtkutils.h" #include "utils.h" @@ -94,7 +90,7 @@ NoticeView *noticeview_create(MainWindow *mainwin) hsep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); g_object_set(hsep, "margin", 1, NULL); gtk_container_add(GTK_CONTAINER(vgrid), hsep); - + hgrid = gtk_grid_new(); gtk_orientable_set_orientation(GTK_ORIENTABLE(hgrid), GTK_ORIENTATION_HORIZONTAL); @@ -106,10 +102,10 @@ NoticeView *noticeview_create(MainWindow *mainwin) gtk_event_box_set_visible_window(GTK_EVENT_BOX(evtbox), FALSE); gtk_widget_show(evtbox); - icon = stock_pixmap_widget(STOCK_PIXMAP_NOTICE_WARN); + icon = stock_pixmap_widget(STOCK_PIXMAP_NOTICE_WARN); gtk_widget_show(icon); - g_signal_connect(G_OBJECT(evtbox), "button-press-event", + g_signal_connect(G_OBJECT(evtbox), "button-press-event", G_CALLBACK(noticeview_icon_pressed), (gpointer) noticeview); g_signal_connect(G_OBJECT(evtbox), "motion-notify-event", @@ -118,27 +114,27 @@ NoticeView *noticeview_create(MainWindow *mainwin) G_CALLBACK(noticeview_leave_notify), noticeview); g_signal_connect(G_OBJECT(evtbox), "enter-notify-event", G_CALLBACK(noticeview_enter_notify), noticeview); - + gtk_container_add(GTK_CONTAINER(evtbox), icon); gtk_container_add(GTK_CONTAINER(hgrid), evtbox); - + text = gtk_label_new(""); gtk_widget_show(text); gtk_container_add(GTK_CONTAINER(hgrid), text); widget = gtk_button_new_with_label(""); - g_signal_connect(G_OBJECT(widget), "clicked", + g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(noticeview_button_pressed), (gpointer) noticeview); g_object_set(widget, "margin-right", 4, NULL); gtk_container_add(GTK_CONTAINER(hgrid), widget); - + widget2 = gtk_button_new_with_label(""); - g_signal_connect(G_OBJECT(widget2), "clicked", + g_signal_connect(G_OBJECT(widget2), "clicked", G_CALLBACK(noticeview_2ndbutton_pressed), (gpointer) noticeview); gtk_container_add(GTK_CONTAINER(hgrid), widget2); - + noticeview->vgrid = vgrid; noticeview->hsep = hsep; noticeview->hgrid = hgrid; @@ -166,7 +162,7 @@ void noticeview_show(NoticeView *noticeview) if (!noticeview->visible) { gtk_widget_show(GTK_WIDGET_PTR(noticeview)); noticeview->visible = TRUE; - } + } } void noticeview_hide(NoticeView *noticeview) @@ -174,7 +170,7 @@ void noticeview_hide(NoticeView *noticeview) if (noticeview && noticeview->visible) { gtk_widget_hide(GTK_WIDGET_PTR(noticeview)); noticeview->visible = FALSE; - } + } } void noticeview_set_text(NoticeView *noticeview, const char *text) @@ -193,10 +189,10 @@ void noticeview_set_button_text(NoticeView *noticeview, const char *text) gtk_widget_show(noticeview->button); } else gtk_widget_hide(noticeview->button); - - /* Callers defining only one button don't have to mind + + /* Callers defining only one button don't have to mind * resetting the second one. Callers defining two have - * to define the second button after the first one. + * to define the second button after the first one. */ gtk_widget_hide(noticeview->button2); } @@ -289,17 +285,17 @@ static void noticeview_2ndbutton_pressed(GtkButton *button, NoticeView *noticevi void noticeview_set_icon(NoticeView *noticeview, StockPixmap icon) { GdkPixbuf *pixbuf; - + if (stock_pixbuf_gdk(icon, &pixbuf) < 0) return; - + gtk_image_set_from_pixbuf(GTK_IMAGE(noticeview->icon), pixbuf); } void noticeview_set_icon_clickable(NoticeView *noticeview, gboolean setting) { noticeview->icon_clickable = setting; -} +} void noticeview_set_tooltip (NoticeView *noticeview, const gchar *text) { diff --git a/src/prefs_customheader.c b/src/prefs_customheader.c @@ -102,7 +102,7 @@ static GtkWidget *prefs_custom_header_list_view_create (void); static void prefs_custom_header_create_list_view_columns (GtkWidget *list_view); static gboolean prefs_custom_header_selected (GtkTreeSelection *selector, - GtkTreeModel *model, + GtkTreeModel *model, GtkTreePath *path, gboolean currently_selected, gpointer data); @@ -440,7 +440,7 @@ static void prefs_custom_header_set_dialog(PrefsAccount *ac) { GtkListStore *store; GSList *cur; - + store = GTK_LIST_STORE(gtk_tree_view_get_model (GTK_TREE_VIEW(customhdr.list_view))); gtk_list_store_clear(store); @@ -453,7 +453,7 @@ static void prefs_custom_header_set_dialog(PrefsAccount *ac) ch->value ? ch->value : ""); prefs_custom_header_list_view_insert_header - (customhdr.list_view, NULL, ch_str, ch); + (customhdr.list_view, NULL, ch_str, ch); g_free(ch_str); } @@ -493,9 +493,9 @@ static void prefs_custom_header_list_view_set_row(PrefsAccount *ac) alertpanel_error(_("Header name is not set.")); return; } - - while (*entry_text && - (*entry_text == '\n' || *entry_text == '\r' || + + while (*entry_text && + (*entry_text == '\n' || *entry_text == '\r' || *entry_text == '\t' || *entry_text == ' ')) entry_text++; @@ -519,11 +519,11 @@ static void prefs_custom_header_list_view_set_row(PrefsAccount *ac) gtk_entry_set_text(GTK_ENTRY(customhdr.hdr_entry), ch->name); entry_text = gtk_entry_get_text(GTK_ENTRY(customhdr.val_entry)); - while (*entry_text && - (*entry_text == '\n' || *entry_text == '\r' || + while (*entry_text && + (*entry_text == '\n' || *entry_text == '\r' || *entry_text == '\t' || *entry_text == ' ')) entry_text++; - + if (entry_text[0] != '\0') { ch->value = g_strdup(entry_text); unfold_line(ch->value); @@ -533,10 +533,10 @@ static void prefs_custom_header_list_view_set_row(PrefsAccount *ac) ch_str = g_strdup_printf("%s: %s", ch->name, ch->value ? ch->value : ""); - + prefs_custom_header_list_view_insert_header (customhdr.list_view, NULL, ch_str, ch); - + g_free(ch_str); prefs_custom_header_set_list(cur_ac); @@ -548,7 +548,7 @@ static void prefs_custom_header_val_from_file_cb(void) gchar *filename = NULL; gchar *contents = NULL; const gchar *hdr = gtk_entry_get_text(GTK_ENTRY(customhdr.hdr_entry)); - + if (!strcmp(hdr, "Face")) filename = filesel_select_file_open(_("Choose a PNG file"), NULL); else if (!strcmp(hdr, "X-Face")) @@ -565,7 +565,7 @@ static void prefs_custom_header_val_from_file_cb(void) gint w, h; GdkPixbufFormat *format = gdk_pixbuf_get_file_info( filename, &w, &h); - + if (format == NULL) { alertpanel_error(_("This file isn't an image.")); g_free(filename); @@ -574,7 +574,7 @@ static void prefs_custom_header_val_from_file_cb(void) if (w != 48 || h != 48) { alertpanel_error(_("The chosen image isn't the correct size (48x48).")); g_free(filename); - return; + return; } if (!strcmp(hdr, "Face")) { if (get_file_size(filename) > 725) { @@ -616,7 +616,7 @@ static void prefs_custom_header_val_from_file_cb(void) gchar *tmp2 = NULL; if (tmp[i] == ' ') { i++; continue; - } + } if (tmp[i] == '\r' || tmp[i] == '\n') { i++; continue; } @@ -632,7 +632,7 @@ static void prefs_custom_header_val_from_file_cb(void) fp = claws_fopen(filename, "rb"); if (!fp) { g_free(filename); - return; + return; } while ((len = claws_fread(inbuf, sizeof(gchar), @@ -669,7 +669,7 @@ static void prefs_custom_header_val_from_file_cb(void) settext: if (contents && strlen(contents)) gtk_entry_set_text(GTK_ENTRY(customhdr.val_entry), contents); - + g_free(contents); g_free(filename); } @@ -688,7 +688,7 @@ static void prefs_custom_header_delete_cb(void) if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection (GTK_TREE_VIEW(customhdr.list_view)), &model, &sel)) - return; + return; if (alertpanel(_("Delete header"), _("Do you really want to delete this header?"), @@ -702,7 +702,7 @@ static void prefs_custom_header_delete_cb(void) gtk_list_store_remove(GTK_LIST_STORE(model), &sel); cur_ac->customhdr_list = g_slist_remove(cur_ac->customhdr_list, ch); - + custom_header_free(ch); } @@ -713,7 +713,7 @@ static void prefs_custom_header_up(void) GtkListStore *store = NULL; GtkTreeModel *model = NULL; GtkTreeIter iprev; - + if (!gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW(customhdr.list_view)), @@ -724,7 +724,7 @@ static void prefs_custom_header_up(void) sel = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &isel); if (!sel) return; - + /* no move if we're at row 0... */ prev = gtk_tree_path_copy(sel); if (!gtk_tree_path_prev(prev)) { @@ -747,7 +747,7 @@ static void prefs_custom_header_down(void) GtkListStore *store = NULL; GtkTreeModel *model = NULL; GtkTreeIter next, sel; - + if (!gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW(customhdr.list_view)), @@ -756,7 +756,7 @@ static void prefs_custom_header_down(void) return; store = (GtkListStore *)model; next = sel; - if (!gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &next)) + if (!gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &next)) return; gtk_list_store_swap(store, &next, &sel); @@ -781,7 +781,7 @@ static void prefs_custom_header_ok(void) static void prefs_custom_header_cancel(void) { - prefs_custom_header_read_config(cur_ac); + prefs_custom_header_read_config(cur_ac); gtk_widget_hide(customhdr.window); gtk_window_set_modal(GTK_WINDOW(customhdr.window), FALSE); } @@ -796,7 +796,7 @@ static gint prefs_custom_header_deleted(GtkWidget *widget, GdkEventAny *event, static GtkListStore* prefs_custom_header_create_data_store(void) { return gtk_list_store_new(N_CUSTHDR_COLUMNS, - G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_POINTER, -1); } @@ -826,7 +826,7 @@ static void prefs_custom_header_list_view_insert_header(GtkWidget *list_view, -1); custom_header_free(old_data); - + gtk_list_store_set(list_store, row_iter, CUSTHDR_STRING, header, CUSTHDR_DATA, data, @@ -842,10 +842,10 @@ static GtkWidget *prefs_custom_header_list_view_create(void) model = GTK_TREE_MODEL(prefs_custom_header_create_data_store()); list_view = GTK_TREE_VIEW(gtk_tree_view_new_with_model(model)); - g_object_unref(model); + g_object_unref(model); gtk_tree_view_set_reorderable(list_view, TRUE); - + selector = gtk_tree_view_get_selection(list_view); gtk_tree_selection_set_mode(selector, GTK_SELECTION_BROWSE); gtk_tree_selection_set_select_function(selector, prefs_custom_header_selected, @@ -868,14 +868,14 @@ static void prefs_custom_header_create_list_view_columns(GtkWidget *list_view) renderer, "text", CUSTHDR_STRING, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(list_view), column); + gtk_tree_view_append_column(GTK_TREE_VIEW(list_view), column); } #define ENTRY_SET_TEXT(entry, str) \ gtk_entry_set_text(GTK_ENTRY(entry), str ? str : "") static gboolean prefs_custom_header_selected(GtkTreeSelection *selector, - GtkTreeModel *model, + GtkTreeModel *model, GtkTreePath *path, gboolean currently_selected, gpointer data) @@ -892,10 +892,10 @@ static gboolean prefs_custom_header_selected(GtkTreeSelection *selector, if (!gtk_tree_model_get_iter(model, &iter, path)) return TRUE; - gtk_tree_model_get(model, &iter, + gtk_tree_model_get(model, &iter, CUSTHDR_DATA, &ch, -1); - + if (!ch) ch = &default_ch; ENTRY_SET_TEXT(customhdr.hdr_entry, ch->name); @@ -906,16 +906,7 @@ static gboolean prefs_custom_header_selected(GtkTreeSelection *selector, gtk_image_set_from_pixbuf (GTK_IMAGE(customhdr.preview), pixbuf); gtk_widget_show(customhdr.preview); g_object_ref_sink (G_OBJECT(preview)); - } -#if HAVE_LIBCOMPFACE - else if (!g_strcmp0("X-Face", ch->name) && ch->value != NULL) { - preview = GTK_IMAGE(xface_get_from_header(ch->value)); - pixbuf = gtk_image_get_pixbuf(preview); - gtk_image_set_from_pixbuf (GTK_IMAGE(customhdr.preview), pixbuf); - gtk_widget_show(customhdr.preview); - g_object_ref_sink (G_OBJECT(preview)); - } -#endif + } else { gtk_widget_hide(customhdr.preview); } diff --git a/src/prefs_message.c b/src/prefs_message.c @@ -74,11 +74,11 @@ static void disphdr_pane_toggled(GtkToggleButton *toggle_btn, GtkWidget *widget) gtk_widget_set_sensitive(widget, !is_active); } -static void prefs_message_create_widget(PrefsPage *_page, GtkWindow *window, +static void prefs_message_create_widget(PrefsPage *_page, GtkWindow *window, gpointer data) { MessagePage *prefs_message = (MessagePage *) _page; - + GtkWidget *vbox1; GtkWidget *vbox2; GtkWidget *hbox1; @@ -107,7 +107,7 @@ static void prefs_message_create_widget(PrefsPage *_page, GtkWindow *window, GtkWidget *checkbtn_hide_quoted; GtkWidget *checkbtn_attach_desc; - + GtkWidget *frame_quote; GtkWidget *hbox2; GtkWidget *vbox_quote; @@ -123,19 +123,12 @@ static void prefs_message_create_widget(PrefsPage *_page, GtkWindow *window, PACK_CHECK_BUTTON(vbox2, checkbtn_disphdrpane, _("Display header pane above message view")); -#if HAVE_LIBCOMPFACE - PACK_CHECK_BUTTON(vbox2, checkbtn_dispxface, - _("Display (X-)Face in message view")); - PACK_CHECK_BUTTON(vbox2, checkbtn_savexface, - _("Save (X-)Face in address book if possible")); -#else PACK_CHECK_BUTTON(vbox2, checkbtn_dispxface, _("Display Face in message view")); PACK_CHECK_BUTTON(vbox2, checkbtn_savexface, _("Save Face in address book if possible")); -#endif - gtk_widget_set_sensitive(checkbtn_dispxface, + gtk_widget_set_sensitive(checkbtn_dispxface, !prefs_common.display_header_pane); g_signal_connect(G_OBJECT(checkbtn_disphdrpane), "toggled", @@ -165,7 +158,7 @@ static void prefs_message_create_widget(PrefsPage *_page, GtkWindow *window, PACK_CHECK_BUTTON(vbox2, checkbtn_html_plugin, _("Render HTML-only messages with plugin if possible")); - + PACK_CHECK_BUTTON(vbox2, checkbtn_promote_html_part, _("Select the HTML part of multipart/alternative messages")); @@ -287,9 +280,9 @@ static void prefs_message_create_widget(PrefsPage *_page, GtkWindow *window, prefs_common.line_space); gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_scrollstep), prefs_common.scroll_step); - gtk_entry_set_text(GTK_ENTRY(entry_quote_chars), + gtk_entry_set_text(GTK_ENTRY(entry_quote_chars), prefs_common.quote_chars?prefs_common.quote_chars:""); - + prefs_message->window = GTK_WIDGET(window); prefs_message->checkbtn_disphdrpane = checkbtn_disphdrpane; prefs_message->checkbtn_dispxface = checkbtn_dispxface; @@ -305,7 +298,7 @@ static void prefs_message_create_widget(PrefsPage *_page, GtkWindow *window, prefs_message->checkbtn_halfpage = checkbtn_halfpage; prefs_message->checkbtn_attach_desc = checkbtn_attach_desc; prefs_message->entry_quote_chars = entry_quote_chars; - + prefs_message->page.widget = vbox1; } @@ -340,7 +333,7 @@ static void prefs_message_save(PrefsPage *_page) prefs_common.scroll_step = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(page->spinbtn_scrollstep)); - g_free(prefs_common.quote_chars); + g_free(prefs_common.quote_chars); prefs_common.quote_chars = gtk_editable_get_chars( GTK_EDITABLE(page->entry_quote_chars), 0, -1); remove_space(prefs_common.quote_chars); diff --git a/src/procheader.c b/src/procheader.c @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * */ #ifdef HAVE_CONFIG_H @@ -56,7 +56,7 @@ static int string_peekchar(char **str); static int file_peekchar(FILE *fp); static gint generic_get_one_field(gchar **bufptr, void *data, HeaderEntry hentry[], - getlinefunc getline, + getlinefunc getline, peekcharfunc peekchar, gboolean unfold); static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags, @@ -118,7 +118,7 @@ static char *string_getline(char *buf, size_t len, char **str) } last_was_cr = is_cr; } - + *buf = '\0'; return buf; @@ -221,7 +221,7 @@ static gint generic_get_one_field(gchar **bufptr, void *data, strretchomp(buf); buflen = strlen(buf); - + /* read next line */ tmpbuf = g_malloc(BUFFSIZE); @@ -260,7 +260,7 @@ static gint generic_get_one_field(gchar **bufptr, void *data, gint procheader_get_one_field_asis(gchar **buf, FILE *fp) { return generic_get_one_field(buf, fp, NULL, - (getlinefunc)fgets_crlf, + (getlinefunc)fgets_crlf, (peekcharfunc)file_peekchar, FALSE); } @@ -586,7 +586,7 @@ MsgInfo *procheader_parse_stream(FILE *fp, MsgFlags flags, gboolean full, static gboolean avatar_from_some_face(gpointer source, gpointer userdata) { AvatarCaptureData *acd = (AvatarCaptureData *)source; - + if (*(acd->content) == '\0') /* won't be null, but may be empty */ return FALSE; @@ -594,12 +594,6 @@ static gboolean avatar_from_some_face(gpointer source, gpointer userdata) debug_print("avatar_from_some_face: found 'Face' header\n"); procmsg_msginfo_add_avatar(acd->msginfo, AVATAR_FACE, acd->content); } -#if HAVE_LIBCOMPFACE - else if (!strcmp(acd->header, hentry_full[H_X_FACE].name)) { - debug_print("avatar_from_some_face: found 'X-Face' header\n"); - procmsg_msginfo_add_avatar(acd->msginfo, AVATAR_XFACE, acd->content); - } -#endif return FALSE; } @@ -639,7 +633,7 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags, || !strncmp(buf, "Subject: ", 9)) { if (isstring) data = orig_data; - else + else rewind((FILE *)data); g_free(buf); buf = NULL; @@ -651,12 +645,12 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags, } msginfo = procmsg_msginfo_new(); - - if (flags.tmp_flags || flags.perm_flags) + + if (flags.tmp_flags || flags.perm_flags) msginfo->flags = flags; - else + else MSG_SET_PERM_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD); - + msginfo->inreplyto = NULL; if (avatar_hook_id == HOOK_NONE && @@ -682,14 +676,14 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags, msginfo->date = g_strdup(hp); } else { gchar *utf = conv_codeset_strdup( - hp, + hp, conv_get_locale_charset_str_no_utf8(), CS_INTERNAL); - if (utf == NULL || + if (utf == NULL || !g_utf8_validate(utf, -1, NULL)) { g_free(utf); utf = g_malloc(strlen(buf)*2+1); - conv_localetodisp(utf, + conv_localetodisp(utf, strlen(hp)*2+1, hp); } msginfo->date = utf; @@ -712,7 +706,7 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags, g_free(p); } else msginfo->to = g_strdup(tmp); - g_free(tmp); + g_free(tmp); break; case H_CC: tmp = conv_unmime_header(hp, NULL, TRUE); @@ -724,7 +718,7 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags, g_free(p); } else msginfo->cc = g_strdup(tmp); - g_free(tmp); + g_free(tmp); break; case H_NEWSGROUPS: if (msginfo->newsgroups) { @@ -780,7 +774,7 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags, if (msginfo->extradata->returnreceiptto) break; msginfo->extradata->returnreceiptto = g_strdup(hp); break; -/* partial download infos */ +/* partial download infos */ case H_SC_PARTIALLY_RETRIEVED: if (!msginfo->extradata) msginfo->extradata = g_new0(MsgInfoExtraData, 1); @@ -1110,8 +1104,8 @@ gboolean procheader_date_parse_to_tm(const gchar *src, struct tm *t, char *zone) if (!t) return FALSE; - - memset(t, 0, sizeof *t); + + memset(t, 0, sizeof *t); if (procheader_scan_date_string(src, weekday, &day, month, &year, &hh, &mm, &ss, zone) < 0) { @@ -1346,7 +1340,7 @@ void procheader_entries_free (HeaderEntry *entries) g_free(he->name); if (he->body != NULL) g_free(he->body); - ++he; + ++he; } g_free(entries); }