}
#define nntp_cache_expand(dst, dlen, fmt, ...) \
- do { \
- snprintf((dst), (dlen), "%s/" fmt, NewsCacheDir, ##__VA_ARGS__); \
- mutt_expand_path((dst), (dlen)); \
+ do { \
+ snprintf((dst), (dlen), "%s/" fmt, mod_core.cachedir, ##__VA_ARGS__);\
+ mutt_expand_path((dst), (dlen)); \
} while (0)
/* Loads $news_cache_dir/.index into memory, loads newsserver data
* and newsgroup cache names */
static int nntp_parse_cacheindex(nntp_server_t *news)
{
- struct stat st;
- char buf[HUGE_STRING], *cp;
- char dir[_POSIX_PATH_MAX], file[_POSIX_PATH_MAX];
- FILE *idx;
nntp_data_t *data;
+ char file[_POSIX_PATH_MAX], buf[HUGE_STRING], *cp;
+ FILE *idx;
int l, m, t;
- unset_option (OPTNEWSCACHE);
- if (m_strisempty(NewsCacheDir))
+ if (m_strisempty(mod_core.cachedir)) {
+ unset_option(OPTNEWSCACHE);
return 0;
-
- m_strcpy(dir, sizeof(dir), NewsCacheDir);
- mutt_expand_path(dir, sizeof(dir));
-
- if (lstat (dir, &st) || (st.st_mode & S_IFDIR) == 0) {
- snprintf(buf, sizeof(buf), _("Directory %s not exist. Create it?"), dir);
- if (mutt_yesorno (buf, M_YES) != M_YES
- || mkdir (dir, (S_IRWXU + S_IRWXG + S_IRWXO))) {
- mutt_error _("Cache directory not created!");
-
- return -1;
- }
- mutt_clear_error ();
+ } else {
+ set_option(OPTNEWSCACHE);
}
- set_option (OPTNEWSCACHE);
-
p_delete(&news->cache);
- snprintf(buf, sizeof (buf), "%s/%s.index", dir, news->conn->account.host);
+ nntp_cache_expand(buf, sizeof(buf), "%s.index", news->conn->account.host);
if (!(idx = safe_fopen (buf, "a+")))
return 0;
rewind (idx);