diff options
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | ChangeLog.ja | 21 | ||||
-rw-r--r-- | libsylph/Makefile.am | 21 | ||||
-rw-r--r-- | libsylph/account.c (renamed from src/account.c) | 0 | ||||
-rw-r--r-- | libsylph/account.h (renamed from src/account.h) | 0 | ||||
-rw-r--r-- | libsylph/customheader.c (renamed from src/customheader.c) | 0 | ||||
-rw-r--r-- | libsylph/customheader.h (renamed from src/customheader.h) | 0 | ||||
-rw-r--r-- | libsylph/enums.h (renamed from src/enums.h) | 0 | ||||
-rw-r--r-- | libsylph/filter.c (renamed from src/filter.c) | 0 | ||||
-rw-r--r-- | libsylph/filter.h (renamed from src/filter.h) | 0 | ||||
-rw-r--r-- | libsylph/folder.c (renamed from src/folder.c) | 0 | ||||
-rw-r--r-- | libsylph/folder.h (renamed from src/folder.h) | 0 | ||||
-rw-r--r-- | libsylph/imap.c (renamed from src/imap.c) | 0 | ||||
-rw-r--r-- | libsylph/imap.h (renamed from src/imap.h) | 0 | ||||
-rw-r--r-- | libsylph/md5.c (renamed from src/md5.c) | 0 | ||||
-rw-r--r-- | libsylph/md5.h (renamed from src/md5.h) | 0 | ||||
-rw-r--r-- | libsylph/mh.c (renamed from src/mh.c) | 0 | ||||
-rw-r--r-- | libsylph/mh.h (renamed from src/mh.h) | 0 | ||||
-rw-r--r-- | libsylph/news.c (renamed from src/news.c) | 0 | ||||
-rw-r--r-- | libsylph/news.h (renamed from src/news.h) | 0 | ||||
-rw-r--r-- | libsylph/nntp.c (renamed from src/nntp.c) | 0 | ||||
-rw-r--r-- | libsylph/nntp.h (renamed from src/nntp.h) | 0 | ||||
-rw-r--r-- | libsylph/pop.c (renamed from src/pop.c) | 0 | ||||
-rw-r--r-- | libsylph/pop.h (renamed from src/pop.h) | 0 | ||||
-rw-r--r-- | libsylph/prefs_account.c (renamed from src/prefs_account.c) | 0 | ||||
-rw-r--r-- | libsylph/prefs_account.h (renamed from src/prefs_account.h) | 0 | ||||
-rw-r--r-- | libsylph/prefs_common.c (renamed from src/prefs_common.c) | 0 | ||||
-rw-r--r-- | libsylph/prefs_common.h (renamed from src/prefs_common.h) | 0 | ||||
-rw-r--r-- | libsylph/procheader.c (renamed from src/procheader.c) | 0 | ||||
-rw-r--r-- | libsylph/procheader.h (renamed from src/procheader.h) | 0 | ||||
-rw-r--r-- | libsylph/procmime.c (renamed from src/procmime.c) | 14 | ||||
-rw-r--r-- | libsylph/procmime.h (renamed from src/procmime.h) | 2 | ||||
-rw-r--r-- | libsylph/procmsg.c (renamed from src/procmsg.c) | 58 | ||||
-rw-r--r-- | libsylph/procmsg.h (renamed from src/procmsg.h) | 9 | ||||
-rw-r--r-- | libsylph/smtp.c (renamed from src/smtp.c) | 0 | ||||
-rw-r--r-- | libsylph/smtp.h (renamed from src/smtp.h) | 0 | ||||
-rw-r--r-- | src/Makefile.am | 18 | ||||
-rw-r--r-- | src/defs.h | 122 | ||||
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/rfc2015.c | 50 | ||||
-rw-r--r-- | src/rfc2015.h | 5 |
41 files changed, 139 insertions, 205 deletions
@@ -1,5 +1,26 @@ 2005-09-05 + * libsylph/account.[ch] + libsylph/customheader.[ch] + libsylph/enums.h + libsylph/filter.[ch] + libsylph/folder[ch] + libsylph/imap.[ch] + libsylph/md5.[ch] + libsylph/mh.[ch] + libsylph/news.[ch] + libsylph/nntp.[ch] + libsylph/pop.[ch] + libsylph/prefs_account.[ch] + libsylph/prefs_common.[ch] + libsylph/procheader.[ch] + libsylph/procmime.[ch] + libsylph/procmsg.[ch] + libsylph/smtp.[ch] + libsylph/Makefile.am: moved more modules to libsylph. + +2005-09-05 + * src/messageview.c src/procmsg.[ch] src/filter.[ch] diff --git a/ChangeLog.ja b/ChangeLog.ja index 2154a8d4..86374c2a 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,26 @@ 2005-09-05 + * libsylph/account.[ch] + libsylph/customheader.[ch] + libsylph/enums.h + libsylph/filter.[ch] + libsylph/folder[ch] + libsylph/imap.[ch] + libsylph/md5.[ch] + libsylph/mh.[ch] + libsylph/news.[ch] + libsylph/nntp.[ch] + libsylph/pop.[ch] + libsylph/prefs_account.[ch] + libsylph/prefs_common.[ch] + libsylph/procheader.[ch] + libsylph/procmime.[ch] + libsylph/procmsg.[ch] + libsylph/smtp.[ch] + libsylph/Makefile.am: さらにモジュールを libsylph に移動。 + +2005-09-05 + * src/messageview.c src/procmsg.[ch] src/filter.[ch] diff --git a/libsylph/Makefile.am b/libsylph/Makefile.am index c0cfc8f8..31771946 100644 --- a/libsylph/Makefile.am +++ b/libsylph/Makefile.am @@ -1,5 +1,7 @@ -AM_CPPFLAGS = -DG_LOG_DOMAIN=\"LibSylph\" +AM_CPPFLAGS = \ + -DG_LOG_DOMAIN=\"LibSylph\" \ + -DSYSCONFDIR=\""$(sysconfdir)"\" INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir) -I$(includedir) @@ -8,13 +10,30 @@ noinst_LTLIBRARIES = libsylph.la libsylph_la_SOURCES = \ defs.h \ + enums.h \ + account.c account.h \ base64.c base64.h \ codeconv.c codeconv.h \ + customheader.c customheader.h \ + filter.c filter.h \ + folder.c folder.h \ html.c html.h \ + imap.c imap.h \ + md5.c md5.h \ + mh.c mh.h \ + news.c news.h \ + nntp.c nntp.h \ + pop.c pop.h \ prefs.c prefs.h \ + prefs_account.c prefs_account.h \ + prefs_common.c prefs_common.h \ + procheader.c procheader.h \ + procmime.c procmime.h \ + procmsg.c procmsg.h \ quoted-printable.c quoted-printable.h \ recv.c recv.h \ session.c session.h \ + smtp.c smtp.h \ socket.c socket.h \ ssl.c ssl.h \ stringtable.c stringtable.h \ diff --git a/src/account.c b/libsylph/account.c index 2ae0ca43..2ae0ca43 100644 --- a/src/account.c +++ b/libsylph/account.c diff --git a/src/account.h b/libsylph/account.h index 0cef7c50..0cef7c50 100644 --- a/src/account.h +++ b/libsylph/account.h diff --git a/src/customheader.c b/libsylph/customheader.c index c145484d..c145484d 100644 --- a/src/customheader.c +++ b/libsylph/customheader.c diff --git a/src/customheader.h b/libsylph/customheader.h index 27ae9373..27ae9373 100644 --- a/src/customheader.h +++ b/libsylph/customheader.h diff --git a/src/enums.h b/libsylph/enums.h index 13ac2a18..13ac2a18 100644 --- a/src/enums.h +++ b/libsylph/enums.h diff --git a/src/filter.c b/libsylph/filter.c index efc2fa02..efc2fa02 100644 --- a/src/filter.c +++ b/libsylph/filter.c diff --git a/src/filter.h b/libsylph/filter.h index dc38047e..dc38047e 100644 --- a/src/filter.h +++ b/libsylph/filter.h diff --git a/src/folder.c b/libsylph/folder.c index 25db6b24..25db6b24 100644 --- a/src/folder.c +++ b/libsylph/folder.c diff --git a/src/folder.h b/libsylph/folder.h index 0908e241..0908e241 100644 --- a/src/folder.h +++ b/libsylph/folder.h diff --git a/src/imap.c b/libsylph/imap.c index a179c23c..a179c23c 100644 --- a/src/imap.c +++ b/libsylph/imap.c diff --git a/src/imap.h b/libsylph/imap.h index c726c875..c726c875 100644 --- a/src/imap.h +++ b/libsylph/imap.h diff --git a/src/md5.c b/libsylph/md5.c index 54585971..54585971 100644 --- a/src/md5.c +++ b/libsylph/md5.c diff --git a/src/md5.h b/libsylph/md5.h index 84894b2c..84894b2c 100644 --- a/src/md5.h +++ b/libsylph/md5.h diff --git a/src/mh.c b/libsylph/mh.c index 40554867..40554867 100644 --- a/src/mh.c +++ b/libsylph/mh.c diff --git a/src/mh.h b/libsylph/mh.h index 160259c1..160259c1 100644 --- a/src/mh.h +++ b/libsylph/mh.h diff --git a/src/news.c b/libsylph/news.c index 28181b32..28181b32 100644 --- a/src/news.c +++ b/libsylph/news.c diff --git a/src/news.h b/libsylph/news.h index 31628113..31628113 100644 --- a/src/news.h +++ b/libsylph/news.h diff --git a/src/nntp.c b/libsylph/nntp.c index 7e36baaa..7e36baaa 100644 --- a/src/nntp.c +++ b/libsylph/nntp.c diff --git a/src/nntp.h b/libsylph/nntp.h index 46992e42..46992e42 100644 --- a/src/nntp.h +++ b/libsylph/nntp.h diff --git a/src/pop.c b/libsylph/pop.c index 3a562054..3a562054 100644 --- a/src/pop.c +++ b/libsylph/pop.c diff --git a/src/pop.h b/libsylph/pop.h index 515bc61b..515bc61b 100644 --- a/src/pop.h +++ b/libsylph/pop.h diff --git a/src/prefs_account.c b/libsylph/prefs_account.c index b6d15fba..b6d15fba 100644 --- a/src/prefs_account.c +++ b/libsylph/prefs_account.c diff --git a/src/prefs_account.h b/libsylph/prefs_account.h index 13ef8d94..13ef8d94 100644 --- a/src/prefs_account.h +++ b/libsylph/prefs_account.h diff --git a/src/prefs_common.c b/libsylph/prefs_common.c index eb1a1864..eb1a1864 100644 --- a/src/prefs_common.c +++ b/libsylph/prefs_common.c diff --git a/src/prefs_common.h b/libsylph/prefs_common.h index afc5f1d0..afc5f1d0 100644 --- a/src/prefs_common.h +++ b/libsylph/prefs_common.h diff --git a/src/procheader.c b/libsylph/procheader.c index 4ca1490c..4ca1490c 100644 --- a/src/procheader.c +++ b/libsylph/procheader.c diff --git a/src/procheader.h b/libsylph/procheader.h index 1667b4ed..1667b4ed 100644 --- a/src/procheader.h +++ b/libsylph/procheader.h diff --git a/src/procmime.c b/libsylph/procmime.c index 1787aa2c..faa882a4 100644 --- a/src/procmime.c +++ b/libsylph/procmime.c @@ -40,10 +40,6 @@ #include "utils.h" #include "prefs_common.h" -#if USE_GPGME -# include "rfc2015.h" -#endif - static GHashTable *procmime_get_mime_type_table (void); static GList *procmime_get_mime_type_list (const gchar *file); @@ -71,17 +67,14 @@ void procmime_mimeinfo_free_all(MimeInfo *mimeinfo) g_free(mimeinfo->boundary); g_free(mimeinfo->content_disposition); g_free(mimeinfo->filename); -#if USE_GPGME + g_free(mimeinfo->plaintextfile); g_free(mimeinfo->sigstatus); g_free(mimeinfo->sigstatus_full); -#endif procmime_mimeinfo_free_all(mimeinfo->sub); procmime_mimeinfo_free_all(mimeinfo->children); -#if USE_GPGME procmime_mimeinfo_free_all(mimeinfo->plaintext); -#endif next = mimeinfo->next; g_free(mimeinfo); @@ -188,13 +181,8 @@ MimeInfo *procmime_scan_message(MsgInfo *msginfo) g_return_val_if_fail(msginfo != NULL, NULL); -#if USE_GPGME if ((fp = procmsg_open_message_decrypted(msginfo, &mimeinfo)) == NULL) return NULL; -#else - if ((fp = procmsg_open_message(msginfo)) == NULL) return NULL; - mimeinfo = procmime_scan_mime_header(fp); -#endif if (mimeinfo) { mimeinfo->size = msginfo->size; diff --git a/src/procmime.h b/libsylph/procmime.h index fc2085a9..3f3cb7cb 100644 --- a/src/procmime.h +++ b/libsylph/procmime.h @@ -108,12 +108,10 @@ struct _MimeInfo MimeInfo *parent; MimeInfo *children; -#if USE_GPGME MimeInfo *plaintext; gchar *plaintextfile; gchar *sigstatus; gchar *sigstatus_full; -#endif gint level; }; diff --git a/src/procmsg.c b/libsylph/procmsg.c index 0ecae5b4..57eff70a 100644 --- a/src/procmsg.c +++ b/libsylph/procmsg.c @@ -32,9 +32,6 @@ #include "prefs_common.h" #include "folder.h" #include "codeconv.h" -#if USE_GPGME -# include "rfc2015.h" -#endif static void mark_sum_func (gpointer key, gpointer value, @@ -1046,56 +1043,27 @@ FILE *procmsg_open_message(MsgInfo *msginfo) return fp; } -#if USE_GPGME +static DecryptMessageFunc decrypt_message_func = NULL; + +void procmsg_set_decrypt_message_func(DecryptMessageFunc func) +{ + decrypt_message_func = func; +} + FILE *procmsg_open_message_decrypted(MsgInfo *msginfo, MimeInfo **mimeinfo) { FILE *fp; - MimeInfo *mimeinfo_; - glong fpos; - g_return_val_if_fail(msginfo != NULL, NULL); + if (decrypt_message_func) + return decrypt_message_func(msginfo, mimeinfo); - if (mimeinfo) *mimeinfo = NULL; - - if ((fp = procmsg_open_message(msginfo)) == NULL) return NULL; - - mimeinfo_ = procmime_scan_mime_header(fp); - if (!mimeinfo_) { - fclose(fp); + *mimeinfo = NULL; + if ((fp = procmsg_open_message(msginfo)) == NULL) return NULL; - } - - if (!MSG_IS_ENCRYPTED(msginfo->flags) && - rfc2015_is_encrypted(mimeinfo_)) { - MSG_SET_TMP_FLAGS(msginfo->flags, MSG_ENCRYPTED); - } - - if (MSG_IS_ENCRYPTED(msginfo->flags) && - !msginfo->plaintext_file && - !msginfo->decryption_failed) { - fpos = ftell(fp); - rfc2015_decrypt_message(msginfo, mimeinfo_, fp); - if (msginfo->plaintext_file && - !msginfo->decryption_failed) { - fclose(fp); - procmime_mimeinfo_free_all(mimeinfo_); - if ((fp = procmsg_open_message(msginfo)) == NULL) - return NULL; - mimeinfo_ = procmime_scan_mime_header(fp); - if (!mimeinfo_) { - fclose(fp); - return NULL; - } - } else { - if (fseek(fp, fpos, SEEK_SET) < 0) - perror("fseek"); - } - } + *mimeinfo = procmime_scan_mime_header(fp); - if (mimeinfo) *mimeinfo = mimeinfo_; return fp; } -#endif gboolean procmsg_msg_exist(MsgInfo *msginfo) { @@ -1292,10 +1260,8 @@ MsgInfo *procmsg_msginfo_get_full_info(MsgInfo *msginfo) full_msginfo->file_path = g_strdup(msginfo->file_path); -#if USE_GPGME full_msginfo->plaintext_file = g_strdup(msginfo->plaintext_file); full_msginfo->decryption_failed = msginfo->decryption_failed; -#endif return full_msginfo; } diff --git a/src/procmsg.h b/libsylph/procmsg.h index 9e6d45b8..14c2b6d7 100644 --- a/src/procmsg.h +++ b/libsylph/procmsg.h @@ -36,7 +36,6 @@ typedef struct _MsgFileInfo MsgFileInfo; #include "folder.h" #include "procmime.h" -#include "prefs_filter.h" typedef enum { @@ -205,6 +204,9 @@ struct _MsgFileInfo MsgFlags *flags; }; +typedef FILE * (*DecryptMessageFunc) (MsgInfo *msginfo, + MimeInfo **mimeinfo); + GHashTable *procmsg_msg_hash_table_create (GSList *mlist); void procmsg_msg_hash_table_append (GHashTable *msg_table, GSList *mlist); @@ -256,10 +258,11 @@ gchar *procmsg_get_message_file (MsgInfo *msginfo); GSList *procmsg_get_message_file_list (GSList *mlist); void procmsg_message_file_list_free (GSList *file_list); FILE *procmsg_open_message (MsgInfo *msginfo); -#if USE_GPGME + +void procmsg_set_decrypt_message_func (DecryptMessageFunc func); FILE *procmsg_open_message_decrypted (MsgInfo *msginfo, MimeInfo **mimeinfo); -#endif + gboolean procmsg_msg_exist (MsgInfo *msginfo); void procmsg_empty_trash (FolderItem *trash); diff --git a/src/smtp.c b/libsylph/smtp.c index 25a0f71a..25a0f71a 100644 --- a/src/smtp.c +++ b/libsylph/smtp.c diff --git a/src/smtp.h b/libsylph/smtp.h index 445bba69..445bba69 100644 --- a/src/smtp.h +++ b/libsylph/smtp.h diff --git a/src/Makefile.am b/src/Makefile.am index c567b8b9..ae8991a2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,8 +3,6 @@ SUBDIRS = icons bin_PROGRAMS = sylpheed sylpheed_SOURCES = \ - defs.h \ - enums.h \ version.h \ main.c main.h \ mainwindow.c mainwindow.h \ @@ -18,21 +16,15 @@ sylpheed_SOURCES = \ summary_search.c summary_search.h \ message_search.c message_search.h \ colorlabel.c colorlabel.h \ - folder.c folder.h \ - procmsg.c procmsg.h \ - procheader.c procheader.h \ - filter.c filter.h \ action.c action.h \ compose.c compose.h \ gtkshruler.c gtkshruler.h \ menu.c menu.h \ stock_pixmap.c stock_pixmap.h \ prefs_ui.c prefs_ui.h \ - prefs_common.c prefs_common.h \ prefs_common_dialog.c prefs_common_dialog.h \ prefs_filter.c prefs_filter.h \ prefs_filter_edit.c prefs_filter_edit.h \ - prefs_account.c prefs_account.h \ prefs_account_dialog.c prefs_account_dialog.h \ prefs_folder_item.c prefs_folder_item.h \ prefs_display_header.c prefs_display_header.h \ @@ -40,10 +32,8 @@ sylpheed_SOURCES = \ prefs_summary_column.c prefs_summary_column.h \ prefs_template.c prefs_template.h \ prefs_actions.c prefs_actions.h \ - account.c account.h \ account_dialog.c account_dialog.h \ displayheader.c displayheader.h \ - customheader.c customheader.h \ template.c template.h \ addressbook.c addressbook.h \ addr_compl.c addr_compl.h \ @@ -80,19 +70,11 @@ sylpheed_SOURCES = \ about.c about.h \ setup.c setup.h \ gtkutils.c gtkutils.h \ - md5.c md5.h \ - smtp.c smtp.h \ - pop.c pop.h \ - mh.c mh.h \ mbox.c mbox.h \ send_message.c send_message.h \ inc.c inc.h \ import.c import.h \ export.c export.h \ - nntp.c nntp.h \ - news.c news.h \ - imap.c imap.h \ - procmime.c procmime.h \ rfc2015.c rfc2015.h \ passphrase.c passphrase.h \ select-keys.c select-keys.h \ diff --git a/src/defs.h b/src/defs.h deleted file mode 100644 index 9683c28d..00000000 --- a/src/defs.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2005 Hiroyuki Yamamoto - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __DEFS_H__ -#define __DEFS_H__ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <glibconfig.h> - -#ifdef G_OS_WIN32 -# include <glib/gwin32.h> -#endif - -#if HAVE_PATHS_H -# include <paths.h> -#endif - -#if HAVE_SYS_PARAM_H -# include <sys/param.h> -#endif - -#define INBOX_DIR "inbox" -#define OUTBOX_DIR "sent" -#define QUEUE_DIR "queue" -#define DRAFT_DIR "draft" -#define TRASH_DIR "trash" -#ifdef G_OS_WIN32 -# define RC_DIR "Sylpheed" -#else -# define RC_DIR ".sylpheed-2.0" -#endif -#define OLD_RC_DIR ".sylpheed" -#define NEWS_CACHE_DIR "newscache" -#define IMAP_CACHE_DIR "imapcache" -#define MIME_TMP_DIR "mimetmp" -#define COMMON_RC "sylpheedrc" -#define ACCOUNT_RC "accountrc" -#define FILTER_RC "filterrc" -#define FILTER_LIST "filter.xml" -#define FILTER_HEADER_RC "filterheaderrc" -#define CUSTOM_HEADER_RC "customheaderrc" -#define DISPLAY_HEADER_RC "dispheaderrc" -#define MENU_RC "menurc" -#define ACTIONS_RC "actionsrc" -#define COMMAND_HISTORY "command_history" -#define TEMPLATE_DIR "templates" -#define TMP_DIR "tmp" -#define UIDL_DIR "uidl" -#define NEWSGROUP_LIST ".newsgroup_list" -#define ADDRESS_BOOK "addressbook.xml" -#define MANUAL_HTML_INDEX "sylpheed.html" -#define FAQ_HTML_INDEX "sylpheed-faq.html" -#define HOMEPAGE_URI "http://sylpheed.good-day.net/" -#define FOLDER_LIST "folderlist.xml" -#define CACHE_FILE ".sylpheed_cache" -#define MARK_FILE ".sylpheed_mark" -#define CACHE_VERSION 0x21 -#define MARK_VERSION 2 - -#ifdef G_OS_WIN32 -# define DEFAULT_SIGNATURE "signature.txt" -#else -# define DEFAULT_SIGNATURE ".signature" -#endif -#define DEFAULT_INC_PATH "/usr/bin/mh/inc" -#define DEFAULT_INC_PROGRAM "inc" -/* #define DEFAULT_INC_PATH "/usr/bin/imget" */ -/* #define DEFAULT_INC_PROGRAM "imget" */ -#define DEFAULT_SENDMAIL_CMD "/usr/sbin/sendmail -t -i" -#define DEFAULT_BROWSER_CMD "mozilla-firefox -remote 'openURL(%s,new-window)'" - -#ifdef _PATH_MAILDIR -# define DEFAULT_SPOOL_PATH _PATH_MAILDIR -#else -# define DEFAULT_SPOOL_PATH "/var/spool/mail" -#endif - -#define BUFFSIZE 8192 - -#ifndef MAXPATHLEN -# define MAXPATHLEN 4095 -#endif - -#define DEFAULT_HEIGHT 460 -#define DEFAULT_FOLDERVIEW_WIDTH 179 -#define DEFAULT_MAINVIEW_WIDTH 600 -#define DEFAULT_SUMMARY_HEIGHT 140 -#define DEFAULT_HEADERVIEW_HEIGHT 40 -#define DEFAULT_COMPOSE_HEIGHT 560 -#define BORDER_WIDTH 2 -#define CTREE_INDENT 18 -#define FOLDER_SPACING 4 -#define MAX_ENTRY_LENGTH 8191 -#define COLOR_DIM 35000 -#define UI_REFRESH_INTERVAL 50000 /* usec */ -#define FOLDER_UPDATE_INTERVAL 1500 /* msec */ -#define PROGRESS_UPDATE_INTERVAL 200 /* msec */ -#define SESSION_TIMEOUT_INTERVAL 60 /* sec */ -#define MAX_HISTORY_SIZE 16 - -#define DEFAULT_MESSAGE_FONT "Monospace 12" - -#endif /* __DEFS_H__ */ @@ -561,6 +561,9 @@ static void check_gpg(void) engineInfo = engineInfo->next; } } + + procmsg_set_decrypt_message_func + (rfc2015_open_message_decrypted); } else { if (prefs_common.gpg_warning) { AlertValue val; diff --git a/src/rfc2015.c b/src/rfc2015.c index ef6a9230..8708dc81 100644 --- a/src/rfc2015.c +++ b/src/rfc2015.c @@ -35,6 +35,7 @@ #include <gpgme.h> +#include "procmsg.h" #include "procmime.h" #include "procheader.h" #include "base64.h" @@ -637,6 +638,55 @@ void rfc2015_decrypt_message(MsgInfo *msginfo, MimeInfo *mimeinfo, FILE *fp) #undef DECRYPTION_ABORT +FILE *rfc2015_open_message_decrypted(MsgInfo *msginfo, MimeInfo **mimeinfo) +{ + FILE *fp; + MimeInfo *mimeinfo_; + glong fpos; + + g_return_val_if_fail(msginfo != NULL, NULL); + + if (mimeinfo) *mimeinfo = NULL; + + if ((fp = procmsg_open_message(msginfo)) == NULL) return NULL; + + mimeinfo_ = procmime_scan_mime_header(fp); + if (!mimeinfo_) { + fclose(fp); + return NULL; + } + + if (!MSG_IS_ENCRYPTED(msginfo->flags) && + rfc2015_is_encrypted(mimeinfo_)) { + MSG_SET_TMP_FLAGS(msginfo->flags, MSG_ENCRYPTED); + } + + if (MSG_IS_ENCRYPTED(msginfo->flags) && + !msginfo->plaintext_file && + !msginfo->decryption_failed) { + fpos = ftell(fp); + rfc2015_decrypt_message(msginfo, mimeinfo_, fp); + if (msginfo->plaintext_file && + !msginfo->decryption_failed) { + fclose(fp); + procmime_mimeinfo_free_all(mimeinfo_); + if ((fp = procmsg_open_message(msginfo)) == NULL) + return NULL; + mimeinfo_ = procmime_scan_mime_header(fp); + if (!mimeinfo_) { + fclose(fp); + return NULL; + } + } else { + if (fseek(fp, fpos, SEEK_SET) < 0) + perror("fseek"); + } + } + + if (mimeinfo) *mimeinfo = mimeinfo_; + return fp; +} + /* * plain contains an entire mime object. diff --git a/src/rfc2015.h b/src/rfc2015.h index 464b0154..e70605e1 100644 --- a/src/rfc2015.h +++ b/src/rfc2015.h @@ -23,6 +23,7 @@ #include <glib.h> #include <stdio.h> +#include "procmsg.h" #include "procmime.h" void rfc2015_disable_all (void); @@ -31,11 +32,15 @@ MimeInfo **rfc2015_find_signature (MimeInfo *mimeinfo); gboolean rfc2015_has_signature (MimeInfo *mimeinfo); void rfc2015_check_signature (MimeInfo *mimeinfo, FILE *fp); + gint rfc2015_is_encrypted (MimeInfo *mimeinfo); gboolean rfc2015_msg_is_encrypted (const gchar *file); void rfc2015_decrypt_message (MsgInfo *msginfo, MimeInfo *mimeinfo, FILE *fp); +FILE *rfc2015_open_message_decrypted (MsgInfo *msginfo, + MimeInfo **mimeinfo); + GSList *rfc2015_create_signers_list (const gchar *keyid); gint rfc2015_encrypt (const gchar *file, GSList *recp_list, |