/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2018 the Claws Mail team and 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
#include "autofaces.h"
#include "spell_entry.h"
#include "headers.h"
-#include "claws_io.h"
+#include "file-utils.h"
#ifdef USE_LDAP
#include "password.h"
compose = compose_create(account, item, COMPOSE_NEW, FALSE);
compose_apply_folder_privacy_settings(compose, item);
+ if (privacy_system_can_sign(compose->privacy_system) == FALSE &&
+ (account->default_encrypt || account->default_sign))
+ alertpanel_error(_("You have opted to sign and/or encrypt this "
+ "message but have not selected a privacy system.\n\n"
+ "Signing and encrypting have been disabled for this "
+ "message."));
+
/* override from name if mailto asked for it */
if (mailto_from) {
gtk_entry_set_text(GTK_ENTRY(compose->from_name), mailto_from);
cm_return_if_fail(compose != NULL);
cm_return_if_fail(account != NULL);
- if (override_pref == FALSE && account->default_encrypt_reply == FALSE)
+ if (privacy_system_can_encrypt(compose->privacy_system) == FALSE ||
+ (override_pref == FALSE && account->default_encrypt_reply == FALSE))
return;
if (account->default_privacy_system && strlen(account->default_privacy_system))
static void compose_force_signing(Compose *compose, PrefsAccount *account, const gchar *system)
{
const gchar *privacy = NULL;
+ if (privacy_system_can_sign(compose->privacy_system) == FALSE)
+ return;
if (account->default_privacy_system && strlen(account->default_privacy_system))
privacy = account->default_privacy_system;
}
g_free(s_system);
+ if (privacy_system_can_sign(compose->privacy_system) == FALSE &&
+ (account->default_encrypt_reply || account->default_sign_reply))
+ alertpanel_error(_("You have opted to sign and/or encrypt this "
+ "message but have not selected a privacy system.\n\n"
+ "Signing and encrypting have been disabled for this "
+ "message."));
+
SIGNAL_BLOCK(textbuf);
if (account->auto_sig)
compose_set_title(compose);
- if (account->default_sign && compose->mode != COMPOSE_REDIRECT)
+ compose_activate_privacy_system(compose, account, FALSE);
+
+ if (account->default_sign && privacy_system_can_sign(compose->privacy_system) &&
+ compose->mode != COMPOSE_REDIRECT)
cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Sign", TRUE);
else
cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Sign", FALSE);
- if (account->default_encrypt && compose->mode != COMPOSE_REDIRECT)
+ if (account->default_encrypt && privacy_system_can_encrypt(compose->privacy_system) &&
+ compose->mode != COMPOSE_REDIRECT)
cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Encrypt", TRUE);
else
cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Encrypt", FALSE);
-
- compose_activate_privacy_system(compose, account, FALSE);
if (!init && compose->mode != COMPOSE_REDIRECT) {
undo_block(compose->undostruct);
rewind(fp);
content = file_read_stream_to_str(fp);
- str_write_to_file(content, tmp_enc_file);
+ str_write_to_file(content, tmp_enc_file, TRUE);
g_free(content);
/* Now write the unencrypted body. */
claws_spell_entry_set_gtkaspell(CLAWS_SPELL_ENTRY(subject_entry), gtkaspell);
#endif
- compose_select_account(compose, account, TRUE);
-
cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Edit/AutoWrap", prefs_common.autowrap);
cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Edit/AutoIndent", prefs_common.auto_indent);
clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
gtk_text_buffer_remove_selection_clipboard(buffer, clipboard);
+ message_search_close(compose);
gtk_widget_destroy(compose->window);
toolbar_destroy(compose->toolbar);
g_free(compose->toolbar);
static void compose_apply_folder_privacy_settings(Compose *compose, FolderItem *folder_item)
{
if (folder_item != NULL) {
- if (folder_item->prefs->always_sign != SIGN_OR_ENCRYPT_DEFAULT) {
+ if (folder_item->prefs->always_sign != SIGN_OR_ENCRYPT_DEFAULT &&
+ privacy_system_can_sign(compose->privacy_system)) {
compose_use_signing(compose,
(folder_item->prefs->always_sign == SIGN_OR_ENCRYPT_ALWAYS) ? TRUE : FALSE);
}
- if (folder_item->prefs->always_encrypt != SIGN_OR_ENCRYPT_DEFAULT) {
+ if (folder_item->prefs->always_encrypt != SIGN_OR_ENCRYPT_DEFAULT &&
+ privacy_system_can_encrypt(compose->privacy_system)) {
compose_use_encryption(compose,
(folder_item->prefs->always_encrypt == SIGN_OR_ENCRYPT_ALWAYS) ? TRUE : FALSE);
}
/* Assume a list of no files, and data has ://, is a remote link */
gchar *tmpdata = g_strstrip(g_strdup(ddata));
gchar *tmpfile = get_tmp_file();
- str_write_to_file(tmpdata, tmpfile);
+ str_write_to_file(tmpdata, tmpfile, TRUE);
g_free(tmpdata);
compose_insert_file(compose, tmpfile);
claws_unlink(tmpfile);