NeoMutt
2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Toggle main menu visibility
Loading...
Searching...
No Matches
array.c
Go to the documentation of this file.
1
22
28
29
#include "config.h"
30
#include <stdbool.h>
31
#include <stddef.h>
32
#include "
mutt/lib.h
"
33
#include "
gui.h
"
34
35
struct
Alias
;
36
47
int
alias_array_alias_add
(
struct
AliasViewArray *ava,
struct
Alias
*alias)
48
{
49
if
(!ava || !alias)
50
return
-1;
51
52
struct
AliasView
av = {
53
.num = 0,
54
.orig_seq =
ARRAY_SIZE
(ava),
55
.is_tagged =
false
,
56
.is_deleted =
false
,
57
.is_visible =
true
,
58
.alias =
alias
,
59
};
60
ARRAY_ADD
(ava, av);
61
return
ARRAY_SIZE
(ava);
62
}
63
73
int
alias_array_alias_delete
(
struct
AliasViewArray *ava,
const
struct
Alias
*
alias
)
74
{
75
if
(!ava || !
alias
)
76
return
-1;
77
78
struct
AliasView
*avp = NULL;
79
ARRAY_FOREACH
(avp, ava)
80
{
81
if
(avp->
alias
!=
alias
)
82
continue
;
83
84
ARRAY_REMOVE
(ava, avp);
85
break
;
86
}
87
88
return
ARRAY_SIZE
(ava);
89
}
90
95
int
alias_array_count_visible
(
struct
AliasViewArray *ava)
96
{
97
int
count = 0;
98
99
struct
AliasView
*avp = NULL;
100
ARRAY_FOREACH
(avp, ava)
101
{
102
if
(avp->
is_visible
)
103
count++;
104
}
105
106
return
count;
107
}
alias_array_count_visible
int alias_array_count_visible(struct AliasViewArray *ava)
Count number of visible Aliases.
Definition
array.c:95
alias_array_alias_delete
int alias_array_alias_delete(struct AliasViewArray *ava, const struct Alias *alias)
Delete an Alias from the AliasViewArray.
Definition
array.c:73
alias_array_alias_add
int alias_array_alias_add(struct AliasViewArray *ava, struct Alias *alias)
Add an Alias to the AliasViewArray.
Definition
array.c:47
ARRAY_ADD
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
Definition
array.h:157
ARRAY_REMOVE
#define ARRAY_REMOVE(head, elem)
Remove an entry from the array, shifting down the subsequent entries.
Definition
array.h:355
ARRAY_FOREACH
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition
array.h:223
ARRAY_SIZE
#define ARRAY_SIZE(head)
The number of elements stored.
Definition
array.h:87
gui.h
Shared code for the Alias and Query Dialogs.
lib.h
Convenience wrapper for the library headers.
AliasView
GUI data wrapping an Alias.
Definition
gui.h:38
AliasView::is_visible
bool is_visible
Is visible?
Definition
gui.h:45
AliasView::alias
struct Alias * alias
Alias.
Definition
gui.h:46
Alias
A shortcut for an email address or addresses.
Definition
alias.h:35