/**
* mutt_grouplist_clear - Clear a GroupList
- * @param head GroupList to clear
+ * @param gl GroupList to clear
*/
-void mutt_grouplist_clear(struct GroupList *head)
+void mutt_grouplist_clear(struct GroupList *gl)
{
- if (!head)
+ if (!gl)
return;
- struct GroupNode *np = STAILQ_FIRST(head);
+ struct GroupNode *np = STAILQ_FIRST(gl);
struct GroupNode *next = NULL;
while (np)
{
FREE(&np);
np = next;
}
- STAILQ_INIT(head);
+ STAILQ_INIT(gl);
}
/**
/**
* mutt_grouplist_add - Add a Group to a GroupList
- * @param head GroupList to add to
+ * @param gl GroupList to add to
* @param group Group to add
*/
-void mutt_grouplist_add(struct GroupList *head, struct Group *group)
+void mutt_grouplist_add(struct GroupList *gl, struct Group *group)
{
- if (!head || !group)
+ if (!gl || !group)
return;
struct GroupNode *np = NULL;
- STAILQ_FOREACH(np, head, entries)
+ STAILQ_FOREACH(np, gl, entries)
{
if (np->group == group)
return;
}
np = mutt_mem_calloc(1, sizeof(struct GroupNode));
np->group = group;
- STAILQ_INSERT_TAIL(head, np, entries);
+ STAILQ_INSERT_TAIL(gl, np, entries);
}
/**
* mutt_grouplist_destroy - Free a GroupList
- * @param head GroupList to free
+ * @param gl GroupList to free
*/
-void mutt_grouplist_destroy(struct GroupList *head)
+void mutt_grouplist_destroy(struct GroupList *gl)
{
- if (!head)
+ if (!gl)
return;
- struct GroupNode *np = STAILQ_FIRST(head);
+ struct GroupNode *np = STAILQ_FIRST(gl);
struct GroupNode *next = NULL;
while (np)
{
FREE(&np);
np = next;
}
- STAILQ_INIT(head);
+ STAILQ_INIT(gl);
}
/**
/**
* mutt_grouplist_add_addrlist - Add Address list to a GroupList
- * @param head GroupList to add to
- * @param al Address list to add
+ * @param gl GroupList to add to
+ * @param al Address list to add
*/
-void mutt_grouplist_add_addrlist(struct GroupList *head, struct AddressList *al)
+void mutt_grouplist_add_addrlist(struct GroupList *gl, struct AddressList *al)
{
- if (!head || !al)
+ if (!gl || !al)
return;
struct GroupNode *np = NULL;
- STAILQ_FOREACH(np, head, entries)
+ STAILQ_FOREACH(np, gl, entries)
{
group_add_addrlist(np->group, al);
}
/**
* mutt_grouplist_remove_addrlist - Remove an AddressList from a GroupList
- * @param head GroupList to remove from
- * @param al AddressList to remove
+ * @param gl GroupList to remove from
+ * @param al AddressList to remove
* @retval 0 Success
* @retval -1 Error
*/
-int mutt_grouplist_remove_addrlist(struct GroupList *head, struct AddressList *al)
+int mutt_grouplist_remove_addrlist(struct GroupList *gl, struct AddressList *al)
{
- if (!head || !al)
+ if (!gl || !al)
return -1;
struct GroupNode *gnp = NULL;
- STAILQ_FOREACH(gnp, head, entries)
+ STAILQ_FOREACH(gnp, gl, entries)
{
struct Address *a = NULL;
TAILQ_FOREACH(a, al, entries)
/**
* mutt_grouplist_add_regex - Add matching Addresses to a GroupList
- * @param head GroupList to add to
+ * @param gl 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_grouplist_add_regex(struct GroupList *head, const char *s, int flags,
- struct Buffer *err)
+int mutt_grouplist_add_regex(struct GroupList *gl, const char *s, int flags, struct Buffer *err)
{
- if (!head || !s)
+ if (!gl || !s)
return -1;
int rc = 0;
struct GroupNode *np = NULL;
- STAILQ_FOREACH(np, head, entries)
+ STAILQ_FOREACH(np, gl, entries)
{
rc = group_add_regex(np->group, s, flags, err);
if (rc)
/**
* mutt_grouplist_remove_regex - Remove matching addresses from a GroupList
- * @param head GroupList to remove from
- * @param s Address to match
+ * @param gl GroupList to remove from
+ * @param s Address to match
* @retval 0 Success
* @retval -1 Error
*/
-int mutt_grouplist_remove_regex(struct GroupList *head, const char *s)
+int mutt_grouplist_remove_regex(struct GroupList *gl, const char *s)
{
- if (!head || !s)
+ if (!gl || !s)
return -1;
int rc = 0;
struct GroupNode *np = NULL;
- STAILQ_FOREACH(np, head, entries)
+ STAILQ_FOREACH(np, gl, entries)
{
rc = group_remove_regex(np->group, s);
if (empty_group(np->group))
/**
* parse_grouplist - Parse a group context
- * @param ctx GroupList to add to
+ * @param gl 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_grouplist(struct GroupList *ctx, struct Buffer *buf,
+static int parse_grouplist(struct GroupList *gl, struct Buffer *buf,
struct Buffer *s, unsigned long data, struct Buffer *err)
{
while (mutt_str_strcasecmp(buf->data, "-group") == 0)
mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
- mutt_grouplist_add(ctx, mutt_pattern_group(buf->data));
+ mutt_grouplist_add(gl, mutt_pattern_group(buf->data));
if (!MoreArgs(s))
{
{
struct Alias *tmp = NULL;
char *estr = NULL;
- struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
+ struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
if (!MoreArgs(s))
{
mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
- if (parse_grouplist(&gc, buf, s, data, err) == -1)
+ if (parse_grouplist(&gl, buf, s, data, err) == -1)
return MUTT_CMD_ERROR;
/* check to see if an alias with this name already exists */
goto bail;
}
- mutt_grouplist_add_addrlist(&gc, &tmp->addr);
+ mutt_grouplist_add_addrlist(&gl, &tmp->addr);
mutt_alias_add_reverse(tmp);
if (C_DebugLevel > LL_DEBUG4)
mutt_debug(5, " %s\n", a->mailbox);
}
}
- mutt_grouplist_destroy(&gc);
+ mutt_grouplist_destroy(&gl);
return MUTT_CMD_SUCCESS;
bail:
- mutt_grouplist_destroy(&gc);
+ mutt_grouplist_destroy(&gl);
return MUTT_CMD_ERROR;
}
static enum CommandResult parse_alternates(struct Buffer *buf, struct Buffer *s,
unsigned long data, struct Buffer *err)
{
- struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
+ struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
alternates_clean();
{
mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
- if (parse_grouplist(&gc, buf, s, data, err) == -1)
+ if (parse_grouplist(&gl, buf, s, data, err) == -1)
goto bail;
mutt_regexlist_remove(&UnAlternates, buf->data);
if (mutt_regexlist_add(&Alternates, buf->data, REG_ICASE, err) != 0)
goto bail;
- if (mutt_grouplist_add_regex(&gc, buf->data, REG_ICASE, err) != 0)
+ if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
goto bail;
} while (MoreArgs(s));
- mutt_grouplist_destroy(&gc);
+ mutt_grouplist_destroy(&gl);
return MUTT_CMD_SUCCESS;
bail:
- mutt_grouplist_destroy(&gc);
+ mutt_grouplist_destroy(&gl);
return MUTT_CMD_ERROR;
}
static enum CommandResult parse_group(struct Buffer *buf, struct Buffer *s,
unsigned long data, struct Buffer *err)
{
- struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
+ struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
enum GroupState state = GS_NONE;
do
{
mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
- if (parse_grouplist(&gc, buf, s, data, err) == -1)
+ if (parse_grouplist(&gl, buf, s, data, err) == -1)
goto bail;
if ((data == MUTT_UNGROUP) && (mutt_str_strcasecmp(buf->data, "*") == 0))
{
- mutt_grouplist_clear(&gc);
+ mutt_grouplist_clear(&gl);
goto out;
}
case GS_RX:
if ((data == MUTT_GROUP) &&
- (mutt_grouplist_add_regex(&gc, buf->data, REG_ICASE, err) != 0))
+ (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0))
{
goto bail;
}
else if ((data == MUTT_UNGROUP) &&
- (mutt_grouplist_remove_regex(&gc, buf->data) < 0))
+ (mutt_grouplist_remove_regex(&gl, buf->data) < 0))
{
goto bail;
}
goto bail;
}
if (data == MUTT_GROUP)
- mutt_grouplist_add_addrlist(&gc, &al);
+ mutt_grouplist_add_addrlist(&gl, &al);
else if (data == MUTT_UNGROUP)
- mutt_grouplist_remove_addrlist(&gc, &al);
+ mutt_grouplist_remove_addrlist(&gl, &al);
mutt_addrlist_clear(&al);
break;
}
} while (MoreArgs(s));
out:
- mutt_grouplist_destroy(&gc);
+ mutt_grouplist_destroy(&gl);
return MUTT_CMD_SUCCESS;
bail:
- mutt_grouplist_destroy(&gc);
+ mutt_grouplist_destroy(&gl);
return MUTT_CMD_ERROR;
warn:
- mutt_grouplist_destroy(&gc);
+ mutt_grouplist_destroy(&gl);
return MUTT_CMD_WARNING;
}
static enum CommandResult parse_lists(struct Buffer *buf, struct Buffer *s,
unsigned long data, struct Buffer *err)
{
- struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
+ struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
do
{
mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
- if (parse_grouplist(&gc, buf, s, data, err) == -1)
+ if (parse_grouplist(&gl, buf, s, data, err) == -1)
goto bail;
mutt_regexlist_remove(&UnMailLists, buf->data);
if (mutt_regexlist_add(&MailLists, buf->data, REG_ICASE, err) != 0)
goto bail;
- if (mutt_grouplist_add_regex(&gc, buf->data, REG_ICASE, err) != 0)
+ if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
goto bail;
} while (MoreArgs(s));
- mutt_grouplist_destroy(&gc);
+ mutt_grouplist_destroy(&gl);
return MUTT_CMD_SUCCESS;
bail:
- mutt_grouplist_destroy(&gc);
+ mutt_grouplist_destroy(&gl);
return MUTT_CMD_ERROR;
}
static enum CommandResult parse_subscribe(struct Buffer *buf, struct Buffer *s,
unsigned long data, struct Buffer *err)
{
- struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
+ struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
do
{
mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
- if (parse_grouplist(&gc, buf, s, data, err) == -1)
+ if (parse_grouplist(&gl, buf, s, data, err) == -1)
goto bail;
mutt_regexlist_remove(&UnMailLists, buf->data);
goto bail;
if (mutt_regexlist_add(&SubscribedLists, buf->data, REG_ICASE, err) != 0)
goto bail;
- if (mutt_grouplist_add_regex(&gc, buf->data, REG_ICASE, err) != 0)
+ if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
goto bail;
} while (MoreArgs(s));
- mutt_grouplist_destroy(&gc);
+ mutt_grouplist_destroy(&gl);
return MUTT_CMD_SUCCESS;
bail:
- mutt_grouplist_destroy(&gc);
+ mutt_grouplist_destroy(&gl);
return MUTT_CMD_ERROR;
}