break;
if (i == OP_CATCHUP)
- nntp_data = mutt_newsgroup_catchup(CurrentNewsSrv, ff->name);
+ nntp_data = mutt_newsgroup_catchup(Context, CurrentNewsSrv, ff->name);
else
- nntp_data = mutt_newsgroup_uncatchup(CurrentNewsSrv, ff->name);
+ nntp_data = mutt_newsgroup_uncatchup(Context, CurrentNewsSrv, ff->name);
if (nntp_data)
{
OptNews = false;
if (op == OP_COMPOSE_ATTACH_NEWS_MESSAGE)
{
- CurrentNewsSrv = nntp_select_server(NewsServer, false);
+ CurrentNewsSrv = nntp_select_server(Context, NewsServer, false);
if (!CurrentNewsSrv)
break;
/**
* struct CompressInfo - Private data for compress
*
- * This object gets attached to the mailbox's Context.
+ * This object gets attached to the Mailbox.
*/
struct CompressInfo
{
if (op == OP_MAIN_CHANGE_GROUP || op == OP_MAIN_CHANGE_GROUP_READONLY)
{
OptNews = true;
- CurrentNewsSrv = nntp_select_server(NewsServer, false);
+ CurrentNewsSrv = nntp_select_server(Context, NewsServer, false);
if (!CurrentNewsSrv)
break;
if (flags)
if (Context && Context->mailbox->magic == MUTT_NNTP)
{
struct NntpData *nntp_data = Context->mailbox->data;
- if (mutt_newsgroup_catchup(nntp_data->nserv, nntp_data->group))
+ if (mutt_newsgroup_catchup(Context, nntp_data->nserv, nntp_data->group))
menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
}
break;
/**
* imap_mbox_check - Implements MxOps::mbox_check()
- * @param ctx Context
+ * @param ctx Mailbox
* @param index_hint Remember our place in the index
* @retval >0 Success, e.g. #MUTT_REOPENED
* @retval -1 Failure
/**
* imap_sync_mailbox - Sync all the changes to the server
- * @param ctx Context
+ * @param ctx Mailbox
* @param expunge if true do expunge
* @retval 0 Success
* @retval -1 Error
/**
* set_changed_flag - Have the flags of an email changed
- * @param[in] ctx Context
+ * @param[in] ctx Mailbox
* @param[in] h Email Header
* @param[in] local_changes Has the local mailbox been changed?
* @param[out] server_changes Set to 1 if the flag has changed
/**
* imap_append_message - Write an email back to the server
- * @param ctx Context
+ * @param ctx Mailbox
* @param msg Message to save
* @retval 0 Success
* @retval -1 Failure
/**
* imap_copy_messages - Server COPY messages to another folder
- * @param ctx Context
+ * @param ctx Mailbox
* @param h Header of the email
* @param dest Destination folder
* @param delete Delete the original?
/**
* imap_allow_reopen - Allow re-opening a folder upon expunge
- * @param ctx Context
+ * @param ctx Mailbox
*/
void imap_allow_reopen(struct Context *ctx)
{
/**
* imap_disallow_reopen - Disallow re-opening a folder upon expunge
- * @param ctx Context
+ * @param ctx Mailbox
*/
void imap_disallow_reopen(struct Context *ctx)
{
}
/**
- * maildir_add_to_context - Add the Maildir list to the Context
+ * maildir_add_to_context - Add the Maildir list to the Mailbox
* @param ctx Mailbox
* @param md Maildir list to copy
* @retval true If there's new mail
}
/**
- * maildir_move_to_context - Copy the Maildir list to the Context
+ * maildir_move_to_context - Copy the Maildir list to the Mailbox
* @param ctx Mailbox
* @param md Maildir list to copy, then free
* @retval 1 If there's new mail
}
/**
- * maildir_update_tables - Update the Context Header tables
+ * maildir_update_tables - Update the Header tables
* @param ctx Mailbox
* @param index_hint Current email in index
*/
if (flags & MUTT_NEWS)
{
OptNews = true;
- CurrentNewsSrv = nntp_select_server(NewsServer, false);
+ CurrentNewsSrv = nntp_select_server(Context, NewsServer, false);
if (!CurrentNewsSrv)
goto main_curses; // TEST38: neomutt -G (unset news_server)
}
return -1;
}
else if (rc == MUTT_YES)
- mutt_newsgroup_catchup(nntp_data->nserv, nntp_data->group);
+ mutt_newsgroup_catchup(Context, nntp_data->nserv, nntp_data->group);
}
}
#endif
/**
* nntp_select_server - Open a connection to an NNTP server
+ * @param ctx Mailbox
* @param server Server URI
* @param leave_lock Leave the server locked?
* @retval ptr NNTP server
* system has broken mtimes, this might mean the file is reloaded every time,
* which we'd have to fix.
*/
-struct NntpServer *nntp_select_server(char *server, bool leave_lock)
+struct NntpServer *nntp_select_server(struct Context *ctx, char *server, bool leave_lock)
{
char file[PATH_MAX];
#ifdef USE_HCACHE
return NULL;
/* check for new newsgroups */
- if (!leave_lock && nntp_check_new_groups(Context->mailbox, nserv) < 0)
+ if (!leave_lock && nntp_check_new_groups(ctx->mailbox, nserv) < 0)
rc = -1;
/* .newsrc has been externally modified */
{
/* try to load list of newsgroups from cache */
if (nserv->cacheable && active_get_cache(nserv) == 0)
- rc = nntp_check_new_groups(Context->mailbox, nserv);
+ rc = nntp_check_new_groups(ctx->mailbox, nserv);
/* load list of newsgroups from server */
else
/**
* mutt_newsgroup_catchup - Catchup newsgroup
+ * @param ctx Mailbox
* @param nserv NNTP server
* @param group Newsgroup
* @retval ptr NNTP data
* @retval NULL Error
*/
-struct NntpData *mutt_newsgroup_catchup(struct NntpServer *nserv, char *group)
+struct NntpData *mutt_newsgroup_catchup(struct Context *ctx,
+ struct NntpServer *nserv, char *group)
{
struct NntpData *nntp_data = NULL;
nntp_data->newsrc_ent[0].last = nntp_data->last_message;
}
nntp_data->unread = 0;
- if (Context && Context->mailbox->data == nntp_data)
+ if (ctx && ctx->mailbox->data == nntp_data)
{
- for (unsigned int i = 0; i < Context->mailbox->msg_count; i++)
- mutt_set_flag(Context, Context->mailbox->hdrs[i], MUTT_READ, 1);
+ for (unsigned int i = 0; i < ctx->mailbox->msg_count; i++)
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_READ, 1);
}
return nntp_data;
}
/**
* mutt_newsgroup_uncatchup - Uncatchup newsgroup
+ * @param ctx Mailbox
* @param nserv NNTP server
* @param group Newsgroup
* @retval ptr NNTP data
* @retval NULL Error
*/
-struct NntpData *mutt_newsgroup_uncatchup(struct NntpServer *nserv, char *group)
+struct NntpData *mutt_newsgroup_uncatchup(struct Context *ctx,
+ struct NntpServer *nserv, char *group)
{
struct NntpData *nntp_data = NULL;
nntp_data->newsrc_ent[0].first = 1;
nntp_data->newsrc_ent[0].last = nntp_data->first_message - 1;
}
- if (Context && Context->mailbox->data == nntp_data)
+ if (ctx && ctx->mailbox->data == nntp_data)
{
- nntp_data->unread = Context->mailbox->msg_count;
- for (unsigned int i = 0; i < Context->mailbox->msg_count; i++)
- mutt_set_flag(Context, Context->mailbox->hdrs[i], MUTT_READ, 0);
+ nntp_data->unread = ctx->mailbox->msg_count;
+ for (unsigned int i = 0; i < ctx->mailbox->msg_count; i++)
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_READ, 0);
}
else
{
group = url.path;
url.path = strchr(url.path, '\0');
url_tostring(&url, server, sizeof(server), 0);
- nserv = nntp_select_server(server, true);
+ nserv = nntp_select_server(ctx, server, true);
url_free(&url);
if (!nserv)
return -1;
/**
* nntp_post - Post article
- * @param mailbox Mailbox
- * @param msg Message to post
+ * @param ctx Mailbox
+ * @param msg Message to post
* @retval 0 Success
* @retval -1 Failure
*/
-int nntp_post(struct Mailbox *mailbox, const char *msg)
+int nntp_post(struct Context *ctx, const char *msg)
{
struct NntpData *nntp_data = NULL;
struct NntpData nntp_tmp = { 0 };
char buf[LONG_STRING];
- if (mailbox && (mailbox->magic == MUTT_NNTP))
- nntp_data = mailbox->data;
+ if (ctx && (ctx->mailbox->magic == MUTT_NNTP))
+ nntp_data = ctx->mailbox->data;
else
{
- CurrentNewsSrv = nntp_select_server(NewsServer, false);
+ CurrentNewsSrv = nntp_select_server(ctx, NewsServer, false);
if (!CurrentNewsSrv)
return -1;
struct BodyCache *bcache;
};
-struct NntpServer *nntp_select_server(char *server, bool leave_lock);
+struct NntpServer *nntp_select_server(struct Context *ctx, char *server, bool leave_lock);
struct NntpData *mutt_newsgroup_subscribe(struct NntpServer *nserv, char *group);
struct NntpData *mutt_newsgroup_unsubscribe(struct NntpServer *nserv, char *group);
-struct NntpData *mutt_newsgroup_catchup(struct NntpServer *nserv, char *group);
-struct NntpData *mutt_newsgroup_uncatchup(struct NntpServer *nserv, char *group);
+struct NntpData *mutt_newsgroup_catchup(struct Context *ctx, struct NntpServer *nserv, char *group);
+struct NntpData *mutt_newsgroup_uncatchup(struct Context *ctx, struct NntpServer *nserv, char *group);
int nntp_active_fetch(struct NntpServer *nserv, bool new);
int nntp_newsrc_update(struct NntpServer *nserv);
-int nntp_post(struct Mailbox *mailbox, const char *msg);
+int nntp_post(struct Context *ctx, const char *msg);
int nntp_check_msgid(struct Context *ctx, const char *msgid);
int nntp_check_children(struct Context *ctx, const char *msgid);
int nntp_newsrc_parse(struct NntpServer *nserv);
int nm_get_all_tags(struct Mailbox *mailbox, char **tag_list, int *tag_count);
/*
- * functions usable outside notmuch Context
+ * functions usable outside of notmuch
*/
int nm_nonctx_get_count(char *path, int *all, int *new);
int nm_path_probe(const char *path, const struct stat *st);
/**
* fetch_uidl - parse UIDL
* @param line String to parse
- * @param data Mailbox Context
+ * @param data Mailbox
* @retval 0 Success
* @retval -1 Failure
*/
/**
* pop_fetch_headers - Read headers
- * @param ctx Context
+ * @param ctx Mailbox
* @retval 0 Success
* @retval -1 Connection lost
* @retval -2 Invalid command or execution error
/**
* pop_mbox_open - open POP mailbox, fetch only headers
- * @param ctx Mailbox Context
+ * @param ctx Mailbox
* @retval 0 Success
* @retval -1 Failure
*/
/**
* pop_mbox_close - close POP mailbox
- * @param ctx Mailbox Context
+ * @param ctx Mailbox
* @retval 0 Always
*/
static int pop_mbox_close(struct Context *ctx)
/**
* pop_msg_open - fetch message from POP server
- * @param ctx Mailbox Context
+ * @param ctx Mailbox
* @param msg Message
* @param msgno Message number
* @retval 0 Success
/**
* pop_msg_close - Close POP Message
- * @param ctx Mailbox Context
+ * @param ctx Mailbox
* @param msg Message
* @retval 0 Success
* @retval EOF Error, see errno
/**
* pop_mbox_sync - update POP mailbox, delete messages from server
- * @param ctx Mailbox Context
+ * @param ctx Mailbox
* @param index_hint Current Message
* @retval 0 Success
* @retval -1 Failure
/**
* pop_mbox_check - Check for new messages and fetch headers
- * @param ctx Mailbox Context
+ * @param ctx Mailbox
* @param index_hint Current Message
* @retval 0 Success
* @retval -1 Failure
NONULL(Inews), nntp_format_str, 0, 0);
if (!*cmd)
{
- i = nntp_post(Context->mailbox, msg);
+ i = nntp_post(Context, msg);
unlink(msg);
return i;
}