From 6e931f8c3aaf70d141426bc177a59420238cfc5d Mon Sep 17 00:00:00 2001 From: Paul Mangan Date: Fri, 19 Aug 2005 10:36:15 +0000 Subject: [PATCH] 2005-08-19 [paul] 1.9.13cvs40 * src/prefs_common.c * src/prefs_common.h * src/summaryview.c reintroduce enable_swap_from as a hidden pref. patch by Colin * src/quote_fmt_parse.y * src/plugins/clamav/clamav_plugin.c * src/plugins/dillo_viewer/dillo_viewer.c * src/plugins/mathml_viewer/mathml_viewer.c * src/plugins/pgpcore/sgpgme.c * src/plugins/pgpinline/pgpinline.c * src/plugins/pgpmime/pgpmime.c tidy up. patch by Colin --- ChangeLog-gtk2.claws | 16 ++++++++ PATCHSETS | 1 + configure.ac | 2 +- src/plugins/clamav/clamav_plugin.c | 2 +- src/plugins/dillo_viewer/dillo_viewer.c | 4 +- src/plugins/mathml_viewer/mathml_viewer.c | 4 +- src/plugins/pgpcore/sgpgme.c | 6 +-- src/plugins/pgpinline/pgpinline.c | 6 +-- src/plugins/pgpmime/pgpmime.c | 4 +- src/prefs_common.c | 2 + src/prefs_common.h | 1 + src/quote_fmt_parse.y | 2 +- src/summaryview.c | 47 +++++++++++++++++++---- 13 files changed, 74 insertions(+), 23 deletions(-) diff --git a/ChangeLog-gtk2.claws b/ChangeLog-gtk2.claws index 9ca7d46c5..bda116358 100644 --- a/ChangeLog-gtk2.claws +++ b/ChangeLog-gtk2.claws @@ -1,3 +1,19 @@ +2005-08-19 [paul] 1.9.13cvs40 + + * src/prefs_common.c + * src/prefs_common.h + * src/summaryview.c + reintroduce enable_swap_from as a + hidden pref. patch by Colin + * src/quote_fmt_parse.y + * src/plugins/clamav/clamav_plugin.c + * src/plugins/dillo_viewer/dillo_viewer.c + * src/plugins/mathml_viewer/mathml_viewer.c + * src/plugins/pgpcore/sgpgme.c + * src/plugins/pgpinline/pgpinline.c + * src/plugins/pgpmime/pgpmime.c + tidy up. patch by Colin + 2005-08-19 [paul] 1.9.13cvs39 * configure.ac diff --git a/PATCHSETS b/PATCHSETS index 4326e1a67..540adb719 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -725,3 +725,4 @@ ( cvs diff -u -r 1.382.2.150 -r 1.382.2.151 src/compose.c; cvs diff -u -r 1.213.2.50 -r 1.213.2.51 src/folder.c; cvs diff -u -r 1.18.2.9 -r 1.18.2.10 src/jpilot.c; cvs diff -u -r 1.150.2.37 -r 1.150.2.38 src/procmsg.c; cvs diff -u -r 1.60.2.14 -r 1.60.2.15 src/procmsg.h; cvs diff -u -r 1.395.2.113 -r 1.395.2.114 src/summaryview.c; ) > 1.9.13cvs37.patchset ( cvs diff -u -r 1.61.2.36 -r 1.61.2.37 src/account.c; cvs diff -u -r 1.12.2.24 -r 1.12.2.25 src/action.c; cvs diff -u -r 1.22.2.3 -r 1.22.2.4 src/addrbook.c; cvs diff -u -r 1.15.2.3 -r 1.15.2.4 src/addrcache.c; cvs diff -u -r 1.6.10.7 -r 1.6.10.8 src/addrharvest.c; cvs diff -u -r 1.28.2.7 -r 1.28.2.8 src/addrindex.c; cvs diff -u -r 1.65.2.34 -r 1.65.2.35 src/codeconv.c; cvs diff -u -r 1.382.2.151 -r 1.382.2.152 src/compose.c; cvs diff -u -r 1.23.2.11 -r 1.23.2.12 src/crash.c; cvs diff -u -r 1.5.2.5 -r 1.5.2.6 src/exporthtml.c; cvs diff -u -r 1.1.4.5 -r 1.1.4.6 src/exportldif.c; cvs diff -u -r 1.213.2.51 -r 1.213.2.52 src/folder.c; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/image_viewer.c; cvs diff -u -r 1.149.2.30 -r 1.149.2.31 src/inc.c; cvs diff -u -r 1.29.2.4 -r 1.29.2.5 src/inc.h; cvs diff -u -r 1.18.2.10 -r 1.18.2.11 src/jpilot.c; cvs diff -u -r 1.12.2.2 -r 1.12.2.3 src/ldif.c; cvs diff -u -r 1.115.2.49 -r 1.115.2.50 src/main.c; cvs diff -u -r 1.75.2.7 -r 1.75.2.8 src/matcher.c; cvs diff -u -r 1.28.2.6 -r 1.28.2.7 src/mbox.c; cvs diff -u -r 1.94.2.61 -r 1.94.2.62 src/messageview.c; cvs diff -u -r 1.79.2.16 -r 1.79.2.17 src/mh.c; cvs diff -u -r 1.83.2.35 -r 1.83.2.36 src/mimeview.c; cvs diff -u -r 1.16.2.25 -r 1.16.2.26 src/msgcache.c; cvs diff -u -r 1.6.10.2 -r 1.6.10.3 src/mutt.c; cvs diff -u -r 1.101.2.12 -r 1.101.2.13 src/news.c; cvs diff -u -r 1.1.2.6 -r 1.1.2.7 src/partial_download.c; cvs diff -u -r 1.6.2.2 -r 1.6.2.3 src/pine.c; cvs diff -u -r 1.56.2.37 -r 1.56.2.38 src/pop.c; cvs diff -u -r 1.60.2.19 -r 1.60.2.20 src/prefs_actions.c; cvs diff -u -r 1.204.2.50 -r 1.204.2.51 src/prefs_common.c; cvs diff -u -r 1.16.2.11 -r 1.16.2.12 src/prefs_customheader.c; cvs diff -u -r 1.16.2.11 -r 1.16.2.12 src/prefs_display_header.c; cvs diff -u -r 1.10.2.12 -r 1.10.2.13 src/prefs_gtk.c; cvs diff -u -r 1.3.2.23 -r 1.3.2.24 src/prefs_themes.c; cvs diff -u -r 1.47.2.22 -r 1.47.2.23 src/procheader.c; cvs diff -u -r 1.49.2.53 -r 1.49.2.54 src/procmime.c; cvs diff -u -r 1.150.2.38 -r 1.150.2.39 src/procmsg.c; cvs diff -u -r 1.17.2.4 -r 1.17.2.5 src/recv.c; cvs diff -u -r 1.17.2.16 -r 1.17.2.17 src/send_message.c; cvs diff -u -r 1.1 -r 1.2 src/simple-gettext.c; cvs diff -u -r 1.9.2.13 -r 1.9.2.14 src/sourcewindow.c; cvs diff -u -r 1.96.2.69 -r 1.96.2.70 src/textview.c; cvs diff -u -r 1.14.2.3 -r 1.14.2.4 src/vcard.c; cvs diff -u -r 1.9.2.12 -r 1.9.2.13 src/common/defs.h; cvs diff -u -r 1.6.2.3 -r 1.6.2.4 src/common/log.c; cvs diff -u -r 1.13.2.5 -r 1.13.2.6 src/common/plugin.c; cvs diff -u -r 1.5.2.1 -r 1.5.2.2 src/common/prefs.c; cvs diff -u -r 1.23.2.5 -r 1.23.2.6 src/common/session.c; cvs diff -u -r 1.8.2.3 -r 1.8.2.4 src/common/session.h; cvs diff -u -r 1.13.2.13 -r 1.13.2.14 src/common/socket.c; cvs diff -u -r 1.13.2.1 -r 1.13.2.2 src/common/socket.h; cvs diff -u -r 1.4.2.1 -r 1.4.2.2 src/common/ssl_certificate.c; cvs diff -u -r 1.2.4.11 -r 1.2.4.12 src/common/template.c; cvs diff -u -r 1.36.2.39 -r 1.36.2.40 src/common/utils.c; cvs diff -u -r 1.20.2.21 -r 1.20.2.22 src/common/utils.h; cvs diff -u -r 1.1.4.9 -r 1.1.4.10 src/common/xml.c; cvs diff -u -r 1.4.2.16 -r 1.4.2.17 src/gtk/about.c; ) > 1.9.13cvs38.patchset ( cvs diff -u -r 1.654.2.765 -r 1.654.2.766 configure.ac; cvs diff -u -r 1.14.2.8 -r 1.14.2.9 src/editaddress.c; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/gedit-print.c; cvs diff -u -r 1.6.10.3 -r 1.6.10.4 src/mutt.c; cvs diff -u -r 1.1.4.3 -r 1.1.4.4 src/etpan/etpan-log.c; cvs diff -u -r 1.1.4.15 -r 1.1.4.16 src/etpan/imap-thread.c; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/gtk/gtksourceprintjob.c; ) > 1.9.13cvs39.patchset +( cvs diff -u -r 1.204.2.51 -r 1.204.2.52 src/prefs_common.c; cvs diff -u -r 1.103.2.24 -r 1.103.2.25 src/prefs_common.h; cvs diff -u -r 1.22.2.11 -r 1.22.2.12 src/quote_fmt_parse.y; cvs diff -u -r 1.395.2.114 -r 1.395.2.115 src/summaryview.c; cvs diff -u -r 1.13.2.7 -r 1.13.2.8 src/plugins/clamav/clamav_plugin.c; cvs diff -u -r 1.12.2.4 -r 1.12.2.5 src/plugins/dillo_viewer/dillo_viewer.c; cvs diff -u -r 1.9.2.3 -r 1.9.2.4 src/plugins/mathml_viewer/mathml_viewer.c; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/plugins/pgpcore/sgpgme.c; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpinline/pgpinline.c; cvs diff -u -r 1.1.2.21 -r 1.1.2.22 src/plugins/pgpmime/pgpmime.c; ) > 1.9.13cvs40.patchset diff --git a/configure.ac b/configure.ac index 71cb484c1..ec6595f22 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=9 MICRO_VERSION=13 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=39 +EXTRA_VERSION=40 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/plugins/clamav/clamav_plugin.c b/src/plugins/clamav/clamav_plugin.c index 488fbaf9c..ec2755ee2 100644 --- a/src/plugins/clamav/clamav_plugin.c +++ b/src/plugins/clamav/clamav_plugin.c @@ -93,7 +93,7 @@ static gboolean scan_func(GNode *node, gpointer data) debug_print("Error: %s\n", cl_strerror(ret)); } - unlink(outfile); + g_unlink(outfile); } return params->is_infected; diff --git a/src/plugins/dillo_viewer/dillo_viewer.c b/src/plugins/dillo_viewer/dillo_viewer.c index d95108057..889afc878 100644 --- a/src/plugins/dillo_viewer/dillo_viewer.c +++ b/src/plugins/dillo_viewer/dillo_viewer.c @@ -74,7 +74,7 @@ static void dillo_show_mimepart(MimeViewer *_viewer, debug_print("dillo_show_mimepart\n"); if (viewer->filename != NULL) { - unlink(viewer->filename); + g_unlink(viewer->filename); g_free(viewer->filename); } @@ -124,7 +124,7 @@ static void dillo_destroy_viewer(MimeViewer *_viewer) debug_print("dillo_destroy_viewer\n"); gtk_widget_unref(GTK_WIDGET(viewer->widget)); - unlink(viewer->filename); + g_unlink(viewer->filename); g_free(viewer->filename); g_free(viewer); } diff --git a/src/plugins/mathml_viewer/mathml_viewer.c b/src/plugins/mathml_viewer/mathml_viewer.c index 5dd414fda..1e0593049 100644 --- a/src/plugins/mathml_viewer/mathml_viewer.c +++ b/src/plugins/mathml_viewer/mathml_viewer.c @@ -63,7 +63,7 @@ static void mathml_show_mimepart(MimeViewer *_viewer, const gchar *infile, MimeI debug_print("mathml_show_mimepart\n"); if (viewer->filename != NULL) { - unlink(viewer->filename); + g_unlink(viewer->filename); g_free(viewer->filename); } @@ -94,7 +94,7 @@ static void mathml_destroy_viewer(MimeViewer *_viewer) debug_print("mathml_destroy_viewer\n"); gtk_widget_unref(GTK_WIDGET(viewer->scrollwin)); - unlink(viewer->filename); + g_unlink(viewer->filename); g_free(viewer->filename); g_free(viewer); } diff --git a/src/plugins/pgpcore/sgpgme.c b/src/plugins/pgpcore/sgpgme.c index 990f37747..fbac4f4ef 100644 --- a/src/plugins/pgpcore/sgpgme.c +++ b/src/plugins/pgpcore/sgpgme.c @@ -229,7 +229,7 @@ gpgme_data_t sgpgme_data_from_mimeinfo(MimeInfo *mimeinfo) { gpgme_data_t data = NULL; gpgme_error_t err; - FILE *fp = fopen(mimeinfo->data.filename, "rb"); + FILE *fp = g_fopen(mimeinfo->data.filename, "rb"); gchar *tmp_file = NULL; if (!fp) @@ -238,13 +238,13 @@ gpgme_data_t sgpgme_data_from_mimeinfo(MimeInfo *mimeinfo) tmp_file = get_tmp_file(); copy_file_part(fp, mimeinfo->offset, mimeinfo->length, tmp_file); fclose(fp); - fp = fopen(tmp_file, "rb"); + fp = g_fopen(tmp_file, "rb"); debug_print("tmp file %s\n", tmp_file); if (!fp) return NULL; err = gpgme_data_new_from_file(&data, tmp_file, 1); - unlink(tmp_file); + g_unlink(tmp_file); g_free(tmp_file); debug_print("data %p (%d %d)\n", data, mimeinfo->offset, mimeinfo->length); diff --git a/src/plugins/pgpinline/pgpinline.c b/src/plugins/pgpinline/pgpinline.c index 8d4b30484..742e1be8b 100644 --- a/src/plugins/pgpinline/pgpinline.c +++ b/src/plugins/pgpinline/pgpinline.c @@ -304,7 +304,7 @@ static MimeInfo *pgpinline_decrypt(MimeInfo *mimeinfo) fname = g_strdup_printf("%s%cplaintext.%08x", get_mime_tmp_dir(), G_DIR_SEPARATOR, ++id); - if ((dstfp = fopen(fname, "wb")) == NULL) { + if ((dstfp = g_fopen(fname, "wb")) == NULL) { FILE_OP_ERROR(fname, "fopen"); g_free(fname); gpgme_data_release(plain); @@ -439,7 +439,7 @@ static gboolean pgpinline_sign(MimeInfo *mimeinfo, PrefsAccount *account) if (msgcontent->content == MIMECONTENT_FILE && msgcontent->data.filename != NULL) { - unlink(msgcontent->data.filename); + g_unlink(msgcontent->data.filename); g_free(msgcontent->data.filename); } msgcontent->data.mem = g_strdup(tmp); @@ -539,7 +539,7 @@ static gboolean pgpinline_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data) if (msgcontent->content == MIMECONTENT_FILE && msgcontent->data.filename != NULL) { - unlink(msgcontent->data.filename); + g_unlink(msgcontent->data.filename); g_free(msgcontent->data.filename); } msgcontent->data.mem = g_strdup(tmp); diff --git a/src/plugins/pgpmime/pgpmime.c b/src/plugins/pgpmime/pgpmime.c index 50c3e963f..49e480bf6 100644 --- a/src/plugins/pgpmime/pgpmime.c +++ b/src/plugins/pgpmime/pgpmime.c @@ -172,7 +172,7 @@ static gint pgpmime_check_signature(MimeInfo *mimeinfo) debug_print("Checking PGP/MIME signature\n"); parent = procmime_mimeinfo_parent(mimeinfo); - fp = fopen(parent->data.filename, "rb"); + fp = g_fopen(parent->data.filename, "rb"); g_return_val_if_fail(fp != NULL, SIGNATURE_INVALID); boundary = g_hash_table_lookup(parent->typeparameters, "boundary"); @@ -303,7 +303,7 @@ static MimeInfo *pgpmime_decrypt(MimeInfo *mimeinfo) fname = g_strdup_printf("%s%cplaintext.%08x", get_mime_tmp_dir(), G_DIR_SEPARATOR, ++id); - if ((dstfp = fopen(fname, "wb")) == NULL) { + if ((dstfp = g_fopen(fname, "wb")) == NULL) { FILE_OP_ERROR(fname, "fopen"); g_free(fname); gpgme_data_release(plain); diff --git a/src/prefs_common.c b/src/prefs_common.c index 44c2d8654..9a42a2495 100644 --- a/src/prefs_common.c +++ b/src/prefs_common.c @@ -239,6 +239,8 @@ static PrefParam param[] = { NULL, NULL, NULL}, /* Display: Summary View */ + {"enable_swap_from", "FALSE", &prefs_common.swap_from, P_BOOL, + NULL, NULL, NULL}, {"use_address_book", "FALSE", &prefs_common.use_addr_book, P_BOOL, NULL, NULL, NULL}, {"thread_by_subject", "TRUE", &prefs_common.thread_by_subject, P_BOOL, diff --git a/src/prefs_common.h b/src/prefs_common.h index 6dac7d32a..ceb6de452 100644 --- a/src/prefs_common.h +++ b/src/prefs_common.h @@ -155,6 +155,7 @@ struct _PrefsCommon gboolean show_searchbar; gboolean expand_thread; + gboolean swap_from; gboolean use_addr_book; gchar *date_format; diff --git a/src/quote_fmt_parse.y b/src/quote_fmt_parse.y index 00282ba78..791d26052 100644 --- a/src/quote_fmt_parse.y +++ b/src/quote_fmt_parse.y @@ -361,7 +361,7 @@ static void quote_fmt_insert_file(const gchar *filename) FILE *file; char buffer[256]; - if ((file = fopen(filename, "rb")) != NULL) { + if ((file = g_fopen(filename, "rb")) != NULL) { while (fgets(buffer, sizeof(buffer), file)) { INSERT(buffer); } diff --git a/src/summaryview.c b/src/summaryview.c index 096097117..2bf6468ce 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -2324,6 +2324,8 @@ static void summary_set_header(SummaryView *summaryview, gchar *text[], static gchar buf[BUFFSIZE]; gint *col_pos = summaryview->col_pos; FolderType ftype = F_UNKNOWN; + gchar *from_text = NULL, *to_text = NULL; + gboolean should_swap = FALSE; text[col_pos[S_COL_MARK]] = NULL; text[col_pos[S_COL_STATUS]] = NULL; @@ -2343,18 +2345,47 @@ static void summary_set_header(SummaryView *summaryview, gchar *text[], else text[col_pos[S_COL_DATE]] = _("(No Date)"); + if (ftype != F_NEWS && prefs_common.swap_from && msginfo->from && msginfo->to) { + gchar *addr = NULL; + + addr = g_strdup(msginfo->from); + + if (addr) { + extract_address(addr); + if (account_find_from_address(addr)) { + should_swap = TRUE; + } + g_free(addr); + } + } + if (!prefs_common.use_addr_book) { - text[col_pos[S_COL_FROM]] = msginfo->fromname ? - msginfo->fromname : - _("(No From)"); + from_text = msginfo->fromname ? + msginfo->fromname : + _("(No From)"); } else { gchar *tmp = summary_complete_address(msginfo->fromname); - text[col_pos[S_COL_FROM]] = tmp ? tmp : (msginfo->fromname ? - msginfo->fromname: - _("(No From)")); + from_text = tmp ? tmp : (msginfo->fromname ? + msginfo->fromname: + _("(No From)")); + } + + to_text = msginfo->to ? msginfo->to : + (msginfo->cc ? msginfo->cc : + (msginfo->newsgroups ? msginfo->newsgroups : _("(No Recipient)") + ) + ); + + if (!should_swap) { + text[col_pos[S_COL_FROM]] = from_text; + text[col_pos[S_COL_TO]] = to_text; + } else { + gchar *tmp = NULL; + tmp = g_strconcat("-->", to_text, NULL); + text[col_pos[S_COL_FROM]] = tmp; + tmp = g_strconcat("<--", from_text, NULL); + text[col_pos[S_COL_TO]] = tmp; } - text[col_pos[S_COL_TO]] = msginfo->to ? msginfo->to : - _("(No Recipient)"); if (msginfo->folder && msginfo->folder->folder) ftype = msginfo->folder->folder->klass->type; -- 2.25.1