NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches

Tag some menu items. More...

+ Collaboration diagram for tag():

Functions

static int alias_tag (struct Menu *menu, int sel, int act)
 Tag some aliases - Implements Menu::tag() -.
 
static int query_tag (struct Menu *menu, int sel, int act)
 Tag an entry in the Query Menu - Implements Menu::tag() -.
 
static int attach_tag (struct Menu *menu, int sel, int act)
 Tag an attachment - Implements Menu::tag() -.
 
static int file_tag (struct Menu *menu, int sel, int act)
 Tag an entry in the menu - Implements Menu::tag() -.
 
static int compose_attach_tag (struct Menu *menu, int sel, int act)
 Tag an attachment - Implements Menu::tag() -.
 
static int post_tag (struct Menu *menu, int sel, int act)
 Tag an email in the postpone menu - Implements Menu::tag() -.
 

Detailed Description

Tag some menu items.

Parameters
menuMenu to tag
selCurrent selection
actAction: 0 untag, 1 tag, -1 toggle
Return values
numNet change in number of tagged attachments

Function Documentation

◆ alias_tag()

static int alias_tag ( struct Menu * menu,
int sel,
int act )
static

Tag some aliases - Implements Menu::tag() -.

Definition at line 140 of file dlg_alias.c.

141{
142 const struct AliasMenuData *mdata = menu->mdata;
143 const struct AliasViewArray *ava = &mdata->ava;
144 struct AliasView *av = ARRAY_GET(ava, sel);
145
146 bool ot = av->is_tagged;
147
148 av->is_tagged = ((act >= 0) ? act : !av->is_tagged);
149
150 return av->is_tagged - ot;
151}
#define ARRAY_GET(head, idx)
Return the element at index.
Definition array.h:109
AliasView array wrapper with Pattern information -.
Definition gui.h:55
struct AliasViewArray ava
All Aliases/Queries.
Definition gui.h:56
struct Menu * menu
Menu.
Definition gui.h:59
GUI data wrapping an Alias.
Definition gui.h:38
bool is_tagged
Is it tagged?
Definition gui.h:43
void * mdata
Private data.
Definition lib.h:155
+ Here is the caller graph for this function:

◆ query_tag()

static int query_tag ( struct Menu * menu,
int sel,
int act )
static

Tag an entry in the Query Menu - Implements Menu::tag() -.

Definition at line 167 of file dlg_query.c.

168{
169 const struct AliasMenuData *mdata = menu->mdata;
170 const struct AliasViewArray *ava = &mdata->ava;
171 struct AliasView *av = ARRAY_GET(ava, sel);
172
173 bool ot = av->is_tagged;
174
175 av->is_tagged = ((act >= 0) ? act : !av->is_tagged);
176 return av->is_tagged - ot;
177}
+ Here is the caller graph for this function:

◆ attach_tag()

static int attach_tag ( struct Menu * menu,
int sel,
int act )
static

Tag an attachment - Implements Menu::tag() -.

Definition at line 154 of file dlg_attach.c.

155{
156 struct AttachPrivateData *priv = menu->mdata;
157 struct AttachCtx *actx = priv->actx;
158
159 struct Body *cur = actx->idx[actx->v2r[sel]]->body;
160 bool ot = cur->tagged;
161
162 cur->tagged = ((act >= 0) ? act : !cur->tagged);
163 return cur->tagged - ot;
164}
A set of attachments.
Definition attach.h:65
struct AttachPtr ** idx
Array of attachments.
Definition attach.h:69
short * v2r
Mapping from virtual to real attachment.
Definition attach.h:73
Private state data for Attachments.
struct Menu * menu
Current Menu.
struct AttachCtx * actx
List of all Attachments.
struct Body * body
Attachment.
Definition attach.h:37
The body of an email.
Definition body.h:36
bool tagged
This attachment is tagged.
Definition body.h:90
+ Here is the caller graph for this function:

◆ file_tag()

static int file_tag ( struct Menu * menu,
int sel,
int act )
static

Tag an entry in the menu - Implements Menu::tag() -.

Parameters
menuMenu
selSelection (entry index)
actAction: 0 untag, 1 tag, -1 toggle
Returns
Net change in number of tagged entries (0 or ±1)

This function tags/untags entries in the browser.

  • For file selection mode, prevents tagging directories
  • For NNTP newsgroups, allows tagging of newsgroup entries for bulk operations

Definition at line 678 of file dlg_browser.c.

