2004-10-13 [colin] 0.9.12cvs126
authorColin Leroy <colin@colino.net>
Wed, 13 Oct 2004 14:06:39 +0000 (14:06 +0000)
committerColin Leroy <colin@colino.net>
Wed, 13 Oct 2004 14:06:39 +0000 (14:06 +0000)
* src/compose.c
Don't convert message to forced encoding when
drafting, plus minor magic-values cleanup.

ChangeLog.claws
PATCHSETS
configure.ac
src/compose.c

index bc34d76..d8e6c69 100644 (file)
@@ -1,3 +1,9 @@
+2004-10-13 [colin]     0.9.12cvs126
+
+       * src/compose.c
+               Don't convert message to forced encoding when 
+               drafting, plus minor magic-values cleanup.
+
 2004-10-13 [colin]     0.9.12cvs125
 
        * po/POTFILES.in
index b065323..689797f 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.187 -r 1.188 src/Makefile.am; cvs diff -u -r 1.74 -r 1.75 src/account.c; cvs diff -u -r 1.442 -r 1.443 src/compose.c; cvs diff -u -r 1.56 -r 1.57 src/compose.h; cvs diff -u -r 1.24 -r 1.25 src/crash.c; cvs diff -u -r 1.145 -r 1.146 src/main.c; cvs diff -u -r 1.128 -r 1.129 src/mimeview.c; cvs diff -u -r -1.13 -r -1.14 src/passphrase.c; cvs diff -u -r -1.5 -r -1.6 src/passphrase.h; cvs diff -u -r 1.114 -r 1.115 src/prefs_account.c; cvs diff -u -r 1.52 -r 1.53 src/prefs_account.h; cvs diff -u -r 1.228 -r 1.229 src/prefs_common.c; cvs diff -u -r 1.115 -r 1.116 src/prefs_common.h; cvs diff -u -r 1.10 -r 1.11 src/privacy.c; cvs diff -u -r 1.10 -r 1.11 src/privacy.h; cvs diff -u -r 1.85 -r 1.86 src/procmime.c; cvs diff -u -r 1.30 -r 1.31 src/procmime.h; cvs diff -u -r 1.167 -r 1.168 src/procmsg.c; cvs diff -u -r -1.42 -r -1.43 src/rfc2015.c; cvs diff -u -r -1.9 -r -1.10 src/rfc2015.h; cvs diff -u -r -1.7 -r -1.8 src/select-keys.c; cvs diff -u -r -1.1.1.1 -r -1.1.1.2 src/select-keys.h; cvs diff -u -r 1.52 -r 1.53 src/common/utils.c; cvs diff -u -r 1.30 -r 1.31 src/common/utils.h; cvs diff -u -r 1.6 -r 1.7 src/gtk/about.c; cvs diff -u -r 1.1 -r 1.2 src/plugins/pgpmime/Makefile.am; cvs diff -u -r 0 -r 1 src/plugins/pgpmime/passphrase.c; cvs diff -u -r 0 -r 1 src/plugins/pgpmime/passphrase.h; cvs diff -u -r 1.4 -r 1.5 src/plugins/pgpmime/pgpmime.c; cvs diff -u -r 1.3 -r 1.4 src/plugins/pgpmime/plugin.c; cvs diff -u -r 0 -r 1 src/plugins/pgpmime/prefs_gpg.c; cvs diff -u -r 0 -r 1 src/plugins/pgpmime/prefs_gpg.h; cvs diff -u -r 0 -r 1 src/plugins/pgpmime/select-keys.c; cvs diff -u -r 0 -r 1 src/plugins/pgpmime/select-keys.h; cvs diff -u -r 1.2 -r 1.3 src/plugins/pgpmime/sgpgme.c; cvs diff -u -r 1.2 -r 1.3 src/plugins/pgpmime/sgpgme.h; ) > 0.9.12cvs123.patchset
 ( cvs diff -u -r 1.1 -r 1.2 m4/spamassassin.m4; cvs diff -u -r 1.443 -r 1.444 src/compose.c; ) > 0.9.12cvs124.patchset
 ( cvs diff -u -r 1.73 -r 1.74 po/POTFILES.in; ) > 0.9.12cvs125.patchset
