}
/**
- * mutt_group_context_clear - Empty a Group List
- * @param head Group List to modify
+ * mutt_group_context_clear - Clear a GroupList
+ * @param head GroupList to clear
* @retval 0 Always
*/
-int mutt_group_context_clear(struct GroupContextHead *head)
+int mutt_group_context_clear(struct GroupList *head)
{
- struct GroupContext *np = STAILQ_FIRST(head), *next = NULL;
+ struct GroupNode *np = STAILQ_FIRST(head), *next = NULL;
while (np)
{
group_remove(np->g);
}
/**
- * mutt_group_context_add - Add a Group to a List
- * @param head Group List
+ * mutt_group_context_add - Add a Group to a GroupList
+ * @param head GroupList to add to
* @param group Group to add
*/
-void mutt_group_context_add(struct GroupContextHead *head, struct Group *group)
+void mutt_group_context_add(struct GroupList *head, struct Group *group)
{
- struct GroupContext *np = NULL;
+ struct GroupNode *np = NULL;
STAILQ_FOREACH(np, head, entries)
{
if (np->g == group)
return;
}
- np = mutt_mem_calloc(1, sizeof(struct GroupContext));
+ np = mutt_mem_calloc(1, sizeof(struct GroupNode));
np->g = group;
STAILQ_INSERT_TAIL(head, np, entries);
}
/**
- * mutt_group_context_destroy - Destroy a Group List
- * @param head Group List to destroy
+ * mutt_group_context_destroy - Free a GroupList
+ * @param head GroupList to free
*/
-void mutt_group_context_destroy(struct GroupContextHead *head)
+void mutt_group_context_destroy(struct GroupList *head)
{
- struct GroupContext *np = STAILQ_FIRST(head), *next = NULL;
+ struct GroupNode *np = STAILQ_FIRST(head), *next = NULL;
while (np)
{
next = STAILQ_NEXT(np, entries);
}
/**
- * mutt_group_context_add_addrlist - Add an Address List to a Group List
- * @param head Group List to add to
- * @param a Address List to add
+ * mutt_group_context_add_addrlist - Add Address list to a GroupList
+ * @param head GroupList to add to
+ * @param a Address to add
*/
-void mutt_group_context_add_addrlist(struct GroupContextHead *head, struct Address *a)
+void mutt_group_context_add_addrlist(struct GroupList *head, struct Address *a)
{
- struct GroupContext *np = NULL;
+ struct GroupNode *np = NULL;
STAILQ_FOREACH(np, head, entries)
{
group_add_addrlist(np->g, a);
}
/**
- * mutt_group_context_remove_addrlist - Remove an Address List from a Group List
- * @param head Group List to modify
- * @param a Address List to remove
+ * mutt_group_context_remove_addrlist - Remove Address from a GroupList
+ * @param head GroupList to remove from
+ * @param a Address to remove
* @retval 0 Success
* @retval -1 Error
*/
-int mutt_group_context_remove_addrlist(struct GroupContextHead *head, struct Address *a)
+int mutt_group_context_remove_addrlist(struct GroupList *head, struct Address *a)
{
int rc = 0;
- struct GroupContext *np = NULL;
+ struct GroupNode *np = NULL;
STAILQ_FOREACH(np, head, entries)
{
}
/**
- * mutt_group_context_add_regex - Add a Regex to a Group List
- * @param head Group List to add to
- * @param s Regex string to add
+ * mutt_group_context_add_regex - Add matching Addresses to a GroupList
+ * @param head GroupList to add to
+ * @param s Address to match
* @param flags Flags, e.g. REG_ICASE
* @param err Buffer for error message
* @retval 0 Success
* @retval -1 Error
*/
-int mutt_group_context_add_regex(struct GroupContextHead *head, const char *s,
+int mutt_group_context_add_regex(struct GroupList *head, const char *s,
int flags, struct Buffer *err)
{
int rc = 0;
- struct GroupContext *np = NULL;
+ struct GroupNode *np = NULL;
STAILQ_FOREACH(np, head, entries)
{
rc = group_add_regex(np->g, s, flags, err);
}
/**
- * mutt_group_context_remove_regex - Remove a Regex from a Group List
- * @param head Group List to modify
- * @param s Regex string to remove
+ * mutt_group_context_remove_regex - Remove matching addresses from a GroupList
+ * @param head GroupList to remove from
+ * @param s Address to match
* @retval 0 Success
* @retval -1 Error
*/
-int mutt_group_context_remove_regex(struct GroupContextHead *head, const char *s)
+int mutt_group_context_remove_regex(struct GroupList *head, const char *s)
{
int rc = 0;
- struct GroupContext *np = NULL;
+ struct GroupNode *np = NULL;
STAILQ_FOREACH(np, head, entries)
{
rc = group_remove_regex(np->g, s);
};
/**
- * struct GroupContext - A set of Groups
+ * struct GroupNode - A node in a GroupNode
*/
-struct GroupContext
+struct GroupNode
{
struct Group *g;
- STAILQ_ENTRY(GroupContext) entries;
+ STAILQ_ENTRY(GroupNode) entries;
};
-STAILQ_HEAD(GroupContextHead, GroupContext);
+STAILQ_HEAD(GroupList, GroupNode);
-void mutt_group_context_add(struct GroupContextHead *head, struct Group *group);
-void mutt_group_context_destroy(struct GroupContextHead *head);
-void mutt_group_context_add_addrlist(struct GroupContextHead *head, struct Address *a);
-int mutt_group_context_add_regex(struct GroupContextHead *head, const char *s,
+void mutt_group_context_add(struct GroupList *head, struct Group *group);
+void mutt_group_context_destroy(struct GroupList *head);
+void mutt_group_context_add_addrlist(struct GroupList *head, struct Address *a);
+int mutt_group_context_add_regex(struct GroupList *head, const char *s,
int flags, struct Buffer *err);
bool mutt_group_match(struct Group *g, const char *s);
-int mutt_group_context_clear(struct GroupContextHead *head);
-int mutt_group_context_remove_regex(struct GroupContextHead *head, const char *s);
-int mutt_group_context_remove_addrlist(struct GroupContextHead *head, struct Address *a);
+int mutt_group_context_clear(struct GroupList *head);
+int mutt_group_context_remove_regex(struct GroupList *head, const char *s);
+int mutt_group_context_remove_addrlist(struct GroupList *head, struct Address *a);
struct Group *mutt_pattern_group(const char *k);
/**
* parse_group_context - Parse a group context
- * @param ctx GroupContext to add to
+ * @param ctx GroupList to add to
* @param buf Temporary Buffer space
* @param s Buffer containing string to be parsed
* @param data Flags associated with the command
* @retval 0 Success
* @retval -1 Error
*/
-static int parse_group_context(struct GroupContextHead *ctx, struct Buffer *buf,
+static int parse_group_context(struct GroupList *ctx, struct Buffer *buf,
struct Buffer *s, unsigned long data, struct Buffer *err)
{
while (mutt_str_strcasecmp(buf->data, "-group") == 0)
{
struct Alias *tmp = NULL;
char *estr = NULL;
- struct GroupContextHead gc = STAILQ_HEAD_INITIALIZER(gc);
+ struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
if (!MoreArgs(s))
{
static int parse_alternates(struct Buffer *buf, struct Buffer *s,
unsigned long data, struct Buffer *err)
{
- struct GroupContextHead gc = STAILQ_HEAD_INITIALIZER(gc);
+ struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
alternates_clean();
static int parse_group(struct Buffer *buf, struct Buffer *s, unsigned long data,
struct Buffer *err)
{
- struct GroupContextHead gc = STAILQ_HEAD_INITIALIZER(gc);
+ struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
enum GroupState state = GS_NONE;
struct Address *addr = NULL;
char *estr = NULL;
static int parse_lists(struct Buffer *buf, struct Buffer *s, unsigned long data,
struct Buffer *err)
{
- struct GroupContextHead gc = STAILQ_HEAD_INITIALIZER(gc);
+ struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
do
{
static int parse_subscribe(struct Buffer *buf, struct Buffer *s,
unsigned long data, struct Buffer *err)
{
- struct GroupContextHead gc = STAILQ_HEAD_INITIALIZER(gc);
+ struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
do
{