/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999-2009 Hiroyuki Yamamoto and the Claws Mail team
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "defs.h"
#ifndef PANGO_ENABLE_ENGINE
# define PANGO_ENABLE_ENGINE
#endif
#include <glib.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <pango/pango-break.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <stdlib.h>
#if HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#include <signal.h>
#include <errno.h>
#ifndef G_OS_WIN32 /* fixme we should have a configure test. */
#include <libgen.h>
#endif
#if (HAVE_WCTYPE_H && HAVE_WCHAR_H)
# include <wchar.h>
# include <wctype.h>
#endif
#include "claws.h"
#include "main.h"
#include "mainwindow.h"
#include "compose.h"
#include "addressbook.h"
#include "folderview.h"
#include "procmsg.h"
#include "menu.h"
#include "stock_pixmap.h"
#include "send_message.h"
#include "imap.h"
#include "news.h"
#include "customheader.h"
#include "prefs_common.h"
#include "prefs_account.h"
#include "action.h"
#include "account.h"
#include "filesel.h"
#include "procheader.h"
#include "procmime.h"
#include "statusbar.h"
#include "about.h"
#include "base64.h"
#include "quoted-printable.h"
#include "codeconv.h"
#include "utils.h"
#include "gtkutils.h"
#include "socket.h"
#include "alertpanel.h"
#include "manage_window.h"
#include "gtkshruler.h"
#include "folder.h"
#include "addr_compl.h"
#include "quote_fmt.h"
#include "undo.h"
#include "foldersel.h"
#include "toolbar.h"
#include "inc.h"
#include "message_search.h"
#include "combobox.h"
#include "hooks.h"
#include "privacy.h"
#include "timing.h"
#include "autofaces.h"
#include "spell_entry.h"
enum
{
COL_MIMETYPE = 0,
COL_SIZE = 1,
COL_NAME = 2,
COL_DATA = 3,
COL_AUTODATA = 4,
N_COL_COLUMNS
};
#define N_ATTACH_COLS (N_COL_COLUMNS)
typedef enum
{
COMPOSE_CALL_ADVANCED_ACTION_MOVE_BEGINNING_OF_LINE,
COMPOSE_CALL_ADVANCED_ACTION_MOVE_FORWARD_CHARACTER,
COMPOSE_CALL_ADVANCED_ACTION_MOVE_BACKWARD_CHARACTER,
COMPOSE_CALL_ADVANCED_ACTION_MOVE_FORWARD_WORD,
COMPOSE_CALL_ADVANCED_ACTION_MOVE_BACKWARD_WORD,
COMPOSE_CALL_ADVANCED_ACTION_MOVE_END_OF_LINE,
COMPOSE_CALL_ADVANCED_ACTION_MOVE_NEXT_LINE,
COMPOSE_CALL_ADVANCED_ACTION_MOVE_PREVIOUS_LINE,
COMPOSE_CALL_ADVANCED_ACTION_DELETE_FORWARD_CHARACTER,
COMPOSE_CALL_ADVANCED_ACTION_DELETE_BACKWARD_CHARACTER,
COMPOSE_CALL_ADVANCED_ACTION_DELETE_FORWARD_WORD,
COMPOSE_CALL_ADVANCED_ACTION_DELETE_BACKWARD_WORD,
COMPOSE_CALL_ADVANCED_ACTION_DELETE_LINE,
COMPOSE_CALL_ADVANCED_ACTION_DELETE_TO_LINE_END
} ComposeCallAdvancedAction;
typedef enum
{
PRIORITY_HIGHEST = 1,
PRIORITY_HIGH,
PRIORITY_NORMAL,
PRIORITY_LOW,
PRIORITY_LOWEST
} PriorityLevel;
typedef enum
{
COMPOSE_INSERT_SUCCESS,
COMPOSE_INSERT_READ_ERROR,
COMPOSE_INSERT_INVALID_CHARACTER,
COMPOSE_INSERT_NO_FILE
} ComposeInsertResult;
typedef enum
{
COMPOSE_WRITE_FOR_SEND,
COMPOSE_WRITE_FOR_STORE
} ComposeWriteType;
typedef enum
{
COMPOSE_QUOTE_FORCED,
COMPOSE_QUOTE_CHECK,
COMPOSE_QUOTE_SKIP
} ComposeQuoteMode;
#define B64_LINE_SIZE 57
#define B64_BUFFSIZE 77
#define MAX_REFERENCES_LEN 999
static GList *compose_list = NULL;
static Compose *compose_generic_new (PrefsAccount *account,
const gchar *to,
FolderItem *item,
GPtrArray *attach_files,
GList *listAddress );
static Compose *compose_create (PrefsAccount *account,
FolderItem *item,
ComposeMode mode,
gboolean batch);
static void compose_entry_mark_default_to (Compose *compose,
const gchar *address);
static Compose *compose_followup_and_reply_to (MsgInfo *msginfo,
ComposeQuoteMode quote_mode,
gboolean to_all,
gboolean to_sender,
const gchar *body);
static Compose *compose_forward_multiple (PrefsAccount *account,
GSList *msginfo_list);
static Compose *compose_reply (MsgInfo *msginfo,
ComposeQuoteMode quote_mode,
gboolean to_all,
gboolean to_ml,
gboolean to_sender,
const gchar *body);
static Compose *compose_reply_mode (ComposeMode mode,
GSList *msginfo_list,
gchar *body);
static void compose_template_apply_fields(Compose *compose, Template *tmpl);
static void compose_update_privacy_systems_menu(Compose *compose);
static GtkWidget *compose_account_option_menu_create
(Compose *compose);
static void compose_set_out_encoding (Compose *compose);
static void compose_set_template_menu (Compose *compose);
static void compose_template_apply (Compose *compose,
Template *tmpl,
gboolean replace);
static void compose_destroy (Compose *compose);
static void compose_entries_set (Compose *compose,
const gchar *mailto,
ComposeEntryType to_type);
static gint compose_parse_header (Compose *compose,
MsgInfo *msginfo);
static gchar *compose_parse_references (const gchar *ref,
const gchar *msgid);
static gchar *compose_quote_fmt (Compose *compose,
MsgInfo *msginfo,
const gchar *fmt,
const gchar *qmark,
const gchar *body,
gboolean rewrap,
gboolean need_unescape,
const gchar *err_msg);
static void compose_reply_set_entry (Compose *compose,
MsgInfo *msginfo,
gboolean to_all,
gboolean to_ml,
gboolean to_sender,
gboolean
followup_and_reply_to);
static void compose_reedit_set_entry (Compose *compose,
MsgInfo *msginfo);
static void compose_insert_sig (Compose *compose,
gboolean replace);
static ComposeInsertResult compose_insert_file (Compose *compose,
const gchar *file);
static gboolean compose_attach_append (Compose *compose,
const gchar *file,
const gchar *type,
const gchar *content_type);
static void compose_attach_parts (Compose *compose,
MsgInfo *msginfo);
static gboolean compose_beautify_paragraph (Compose *compose,
GtkTextIter *par_iter,
gboolean force);
static void compose_wrap_all (Compose *compose);
static void compose_wrap_all_full (Compose *compose,
gboolean autowrap);
static void compose_set_title (Compose *compose);
static void compose_select_account (Compose *compose,
PrefsAccount *account,
gboolean init);
static PrefsAccount *compose_current_mail_account(void);
/* static gint compose_send (Compose *compose); */
static gboolean compose_check_for_valid_recipient
(Compose *compose);
static gboolean compose_check_entries (Compose *compose,
gboolean check_everything);
static gint compose_write_to_file (Compose *compose,
FILE *fp,
gint action,
gboolean attach_parts);
static gint compose_write_body_to_file (Compose *compose,
const gchar *file);
static gint compose_remove_reedit_target (Compose *compose,
gboolean force);
static void compose_remove_draft (Compose *compose);
static gint compose_queue_sub (Compose *compose,
gint *msgnum,
FolderItem **item,
gchar **msgpath,
gboolean check_subject,
gboolean remove_reedit_target);
static void compose_add_attachments (Compose *compose,
M
评论1
最新资源