+( cvs diff -u -r 1.444 -r 1.445 src/compose.c; ) > 0.9.12cvs126.patchset
index 2c27ba4..b027c13 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=12
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=125
+EXTRA_VERSION=126
 EXTRA_RELEASE=
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
index 12df642..17f5227 100644 (file)
@@ -154,6 +154,20 @@ typedef enum
        COMPOSE_INSERT_NO_FILE
 } ComposeInsertResult;
 
+typedef enum
+{
+       COMPOSE_QUIT_EDITING,
+       COMPOSE_KEEP_EDITING,
+       COMPOSE_AUTO_SAVE
+} ComposeDraftAction;
+
+typedef enum
+{
+       COMPOSE_WRITE_FOR_SEND,
+       COMPOSE_WRITE_FOR_STORE
+} ComposeWriteType;
+
+
 #define B64_LINE_SIZE          57
 #define B64_BUFFSIZE           77
 
@@ -229,7 +243,8 @@ static gboolean compose_check_for_valid_recipient
 static gboolean compose_check_entries          (Compose        *compose,
                                                 gboolean       check_subject);
 static gint compose_write_to_file              (Compose        *compose,
-                                                FILE           *fp);
+                                                FILE           *fp,
+                                                gint            action);
 static gint compose_write_body_to_file         (Compose        *compose,
                                                 const gchar    *file);
 static gint compose_remove_reedit_target       (Compose        *compose);
@@ -520,7 +535,7 @@ static GtkItemFactoryEntry compose_entries[] =
        {N_("/_Message/Insert si_gnature"),     "<control>G", compose_insert_sig_cb,  0, NULL},
        {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/_Save"),
-                                               "<control>S", compose_draft_cb, 1, NULL},
+                                               "<control>S", compose_draft_cb, COMPOSE_KEEP_EDITING, NULL},
        {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/_Close"),                        "<control>W", compose_close_cb, 0, NULL},
 
@@ -1483,7 +1498,7 @@ void compose_toolbar_cb(gint action, gpointer data)
                compose_send_later_cb(compose, 0, NULL);
                break;
        case A_DRAFT:
-               compose_draft_cb(compose, 0, NULL);
+               compose_draft_cb(compose, COMPOSE_QUIT_EDITING, NULL);
                break;
        case A_INSERT:
                compose_insert_file_cb(compose, 0, NULL);
@@ -3319,7 +3334,7 @@ error:
        return -1;
 }
 