679{
681 struct BrowserPrivateData *priv = menu->mdata;
682 struct BrowserEntryArray *entry = &priv->state.entry;
683 struct FolderFile *ff = ARRAY_GET(entry, sel);
684
685 /* Allow tagging NNTP newsgroups, but disallow tagging directories for file selection */
686 bool is_nntp = (ff->nd != NULL);
687 if (!is_nntp &&
688 (S_ISDIR(ff->mode) ||
689 (S_ISLNK(ff->mode) && link_is_dir(buf_string(&mod_data->last_dir), ff->name))))
690 {
691 mutt_error(_("Can't attach a directory"));
692 return 0;
693 }
694
695 bool ot = ff->tagged;
696 ff->tagged = ((act >= 0) ? act : !ff->tagged);
697
698 return ff->tagged - ot;
699}
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
bool link_is_dir(const char *folder, const char *path)
Does this symlink point to a directory?
#define mutt_error(...)
Definition logging2.h:94
@ MODULE_ID_BROWSER
ModuleBrowser, Mailbox Browser
Definition module_api.h:52
#define _(a)
Definition message.h:28
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
Browser private Module data.
Definition module_data.h:32
struct Buffer last_dir
Browser: previous selected directory.
Definition module_data.h:35
Private state data for the Browser.
struct Menu * menu
Menu.
struct BrowserState state
State containing list of files/dir/mailboxes.
struct BrowserEntryArray entry
Array of files / dirs / mailboxes.
Definition lib.h:149
Browser entry representing a folder/dir.
Definition lib.h:82
char * name
Name of file/dir/mailbox.
Definition lib.h:90
bool tagged
Folder is tagged.
Definition lib.h:106
struct NntpMboxData * nd
Extra NNTP data.
Definition lib.h:107
mode_t mode
File permissions.
Definition lib.h:83
Container for Accounts, Notifications.
Definition neomutt.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_attach_tag()

static int compose_attach_tag ( struct Menu * menu,
int sel,
int act )
static

Tag an attachment - Implements Menu::tag() -.

Definition at line 203 of file attach.c.

204{
205 struct ComposeAttachData *adata = menu->mdata;
206 struct AttachCtx *actx = adata->actx;
207 struct Body *cur = actx->idx[actx->v2r[sel]]->body;
208 bool ot = cur->tagged;
209
210 cur->tagged = ((act >= 0) ? act : !cur->tagged);
211 return cur->tagged - ot;
212}
Data to fill the Compose Attach Window.
Definition attach_data.h:33
struct Menu * menu
Menu displaying the attachments.
Definition attach_data.h:35
struct AttachCtx * actx
Set of attachments.
Definition attach_data.h:34
+ Here is the caller graph for this function:

◆ post_tag()

static int post_tag ( struct Menu * menu,
int sel,
int act )
static

Tag an email in the postpone menu - Implements Menu::tag() -.

Definition at line 179 of file dlg_postpone.c.

180{
181 struct PostponeData *pd = menu->mdata;
182 struct MailboxView *mv = pd->mailbox_view;
183 struct Mailbox *m = mv->mailbox;
184
185 const bool c_auto_tag = cs_subset_bool(NeoMutt->sub, "auto_tag");
186 if (menu->tag_prefix && !c_auto_tag)
187 {
188 for (size_t i = 0; i < m->msg_count; i++)
189 {
190 struct Email *e = m->emails[i];
191 if (!e)
192 break;
193 mutt_set_flag(m, e, MUTT_TAG, false, true);
194 }
196 return FR_SUCCESS;
197 }
198
199 int index = menu_get_index(menu);
200 struct Email *e = m->emails[index];
201 if (!e)
202 return FR_NO_ACTION;
203
204 mutt_set_flag(m, e, MUTT_TAG, !e->tagged, true);
205
206 return FR_SUCCESS;
207}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
@ FR_SUCCESS
Valid function - successfully performed.
Definition dispatcher.h:40
@ FR_NO_ACTION
Valid function - no action performed.
Definition dispatcher.h:38
void mutt_set_flag(struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool upd_mbox)
Set a flag on an email.
Definition flags.c:54
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition menu.c:179
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition menu.c:155
@ MENU_REDRAW_INDEX
Redraw the index.
Definition lib.h:61
@ MUTT_TAG
Tagged messages.
Definition mutt.h:99
The envelope/body of an email.
Definition email.h:39
int index
The absolute (unsorted) message number.
Definition email.h:110
bool tagged
Email is tagged.
Definition email.h:107
View of a Mailbox.
Definition mview.h:40
struct Mailbox * mailbox
Current Mailbox.
Definition mview.h:51
A mailbox.
Definition mailbox.h:81
int msg_count
Total number of messages.
Definition mailbox.h:90
struct Email ** emails
Array of Emails.
Definition mailbox.h:98
bool tag_prefix
User has pressed <tag-prefix>
Definition lib.h:92
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
Data to pass to the Postpone Functions.
Definition functions.h:35
struct MailboxView * mailbox_view
Postponed Mailbox view.
Definition functions.h:36
struct Menu * menu
Postponed Menu.
Definition functions.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function: