[sylpheed:33622] [PATCH 2/2] Preserve PGP settings saving and loading drafts.
Antonio Ospite
ospite at studenti.unina.it
Mon Feb 8 20:14:35 JST 2010
This is done by introducing two new X-Sylpheed headers called
X-Sylpheed-Compose-UseSigning and X-Sylpheed-Compose-UseEncryption to
store the settings values in the message source when saving to drafts.
The settings are restored and the UI status is updated on re-edit.
Signed-off-by: Antonio Ospite <ospite at studenti.unina.it>
---
src/compose.c | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/src/compose.c b/src/compose.c
index d2be386..f4884c0 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -1224,6 +1224,11 @@ void compose_reedit(MsgInfo *msginfo)
compose_set_spell_lang_menu(compose);
#endif
+#ifdef USE_GPGME
+ menu_set_active(ifactory, "/Tools/PGP Sign", compose->use_signing);
+ menu_set_active(ifactory, "/Tools/PGP Encrypt", compose->use_encryption);
+#endif
+
syl_plugin_signal_emit("compose-created", compose);
if (prefs_common.enable_autosave && prefs_common.autosave_itv > 0)
@@ -1606,6 +1611,8 @@ static gint compose_parse_source_msg(Compose *compose, MsgInfo *msginfo)
{"X-Sylpheed-Compose-AutoWrap:", NULL, FALSE},
{"X-Sylpheed-Compose-CheckSpell:", NULL, FALSE},
{"X-Sylpheed-Compose-SpellLang:", NULL, FALSE},
+ {"X-Sylpheed-Compose-UseSigning:", NULL, FALSE},
+ {"X-Sylpheed-Compose-UseEncryption:", NULL, FALSE},
{NULL, NULL, FALSE}};
enum
@@ -1617,7 +1624,9 @@ static gint compose_parse_source_msg(Compose *compose, MsgInfo *msginfo)
H_MDN = 4,
H_X_SYLPHEED_COMPOSE_AUTOWRAP = 5,
H_X_SYLPHEED_COMPOSE_CHECKSPELL = 6,
- H_X_SYLPHEED_COMPOSE_SPELLLANG = 7
+ H_X_SYLPHEED_COMPOSE_SPELLLANG = 7,
+ H_X_SYLPHEED_COMPOSE_USESIGNING = 8,
+ H_X_SYLPHEED_COMPOSE_USEENCRYPTION = 9
};
gchar *file;
@@ -1662,6 +1671,19 @@ static gint compose_parse_source_msg(Compose *compose, MsgInfo *msginfo)
} else if (hnum == H_X_SYLPHEED_COMPOSE_SPELLLANG) {
compose->spell_lang = g_strdup(str);
#endif
+
+#ifdef USE_GPGME
+ } else if (hnum == H_X_SYLPHEED_COMPOSE_USESIGNING) {
+ if (g_ascii_strcasecmp(str, "TRUE") == 0)
+ compose->use_signing = TRUE;
+ else
+ compose->use_signing = FALSE;
+ } else if (hnum == H_X_SYLPHEED_COMPOSE_USEENCRYPTION) {
+ if (g_ascii_strcasecmp(str, "TRUE") == 0)
+ compose->use_encryption = TRUE;
+ else
+ compose->use_encryption = FALSE;
+#endif
}
}
@@ -4770,6 +4792,13 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
fprintf(fp, "X-Sylpheed-Compose-SpellLang: %s\n",
compose->spell_lang);
#endif
+
+#if USE_GPGME
+ fprintf(fp, "X-Sylpheed-Compose-UseSigning: %s\n",
+ compose->use_signing ? "TRUE": "FALSE");
+ fprintf(fp, "X-Sylpheed-Compose-UseEncryption: %s\n",
+ compose->use_encryption ? "TRUE": "FALSE");
+#endif
}
/* separator between header and body */
--
1.6.6.1
More information about the Sylpheed
mailing list