break;
case 'n':
- if (Context && Context->data == folder->ff->nd)
+ if (Context && Context->mailbox->data == folder->ff->nd)
{
snprintf(fmt, sizeof(fmt), "%%%sd", prec);
snprintf(buf, buflen, fmt, Context->new);
group_index_format_str, data, flags);
}
}
- else if (Context && Context->data == folder->ff->nd)
+ else if (Context && Context->mailbox->data == folder->ff->nd)
{
snprintf(fmt, sizeof(fmt), "%%%sd", prec);
snprintf(buf, buflen, fmt, Context->mailbox->msg_unread);
void *compress_info; /**< compressed mbox module private data */
#endif /**< USE_COMPRESSED */
- /* driver hooks */
- void *data; /**< driver specific data */
-
struct Mailbox *mailbox;
};
CHECK_ATTACH
if (Context && Context->mailbox->magic == MUTT_NNTP)
{
- struct NntpData *nntp_data = Context->data;
+ struct NntpData *nntp_data = Context->mailbox->data;
if (mutt_newsgroup_catchup(nntp_data->nserv, nntp_data->group))
menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
}
_("Reply by mail as poster prefers?")) != MUTT_YES)
{
if (Context && Context->mailbox->magic == MUTT_NNTP &&
- !((struct NntpData *) Context->data)->allowed && query_quadoption(PostModerated, _("Posting to this group not allowed, may be moderated. Continue?")) != MUTT_YES)
+ !((struct NntpData *) Context->mailbox->data)->allowed && query_quadoption(PostModerated, _("Posting to this group not allowed, may be moderated. Continue?")) != MUTT_YES)
{
break;
}
break;
case MUTT_SERVERSEARCH:
{
- struct ImapData *idata = ctx->data;
+ struct ImapData *idata = ctx->mailbox->data;
if (!mutt_bit_isset(idata->capabilities, X_GM_EXT1))
{
mutt_error(_("Server-side custom search not supported: %s"), pat->p.str);
char buf[PATH_MAX], mbox[PATH_MAX];
struct ImapData *idata = NULL;
- if (!ctx || !ctx->data)
+ if (!ctx || !ctx->mailbox->data)
{
idata = imap_conn_find(&mx->account, ImapPassive ? MUTT_IMAP_CONN_NONEW : 0);
if (!idata)
}
else
{
- idata = ctx->data;
+ idata = ctx->mailbox->data;
}
imap_munge_mbox_name(idata, mbox, sizeof(mbox), mx->mbox);
*/
int imap_check_mailbox(struct Context *ctx, bool force)
{
- return imap_check(ctx->data, force);
+ return imap_check(ctx->mailbox->data, force);
}
/**
int imap_search(struct Context *ctx, const struct Pattern *pat)
{
struct Buffer buf;
- struct ImapData *idata = ctx->data;
+ struct ImapData *idata = ctx->mailbox->data;
for (int i = 0; i < ctx->mailbox->msg_count; i++)
ctx->hdrs[i]->matched = false;
struct Buffer *sync_cmd = NULL;
int err_continue = MUTT_NO;
- struct ImapData *idata = ctx->data;
+ struct ImapData *idata = ctx->mailbox->data;
if (imap_parse_path(dest, &mx))
{
goto fail;
/* once again the context is new */
- ctx->data = idata;
+ ctx->mailbox->data = idata;
/* Clean up path and replace the one in the ctx */
imap_fix_path(idata, mx.mbox, buf, sizeof(buf));
return -1;
}
- ctx->data = idata;
+ ctx->mailbox->data = idata;
imap_fix_path(idata, mx.mbox, mailbox, sizeof(mailbox));
if (!*mailbox)
*/
static int imap_mbox_close(struct Context *ctx)
{
- struct ImapData *idata = ctx->data;
+ struct ImapData *idata = ctx->mailbox->data;
/* Check to see if the mailbox is actually open */
if (!idata)
return 0;
(void) index_hint;
imap_allow_reopen(ctx);
- rc = imap_check(ctx->data, false);
+ rc = imap_check(ctx->mailbox->data, false);
imap_disallow_reopen(ctx);
return rc;
int oldsort;
int rc;
- struct ImapData *idata = ctx->data;
+ struct ImapData *idata = ctx->mailbox->data;
if (idata->state < IMAP_SELECTED)
{
{
char *new = NULL;
char *checker = NULL;
- struct ImapData *idata = ctx->data;
+ struct ImapData *idata = ctx->mailbox->data;
/* Check for \* flags capability */
if (!imap_has_flag(&idata->flags, NULL))
struct Buffer *cmd = NULL;
char uid[11];
- struct ImapData *idata = ctx->data;
+ struct ImapData *idata = ctx->mailbox->data;
if (*buf == '\0')
buf = NULL;
int rc = -1; /* default now is that string isn't FETCH response */
int parse_rc;
- struct ImapData *idata = ctx->data;
+ struct ImapData *idata = ctx->mailbox->data;
if (buf[0] != '*')
return rc;
bool fetched = false;
int output_progress;
- struct ImapData *idata = ctx->data;
+ struct ImapData *idata = ctx->mailbox->data;
struct Header *h = ctx->hdrs[msgno];
msg->fp = msg_cache_get(idata, h);
struct ImapMbox mx;
int rc;
- struct ImapData *idata = ctx->data;
+ struct ImapData *idata = ctx->mailbox->data;
if (imap_parse_path(ctx->mailbox->path, &mx))
return -1;
int err_continue = MUTT_NO;
int triedcreate = 0;
- struct ImapData *idata = ctx->data;
+ struct ImapData *idata = ctx->mailbox->data;
if (imap_parse_path(dest, &mx))
{
void imap_allow_reopen(struct Context *ctx)
{
struct ImapData *idata = NULL;
- if (!ctx || !ctx->data || ctx->mailbox->magic != MUTT_IMAP)
+ if (!ctx || !ctx->mailbox->data || ctx->mailbox->magic != MUTT_IMAP)
return;
- idata = ctx->data;
+ idata = ctx->mailbox->data;
if (idata->ctx == ctx)
idata->reopen |= IMAP_REOPEN_ALLOW;
}
void imap_disallow_reopen(struct Context *ctx)
{
struct ImapData *idata = NULL;
- if (!ctx || !ctx->data || ctx->mailbox->magic != MUTT_IMAP)
+ if (!ctx || !ctx->mailbox->data || ctx->mailbox->magic != MUTT_IMAP)
return;
- idata = ctx->data;
+ idata = ctx->mailbox->data;
if (idata->ctx == ctx)
idata->reopen &= ~IMAP_REOPEN_ALLOW;
}
struct timespec last_visited; /**< time of last exit from this mailbox */
struct timespec stats_last_checked; /**< mtime of mailbox the last time stats where checked. */
+ /* driver hooks */
+ void *data; /**< driver specific data */
const struct MxOps *mx_ops;
int flags; /**< e.g. #MB_NORMAL */
*/
static inline struct MhData *mh_data(struct Context *ctx)
{
- return ctx->data;
+ return ctx->mailbox->data;
}
/**
*/
static int mh_mbox_close(struct Context *ctx)
{
- FREE(&ctx->data);
+ FREE(&ctx->mailbox->data);
return 0;
}
mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, ReadInc, 0);
}
- if (!ctx->data)
+ if (!ctx->mailbox->data)
{
- ctx->data = mutt_mem_calloc(1, sizeof(struct MhData));
+ ctx->mailbox->data = mutt_mem_calloc(1, sizeof(struct MhData));
}
data = mh_data(ctx);
#ifdef USE_NNTP
if (ctx->mailbox->msg_unread && ctx->mailbox->magic == MUTT_NNTP)
{
- struct NntpData *nntp_data = ctx->data;
+ struct NntpData *nntp_data = ctx->mailbox->data;
if (nntp_data && nntp_data->nserv && nntp_data->group)
{
*/
void nntp_newsrc_gen_entries(struct Context *ctx)
{
- struct NntpData *nntp_data = ctx->data;
+ struct NntpData *nntp_data = ctx->mailbox->data;
anum_t last = 0, first = 1;
bool series;
int save_sort = SORT_ORDER;
*/
void nntp_article_status(struct Context *ctx, struct Header *hdr, char *group, anum_t anum)
{
- struct NntpData *nntp_data = ctx->data;
+ struct NntpData *nntp_data = ctx->mailbox->data;
if (group)
nntp_data = mutt_hash_find(nntp_data->nserv->groups_hash, group);
nntp_data->newsrc_ent[0].last = nntp_data->last_message;
}
nntp_data->unread = 0;
- if (Context && Context->data == nntp_data)
+ if (Context && Context->mailbox->data == nntp_data)
{
for (unsigned int i = 0; i < Context->mailbox->msg_count; i++)
mutt_set_flag(Context, Context->hdrs[i], MUTT_READ, 1);
nntp_data->newsrc_ent[0].first = 1;
nntp_data->newsrc_ent[0].last = nntp_data->first_message - 1;
}
- if (Context && Context->data == nntp_data)
+ if (Context && Context->mailbox->data == nntp_data)
{
nntp_data->unread = Context->mailbox->msg_count;
for (unsigned int i = 0; i < Context->mailbox->msg_count; i++)
continue;
if (Context && Context->mailbox->magic == MUTT_NNTP &&
- (mutt_str_strcmp(nntp_data->group, ((struct NntpData *) Context->data)->group) == 0))
+ (mutt_str_strcmp(nntp_data->group,
+ ((struct NntpData *) Context->mailbox->data)->group) == 0))
{
unsigned int unread = 0;
*/
static void nntp_parse_xref(struct Context *ctx, struct Header *hdr)
{
- struct NntpData *nntp_data = ctx->data;
+ struct NntpData *nntp_data = ctx->mailbox->data;
char *buf = mutt_str_strdup(hdr->env->xref);
char *p = buf;
{
struct FetchCtx *fc = data;
struct Context *ctx = fc->ctx;
- struct NntpData *nntp_data = ctx->data;
+ struct NntpData *nntp_data = ctx->mailbox->data;
struct Header *hdr = NULL;
char *header = NULL, *field = NULL;
bool save = true;
static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
anum_t last, int restore)
{
- struct NntpData *nntp_data = ctx->data;
+ struct NntpData *nntp_data = ctx->mailbox->data;
struct FetchCtx fc;
struct Header *hdr = NULL;
char buf[HUGE_STRING];
}
time(&nserv->check_time);
- ctx->data = nntp_data;
+ ctx->mailbox->data = nntp_data;
if (!nntp_data->bcache && (nntp_data->newsrc_ent || nntp_data->subscribed || SaveUnsubscribed))
nntp_data->bcache = mutt_bcache_open(&nserv->conn->account, nntp_data->group);
*/
static int nntp_msg_open(struct Context *ctx, struct Message *msg, int msgno)
{
- struct NntpData *nntp_data = ctx->data;
+ struct NntpData *nntp_data = ctx->mailbox->data;
struct Header *hdr = ctx->hdrs[msgno];
char article[16];
char buf[LONG_STRING];
if (Context && Context->mailbox->magic == MUTT_NNTP)
- nntp_data = Context->data;
+ nntp_data = Context->mailbox->data;
else
{
CurrentNewsSrv = nntp_select_server(NewsServer, false);
*/
static int check_mailbox(struct Context *ctx)
{
- struct NntpData *nntp_data = ctx->data;
+ struct NntpData *nntp_data = ctx->mailbox->data;
struct NntpServer *nserv = nntp_data->nserv;
time_t now = time(NULL);
int rc, ret = 0;
int ret = check_mailbox(ctx);
if (ret == 0)
{
- struct NntpData *nntp_data = ctx->data;
+ struct NntpData *nntp_data = ctx->mailbox->data;
struct NntpServer *nserv = nntp_data->nserv;
nntp_newsrc_close(nserv);
}
*/
static int nntp_mbox_sync(struct Context *ctx, int *index_hint)
{
- struct NntpData *nntp_data = ctx->data;
+ struct NntpData *nntp_data = ctx->mailbox->data;
int rc;
#ifdef USE_HCACHE
header_cache_t *hc = NULL;
*/
static int nntp_mbox_close(struct Context *ctx)
{
- struct NntpData *nntp_data = ctx->data, *nntp_tmp = NULL;
+ struct NntpData *nntp_data = ctx->mailbox->data, *nntp_tmp = NULL;
if (!nntp_data)
return 0;
if (Context && Context->mailbox->magic == MUTT_NNTP)
{
buf[0] = '\0';
- if (nntp_query(Context->data, buf, sizeof(buf)) < 0)
+ if (nntp_query(Context->mailbox->data, buf, sizeof(buf)) < 0)
return -1;
}
}
return -1;
nntp_data.nserv = nserv;
if (Context && Context->mailbox->magic == MUTT_NNTP)
- nntp_data.group = ((struct NntpData *) Context->data)->group;
+ nntp_data.group = ((struct NntpData *) Context->mailbox->data)->group;
else
nntp_data.group = NULL;
i = nserv->groups_num;
*/
int nntp_check_msgid(struct Context *ctx, const char *msgid)
{
- struct NntpData *nntp_data = ctx->data;
+ struct NntpData *nntp_data = ctx->mailbox->data;
char buf[LONG_STRING];
FILE *fp = mutt_file_mkstemp();
*/
int nntp_check_children(struct Context *ctx, const char *msgid)
{
- struct NntpData *nntp_data = ctx->data;
+ struct NntpData *nntp_data = ctx->mailbox->data;
struct ChildCtx cc;
char buf[STRING];
int rc;
if (!ctx || (ctx->mailbox->magic != MUTT_NOTMUCH))
return -1;
- if (ctx->data)
+ if (ctx->mailbox->data)
return 0;
- ctx->data = new_ctxdata(ctx->mailbox->path);
- if (!ctx->data)
+ ctx->mailbox->data = new_ctxdata(ctx->mailbox->path);
+ if (!ctx->mailbox->data)
return -1;
return 0;
static struct NmCtxData *get_ctxdata(struct Context *ctx)
{
if (ctx && (ctx->mailbox->magic == MUTT_NOTMUCH))
- return ctx->data;
+ return ctx->mailbox->data;
return NULL;
}
return false;
tmp_ctx.mailbox->magic = MUTT_NOTMUCH;
- tmp_ctx.data = tmp_ctxdata;
+ tmp_ctx.mailbox->data = tmp_ctxdata;
mutt_debug(2, "#1 () -> db_query: %s\n", tmp_ctxdata->db_query);
}
}
- free_ctxdata(ctx->data);
- ctx->data = NULL;
+ free_ctxdata(ctx->mailbox->data);
+ ctx->mailbox->data = NULL;
return 0;
}
CHECK_MODE(IsHeader(extra) && !IsAttach(extra));
CHECK_ATTACH;
if (extra->ctx && extra->ctx->mailbox->magic == MUTT_NNTP &&
- !((struct NntpData *) extra->ctx->data)->allowed && query_quadoption(PostModerated, _("Posting to this group not allowed, may be moderated. Continue?")) != MUTT_YES)
+ !((struct NntpData *) extra->ctx->mailbox->data)->allowed && query_quadoption(PostModerated, _("Posting to this group not allowed, may be moderated. Continue?")) != MUTT_YES)
{
break;
}
CHECK_MODE(IsHeader(extra) || IsMsgAttach(extra));
CHECK_ATTACH;
if (extra->ctx && extra->ctx->mailbox->magic == MUTT_NNTP &&
- !((struct NntpData *) extra->ctx->data)->allowed && query_quadoption(PostModerated, _("Posting to this group not allowed, may be moderated. Continue?")) != MUTT_YES)
+ !((struct NntpData *) extra->ctx->mailbox->data)->allowed && query_quadoption(PostModerated, _("Posting to this group not allowed, may be moderated. Continue?")) != MUTT_YES)
{
break;
}
_("Reply by mail as poster prefers?")) != MUTT_YES)
{
if (extra->ctx && extra->ctx->mailbox->magic == MUTT_NNTP &&
- !((struct NntpData *) extra->ctx->data)->allowed && query_quadoption(PostModerated, _("Posting to this group not allowed, may be moderated. Continue?")) != MUTT_YES)
+ !((struct NntpData *) extra->ctx->mailbox->data)->allowed && query_quadoption(PostModerated, _("Posting to this group not allowed, may be moderated. Continue?")) != MUTT_YES)
{
break;
}
{
int i, index;
struct Context *ctx = data;
- struct PopData *pop_data = ctx->data;
+ struct PopData *pop_data = ctx->mailbox->data;
char *endp = NULL;
errno = 0;
struct Context *ctx = data;
if (!ctx)
return -1;
- struct PopData *pop_data = ctx->data;
+ struct PopData *pop_data = ctx->mailbox->data;
if (!pop_data)
return -1;
*/
static int pop_fetch_headers(struct Context *ctx)
{
- struct PopData *pop_data = ctx->data;
+ struct PopData *pop_data = ctx->mailbox->data;
struct Progress progress;
#ifdef USE_HCACHE
pop_data = mutt_mem_calloc(1, sizeof(struct PopData));
pop_data->conn = conn;
- ctx->data = pop_data;
+ ctx->mailbox->data = pop_data;
if (pop_open_connection(pop_data) < 0)
return -1;
*/
static int pop_mbox_close(struct Context *ctx)
{
- struct PopData *pop_data = ctx->data;
+ struct PopData *pop_data = ctx->mailbox->data;
if (!pop_data)
return 0;
char buf[LONG_STRING];
char path[PATH_MAX];
struct Progress progressbar;
- struct PopData *pop_data = ctx->data;
+ struct PopData *pop_data = ctx->mailbox->data;
struct PopCache *cache = NULL;
struct Header *h = ctx->hdrs[msgno];
unsigned short bcache = 1;
{
int i, j, ret = 0;
char buf[LONG_STRING];
- struct PopData *pop_data = ctx->data;
+ struct PopData *pop_data = ctx->mailbox->data;
struct Progress progress;
#ifdef USE_HCACHE
header_cache_t *hc = NULL;
static int pop_mbox_check(struct Context *ctx, int *index_hint)
{
int ret;
- struct PopData *pop_data = ctx->data;
+ struct PopData *pop_data = ctx->mailbox->data;
if ((pop_data->check_time + PopCheckinterval) > time(NULL))
return 0;
*/
void pop_logout(struct Context *ctx)
{
- struct PopData *pop_data = ctx->data;
+ struct PopData *pop_data = ctx->mailbox->data;
if (pop_data->status == POP_CONNECTED)
{
*/
int pop_reconnect(struct Context *ctx)
{
- struct PopData *pop_data = ctx->data;
+ struct PopData *pop_data = ctx->mailbox->data;
if (pop_data->status == POP_CONNECTED)
return 0;
#ifdef USE_NNTP
if ((flags & SEND_NEWS) && ctx && ctx->mailbox->magic == MUTT_NNTP &&
!msg->env->newsgroups)
- msg->env->newsgroups = mutt_str_strdup(((struct NntpData *) ctx->data)->group);
+ msg->env->newsgroups =
+ mutt_str_strdup(((struct NntpData *) ctx->mailbox->data)->group);
#endif
if (!(flags & (SEND_MAILX | SEND_BATCH)) && !(Autoedit && EditHeaders) &&