break;
}
- if (np && Context && (mutt_str_strcmp(np->b->realpath, Context->realpath) == 0))
+ if (np && Context && (mutt_str_strcmp(np->b->realpath, Context->mailbox->realpath) == 0))
{
np->b->msg_count = Context->msgcount;
np->b->msg_unread = Context->unread;
struct MailboxNode *np = NULL;
STAILQ_FOREACH(np, &AllMailboxes, entries)
{
- if (Context && (mutt_str_strcmp(np->b->realpath, Context->realpath) == 0))
+ if (Context && (mutt_str_strcmp(np->b->realpath, Context->mailbox->realpath) == 0))
{
np->b->msg_count = Context->msgcount;
np->b->msg_unread = Context->unread;
* until the next open. Until then, improvise. */
struct Mailbox *cm = NULL;
if (savectx->compress_info)
- cm = mutt_find_mailbox(savectx->realpath);
+ {
+ cm = mutt_find_mailbox(savectx->mailbox->realpath);
+ }
/* We probably haven't been opened yet */
if (cm && (cm->msg_count == 0))
cm = NULL;
#include "format_flags.h"
#include "globals.h"
#include "hook.h"
+#include "mailbox.h"
#include "mutt_curses.h"
#include "muttlib.h"
#include "mx.h"
return 1;
if (excl)
- ci->lockfp = fopen(ctx->realpath, "a");
+ ci->lockfp = fopen(ctx->mailbox->realpath, "a");
else
- ci->lockfp = fopen(ctx->realpath, "r");
+ ci->lockfp = fopen(ctx->mailbox->realpath, "r");
if (!ci->lockfp)
{
- mutt_perror(ctx->realpath);
+ mutt_perror(ctx->mailbox->realpath);
return 0;
}
char tmppath[PATH_MAX];
/* Setup the right paths */
- FREE(&ctx->realpath);
- ctx->realpath = ctx->path;
+ FREE(&ctx->mailbox->realpath);
+ mutt_str_strfcpy(ctx->mailbox->realpath, ctx->path, sizeof(ctx->mailbox->realpath));
/* We will uncompress to /tmp */
mutt_mktemp(tmppath, sizeof(tmppath));
if (!ci)
return;
- ci->size = get_size(ctx->realpath);
+ ci->size = get_size(ctx->mailbox->realpath);
}
/**
{
case 'f':
/* Compressed file */
- snprintf(buf, buflen, "%s", NONULL(escape_path(ctx->realpath)));
+ snprintf(buf, buflen, "%s", NONULL(escape_path(ctx->mailbox->realpath)));
break;
case 't':
/* Plaintext, temporary file */
return 0;
if (!ctx->quiet)
- mutt_message(progress, ctx->realpath);
+ {
+ mutt_message(progress, ctx->mailbox->realpath);
+ }
mutt_sig_block();
endwin();
}
/* Open the existing mailbox, unless we are appending */
- if (!ci->append && (get_size(ctx->realpath) > 0))
+ if (!ci->append && (get_size(ctx->mailbox->realpath) > 0))
{
int rc = execute_command(ctx, ci->open, _("Decompressing %s"));
if (rc == 0)
/* If the file was removed, remove the compressed folder too */
if ((access(ctx->path, F_OK) != 0) && !SaveEmpty)
{
- remove(ctx->realpath);
+ remove(ctx->mailbox->realpath);
}
else
{
const char *msg = NULL;
/* The file exists and we can append */
- if ((access(ctx->realpath, F_OK) == 0) && ci->append)
+ if ((access(ctx->mailbox->realpath, F_OK) == 0) && ci->append)
{
append = ci->append;
msg = _("Compressed-appending to %s...");
if (!ops)
return -1;
- int size = get_size(ctx->realpath);
+ int size = get_size(ctx->mailbox->realpath);
if (size == ci->size)
return 0;
struct Context
{
char *path;
- char *realpath; /**< used for mailbox comparison and the sidebar */
FILE *fp;
struct timespec atime;
struct timespec mtime;
int monitor_remove_rc = mutt_monitor_remove(NULL);
#endif
#ifdef USE_COMPRESSED
- if (Context->compress_info && Context->realpath)
- new_last_folder = mutt_str_strdup(Context->realpath);
+ if (Context->compress_info && Context->mailbox->realpath)
+ new_last_folder = mutt_str_strdup(Context->mailbox->realpath);
else
#endif
new_last_folder = mutt_str_strdup(Context->path);
if (np)
{
- if (Context && (mutt_str_strcmp(np->b->realpath, Context->realpath) == 0))
+ if (Context && (mutt_str_strcmp(np->b->realpath, Context->mailbox->realpath) == 0))
{
np->b->msg_count = Context->msgcount;
np->b->msg_unread = Context->unread;
imap_qualify_path(buf, sizeof(buf), &mx, idata->mailbox);
FREE(&(ctx->path));
- FREE(&(ctx->realpath));
ctx->path = mutt_str_strdup(buf);
- ctx->realpath = mutt_str_strdup(ctx->path);
+ mutt_str_strfcpy(ctx->mailbox->realpath, ctx->path, sizeof(ctx->mailbox->realpath));
idata->ctx = ctx;
else if (Context)
{
info->magic = Context->magic;
- info->path = Context->realpath;
+ info->path = Context->mailbox->realpath;
}
else
{
}
else
{
- if (mutt_find_mailbox(Context->realpath))
+ if (mutt_find_mailbox(Context->mailbox->realpath))
return 1;
}
}
FREE(&ctx);
return NULL;
}
- ctx->realpath = realpath(ctx->path, NULL);
- if (!ctx->realpath)
- ctx->realpath = mutt_str_strdup(ctx->path);
-
ctx->mailbox = mutt_find_mailbox(ctx->path);
if (!ctx->mailbox)
{
ctx->mailbox->flags = MB_HIDDEN;
}
+ if (!realpath(ctx->path, ctx->mailbox->realpath))
+ mutt_str_strfcpy(ctx->mailbox->realpath, ctx->path, sizeof(ctx->mailbox->realpath));
+
ctx->msgnotreadyet = -1;
ctx->collapsed = false;
FREE(&ctx->hdrs);
FREE(&ctx->v2r);
FREE(&ctx->path);
- FREE(&ctx->realpath);
FREE(&ctx->pattern);
if (ctx->limit_pattern)
mutt_pattern_free(&ctx->limit_pattern);
#include "bcache.h"
#include "context.h"
#include "globals.h"
+#include "mailbox.h"
#include "mutt_account.h"
#include "mutt_header.h"
#include "mutt_logging.h"
return -1;
FREE(&ctx->path);
- FREE(&ctx->realpath);
ctx->path = mutt_str_strdup(buf);
- ctx->realpath = mutt_str_strdup(ctx->path);
+ mutt_str_strfcpy(ctx->mailbox->realpath, ctx->path, sizeof(ctx->mailbox->realpath));
pop_data = mutt_mem_calloc(1, sizeof(struct PopData));
pop_data->conn = conn;
if (!b)
return src;
- int c = Context && (mutt_str_strcmp(Context->realpath, b->realpath) == 0);
+ int c = Context && (mutt_str_strcmp(Context->mailbox->realpath, b->realpath) == 0);
optional = flags & MUTT_FORMAT_OPTIONAL;
continue;
}
- if (Context && (mutt_str_strcmp(sbe->mailbox->realpath, Context->realpath) == 0))
+ if (Context && (mutt_str_strcmp(sbe->mailbox->realpath, Context->mailbox->realpath) == 0))
{
/* Spool directory */
continue;
col = div_width;
mutt_window_move(MuttSidebarWindow, row, col);
- if (Context && Context->realpath &&
- (mutt_str_strcmp(b->realpath, Context->realpath) == 0))
+ if (Context && Context->mailbox->realpath &&
+ (mutt_str_strcmp(b->realpath, Context->mailbox->realpath) == 0))
{
#ifdef USE_NOTMUCH
if (b->magic == MUTT_NOTMUCH)
struct MailboxNode *np = NULL;
STAILQ_FOREACH(np, &AllMailboxes, entries)
{
- if (mutt_str_strcmp(np->b->realpath, ctx->realpath) == 0)
+ if (mutt_str_strcmp(np->b->realpath, ctx->mailbox->realpath) == 0)
{
np->b->msg_unread = ctx->unread;
np->b->msg_count = ctx->msgcount;
for (int entry = 0; entry < EntryCount; entry++)
{
- if (mutt_str_strcmp(Entries[entry]->mailbox->realpath, Context->realpath) == 0)
+ if (mutt_str_strcmp(Entries[entry]->mailbox->realpath, Context->mailbox->realpath) == 0)
{
OpnIndex = entry;
HilIndex = entry;
TopIndex = EntryCount;
if (BotIndex < 0)
BotIndex = EntryCount;
- if ((OpnIndex < 0) && Context && (mutt_str_strcmp(b->realpath, Context->realpath) == 0))
+ if ((OpnIndex < 0) && Context && (mutt_str_strcmp(b->realpath, Context->mailbox->realpath) == 0))
OpnIndex = EntryCount;
EntryCount++;
else
#endif
#ifdef USE_COMPRESSED
- if (Context && Context->compress_info && Context->realpath)
+ if (Context && Context->compress_info && Context->mailbox->realpath)
{
- mutt_str_strfcpy(tmp, Context->realpath, sizeof(tmp));
+ mutt_str_strfcpy(tmp, Context->mailbox->realpath, sizeof(tmp));
mutt_pretty_mailbox(tmp, sizeof(tmp));
}
else