*/
#define is_special(x) strchr(AddressSpecials, x)
-/**
- * AddressError - An out-of-band error code
- *
- * Many of the Address functions set this variable on error.
- * Its values are defined in #AddressError.
- * Text for the errors can be looked up using #AddressErrors.
- */
-int AddressError = 0;
-
-/**
- * AddressErrors - Messages for the error codes in #AddressError
- *
- * These must defined in the same order as enum AddressError.
- */
-const char *const AddressErrors[] = {
- "out of memory", "mismatched parenthesis", "mismatched quotes",
- "bad route in <>", "bad address in <>", "bad address spec",
-};
-
-/**
- * mutt_addr_new - Create a new Address
- * @retval ptr Newly allocated Address
- *
- * Free the result with free_address() or mutt_addr_free()
- */
-struct Address *mutt_addr_new(void)
-{
- return mutt_mem_calloc(1, sizeof(struct Address));
-}
-
/**
* free_address - Free a single Address
* @param a Address to free
FREE(&(*a));
}
-/**
- * mutt_addr_remove_from_list - Remove an Address from a list
- * @param a Address list
- * @param mailbox Email address to match
- * @retval 0 Success
- * @retval -1 Error, or email not found
- */
-int mutt_addr_remove_from_list(struct Address **a, const char *mailbox)
-{
- struct Address *p = NULL, *last = NULL, *t = NULL;
- int rc = -1;
-
- p = *a;
- last = NULL;
- while (p)
- {
- if (mutt_str_strcasecmp(mailbox, p->mailbox) == 0)
- {
- if (last)
- last->next = p->next;
- else
- (*a) = p->next;
- t = p;
- p = p->next;
- free_address(&t);
- rc = 0;
- }
- else
- {
- last = p;
- p = p->next;
- }
- }
-
- return rc;
-}
-
-/**
- * mutt_addr_free - Free a list of Addresses
- * @param p Top of the list
- */
-void mutt_addr_free(struct Address **p)
-{
- struct Address *t = NULL;
-
- while (*p)
- {
- t = *p;
- *p = (*p)->next;
- free_address(&t);
- }
-}
-
/**
* parse_comment - Extract a comment (parenthesised string)
* @param[in] s String, just after the opening parenthesis
*last = cur;
}
+/**
+ * AddressError - An out-of-band error code
+ *
+ * Many of the Address functions set this variable on error.
+ * Its values are defined in #AddressError.
+ * Text for the errors can be looked up using #AddressErrors.
+ */
+int AddressError = 0;
+
+/**
+ * AddressErrors - Messages for the error codes in #AddressError
+ *
+ * These must defined in the same order as enum AddressError.
+ */
+const char *const AddressErrors[] = {
+ "out of memory", "mismatched parenthesis", "mismatched quotes",
+ "bad route in <>", "bad address in <>", "bad address spec",
+};
+
+/**
+ * mutt_addr_new - Create a new Address
+ * @retval ptr Newly allocated Address
+ *
+ * Free the result with free_address() or mutt_addr_free()
+ */
+struct Address *mutt_addr_new(void)
+{
+ return mutt_mem_calloc(1, sizeof(struct Address));
+}
+
+/**
+ * mutt_addr_remove_from_list - Remove an Address from a list
+ * @param a Address list
+ * @param mailbox Email address to match
+ * @retval 0 Success
+ * @retval -1 Error, or email not found
+ */
+int mutt_addr_remove_from_list(struct Address **a, const char *mailbox)
+{
+ struct Address *p = NULL, *last = NULL, *t = NULL;
+ int rc = -1;
+
+ p = *a;
+ last = NULL;
+ while (p)
+ {
+ if (mutt_str_strcasecmp(mailbox, p->mailbox) == 0)
+ {
+ if (last)
+ last->next = p->next;
+ else
+ (*a) = p->next;
+ t = p;
+ p = p->next;
+ free_address(&t);
+ rc = 0;
+ }
+ else
+ {
+ last = p;
+ p = p->next;
+ }
+ }
+
+ return rc;
+}
+
+/**
+ * mutt_addr_free - Free a list of Addresses
+ * @param p Top of the list
+ */
+void mutt_addr_free(struct Address **p)
+{
+ struct Address *t = NULL;
+
+ while (*p)
+ {
+ t = *p;
+ *p = (*p)->next;
+ free_address(&t);
+ }
+}
+
/**
* mutt_addr_parse_list - Parse a list of email addresses
* @param top List to append addresses
char *HiddenTags; /**< Private tags which should not be displayed */
struct Hash *TagTransforms; /**< Lookup table of alternative tag names */
-/**
- * driver_tags_free - Free tags from a header
- * @param[in] head List of tags
- *
- * Free the whole tags structure
- */
-void driver_tags_free(struct TagHead *head)
-{
- if (!head)
- return;
-
- struct TagNode *np = STAILQ_FIRST(head), *next = NULL;
- while (np)
- {
- next = STAILQ_NEXT(np, entries);
- FREE(&np->name);
- FREE(&np->transformed);
- FREE(&np);
- np = next;
- }
- STAILQ_INIT(head);
-}
-
/**
* driver_tags_getter - Get transformed tags
* @param head List of tags
return tags;
}
+/**
+ * driver_tags_add - Add a tag to header
+ * @param[in] head List of tags
+ * @param[in] new_tag string representing the new tag
+ *
+ * Add a tag to the header tags
+ */
+static void driver_tags_add(struct TagHead *head, char *new_tag)
+{
+ char *new_tag_transformed = mutt_hash_find(TagTransforms, new_tag);
+
+ struct TagNode *np = mutt_mem_calloc(1, sizeof(struct TagNode));
+ np->name = mutt_str_strdup(new_tag);
+ np->hidden = false;
+ if (new_tag_transformed)
+ np->transformed = mutt_str_strdup(new_tag_transformed);
+
+ /* filter out hidden tags */
+ if (HiddenTags)
+ {
+ char *p = strstr(HiddenTags, new_tag);
+ size_t xsz = p ? mutt_str_strlen(new_tag) : 0;
+
+ if (p && ((p == HiddenTags) || (*(p - 1) == ',') || (*(p - 1) == ' ')) &&
+ ((*(p + xsz) == '\0') || (*(p + xsz) == ',') || (*(p + xsz) == ' ')))
+ {
+ np->hidden = true;
+ }
+ }
+
+ STAILQ_INSERT_TAIL(head, np, entries);
+}
+
+/**
+ * driver_tags_free - Free tags from a header
+ * @param[in] head List of tags
+ *
+ * Free the whole tags structure
+ */
+void driver_tags_free(struct TagHead *head)
+{
+ if (!head)
+ return;
+
+ struct TagNode *np = STAILQ_FIRST(head), *next = NULL;
+ while (np)
+ {
+ next = STAILQ_NEXT(np, entries);
+ FREE(&np->name);
+ FREE(&np->transformed);
+ FREE(&np);
+ np = next;
+ }
+ STAILQ_INIT(head);
+}
+
/**
* driver_tags_get_transformed - Get transformed tags
* @param[in] head List of tags
return driver_tags_getter(head, true, true, name);
}
-/**
- * driver_tags_add - Add a tag to header
- * @param[in] head List of tags
- * @param[in] new_tag string representing the new tag
- *
- * Add a tag to the header tags
- */
-static void driver_tags_add(struct TagHead *head, char *new_tag)
-{
- char *new_tag_transformed = mutt_hash_find(TagTransforms, new_tag);
-
- struct TagNode *np = mutt_mem_calloc(1, sizeof(struct TagNode));
- np->name = mutt_str_strdup(new_tag);
- np->hidden = false;
- if (new_tag_transformed)
- np->transformed = mutt_str_strdup(new_tag_transformed);
-
- /* filter out hidden tags */
- if (HiddenTags)
- {
- char *p = strstr(HiddenTags, new_tag);
- size_t xsz = p ? mutt_str_strlen(new_tag) : 0;
-
- if (p && ((p == HiddenTags) || (*(p - 1) == ',') || (*(p - 1) == ' ')) &&
- ((*(p + xsz) == '\0') || (*(p + xsz) == ',') || (*(p + xsz) == ' ')))
- {
- np->hidden = true;
- }
- }
-
- STAILQ_INSERT_TAIL(head, np, entries);
-}
-
/**
* driver_tags_replace - Replace all tags
* @param[in] head List of tags