-static gint compose_write_to_file(Compose *compose, FILE *fp)
+static gint compose_write_to_file(Compose *compose, FILE *fp, gint action)
 {
        gchar *chars;
        gchar *buf;
@@ -3367,27 +3382,33 @@ static gint compose_write_to_file(Compose *compose, FILE *fp)
                debug_print("src encoding = %s, out encoding = %s, transfer encoding = %s\n",
                            src_codeset, out_codeset, procmime_get_encoding_str(encoding));
 
-               buf = conv_codeset_strdup(chars, src_codeset, out_codeset);
-               if (!buf) {
-                       AlertValue aval;
-                       gchar *msg;
-
-                       msg = g_strdup_printf(_("Can't convert the character encoding of the message from\n"
-                                               "%s to %s.\n"
-                                               "Send it anyway?"), src_codeset, out_codeset);
-                       aval = alertpanel_with_type
-                               (_("Error"), msg, _("Yes"), _("+No"), NULL, NULL, ALERT_ERROR);
-                       g_free(msg);
-
-                       if (aval != G_ALERTDEFAULT) {
-                               g_free(chars);
-                               return -1;
-                       } else {
-                               buf = chars;
-                               out_codeset = src_codeset;
-                               chars = NULL;
+               if (action == COMPOSE_WRITE_FOR_SEND) {
+                       buf = conv_codeset_strdup(chars, src_codeset, out_codeset);
+                       if (!buf) {
+                               AlertValue aval;
+                               gchar *msg;
+
+                               msg = g_strdup_printf(_("Can't convert the character encoding of the message from\n"
+                                                       "%s to %s.\n"
+                                                       "Send it anyway?"), src_codeset, out_codeset);
+                               aval = alertpanel_with_type
+                                       (_("Error"), msg, _("Yes"), _("+No"), NULL, NULL, ALERT_ERROR);
+                               g_free(msg);
+
+                               if (aval != G_ALERTDEFAULT) {
+                                       g_free(chars);
+                                       return -1;
+                               } else {
+                                       buf = chars;
+                                       out_codeset = src_codeset;
+                                       chars = NULL;
+                               }
                        }
-               }
+               } else {
+                       buf = chars;
+                       out_codeset = src_codeset;
+                       chars = NULL;
+               }
        }
        g_free(chars);
 
@@ -3398,7 +3419,6 @@ static gint compose_write_to_file(Compose *compose, FILE *fp)
        mimetext->subtype = g_strdup("plain");
        g_hash_table_insert(mimetext->typeparameters, g_strdup("charset"),
                            g_strdup(out_codeset));
-       /* procmime_encode_content(mimetext, encoding); */
 
        /* append attachment parts */
        if (compose_use_attach(compose)) {
@@ -3667,7 +3687,7 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
                        return -1;
                }
        } else {
-               if (compose_write_to_file(compose, fp) < 0) {
+               if (compose_write_to_file(compose, fp, COMPOSE_WRITE_FOR_SEND) < 0) {
                        lock = FALSE;
                        fclose(fp);
                        unlink(tmp);
@@ -6014,7 +6034,7 @@ static void compose_send_later_cb(gpointer data, guint action,
 
 void compose_draft (gpointer data) 
 {
-       compose_draft_cb(data, 0, NULL);        
+       compose_draft_cb(data, COMPOSE_QUIT_EDITING, NULL);     
 }
 
 static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
@@ -6063,7 +6083,7 @@ static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
        fprintf(fp, "X-Sylpheed-Gnupg-Mode:%s\n", compose->privacy_system);
        fprintf(fp, "\n");
 
-       if (compose_write_to_file(compose, fp) < 0) {
+       if (compose_write_to_file(compose, fp, COMPOSE_WRITE_FOR_STORE) < 0) {
                fclose(fp);
                unlink(tmp);
                g_free(tmp);
@@ -6101,8 +6121,7 @@ static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
        
        lock = FALSE;
 
-       /* 0: quit editing  1: keep editing  2: keep editing (autosave) */
-       if (action == 0)
+       if (action == COMPOSE_QUIT_EDITING)
                gtk_widget_destroy(compose->window);
        else {
                struct stat s;
@@ -6126,7 +6145,7 @@ static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
                compose->targetinfo->folder = draft;
                compose->mode = COMPOSE_REEDIT;
                
-               if (action == 2) {
+               if (action == COMPOSE_AUTO_SAVE) {
                        compose->autosaved_draft = compose->targetinfo;
                }
        }
@@ -6232,7 +6251,7 @@ static void compose_close_cb(gpointer data, guint action, GtkWidget *widget)
                                compose_remove_draft(compose);                  
                        break;
                case G_ALERTALTERNATE:
-                       compose_draft_cb(data, 0, NULL);
+                       compose_draft_cb(data, COMPOSE_QUIT_EDITING, NULL);
                        return;
                default:
                        return;
@@ -6716,7 +6735,7 @@ static void text_inserted(GtkWidget *widget, const gchar *text,
 static gint compose_defer_auto_save_draft(Compose *compose)
 {
        compose->draft_timeout_tag = -1;
-       compose_draft_cb((gpointer)compose, 2, NULL);
+       compose_draft_cb((gpointer)compose, COMPOSE_AUTO_SAVE, NULL);
        return FALSE;
 }