NeoMutt  2024-04-25-97-g7d2481
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
alias.h File Reference

Representation of a single alias to an email address. More...

#include "mutt/lib.h"
#include "address/lib.h"
#include "email/lib.h"
+ Include dependency graph for alias.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Alias
 A shortcut for an email address or addresses. More...
 
struct  EventAlias
 An alias-change event. More...
 

Enumerations

enum  NotifyAlias { NT_ALIAS_ADD = 1 , NT_ALIAS_DELETE , NT_ALIAS_DELETE_ALL , NT_ALIAS_CHANGE }
 Alias notification types. More...
 

Functions

 TAILQ_HEAD (AliasList, Alias)
 
void alias_free (struct Alias **ptr)
 Free an Alias.
 
struct Aliasalias_new (void)
 Create a new Alias.
 
void aliaslist_clear (struct AliasList *al)
 Empty a List of Aliases.
 

Variables

struct AliasList Aliases
 List of all the user's email aliases.
 

Detailed Description

Representation of a single alias to an email address.

Authors
  • Richard Russon
  • Pietro Cerutti

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 alias.h.

Enumeration Type Documentation

◆ NotifyAlias

Alias notification types.

Observers of NT_ALIAS will be passed an EventAlias.

Note
Delete notifications are sent before the object is deleted.
Other notifications are sent after the event.
Enumerator
NT_ALIAS_ADD 

Alias has been added.

NT_ALIAS_DELETE 

Alias is about to be deleted.

NT_ALIAS_DELETE_ALL 

All Aliases are about to be deleted.

NT_ALIAS_CHANGE 

Alias has been changed.

Definition at line 54 of file alias.h.

55{
56 NT_ALIAS_ADD = 1,
60};
@ NT_ALIAS_DELETE_ALL
All Aliases are about to be deleted.
Definition: alias.h:58
@ NT_ALIAS_ADD
Alias has been added.
Definition: alias.h:56
@ NT_ALIAS_CHANGE
Alias has been changed.
Definition: alias.h:59
@ NT_ALIAS_DELETE
Alias is about to be deleted.
Definition: alias.h:57

Function Documentation

◆ TAILQ_HEAD()

TAILQ_HEAD ( AliasList  ,
Alias   
)

◆ alias_free()

void alias_free ( struct Alias **  ptr)

Free an Alias.

Parameters
[out]ptrAlias to free

Definition at line 672 of file alias.c.

673{
674 if (!ptr || !*ptr)
675 return;
676
677 struct Alias *alias = *ptr;
678
679 mutt_debug(LL_NOTIFY, "NT_ALIAS_DELETE: %s\n", alias->name);
680 struct EventAlias ev_a = { alias };
682
683 FREE(&alias->name);
684 FREE(&alias->comment);
687
688 FREE(ptr);
689}
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition: address.c:1460
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
@ LL_NOTIFY
Log of notifications.
Definition: logging2.h:48
#define FREE(x)
Definition: memory.h:45
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:173
@ NT_ALIAS
Alias has changed, NotifyAlias, EventAlias.
Definition: notify_type.h:37
A shortcut for an email address or addresses.
Definition: alias.h:35
struct TagList tags
Tags.
Definition: alias.h:39
char * comment
Free-form comment string.
Definition: alias.h:38
char * name
Short name.
Definition: alias.h:36
struct AddressList addr
List of Addresses the Alias expands to.
Definition: alias.h:37
An alias-change event.
Definition: alias.h:66
struct Alias * alias
Alias that changed.
Definition: alias.h:67
Container for Accounts, Notifications.
Definition: neomutt.h:42
struct Notify * notify
Notifications handler.
Definition: neomutt.h:43
void driver_tags_free(struct TagList *tl)
Free tags from a header.
Definition: tags.c:131
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alias_new()

struct Alias * alias_new ( void  )

Create a new Alias.

Return values
ptrNewly allocated Alias

Free the result with alias_free()

Definition at line 660 of file alias.c.

661{
662 struct Alias *a = mutt_mem_calloc(1, sizeof(struct Alias));
663 TAILQ_INIT(&a->addr);
664 STAILQ_INIT(&a->tags);
665 return a;
666}
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:51
#define STAILQ_INIT(head)
Definition: queue.h:372
#define TAILQ_INIT(head)
Definition: queue.h:765
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ aliaslist_clear()

void aliaslist_clear ( struct AliasList *  al)

Empty a List of Aliases.

Parameters
alAliasList to empty

Each Alias will be freed and the AliasList will be left empty.

Definition at line 697 of file alias.c.

698{
699 if (!al)
700 return;
701
702 struct Alias *np = NULL, *tmp = NULL;
703 TAILQ_FOREACH_SAFE(np, al, entries, tmp)
704 {
705 TAILQ_REMOVE(al, np, entries);
706 alias_free(&np);
707 }
708 TAILQ_INIT(al);
709}
void alias_free(struct Alias **ptr)
Free an Alias.
Definition: alias.c:672
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:735
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:841
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ Aliases

struct AliasList Aliases
extern

List of all the user's email aliases.

Definition at line 62 of file alias.c.