Skip to content

Commit

Permalink
mv: mutt_alternates_reset()
Browse files Browse the repository at this point in the history
Pass a MailboxView param to mutt_alternates_reset()
This will be needed when the Mailbox and MailboxView are separated.
  • Loading branch information
flatcap committed May 12, 2023
1 parent f02664e commit a5aa8e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
9 changes: 6 additions & 3 deletions alternates.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "alternates.h"
#include "parse/lib.h"
#include "commands.h"
#include "mview.h"

static struct RegexList Alternates = STAILQ_HEAD_INITIALIZER(Alternates); ///< List of regexes to match the user's alternate email addresses
static struct RegexList UnAlternates = STAILQ_HEAD_INITIALIZER(UnAlternates); ///< List of regexes to exclude false matches in Alternates
Expand Down Expand Up @@ -67,13 +68,15 @@ void alternates_init(void)

/**
* mutt_alternates_reset - Clear the recipient valid flag of all emails
* @param m Mailbox
* @param mv Mailbox view
*/
void mutt_alternates_reset(struct Mailbox *m)
void mutt_alternates_reset(struct MailboxView *mv)
{
if (!m)
if (!mv || !mv->mailbox)
return;

struct Mailbox *m = mv->mailbox;

for (int i = 0; i < m->msg_count; i++)
{
struct Email *e = m->emails[i];
Expand Down
3 changes: 2 additions & 1 deletion alternates.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "core/lib.h"

struct Buffer;
struct MailboxView;

/**
* enum NotifyAlternates - Alternates command notification types
Expand All @@ -50,6 +51,6 @@ enum CommandResult parse_alternates (struct Buffer *buf, struct Buffer *s, intp
enum CommandResult parse_unalternates(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);

bool mutt_alternates_match(const char *addr);
void mutt_alternates_reset(struct Mailbox *m);
void mutt_alternates_reset(struct MailboxView *mv);

#endif /* MUTT_ALTERNATES_H */
2 changes: 1 addition & 1 deletion index/index.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ static int index_altern_observer(struct NotifyCallback *nc)
struct MuttWindow *dlg = dialog_find(win);
struct IndexSharedData *shared = dlg->wdata;

mutt_alternates_reset(shared->mailbox);
mutt_alternates_reset(shared->mailbox_view);
mutt_debug(LL_DEBUG5, "alternates done\n");
return 0;
}
Expand Down

0 comments on commit a5aa8e7

Please sign in to comment.