NeoMutt  2024-11-14-34-g5aaf0d
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
reverse.c
Go to the documentation of this file.
1
29#include "config.h"
30#include <stddef.h>
31#include "mutt/lib.h"
32#include "address/lib.h"
33#include "reverse.h"
34#include "lib.h"
35#include "alias.h"
36
37static struct HashTable *ReverseAliases = NULL;
38
43{
44 /* reverse alias keys need to be strdup'ed because of idna conversions */
47}
48
53{
55}
56
61void alias_reverse_add(struct Alias *alias)
62{
63 if (!alias)
64 return;
65
66 /* Note that the address mailbox should be converted to intl form
67 * before using as a key in the hash. This is currently done
68 * by all callers, but added here mostly as documentation. */
69 mutt_addrlist_to_intl(&alias->addr, NULL);
70
71 struct Address *addr = NULL;
72 TAILQ_FOREACH(addr, &alias->addr, entries)
73 {
74 if (!addr->group && addr->mailbox)
76 }
77}
78
83void alias_reverse_delete(struct Alias *alias)
84{
85 if (!alias)
86 return;
87
88 /* If the alias addresses were converted to local form, they won't
89 * match the hash entries. */
90 mutt_addrlist_to_intl(&alias->addr, NULL);
91
92 struct Address *addr = NULL;
93 TAILQ_FOREACH(addr, &alias->addr, entries)
94 {
95 if (!addr->group && addr->mailbox)
97 }
98}
99
105struct Address *alias_reverse_lookup(const struct Address *addr)
106{
107 if (!addr || !addr->mailbox)
108 return NULL;
109
111}
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
Definition: address.c:1293
Email Address Handling.
Representation of a single alias to an email address.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:96
struct HashElem * mutt_hash_insert(struct HashTable *table, const char *strkey, void *data)
Add a new element to the Hash Table (with string keys)
Definition: hash.c:335
void mutt_hash_delete(struct HashTable *table, const char *strkey, const void *data)
Remove an element from a Hash Table.
Definition: hash.c:427
void * mutt_hash_find(const struct HashTable *table, const char *strkey)
Find the HashElem data in a Hash Table element using a key.
Definition: hash.c:362
struct HashTable * mutt_hash_new(size_t num_elems, HashFlags flags)
Create a new Hash Table (with string keys)
Definition: hash.c:259
void mutt_hash_free(struct HashTable **ptr)
Free a hash table.
Definition: hash.c:457
#define MUTT_HASH_STRDUP_KEYS
make a copy of the keys
Definition: hash.h:111
#define MUTT_HASH_ALLOW_DUPS
allow duplicate keys to be inserted
Definition: hash.h:112
#define MUTT_HASH_STRCASECMP
use strcasecmp() to compare keys
Definition: hash.h:110
Convenience wrapper for the library headers.
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:725
static struct HashTable * ReverseAliases
Hash Table of aliases (email address -> alias)
Definition: reverse.c:37
void alias_reverse_add(struct Alias *alias)
Add an email address lookup for an Alias.
Definition: reverse.c:61
void alias_reverse_shutdown(void)
Clear up the Reverse Alias Hash Table.
Definition: reverse.c:52
struct Address * alias_reverse_lookup(const struct Address *addr)
Does the user have an alias for the given address.
Definition: reverse.c:105
void alias_reverse_delete(struct Alias *alias)
Remove an email address lookup for an Alias.
Definition: reverse.c:83
void alias_reverse_init(void)
Set up the Reverse Alias Hash Table.
Definition: reverse.c:42
Manage alias reverse lookups.
Key value store.
An email address.
Definition: address.h:36
bool group
Group mailbox?
Definition: address.h:39
struct Buffer * mailbox
Mailbox and host address.
Definition: address.h:38
A shortcut for an email address or addresses.
Definition: alias.h:35
struct AddressList addr
List of Addresses the Alias expands to.
Definition: alias.h:37
A Hash Table.
Definition: hash.h:97