#undef ACP_FDUP
#undef ACP_FASSIGN
+static void account_empty_cache(PrefsAccount *ac_prefs)
+{
+ gchar *cache_dir;
+
+ cache_dir = prefs_account_cache_dir(ac_prefs, FALSE);
+ if (cache_dir == NULL)
+ return; /* no cache dir, nothing to do */
+
+ if (is_dir_exist(cache_dir) && remove_dir_recursive(cache_dir) < 0) {
+ g_warning("can't remove directory '%s'", cache_dir);
+ } else {
+ gchar *server_dir = prefs_account_cache_dir(ac_prefs, TRUE);
+ if (g_rmdir(server_dir) == 0)
+ debug_print("Removed empty cache server directory\n");
+ else
+ debug_print("Cache server directory not empty: not removed\n");
+ g_free(server_dir);
+ }
+ g_free(cache_dir);
+}
+
static void account_delete(GtkWidget *widget, gpointer data)
{
PrefsAccount *ac_prefs;
GList *list;
Folder *folder;
GSList *cur;
-
+
ac_prefs = account_list_view_get_selected_account(edit_account.list_view);
if (ac_prefs == NULL)
return;
cur = g_slist_next(cur);
}
}
+
+ debug_print("Removing cache directory of this account...\n");
+ account_empty_cache(ac_prefs);
+
folder_write_list();
}
#ifdef USE_GNUTLS
protocol = ac_prefs->protocol == A_POP3 ?
(ac_prefs->ssl_pop == SSL_TUNNEL ?
- "POP3 (SSL)" :
+ "POP (SSL/TLS)" :
ac_prefs->ssl_pop == SSL_STARTTLS ?
- "POP3 (TLS)" : "POP3") :
+ "POP (STARTTLS)" : "POP") :
ac_prefs->protocol == A_IMAP4 ?
(ac_prefs->ssl_imap == SSL_TUNNEL ?
- "IMAP4 (SSL)" :
+ "IMAP (SSL/TLS)" :
ac_prefs->ssl_imap == SSL_STARTTLS ?
- "IMAP4 (TLS)" : "IMAP4") :
+ "IMAP (STARTTLS)" : "IMAP") :
ac_prefs->protocol == A_NNTP ?
(ac_prefs->ssl_nntp == SSL_TUNNEL ?
- "NNTP (SSL)" : "NNTP") :
+ "NNTP (SSL/TLS)" : "NNTP") :
ac_prefs->protocol == A_LOCAL ? "Local" :
ac_prefs->protocol == A_NONE ? "SMTP" : "-";
#else
- protocol = ac_prefs->protocol == A_POP3 ? "POP3" :
- ac_prefs->protocol == A_IMAP4 ? "IMAP4" :
+ protocol = ac_prefs->protocol == A_POP3 ? "POP" :
+ ac_prefs->protocol == A_IMAP4 ? "IMAP" :
ac_prefs->protocol == A_LOCAL ? "Local" :
ac_prefs->protocol == A_NNTP ? "NNTP" :
ac_prefs->protocol == A_NONE ? "SMTP" : "-";
else if (folder_has_parent_of_type(msginfo->folder, F_QUEUE) ||
folder_has_parent_of_type(msginfo->folder, F_OUTBOX) ||
folder_has_parent_of_type(msginfo->folder, F_DRAFT)) {
- gchar from[BUFFSIZE];
+ gchar *from = NULL;
if (!procheader_get_header_from_msginfo
- (msginfo, from, sizeof from, "From:")) {
+ (msginfo, &from, "From:")) {
gchar *buf = from + strlen("From:");
extract_address(buf);
account = account_find_from_address(buf, FALSE);
- }
+ g_free(from);
+ }
}
/* select account by to: and cc: header if enabled */
if (reply_autosel) {
}
}
if (!account) {
- gchar deliveredto[BUFFSIZE];
+ gchar *deliveredto = NULL;
if (!procheader_get_header_from_msginfo
- (msginfo, deliveredto,sizeof deliveredto , "Delivered-To:")) {
+ (msginfo, &deliveredto, "Delivered-To:")) {
gchar *buf = deliveredto + strlen("Delivered-To:");
extract_address(buf);
account = account_find_from_address(buf, FALSE);
- }
+ g_free(deliveredto);
+ }
}
}
return NULL;
if (account->sig_type == SIG_FILE) {
- if (!is_file_or_fifo_exist(account->sig_path)) {
- g_warning("can't open signature file: '%s'",
- account->sig_path);
+ gchar *sig_full_path;
+ if (!g_path_is_absolute(account->sig_path)) {
+ sig_full_path = g_build_filename(get_home_dir(), account->sig_path, NULL);
+ } else {
+ sig_full_path = g_strdup(account->sig_path);
+ }
+
+ if (!is_file_or_fifo_exist(sig_full_path)) {
+ g_warning("can't open signature file: '%s'", sig_full_path);
+ g_free(sig_full_path);
return NULL;
}
- }
- if (account->sig_type == SIG_COMMAND)
- sig_body = get_command_output(account->sig_path);
- else {
- gchar *tmp;
+ debug_print("Reading signature from file '%s'\n", sig_full_path);
+ gchar *tmp = file_read_to_str(sig_full_path);
+ g_free(sig_full_path);
- tmp = file_read_to_str(account->sig_path);
if (!tmp)
return NULL;
+
sig_body = normalize_newlines(tmp);
g_free(tmp);
+ } else {
+ sig_body = get_command_output(account->sig_path);
}
if (account->sig_sep) {