NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
dlgalias.c File Reference
#include "config.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mutt/lib.h"
#include "address/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "lib.h"
#include "pattern/lib.h"
#include "alias.h"
#include "format_flags.h"
#include "gui.h"
#include "keymap.h"
#include "mutt_globals.h"
#include "mutt_menu.h"
#include "muttlib.h"
#include "opcodes.h"
+ Include dependency graph for dlgalias.c:

Go to the source code of this file.

Functions

static const char * alias_format_str (char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
 Format a string for the alias list - Implements format_t. More...
 
static void alias_make_entry (struct Menu *menu, char *buf, size_t buflen, int line)
 Format a menu item for the alias list - Implements Menu::make_entry() More...
 
static int alias_tag (struct Menu *menu, int sel, int act)
 Tag some aliases - Implements Menu::tag() More...
 
static int alias_alias_observer (struct NotifyCallback *nc)
 Listen for data changes affecting the Alias menu - Implements observer_t. More...
 
static void dlg_select_alias (char *buf, size_t buflen, struct AliasMenuData *mdata)
 Display a menu of Aliases. More...
 
int alias_complete (char *buf, size_t buflen, struct ConfigSubset *sub)
 alias completion routine More...
 

Variables

static const struct Mapping AliasHelp []
 Help Bar for the Alias dialog (address book) More...
 

Detailed Description

Address book handling aliases

Authors
  • Michael R. Elkins
  • Pietro Cerutti
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file dlgalias.c.

Function Documentation

◆ alias_format_str()

static const char* alias_format_str ( char *  buf,
size_t  buflen,
size_t  col,
int  cols,
char  op,
const char *  src,
const char *  prec,
const char *  if_str,
const char *  else_str,
intptr_t  data,
MuttFormatFlags  flags 
)
static

Format a string for the alias list - Implements format_t.

Expando Description
%a Alias name
%c Comments
%f Flags - currently, a 'd' for an alias marked for deletion
%n Index number
%r Address which alias expands to
%t Character which indicates if the alias is tagged for inclusion

Definition at line 80 of file dlgalias.c.

84 {
85  char fmt[128], addr[1024];
86  struct AliasView *av = (struct AliasView *) data;
87  struct Alias *alias = av->alias;
88 
89  switch (op)
90  {
91  case 'a':
92  mutt_format_s(buf, buflen, prec, alias->name);
93  break;
94  case 'c':
95  mutt_format_s(buf, buflen, prec, alias->comment);
96  break;
97  case 'f':
98  snprintf(fmt, sizeof(fmt), "%%%ss", prec);
99  snprintf(buf, buflen, fmt, av->is_deleted ? "D" : " ");
100  break;
101  case 'n':
102  snprintf(fmt, sizeof(fmt), "%%%sd", prec);
103  snprintf(buf, buflen, fmt, av->num + 1);
104  break;
105  case 'r':
106  addr[0] = '\0';
107  mutt_addrlist_write(&alias->addr, addr, sizeof(addr), true);
108  mutt_format_s(buf, buflen, prec, addr);
109  break;
110  case 't':
111  buf[0] = av->is_tagged ? '*' : ' ';
112  buf[1] = '\0';
113  break;
114  }
115 
116  return src;
117 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alias_make_entry()

static void alias_make_entry ( struct Menu menu,
char *  buf,
size_t  buflen,
int  line 
)
static

Format a menu item for the alias list - Implements Menu::make_entry()

Definition at line 122 of file dlgalias.c.

123 {
124  const struct AliasMenuData *mdata = (struct AliasMenuData *) menu->mdata;
125  const struct AliasViewArray *ava = &((struct AliasMenuData *) menu->mdata)->ava;
126  const struct AliasView *av = ARRAY_GET(ava, line);
127 
128  const char *alias_format = cs_subset_string(mdata->sub, "alias_format");
129 
130  mutt_expando_format(buf, buflen, 0, menu->win_index->state.cols, NONULL(alias_format),
132 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alias_tag()

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

Tag some aliases - Implements Menu::tag()

Definition at line 137 of file dlgalias.c.

138 {
139  const struct AliasViewArray *ava = &((struct AliasMenuData *) menu->mdata)->ava;
140  struct AliasView *av = ARRAY_GET(ava, sel);
141 
142  bool ot = av->is_tagged;
143 
144  av->is_tagged = ((act >= 0) ? act : !av->is_tagged);
145 
146  return av->is_tagged - ot;
147 }
+ Here is the caller graph for this function:

◆ alias_alias_observer()

static int alias_alias_observer ( struct NotifyCallback nc)
static

Listen for data changes affecting the Alias menu - Implements observer_t.

Definition at line 152 of file dlgalias.c.

153 {
154  if (!nc->event_data || !nc->global_data)
155  return -1;
156  if (nc->event_type != NT_ALIAS)
157  return 0;
158 
159  struct EventAlias *ea = nc->event_data;
160  struct Menu *menu = nc->global_data;
161  struct AliasMenuData *mdata = menu->mdata;
162  struct Alias *alias = ea->alias;
163 
164  if (nc->event_subtype == NT_ALIAS_NEW)
165  {
166  alias_array_alias_add(&mdata->ava, alias);
167 
168  if (alias_array_count_visible(&mdata->ava) != ARRAY_SIZE(&mdata->ava))
169  mutt_pattern_alias_func(MUTT_LIMIT, NULL, _("Aliases"), mdata, Context, menu);
170  }
171  else if (nc->event_subtype == NT_ALIAS_DELETED)
172  {
173  alias_array_alias_delete(&mdata->ava, alias);
174 
175  int vcount = alias_array_count_visible(&mdata->ava);
176  if ((menu->current > (vcount - 1)) && (menu->current > 0))
177  menu->current--;
178  }
179 
180  alias_array_sort(&mdata->ava, mdata->sub);
181 
182  menu->max = alias_array_count_visible(&mdata->ava);
183  menu->redraw = REDRAW_FULL;
184 
185  return 0;
186 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_select_alias()

static void dlg_select_alias ( char *  buf,
size_t  buflen,
struct AliasMenuData mdata 
)
static

Display a menu of Aliases.

Parameters
bufBuffer for expanded aliases
buflenLength of buffer
mdataMenu data holding Aliases

Definition at line 194 of file dlgalias.c.

195 {
196  if (ARRAY_EMPTY(&mdata->ava))
197  {
198  mutt_warning(_("You have no aliases"));
199  return;
200  }
201 
202  int t = -1;
203  bool done = false;
204 
205  struct Menu *menu = mutt_menu_new(MENU_ALIAS);
207  dlg->help_data = AliasHelp;
208  dlg->help_menu = MENU_ALIAS;
209 
211  menu->custom_search = true;
212  menu->tag = alias_tag;
213  menu->max = alias_array_count_visible(&mdata->ava);
214  menu->mdata = mdata;
215  menu->title = menu_create_alias_title(_("Aliases"), mdata->str);
216 
220 
222 
223  alias_array_sort(&mdata->ava, mdata->sub);
224 
225  struct AliasView *avp = NULL;
226  ARRAY_FOREACH(avp, &mdata->ava)
227  {
228  avp->num = ARRAY_FOREACH_IDX;
229  }
230 
231  while (!done)
232  {
233  int op = mutt_menu_loop(menu);
234  switch (op)
235  {
236  case OP_DELETE:
237  case OP_UNDELETE:
238  if (menu->tagprefix)
239  {
240  ARRAY_FOREACH(avp, &mdata->ava)
241  {
242  if (avp->is_tagged)
243  avp->is_deleted = (op == OP_DELETE);
244  }
245  menu->redraw |= REDRAW_INDEX;
246  }
247  else
248  {
249  ARRAY_GET(&mdata->ava, menu->current)->is_deleted = (op == OP_DELETE);
250  menu->redraw |= REDRAW_CURRENT;
251  if (C_Resolve && (menu->current < menu->max - 1))
252  {
253  menu->current++;
254  menu->redraw |= REDRAW_INDEX;
255  }
256  }
257  break;
258  case OP_SORT:
259  case OP_SORT_REVERSE:
260  {
261  int sort = cs_subset_sort(mdata->sub, "sort_alias");
262  bool resort = true;
263  bool reverse = (op == OP_SORT_REVERSE);
264 
265  switch (mutt_multi_choice(
266  reverse ?
267  /* L10N: The highlighted letters must match the "Sort" options */
268  _("Rev-Sort (a)lias, a(d)dress or (u)nsorted?") :
269  /* L10N: The highlighted letters must match the "Rev-Sort" options */
270  _("Sort (a)lias, a(d)dress or (u)nsorted?"),
271  /* L10N: These must match the highlighted letters from "Sort" and "Rev-Sort" */
272  _("adu")))
273  {
274  case -1: /* abort */
275  resort = false;
276  break;
277 
278  case 1: /* (a)lias */
279  sort = SORT_ALIAS;
280  break;
281 
282  case 2: /* a(d)dress */
283  sort = SORT_ADDRESS;
284  break;
285 
286  case 3: /* (u)nsorted */
287  sort = SORT_ORDER;
288  break;
289  }
290 
291  if (resort)
292  {
293  sort |= reverse ? SORT_REVERSE : 0;
294 
295  cs_subset_str_native_set(mdata->sub, "sort_alias", sort, NULL);
296  menu->redraw = REDRAW_FULL;
297  }
298 
299  break;
300  }
301  case OP_SEARCH_REVERSE:
302  case OP_SEARCH_NEXT:
303  case OP_SEARCH_OPPOSITE:
304  case OP_SEARCH:
305  menu->current = mutt_search_alias_command(Context, menu, menu->current, op);
306  if (menu->current == -1)
307  menu->current = menu->oldcurrent;
308  else
309  menu->redraw |= REDRAW_MOTION;
310  break;
311 
312  case OP_MAIN_LIMIT:
313  {
314  int result = mutt_pattern_alias_func(MUTT_LIMIT, _("Limit to messages matching: "),
315  _("Aliases"), mdata, Context, menu);
316  if (result == 0)
317  {
318  alias_array_sort(&mdata->ava, mdata->sub);
319  menu->redraw = REDRAW_FULL;
320  }
321 
322  break;
323  }
324 
325  case OP_GENERIC_SELECT_ENTRY:
326  t = menu->current;
327  if (t >= ARRAY_SIZE(&mdata->ava))
328  t = -1;
329  done = true;
330  break;
331  case OP_EXIT:
332  done = true;
333  break;
334  }
335  }
336 
337  ARRAY_FOREACH(avp, &mdata->ava)
338  {
339  if (avp->is_tagged)
340  {
341  mutt_addrlist_write(&avp->alias->addr, buf, buflen, true);
342  t = -1;
343  }
344  }
345 
346  if (t != -1)
347  {
348  mutt_addrlist_write(&ARRAY_GET(&mdata->ava, t)->alias->addr, buf, buflen, true);
349  }
350 
354 
355  mutt_menu_pop_current(menu);
356 
357  FREE(&menu->title);
358  mutt_menu_free(&menu);
359 
361 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alias_complete()

int alias_complete ( char *  buf,
size_t  buflen,
struct ConfigSubset sub 
)

alias completion routine

Parameters
bufPartial Alias to complete
buflenLength of buffer
subConfig items
Return values
1Success
0Error

Given a partial alias, this routine attempts to fill in the alias from the alias list as much as possible. if given empty search string or found nothing, present all aliases

Definition at line 375 of file dlgalias.c.

376 {
377  struct Alias *np = NULL;
378  char bestname[8192] = { 0 };
379 
380  struct AliasMenuData mdata = { NULL, NULL, ARRAY_HEAD_INITIALIZER, sub };
381  mdata.str = mutt_str_dup(buf);
382 
383  if (buf[0] != '\0')
384  {
385  TAILQ_FOREACH(np, &Aliases, entries)
386  {
387  if (np->name && mutt_strn_equal(np->name, buf, strlen(buf)))
388  {
389  if (bestname[0] == '\0') /* init */
390  {
391  mutt_str_copy(bestname, np->name,
392  MIN(mutt_str_len(np->name) + 1, sizeof(bestname)));
393  }
394  else
395  {
396  int i;
397  for (i = 0; np->name[i] && (np->name[i] == bestname[i]); i++)
398  ; // do nothing
399 
400  bestname[i] = '\0';
401  }
402  }
403  }
404 
405  if (bestname[0] != '\0')
406  {
407  /* fake the pattern for menu title */
408  char *mtitle = NULL;
409  mutt_str_asprintf(&mtitle, "~f ^%s", buf);
410  FREE(&mdata.str);
411  mdata.str = mtitle;
412 
413  if (!mutt_str_equal(bestname, buf))
414  {
415  /* we are adding something to the completion */
416  mutt_str_copy(buf, bestname, mutt_str_len(bestname) + 1);
417  FREE(&mdata.str);
418  return 1;
419  }
420 
421  /* build alias list and show it */
422  TAILQ_FOREACH(np, &Aliases, entries)
423  {
424  int aasize = alias_array_alias_add(&mdata.ava, np);
425 
426  struct AliasView *av = ARRAY_GET(&mdata.ava, aasize - 1);
427 
428  if (np->name && !mutt_strn_equal(np->name, buf, strlen(buf)))
429  {
430  av->is_visible = false;
431  }
432  }
433  }
434  }
435 
436  if (ARRAY_EMPTY(&mdata.ava))
437  {
438  TAILQ_FOREACH(np, &Aliases, entries)
439  {
440  alias_array_alias_add(&mdata.ava, np);
441  }
442 
443  mutt_pattern_alias_func(MUTT_LIMIT, NULL, _("Aliases"), &mdata, Context, NULL);
444  }
445 
446  alias_array_sort(&mdata.ava, mdata.sub);
447 
448  bestname[0] = '\0';
449  dlg_select_alias(bestname, sizeof(bestname), &mdata);
450  if (bestname[0] != '\0')
451  mutt_str_copy(buf, bestname, buflen);
452 
453  struct AliasView *avp = NULL;
454  ARRAY_FOREACH(avp, &mdata.ava)
455  {
456  if (!avp->is_deleted)
457  continue;
458 
459  TAILQ_REMOVE(&Aliases, avp->alias, entries);
460  alias_free(&avp->alias);
461  }
462 
463  ARRAY_FREE(&mdata.ava);
464  FREE(&mdata.str);
465 
466  return 0;
467 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ AliasHelp

const struct Mapping AliasHelp[]
static
Initial value:
= {
{ N_("Exit"), OP_EXIT },
{ N_("Del"), OP_DELETE },
{ N_("Undel"), OP_UNDELETE },
{ N_("Sort"), OP_SORT },
{ N_("Rev-Sort"), OP_SORT_REVERSE },
{ N_("Select"), OP_GENERIC_SELECT_ENTRY },
{ N_("Help"), OP_HELP },
{ NULL, 0 },
}

Help Bar for the Alias dialog (address book)

Definition at line 55 of file dlgalias.c.

Menu::oldcurrent
int oldcurrent
For driver use only.
Definition: mutt_menu.h:76
IP
#define IP
Definition: set.h:54
dialog_create_simple_index
struct MuttWindow * dialog_create_simple_index(struct Menu *menu, enum WindowType type)
Create a simple index Dialog.
Definition: dialog.c:165
alias_array_alias_delete
int alias_array_alias_delete(struct AliasViewArray *ava, struct Alias *alias)
Delete an Alias from the AliasViewArray.
Definition: array.c:69
_
#define _(a)
Definition: message.h:28
NONULL
#define NONULL(x)
Definition: string2.h:37
Alias::addr
struct AddressList addr
List of Addresses the Alias expands to.
Definition: alias.h:36
mutt_strn_equal
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
Definition: string.c:593
alias_array_sort
void alias_array_sort(struct AliasViewArray *ava, const struct ConfigSubset *sub)
Sort and reindex an AliasViewArray.
Definition: sort.c:158
NT_CONFIG
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:37
AliasMenuData::str
char * str
String representing the limit being used.
Definition: gui.h:55
SORT_ALIAS
@ SORT_ALIAS
Sort by email alias.
Definition: sort2.h:55
alias_array_alias_add
int alias_array_alias_add(struct AliasViewArray *ava, struct Alias *alias)
Add an Alias to the AliasViewArray.
Definition: array.c:45
MUTT_FORMAT_ARROWCURSOR
#define MUTT_FORMAT_ARROWCURSOR
Reserve space for arrow_cursor.
Definition: format_flags.h:35
mutt_addrlist_write
size_t mutt_addrlist_write(const struct AddressList *al, char *buf, size_t buflen, bool display)
Write an Address to a buffer.
Definition: address.c:1150
NeoMutt::notify
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
MuttWindow
A division of the screen.
Definition: mutt_window.h:115
mutt_multi_choice
int mutt_multi_choice(const char *prompt, const char *letters)
Offer the user a multiple choice question.
Definition: curs_lib.c:937
TAILQ_FOREACH
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:718
Context
The "current" mailbox.
Definition: context.h:38
mutt_str_dup
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:370
AliasView::is_visible
bool is_visible
Is visible?
Definition: gui.h:44
AliasView::alias
struct Alias * alias
Alias.
Definition: gui.h:45
FREE
#define FREE(x)
Definition: memory.h:40
AliasView::num
int num
Index number in list.
Definition: gui.h:38
SORT_REVERSE
#define SORT_REVERSE
Reverse the order of the sort.
Definition: sort2.h:81
alias_free
void alias_free(struct Alias **ptr)
Free an Alias.
Definition: alias.c:628
mutt_menu_new
struct Menu * mutt_menu_new(enum MenuType type)
Create a new Menu.
Definition: menu.c:956
MuttWindow::help_menu
int help_menu
Menu for key bindings, e.g. MENU_PAGER.
Definition: mutt_window.h:134
ARRAY_SIZE
#define ARRAY_SIZE(head)
The number of elements stored.
Definition: array.h:83
Menu::make_entry
void(* make_entry)(struct Menu *menu, char *buf, size_t buflen, int line)
Format a item for a menu.
Definition: mutt_menu.h:88
MUTT_LIMIT
@ MUTT_LIMIT
Messages in limited view.
Definition: mutt.h:105
ARRAY_GET
#define ARRAY_GET(head, idx)
Return the element at index.
Definition: array.h:105
cs_subset_str_native_set
int cs_subset_str_native_set(const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err)
Natively set the value of a string config item.
Definition: subset.c:292
EventAlias
An alias-change event.
Definition: alias.h:59
AliasView
GUI data wrapping an Alias.
Definition: gui.h:36
mutt_str_equal
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:871
TAILQ_REMOVE
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:834
mutt_menu_push_current
void mutt_menu_push_current(struct Menu *menu)
Add a new Menu to the stack.
Definition: menu.c:1015
AliasMenuData::ava
struct AliasViewArray ava
Array of AliasView.
Definition: gui.h:57
alias_tag
static int alias_tag(struct Menu *menu, int sel, int act)
Tag some aliases - Implements Menu::tag()
Definition: dlgalias.c:137
ARRAY_FOREACH
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:206
ARRAY_HEAD_INITIALIZER
#define ARRAY_HEAD_INITIALIZER
Static initializer for arrays.
Definition: array.h:54
alias_format_str
static const char * alias_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
Format a string for the alias list - Implements format_t.
Definition: dlgalias.c:80
notify_observer_remove
bool notify_observer_remove(struct Notify *notify, observer_t callback, void *global_data)
Remove an observer from an object.
Definition: notify.c:207
NT_COLOR
@ NT_COLOR
Colour has changed, ColorId, EventColor.
Definition: notify_type.h:35
AliasView::is_tagged
bool is_tagged
Is it tagged?
Definition: gui.h:42
REDRAW_FULL
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:45
alias_array_count_visible
int alias_array_count_visible(struct AliasViewArray *ava)
Count number of visible Aliases.
Definition: array.c:91
NotifyCallback::global_data
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
Menu::tagprefix
bool tagprefix
Definition: mutt_menu.h:61
ARRAY_FREE
#define ARRAY_FREE(head)
Release all memory.
Definition: array.h:198
Menu::tag
int(* tag)(struct Menu *menu, int sel, int act)
Tag some menu items.
Definition: mutt_menu.h:107
Menu::title
const char * title
Title of this menu.
Definition: mutt_menu.h:54
notify_observer_add
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
Definition: notify.c:169
REDRAW_INDEX
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
AliasMenuData::sub
struct ConfigSubset * sub
Config items.
Definition: gui.h:58
mutt_str_len
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:631
Aliases
struct AliasList Aliases
List of all the user's email aliases.
Definition: alias.c:55
SORT_ORDER
@ SORT_ORDER
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:50
MuttWindow::help_data
const struct Mapping * help_data
Data for the Help Bar.
Definition: mutt_window.h:135
mutt_format_s
void mutt_format_s(char *buf, size_t buflen, const char *prec, const char *s)
Format a simple string.
Definition: curs_lib.c:1248
mutt_search_alias_command
int mutt_search_alias_command(struct Context *ctx, struct Menu *menu, int cur, int op)
Perform a search.
Definition: pattern.c:642
Menu::custom_search
bool custom_search
The menu implements its own non-Menusearch()-compatible search, trickle OP_SEARCH*.
Definition: mutt_menu.h:79
alias_config_observer
int alias_config_observer(struct NotifyCallback *nc)
Listen for sort_alias configuration changes and reorders menu items accordingly.
Definition: gui.c:44
SORT_ADDRESS
@ SORT_ADDRESS
Sort by email address.
Definition: sort2.h:56
NotifyCallback::event_data
void * event_data
Data from notify_send()
Definition: observer.h:44
cs_subset_sort
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:219
mutt_menu_loop
int mutt_menu_loop(struct Menu *menu)
Menu event loop.
Definition: menu.c:1309
MuttWindow::state
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:120
Alias::name
char * name
Short name.
Definition: alias.h:35
mutt_menu_pop_current
void mutt_menu_pop_current(struct Menu *menu)
Remove a Menu from the stack.
Definition: menu.c:1027
WT_DLG_ALIAS
@ WT_DLG_ALIAS
Alias Dialog, dlg_select_alias()
Definition: mutt_window.h:74
NT_ALIAS_NEW
@ NT_ALIAS_NEW
A new Alias has been created.
Definition: alias.h:51
EventAlias::alias
struct Alias * alias
Definition: alias.h:61
cs_subset_string
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:241
NT_ALIAS_DELETED
@ NT_ALIAS_DELETED
An Alias is about to be deleted.
Definition: alias.h:53
AliasHelp
static const struct Mapping AliasHelp[]
Help Bar for the Alias dialog (address book)
Definition: dlgalias.c:55
ARRAY_EMPTY
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition: array.h:70
Menu::mdata
void * mdata
Extra data for the current menu.
Definition: mutt_menu.h:55
mutt_expando_format
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t callback, intptr_t data, MuttFormatFlags flags)
Expand expandos (x) in a string.
Definition: muttlib.c:774
menu_create_alias_title
char * menu_create_alias_title(char *menu_name, char *limit)
Create a title string for the Menu.
Definition: gui.c:84
Menu::max
int max
Number of entries in the menu.
Definition: mutt_menu.h:57
MENU_ALIAS
@ MENU_ALIAS
Select an email address by its alias.
Definition: keymap.h:74
Alias::comment
char * comment
Free-form comment string.
Definition: alias.h:37
alias_make_entry
static void alias_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format a menu item for the alias list - Implements Menu::make_entry()
Definition: dlgalias.c:122
NeoMutt
Container for Accounts, Notifications.
Definition: neomutt.h:36
NT_ALIAS
@ NT_ALIAS
Alias has changed, NotifyAlias, EventAlias.
Definition: notify_type.h:44
AliasMenuData
AliasMenuData - AliasView array wrapper with Pattern information.
Definition: gui.h:53
mutt_pattern_alias_func
int mutt_pattern_alias_func(int op, char *prompt, char *title, struct AliasMenuData *mdata, struct Context *ctx, struct Menu *menu)
Perform some Pattern matching for Alias.
Definition: pattern.c:241
Menu::redraw
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:58
alias_alias_observer
static int alias_alias_observer(struct NotifyCallback *nc)
Listen for data changes affecting the Alias menu - Implements observer_t.
Definition: dlgalias.c:152
REDRAW_CURRENT
#define REDRAW_CURRENT
Redraw the current line of the menu.
Definition: mutt_menu.h:43
C_Resolve
WHERE bool C_Resolve
Config: Move to the next email whenever a command modifies an email.
Definition: mutt_globals.h:155
Alias
A shortcut for an email address or addresses.
Definition: alias.h:33
WindowState::cols
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
dialog_destroy_simple_index
void dialog_destroy_simple_index(struct MuttWindow **ptr)
Destroy a simple index Dialog.
Definition: dialog.c:209
NotifyCallback::event_subtype
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:43
Menu::current
int current
Current entry.
Definition: mutt_menu.h:56
NotifyCallback::event_type
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
REDRAW_MOTION
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:41
mutt_str_asprintf
int mutt_str_asprintf(char **strp, const char *fmt,...)
Definition: string.c:1095
dlg_select_alias
static void dlg_select_alias(char *buf, size_t buflen, struct AliasMenuData *mdata)
Display a menu of Aliases.
Definition: dlgalias.c:194
Menu::win_index
struct MuttWindow * win_index
Definition: mutt_menu.h:63
mutt_warning
#define mutt_warning(...)
Definition: logging.h:82
Menu
GUI selectable list of items.
Definition: mutt_menu.h:52
N_
#define N_(a)
Definition: message.h:32
AliasView::is_deleted
bool is_deleted
Is it deleted?
Definition: gui.h:43
alias_color_observer
int alias_color_observer(struct NotifyCallback *nc)
Listen for color configuration changes and refreshes the menu.
Definition: gui.c:66
mutt_menu_free
void mutt_menu_free(struct Menu **ptr)
Destroy a menu.
Definition: menu.c:972
MIN
#define MIN(a, b)
Definition: memory.h:31
mutt_str_copy
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:716