commit fdc4bd531cf10e88b140b509d4998b76ec8c077a from: Oliver Lowe date: Fri Sep 5 07:00:24 2025 UTC Dump more globals used once commit - 17a2e58047a50a92b60ba544673b4ecc365a9420 commit + fdc4bd531cf10e88b140b509d4998b76ec8c077a blob - d16a310231a094a9a584ef5b0d73626775baa44f blob + 34639ddcc12c0614dd3544d0ef0eb3b9efca8122 --- src/account.c +++ src/account.c @@ -1016,23 +1016,11 @@ static void account_clone(GtkWidget *widget, gpointer #undef ACP_FDUP #undef ACP_FASSIGN -static void account_empty_cache(PrefsAccount *ac_prefs) +void account_empty_cache(const char *server) { - gchar *cache_dir; - - cache_dir = prefs_account_cache_dir(ac_prefs, FALSE); - if (cache_dir == NULL) - return; /* no cache dir, nothing to do */ - + char *cache_dir = prefs_account_cache_dir(server, NULL); 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); } @@ -1040,7 +1028,6 @@ static void account_empty_cache(PrefsAccount *ac_prefs static void account_delete(GtkWidget *widget, gpointer data) { PrefsAccount *ac_prefs; - gchar buf[BUFFSIZE]; GList *list; Folder *folder; @@ -1048,12 +1035,14 @@ static void account_delete(GtkWidget *widget, gpointer if (ac_prefs == NULL) return; - g_snprintf(buf, sizeof(buf), - _("Do you really want to delete the account '%s'?"), - ac_prefs->account_name ? ac_prefs->account_name : - _("(Untitled)")); - if (alertpanel_full(_("Delete account"), buf, - NULL, _("_Cancel"), "edit-delete-symbolic", _("_Delete"), + char msg[BUFSIZ]; + char *name = ac_prefs->account_name; + if (!name) + strlcpy(msg, "Do you really want to delete this account?", sizeof(msg)); + else + snprintf(msg, sizeof(msg), "Do you really want to delete the account '%s'?", name); + if (alertpanel_full("Delete account", msg, + NULL, "_Cancel", "edit-delete-symbolic", "_Delete", NULL, NULL, ALERTFOCUS_FIRST, FALSE, NULL, ALERT_WARNING) != G_ALERTALTERNATE) return; @@ -1089,8 +1078,8 @@ static void account_delete(GtkWidget *widget, gpointer passwd_store_delete_block(PWS_ACCOUNT, uid); g_free(uid); - debug_print("Removing cache directory of this account...\n"); - account_empty_cache(ac_prefs); + if (ac_prefs->protocol == A_IMAP4) + account_empty_cache(ac_prefs->recv_server); folder_write_list(); } blob - a8ac4c300b6585e272616dd2216d13522ceaa0f7 blob + 322a56f15e71f61097cb2c65215281d4b42b93fb --- src/common/defs.h +++ src/common/defs.h @@ -24,62 +24,34 @@ #define QUEUE_DIR "queue" #define DRAFT_DIR "draft" #define TRASH_DIR "trash" -#define TAGS_DIR "tagsdb" #define RC_DIR ".claws-mail" -#define IMAP_CACHE_DIR "imapcache" -#define HEADER_CACHE_DIR "headercache" -#define MIME_TMP_DIR "mimetmp" #define COMMON_RC "clawsrc" #define ACCOUNT_RC "accountrc" #define OAUTH2_RC "oauth2rc" #define CUSTOM_HEADER_RC "customheaderrc" #define DISPLAY_HEADER_RC "dispheaderrc" #define FOLDERITEM_RC "folderitemrc" -#define FILTERING_RC "filteringrc" -#define MATCHER_RC "matcherrc" #define MENU_RC "menurc" -#define TAGS_RC "tagsrc" #define PASSWORD_STORE_RC "passwordstorerc" -#define MESSAGE_SEARCH_HISTORY "messagesearch_history" #define COMPOSE_SAVE_TO_HISTORY "compose_save_to_history" -#define ADDRESSBOOK_CUSTOM_ATTRIBUTES "attributesrc" -#define TEMPLATE_DIR "templates" -#define TMP_DIR "tmp" #define ADDRESS_BOOK "addressbook.xml" #define ADDRBOOK_DIR "addrbook" -#define MANUAL_HTML_INDEX "claws-mail-manual.html" #define HOMEPAGE_URI "https://www.claws-mail.org/" -#define MANUAL_URI "https://www.claws-mail.org/documentation.php" -#define FAQ_URI "https://www.claws-mail.org/faq/index.php" -#define BUGZILLA_URI "https://www.thewildbeast.co.uk/claws-mail/bugzilla/enter_bug.cgi" -#define THEMES_URI "https://www.claws-mail.org/themes.php" -#define TOOLS_URI "https://www.claws-mail.org/tools.php" -#define MAILING_LIST_URI "https://www.claws-mail.org/MLs.php" -#define WELCOME_MSG_ADDR "noreply@claws-mail.org" #define USERS_ML_URI "https://lists.claws-mail.org/cgi-bin/mailman/listinfo/users" -#define GPL_URI "https://www.gnu.org/licenses/gpl.html" #define DONATE_URI "https://www.claws-mail.org/donations.php" -#define CONFIG_VERSIONS_URI "https://www.claws-mail.org/cvc.php" #define RELEASE_NOTES_FILE "RELEASE_NOTES" #define FOLDER_LIST "folderlist.xml" -#define CACHE_FILE ".claws_cache" -#define MARK_FILE ".claws_mark" -#define TAGS_FILE ".claws_tags" #define CACHE_VERSION 24 #define MARK_VERSION 2 -#define TAGS_VERSION 1 #define ACTIONS_RC "actionsrc" #define COMMAND_HISTORY "command_history" #define DEFAULT_SIGNATURE ".signature" #define DEFAULT_INC_PATH "/usr/bin/mh/inc" -#define DEFAULT_INC_PROGRAM "inc" #define DEFAULT_SENDMAIL_CMD "/usr/sbin/sendmail -t -i" #define DEFAULT_BROWSER_CMD "firefox '%s'" #define DEFAULT_EDITOR_CMD "gedit '%s'" -#define DEFAULT_IMAGE_VIEWER_CMD "display '%s'" -#define DEFAULT_AUDIO_PLAYER_CMD "play '%s'" #define BUFFSIZE 8192 @@ -88,15 +60,12 @@ #define BORDER_WIDTH 2 #define CTREE_INDENT 18 #define FOLDER_SPACING 4 -#define MAX_ENTRY_LENGTH 8191 #define COLOR_DIM ((double)35000 / 65535) #define UI_REFRESH_INTERVAL 50000 /* usec */ -#define FOLDER_UPDATE_INTERVAL 1500 /* msec */ #define PROGRESS_UPDATE_INTERVAL 200 /* msec */ #define SESSION_TIMEOUT_INTERVAL 60 /* sec */ #define MAX_HISTORY_SIZE 32 #define HSPACING_NARROW 4 -#define HSPACING_NARROW_2 2 #define VSPACING 10 #define VSPACING_NARROW 4 #define VSPACING_NARROW_2 2 @@ -105,8 +74,6 @@ #define DEFAULT_PIXMAP_THEME "INTERNAL_DEFAULT" -#define AVATAR_NONE 0 -#define AVATAR_XFACE 1 #define AVATAR_FACE 2 #endif /* __DEFS_H__ */ blob - a4d30d0428a14355078c68d249be6c1b1b71c81f blob + 83f9752a02e6d4d132d74a08cd0137ed18add9e2 --- src/common/utils.c +++ src/common/utils.c @@ -1446,24 +1446,12 @@ const gchar *get_mail_base_dir(void) return get_home_dir(); } -const gchar *get_imap_cache_dir(void) -{ - static gchar *imap_cache_dir = NULL; - - if (!imap_cache_dir) - imap_cache_dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, - IMAP_CACHE_DIR, NULL); - - return imap_cache_dir; -} - const gchar *get_mime_tmp_dir(void) { static gchar *mime_tmp_dir = NULL; if (!mime_tmp_dir) - mime_tmp_dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, - MIME_TMP_DIR, NULL); + mime_tmp_dir = g_strconcat(get_rc_dir(), "/mimetmp", NULL); return mime_tmp_dir; } @@ -1473,9 +1461,7 @@ const gchar *get_template_dir(void) static gchar *template_dir = NULL; if (!template_dir) - template_dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, - TEMPLATE_DIR, NULL); - + template_dir = g_strconcat(get_rc_dir(), "/templates", NULL); return template_dir; } @@ -1494,9 +1480,7 @@ const gchar *get_tmp_dir(void) static gchar *tmp_dir = NULL; if (!tmp_dir) - tmp_dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, - TMP_DIR, NULL); - + tmp_dir = g_strconcat(get_rc_dir(), "/tmp", NULL); return tmp_dir; } blob - a9570863b63f2d1e33bfbe1439cefb3d9141c4fe blob + b9a90ef3d7ffb21a2d5d406843f78c184cf48c85 --- src/folder.c +++ src/folder.c @@ -3837,7 +3837,7 @@ static gchar *folder_item_get_cache_file(FolderItem *i cm_return_val_if_fail(path != NULL, NULL); if (!is_dir_exist(path)) make_dir_hier(path); - file = g_strconcat(path, G_DIR_SEPARATOR_S, CACHE_FILE, NULL); + file = g_strconcat(path, "/.claws_cache", NULL); g_free(path); return file; @@ -3856,12 +3856,14 @@ static gchar *folder_item_get_mark_file(FolderItem *it cm_return_val_if_fail(path != NULL, NULL); if (!is_dir_exist(path)) make_dir_hier(path); - file = g_strconcat(path, G_DIR_SEPARATOR_S, MARK_FILE, NULL); + file = g_strconcat(path, "/.claws_mark", NULL); g_free(path); return file; } +const char *tags_dir = ".claws_tags"; + static gchar *folder_item_get_tags_file(FolderItem *item) { gchar *path; @@ -3878,17 +3880,12 @@ static gchar *folder_item_get_tags_file(FolderItem *it identifier = folder_item_get_identifier(item); cm_return_val_if_fail(identifier != NULL, NULL); - path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, - TAGS_DIR, G_DIR_SEPARATOR_S, - identifier, NULL); - + path = g_strconcat(get_rc_dir(), "/tagsdb/", identifier, NULL); g_free(identifier); - if (!is_dir_exist(path)) make_dir_hier(path); + file = g_strconcat(path, "/.claws_tags", NULL); - file = g_strconcat(path, G_DIR_SEPARATOR_S, TAGS_FILE, NULL); - g_free(path); return file; blob - 03ef284e24ba5d1a2166b1501e0c4a52bd65b87a blob + 4230121d8e999a8f61622e8e27dfaaa56d27bdd3 --- src/gtk/gtkutils.c +++ src/gtk/gtkutils.c @@ -92,10 +92,7 @@ void gtkut_stock_button_add_help(GtkWidget *bbox, GtkW gtk_widget_set_can_default(*help_btn, TRUE); gtk_box_pack_end(GTK_BOX (bbox), *help_btn, TRUE, TRUE, 0); - gtk_button_box_set_child_secondary(GTK_BUTTON_BOX (bbox), - *help_btn, TRUE); - gtk_widget_set_sensitive(*help_btn, - manual_available(MANUAL_MANUAL_CLAWS)); + gtk_button_box_set_child_secondary(GTK_BUTTON_BOX (bbox), *help_btn, TRUE); gtk_widget_show(*help_btn); } blob - 0812abdd4091ba2a2ce5738d63f52f72a019edda blob + c55c9ee4283dd806665015ddf891a5a5497eb02d --- src/imap.c +++ src/imap.c @@ -2530,13 +2530,10 @@ static gchar *imap_item_get_path(Folder *folder, Folde g_return_val_if_fail(folder != NULL, NULL); g_return_val_if_fail(folder->account != NULL, NULL); g_return_val_if_fail(item != NULL, NULL); - folder_path = prefs_account_cache_dir(folder->account, FALSE); - g_return_val_if_fail(folder_path != NULL, NULL); - + folder_path = prefs_account_cache_dir(folder->account->recv_server, folder->account->userid); item_path = g_strdup(item->path); - - if (g_path_is_absolute(folder_path)) { + if (g_path_is_absolute(folder_path)) { if (item_path) path = g_strconcat(folder_path, G_DIR_SEPARATOR_S, item_path, NULL); blob - 960e6a479dc008f45984cde0cffe698df7d944bd blob + 3816e9a1c19c654e198635729fe4b9aaa0cf9384 --- src/main.c +++ src/main.c @@ -429,7 +429,6 @@ int main(int argc, char *argv[]) CHDIR_RETURN_VAL_IF_FAIL(get_rc_dir(), 1); MAKE_DIR_IF_NOT_EXIST(get_mail_base_dir()); - MAKE_DIR_IF_NOT_EXIST(get_imap_cache_dir()); MAKE_DIR_IF_NOT_EXIST(get_mime_tmp_dir()); MAKE_DIR_IF_NOT_EXIST(get_tmp_dir()); blob - 8a512bc997042e6bbc388f224ecad5b606dc4f10 blob + 9e7601625a6397ce5eef4a20f2f91c0c8b805c01 --- src/manual.c +++ src/manual.c @@ -23,7 +23,6 @@ #include #include -#include "prefs_common.h" #include "manual.h" #include "utils.h" @@ -64,62 +63,13 @@ static gchar *get_local_path_with_locale(gchar *rootpa return dir; } -gboolean manual_available(ManualType type) -{ - gboolean ret = FALSE; - gchar *dir = NULL, *uri = NULL; - - switch (type) { - case MANUAL_MANUAL_CLAWS: - dir = get_local_path_with_locale("/dev/null"); // TODO: was MANUALDIR - if (dir != NULL) { - uri = g_strconcat(dir, G_DIR_SEPARATOR_S, MANUAL_HTML_INDEX, NULL); - g_free(dir); - if (is_file_exist(uri)) - ret = TRUE; - else - ret = FALSE; - g_free(uri); - } - break; - default: - ret = FALSE; - } - - return ret; -} - void manual_open(ManualType type, gchar *url_anchor) { - gchar *uri = NULL; - gchar *dir; - - switch (type) { - case MANUAL_MANUAL_CLAWS: - dir = get_local_path_with_locale("/dev/null"); // TODO: was MANUALDIR - if (dir != NULL) { - gchar *tmp_anchor = NULL; - if (url_anchor && *url_anchor != '\0') - tmp_anchor = g_strconcat("#", url_anchor, NULL); - uri = g_strconcat("file://", - dir, G_DIR_SEPARATOR_S, MANUAL_HTML_INDEX, - tmp_anchor, - NULL); - g_free(tmp_anchor); - g_free(dir); - } else { - uri = g_strconcat(MANUAL_URI, NULL); - } - break; - case MANUAL_FAQ_CLAWS: - uri = g_strconcat(FAQ_URI, NULL); - break; - - default: - break; + if (type == MANUAL_FAQ_CLAWS) { + open_uri("https://www.claws-mail.org/faq/index.php", "xdg-open '%s'"); + return; } - open_uri(uri, prefs_common_get_uri_cmd()); - g_free(uri); + open_uri("https://www.claws-mail.org/documentation.php", "xdg-open '%s'"); } void manual_open_with_anchor_cb(GtkWidget *widget, gchar *url_anchor) blob - c6472d5c4f1afda33e91f3e43bca05ec8fd3bcb5 blob + 95ca60f190078912cfc4717554aed6b8d3799ae6 --- src/manual.h +++ src/manual.h @@ -14,12 +14,14 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * */ #ifndef __MANUAL_H__ #define __MANUAL_H__ +#include + typedef enum { MANUAL_MANUAL_CLAWS, @@ -37,7 +39,6 @@ typedef enum #define MANUAL_ANCHOR_PLUGINS "adv_plugins" #define MANUAL_ANCHOR_TAGS "adv_tags" -gboolean manual_available (ManualType type); void manual_open (ManualType type, gchar *url_anchor); void manual_open_with_anchor_cb(GtkWidget *widget, gchar *url_anchor); blob - 4122b8544e2f20d4329c619fa692e7bbdfbe825f blob + 63971b2e967f33197e38f05a916fcd3fcb404f93 --- src/prefs_account.c +++ src/prefs_account.c @@ -4680,27 +4680,15 @@ void prefs_account_unregister_page(PrefsPage *page) prefs_pages = g_slist_remove(prefs_pages, page); } -gchar *prefs_account_cache_dir(PrefsAccount *ac_prefs, gboolean for_server) +char *prefs_account_cache_dir(const char *server, const char *userid) { - gchar *dir = NULL; - - if (ac_prefs->protocol == A_IMAP4) { - if (for_server) { - dir = g_strconcat(get_imap_cache_dir(), - G_DIR_SEPARATOR_S, - ac_prefs->recv_server, - NULL); - } else { - dir = g_strconcat(get_imap_cache_dir(), - G_DIR_SEPARATOR_S, - ac_prefs->recv_server, - G_DIR_SEPARATOR_S, - ac_prefs->userid, - NULL); - } - } - - return dir; + char dir[PATH_MAX]; + snprintf(dir, sizeof(dir), "%s/imapcache/%s", get_rc_dir(), server); + if (userid == NULL) + return strdup(dir); + strlcat(dir, "/", sizeof(dir)); + strlcat(dir, userid, sizeof(dir)); + return strdup(dir); } static void prefs_account_receive_itv_spinbutton_value_changed_cb(GtkWidget *w, gpointer data) blob - 6f7ccb3f750187076cbd5370b3fec627f686373d blob + fdbe6055090c8eb6e1aefc0aacefdebb041c29f3 --- src/prefs_account.h +++ src/prefs_account.h @@ -217,6 +217,6 @@ gchar *prefs_account_generate_msgid(PrefsAccount *acco void prefs_account_register_page (PrefsPage *page); void prefs_account_unregister_page (PrefsPage *page); -gchar *prefs_account_cache_dir (PrefsAccount *ac_prefs, gboolean for_server); +char *prefs_account_cache_dir (const char *server, const char *userid); #endif /* PREFS_ACCOUNT_H */ blob - 397faf4f3c332ecc7ee8587dfe604e908ff7495c blob + 27abf5da18934c999ce2ec8c97486e4ef9a14590 --- src/prefs_common.c +++ src/prefs_common.c @@ -978,7 +978,7 @@ void prefs_common_read_config(void) prefs_common.mime_open_cmd_history = prefs_common_read_history(COMMAND_HISTORY); prefs_common.message_search_history = - prefs_common_read_history(MESSAGE_SEARCH_HISTORY); + prefs_common_read_history("messagesearch_history"); prefs_common.compose_save_to_history = prefs_common_read_history(COMPOSE_SAVE_TO_HISTORY); } @@ -1056,14 +1056,8 @@ void prefs_common_write_config(void) { prefs_write_config(param, "Common", COMMON_RC); - prefs_common_save_history(COMMAND_HISTORY, - prefs_common.mime_open_cmd_history); - prefs_common_save_history(COMPOSE_SAVE_TO_HISTORY, - prefs_common.compose_save_to_history); - - prefs_common_save_history_to_dir(ADDRBOOK_DIR, - ADDRESSBOOK_CUSTOM_ATTRIBUTES, - prefs_common.addressbook_custom_attributes); + prefs_common_save_history(COMMAND_HISTORY, prefs_common.mime_open_cmd_history); + prefs_common_save_history(COMPOSE_SAVE_TO_HISTORY, prefs_common.compose_save_to_history); } /* make a copy of string 'in' into buffer 'out'. un-escape \ sequences. blob - defbfc617c867b547e7a50f294bd22de58886ac7 blob + 5fbbb3419415c60c4811b5bbcbb53026eed655a1 --- src/prefs_common.h +++ src/prefs_common.h @@ -339,7 +339,6 @@ struct _PrefsCommon gboolean addressbook_use_editaddress_dialog; gint addressbook_hpaned_pos; gint addressbook_vpaned_pos; - GList *addressbook_custom_attributes; /* Interface */ LayoutType layout_mode; blob - ff3d1b1876ac4a0774b2b5942bb8f64c6a5c09c8 blob + 0f9a71d1c27782d9da8b0618fcbb6d64ea32d462 --- src/prefs_themes.c +++ src/prefs_themes.c @@ -888,7 +888,7 @@ static void prefs_themes_create_widget(PrefsPage *page gtk_box_pack_start (GTK_BOX (hbox3), btn_install, FALSE, FALSE, 0); gtk_widget_set_can_default (btn_install, TRUE); - btn_more = gtk_link_button_new_with_label(THEMES_URI, _("Get more...")); + btn_more = gtk_link_button_new_with_label("https://www.claws-mail.org/themes.php", "Get more..."); gtk_widget_show (btn_more); gtk_box_pack_start (GTK_BOX (hbox3), btn_more, FALSE, FALSE, 0); blob - 93b101bf84c5be0d2b0d135d00b4b45b1e067396 blob + 64d9d8a986849c2b837975f9bb88019dbb5a0afc --- src/summaryview.c +++ src/summaryview.c @@ -514,7 +514,7 @@ SummaryView *summary_create(MainWindow *mainwin) statlabel_folder = gtk_label_new(""); gtk_widget_show(statlabel_folder); - gtk_box_pack_start(GTK_BOX(hbox_l), statlabel_folder, FALSE, FALSE, HSPACING_NARROW_2); + gtk_box_pack_start(GTK_BOX(hbox_l), statlabel_folder, FALSE, FALSE, 2); statlabel_select = gtk_label_new(""); gtk_widget_show(statlabel_select); gtk_box_pack_start(GTK_BOX(hbox_l), statlabel_select, FALSE, FALSE, 12);