/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2004-2007 Hiroyuki Yamamoto & the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2004-2007 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 2 of the License, or
+ * 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,
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
*/
#include <gtk/gtk.h>
NULL, NULL, NULL},
{"gpg_ask_create_key", "TRUE", &prefs_gpg.gpg_ask_create_key, P_BOOL,
NULL, NULL, NULL},
+ {"skip_encryption_warning", "", &prefs_gpg.skip_encryption_warning, P_STRING,
+ NULL, NULL, NULL},
{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
};
debug_print("Can't enable gpg agent (no GPG_AGENT_INFO)\n");
}
} else {
+ if (saved_gpg_agent_info) {
g_unsetenv("GPG_AGENT_INFO");
debug_print("unset GPG_AGENT_INFO=%s\n",
saved_gpg_agent_info);
+ } else {
+ debug_print("Can't disable gpg agent (no GPG_AGENT_INFO)\n");
+ }
}
}
{
static gchar *path[3];
gchar *rcpath;
- gchar *tmp = NULL;
+ const gchar *tmp = NULL;
prefs_set_default(param);
rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
prefs_account_unregister_page((PrefsPage *) &gpg_account_page);
prefs_gpg_enable_agent(TRUE);
}
+
+gboolean prefs_gpg_should_skip_encryption_warning(const gchar *systemid)
+{
+ gchar **systems = NULL;
+ int i = 0;
+ if (prefs_gpg_get_config()->skip_encryption_warning == NULL)
+ return FALSE;
+ systems = g_strsplit(prefs_gpg_get_config()->skip_encryption_warning,
+ ",", -1);
+ while (systems && systems[i]) {
+ printf(" cmp %s %s\n", systems[i], systemid);
+ if (!strcmp(systems[i],systemid)) {
+ g_strfreev(systems);
+ return TRUE;
+ }
+ i++;
+ }
+ g_strfreev(systems);
+ return FALSE;
+}
+
+void prefs_gpg_add_skip_encryption_warning(const gchar *systemid)
+{
+ gchar *tmp = NULL;
+ if (prefs_gpg_get_config()->skip_encryption_warning == NULL)
+ prefs_gpg_get_config()->skip_encryption_warning =
+ g_strdup_printf("%s,", systemid);
+ else if (!prefs_gpg_should_skip_encryption_warning(systemid)) {
+ tmp = g_strdup_printf("%s%s,",
+ prefs_gpg_get_config()->skip_encryption_warning,
+ systemid);
+ g_free(prefs_gpg_get_config()->skip_encryption_warning);
+ prefs_gpg_get_config()->skip_encryption_warning = tmp;
+ }
+ prefs_gpg_save_config();
+}
+
+void prefs_gpg_remove_skip_encryption_warning(const gchar *systemid)
+{
+ gchar **systems = NULL;
+ int i = 0;
+ if (prefs_gpg_get_config()->skip_encryption_warning == NULL)
+ return;
+
+ if (prefs_gpg_should_skip_encryption_warning(systemid)) {
+ systems = g_strsplit(prefs_gpg_get_config()->skip_encryption_warning,
+ ",", -1);
+ g_free(prefs_gpg_get_config()->skip_encryption_warning);
+ prefs_gpg_get_config()->skip_encryption_warning = NULL;
+
+ while (systems && systems[i]) {
+ if (!strcmp(systems[i],systemid)) {
+ i++;
+ continue;
+ }
+ prefs_gpg_add_skip_encryption_warning(systems[i]);
+ i++;
+ }
+
+ g_strfreev(systems);
+ }
+ prefs_gpg_save_config();
+}