{NULL, OP_NULL}
};
-void alias_wipe(alias_t *a) {
- p_delete(&a->name);
- address_delete(&a->addr);
- alias_delete(&a->next);
-}
-
const address_t *alias_lookup(const alias_t *list, const char *s)
{
while (list) {
const char *err = NULL;
if (mutt_get_field(_("Address: "), buf, sizeof(buf), 0) || !buf[0]) {
- alias_delete(&new);
+ alias_list_wipe(&new);
return;
}
}
if (mutt_get_field(_("Personal name: "), buf, sizeof(buf), 0)) {
- alias_delete(&new);
+ alias_list_wipe(&new);
return;
}
new->addr->personal = m_strdup(buf);
rfc822_write_address(buf, sizeof(buf), new->addr, 1);
snprintf(prompt, sizeof(prompt), _("[%s = %s] Accept?"), new->name, buf);
if (mutt_yesorno(prompt, M_YES) != M_YES) {
- alias_delete(&new);
+ alias_list_wipe(&new);
return;
}
}
}
-static address_t *mutt_expand_aliases_r(address_t *a, LIST **expn)
+static address_t *mutt_expand_aliases_r(address_t *a, string_list_t **expn)
{
address_t *pop, *head = NULL;
address_t **last = &head;
const address_t *t = alias_lookup(Aliases, pop->mailbox);
if (t) {
- LIST *u;
+ string_list_t *u;
for (u = *expn; u; u = u->next) {
if (!m_strcmp(pop->mailbox, u->data)) { /* alias already found */
- address_delete(&pop);
+ address_list_wipe(&pop);
continue;
}
}
/* save the fact we saw it */
- u = mutt_new_list();
+ u = string_item_new();
u->data = m_strdup(pop->mailbox);
u->next = *expn;
*expn = u;
- address_delete(&pop);
+ address_list_wipe(&pop);
/* recurse */
last = address_list_last(last);
address_t *mutt_expand_aliases(address_t *a)
{
address_t *t;
- LIST *expn = NULL; /* previously expanded aliases to avoid loops */
+ string_list_t *expn = NULL; /* previously expanded aliases to avoid loops */
t = mutt_expand_aliases_r(a, &expn);
- mutt_free_list(&expn);
+ string_list_wipe(&expn);
return mutt_remove_duplicates(t);
}
Aliases = a_cur->next;
a_cur->next = NULL;
- alias_delete(&a_cur);
+ alias_list_wipe(&a_cur);
if (a_list)
a_cur = a_list;
} alias_t;
DO_INIT(alias_t, alias);
-void alias_wipe(alias_t *a);
+static inline void alias_wipe(alias_t *a) {
+ address_list_wipe(&a->addr);
+}
DO_NEW(alias_t, alias);
DO_DELETE(alias_t, alias);
-DO_SLIST(alias_t, alias);
+DO_SLIST(alias_t, alias, alias_delete);
const address_t *alias_lookup(const alias_t *list, const char *s);
int mutt_addr_is_user(address_t *);
b = mutt_read_mime_header (fp, 0);
if (b) {
if (b->parameter) {
- parameter_delete(&a->parameter);
+ parameter_list_wipe(&a->parameter);
a->parameter = b->parameter;
b->parameter = NULL;
}
void mutt_check_lookup_list (BODY * b, char *type, int len)
{
- LIST *t = MimeLookupList;
+ string_list_t *t = MimeLookupList;
int i;
for (; t; t = t->next) {
int mutt_is_autoview (BODY * b, const char *type)
{
- LIST *t = AutoViewList;
+ string_list_t *t = AutoViewList;
char _type[SHORT_STRING];
int i;
{
#ifdef USE_NNTP
if (option (OPTNEWS)) {
- LIST *tmp;
+ string_list_t *tmp;
NNTP_DATA *data;
NNTP_SERVER *news = CurrentNewsSrv;
#ifdef USE_NNTP
if (option (OPTNEWS)) {
- LIST *tmp;
+ string_list_t *tmp;
NNTP_DATA *data;
NNTP_SERVER *news = CurrentNewsSrv;
if (*f)
m_strcpy(prefix, sizeof(prefix), f);
else {
- LIST *list;
+ string_list_t *list;
/* default state for news reader mode is browse subscribed newsgroups */
buffy = 0;
break;
{
- LIST *tmp;
+ string_list_t *tmp;
NNTP_DATA *data;
for (tmp = CurrentNewsSrv->list; tmp; tmp = tmp->next) {
}
}
if (i == OP_SUBSCRIBE_PATTERN) {
- LIST *grouplist = NULL;
+ string_list_t *grouplist = NULL;
if (news)
grouplist = news->list;
if (mutt_addrlist_to_idna (adr, &err) < 0) {
mutt_error (_("Bad IDN: '%s'"), err);
p_delete(&err);
- address_delete (&adr);
+ address_list_wipe(&adr);
return;
}
}
if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) {
- address_delete (&adr);
+ address_list_wipe(&adr);
CLEARLINE (LINES - 1);
mutt_message (h ? _("Message not bounced.") : _("Messages not bounced."));
return;
CLEARLINE (LINES - 1);
rc = mutt_bounce_message (NULL, h, adr);
- address_delete (&adr);
+ address_list_wipe(&adr);
/* If no error, or background, display message. */
if ((rc == 0) || (rc == S_BKG))
mutt_message (h ? _("Message bounced.") : _("Messages bounced."));
return;
/* clean up previous junk */
- parameter_delete(&b->parameter);
+ parameter_list_wipe(&b->parameter);
p_delete(&b->subtype);
mutt_parse_content_type (buf, b);
#ifdef USE_NNTP
if (option (OPTNEWS)) {
- LIST *l = CurrentNewsSrv->list;
+ string_list_t *l = CurrentNewsSrv->list;
m_strcpy(filepart, sizeof(filepart), s);
#ifdef MIXMASTER
-static void redraw_mix_line (LIST * chain)
+static void redraw_mix_line (string_list_t * chain)
{
int c;
const char *t;
mutt_addrlist_to_local (*addr);
rfc822_write_address (buf, sizeof (buf), *addr, 0);
if (mutt_get_field (Prompts[line - 1], buf, sizeof (buf), M_ALIAS) == 0) {
- address_delete (addr);
+ address_list_wipe(addr);
*addr = mutt_parse_adrlist (*addr, buf);
*addr = mutt_expand_aliases (*addr);
}
int ignore = 0;
char buf[STRING]; /* should be long enough to get most fields in one pass */
char *nl;
- LIST *t;
+ string_list_t *t;
char **headers;
int hdr_count;
int x;
if (flags & CH_UPDATE) {
if ((flags & CH_NOSTATUS) == 0) {
if (h->env->irt_changed && h->env->in_reply_to) {
- LIST *listp = h->env->in_reply_to;
+ string_list_t *listp = h->env->in_reply_to;
if (fputs ("In-Reply-To: ", out) == EOF)
return (-1);
}
if (h->env->refs_changed && h->env->references) {
- LIST *listp = h->env->references, *refs = NULL, *t;
+ string_list_t *listp = h->env->references, *refs = NULL, *t;
if (fputs ("References: ", out) == EOF)
return (-1);
/* Mutt stores references in reverse order, thus we create
* a reordered refs list that we can put in the headers */
for (; listp; listp = listp->next, refs = t) {
- t = p_new(LIST, 1);
+ t = p_new(string_list_t, 1);
t->data = listp->data;
t->next = refs;
}
format_address_header (h, a);
- address_delete (&a);
+ address_list_wipe(&a);
p_delete(&s);
return 1;
#endif
#ifdef USE_SSL
WHERE char *SslClientCert INITVAL (NULL);
-WHERE LIST *SslSessionCerts INITVAL (NULL);
+WHERE string_list_t *SslSessionCerts INITVAL (NULL);
#endif
#ifdef USE_GNUTLS
WHERE short SslDHPrimeBits;
WHERE char *CurrentFolder;
WHERE char *LastFolder;
-WHERE LIST *AutoViewList INITVAL (0);
-WHERE LIST *AlternativeOrderList INITVAL (0);
-WHERE LIST *AttachAllow INITVAL(0);
-WHERE LIST *AttachExclude INITVAL(0);
-WHERE LIST *InlineAllow INITVAL(0);
-WHERE LIST *InlineExclude INITVAL(0);
-WHERE LIST *HeaderOrderList INITVAL (0);
-WHERE LIST *Ignore INITVAL (0);
-WHERE LIST *MimeLookupList INITVAL (0);
-WHERE LIST *UnIgnore INITVAL (0);
+WHERE string_list_t *AutoViewList INITVAL (0);
+WHERE string_list_t *AlternativeOrderList INITVAL (0);
+WHERE string_list_t *AttachAllow INITVAL(0);
+WHERE string_list_t *AttachExclude INITVAL(0);
+WHERE string_list_t *InlineAllow INITVAL(0);
+WHERE string_list_t *InlineExclude INITVAL(0);
+WHERE string_list_t *HeaderOrderList INITVAL (0);
+WHERE string_list_t *Ignore INITVAL (0);
+WHERE string_list_t *MimeLookupList INITVAL (0);
+WHERE string_list_t *UnIgnore INITVAL (0);
WHERE list2_t *Alternates INITVAL (0);
WHERE list2_t *UnAlternates INITVAL (0);
WHERE int CurrentMenu;
WHERE alias_t *Aliases INITVAL (0);
-WHERE LIST *UserHeader INITVAL (0);
+WHERE string_list_t *UserHeader INITVAL (0);
/*-- formerly in pgp.h --*/
WHERE rx_t PgpGoodSign;
{
BODY *choice = NULL;
BODY *b;
- LIST *t;
+ string_list_t *t;
char buf[STRING];
int type = 0;
int mustfree = 0;
*a = NULL;
}
-static unsigned char *dump_list (LIST * l, unsigned char *d, int *off)
+static unsigned char *dump_list (string_list_t * l, unsigned char *d, int *off)
{
unsigned int counter = 0;
unsigned int start_off = *off;
return d;
}
-static void restore_list (LIST ** l, const unsigned char *d, int *off)
+static void restore_list (string_list_t ** l, const unsigned char *d, int *off)
{
unsigned int counter;
restore_int (&counter, d, off);
while (counter) {
- *l = p_new(LIST, 1);
+ *l = p_new(string_list_t, 1);
restore_char (&(*l)->data, d, off);
l = &(*l)->next;
counter--;
ENVELOPE *n;
time_t mtime;
struct stat st;
- LIST *cur, **last = NULL, *tmp;
+ string_list_t *cur, **last = NULL, *tmp;
mutt_mktemp (path);
if ((ofp = safe_fopen (path, "w")) == NULL) {
}
mutt_unlink (body);
- mutt_free_list (&msg->env->userhdrs);
+ string_list_wipe(&msg->env->userhdrs);
/* Read the temp file back in */
if ((ifp = fopen (path, "r")) == NULL) {
#ifdef USE_NNTP
if (!option (OPTNEWSSEND))
#endif
- mutt_free_list (&msg->env->references);
+ string_list_wipe(&msg->env->references);
mutt_expand_aliases_env (msg->env);
*last = cur->next;
cur = cur->next;
tmp->next = NULL;
- mutt_free_list (&tmp);
+ string_list_wipe(&tmp);
}
}
}
save_lsub = option (OPTIMAPCHECKSUBSCRIBED);
unset_option (OPTIMAPCHECKSUBSCRIBED);
m_strcpy(list_cmd, sizeof(list_cmd),
- option(OPTIMAPLSUB) ? "LSUB" : "LIST");
+ option(OPTIMAPLSUB) ? "LSUB" : "string_list_t");
if (!(idata = imap_conn_find (&(mx.account), 0)))
goto fail;
* namespace is not "", so we have to list it explicitly. We ask the
* server to see if it has descendants. */
debug_print (3, ("adding INBOX\n"));
- if (browse_add_list_result (idata, "LIST \"\" \"INBOX\"", state, 0))
+ if (browse_add_list_result (idata, "string_list_t \"\" \"INBOX\"", state, 0))
goto fail;
}
* than invisible namespaces */
if (nsi->delim)
snprintf (buf, sizeof (buf), "%s \"\" \"%s%c%%\"",
- option (OPTIMAPLSUB) ? "LSUB" : "LIST", nsi->prefix,
+ option (OPTIMAPLSUB) ? "LSUB" : "string_list_t", nsi->prefix,
nsi->delim);
else
snprintf (buf, sizeof (buf), "%s \"\" \"%s%%\"",
- option (OPTIMAPLSUB) ? "LSUB" : "LIST", nsi->prefix);
+ option (OPTIMAPLSUB) ? "LSUB" : "string_list_t", nsi->prefix);
imap_cmd_start (idata, buf);
/* imap forward declarations */
static int imap_get_delim (IMAP_DATA * idata);
-static char *imap_get_flags (LIST ** hflags, char *s);
+static char *imap_get_flags (string_list_t ** hflags, char *s);
static int imap_check_acl (IMAP_DATA * idata);
static int imap_check_capabilities (IMAP_DATA * idata);
static void imap_set_flag (IMAP_DATA * idata, int aclbit, int flag,
* than getting the delim wrong */
idata->delim = '/';
- imap_cmd_start (idata, "LIST \"\" \"\"");
+ imap_cmd_start (idata, "string_list_t \"\" \"\"");
do {
if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE)
break;
s = imap_next_word (idata->cmd.buf);
- if (ascii_strncasecmp ("LIST", s, 4) == 0) {
+ if (ascii_strncasecmp ("string_list_t", s, 4) == 0) {
s = imap_next_word (s);
s = imap_next_word (s);
if (s && s[0] == '\"' && s[1] && s[2] == '\"')
/* imap_get_flags: Make a simple list out of a FLAGS response.
* return stream following FLAGS response */
-static char *imap_get_flags (LIST ** hflags, char *s)
+static char *imap_get_flags (string_list_t ** hflags, char *s)
{
- LIST *flags;
+ string_list_t *flags;
char *flag_word;
char ctmp;
}
/* create list, update caller's flags handle */
- flags = mutt_new_list ();
+ flags = string_item_new();
*hflags = flags;
while (*s && *s != ')') {
/* note bad flags response */
if (*s != ')') {
debug_print (1, ("Unterminated FLAGS response: %s\n", s));
- mutt_free_list (hflags);
+ string_list_wipe(hflags);
return NULL;
}
else if (ascii_strncasecmp ("OK [PERMANENTFLAGS", pc, 18) == 0) {
debug_print (2, ("Getting mailbox PERMANENTFLAGS\n"));
/* safe to call on NULL */
- mutt_free_list (&(idata->flags));
+ string_list_wipe(&(idata->flags));
/* skip "OK [PERMANENT" so syntax is the same as FLAGS */
pc += 13;
if ((pc = imap_get_flags (&(idata->flags), pc)) == NULL)
if (!idata->flags)
debug_print (3, ("No folder flags found\n"));
else {
- LIST *t = idata->flags;
+ string_list_t *t = idata->flags;
debug_print (3, ("Mailbox flags:\n"));
idata->reopen &= IMAP_REOPEN_ALLOW;
p_delete(&(idata->mailbox));
- mutt_free_list (&idata->flags);
+ string_list_wipe(&idata->flags);
idata->ctx = NULL;
}
/* all this listing/browsing is a mess. I don't like that name is a pointer
* into idata->buf (used to be a pointer into the passed in buffer, just
* as bad), nor do I like the fact that the fetch is done here. This
- * code can't possibly handle non-LIST untagged responses properly.
+ * code can't possibly handle non-string_list_t untagged responses properly.
* FIXME. ?! */
int imap_parse_list_response (IMAP_DATA * idata, char **name, int *noselect,
int *noinferiors, char *delim)
return -1;
s = imap_next_word (idata->cmd.buf);
- if ((ascii_strncasecmp ("LIST", s, 4) == 0) ||
+ if ((ascii_strncasecmp ("string_list_t", s, 4) == 0) ||
(ascii_strncasecmp ("LSUB", s, 4) == 0)) {
*noselect = 0;
*noinferiors = 0;
/* fire off command */
snprintf (buf, sizeof (buf), "%s \"\" \"%s%%\"",
- option (OPTIMAPLSUB) ? "LSUB" : "LIST", list);
+ option (OPTIMAPLSUB) ? "LSUB" : "string_list_t", list);
imap_cmd_start (idata, buf);
#endif
/* all folder flags - system flags AND keywords */
- LIST *flags;
+ string_list_t *flags;
} IMAP_DATA;
/* I wish that were called IMAP_CONTEXT :( */
int imap_exec (IMAP_DATA * idata, const char *cmd, int flags);
/* message.c */
-void imap_add_keywords (char *s, HEADER * keywords, LIST * mailbox_flags,
+void imap_add_keywords (char *s, HEADER * keywords, string_list_t * mailbox_flags,
size_t slen);
void imap_free_header_data (void **data);
int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend);
static void flush_buffer (char *buf, size_t * len, CONNECTION * conn);
static int msg_fetch_header (CONTEXT * ctx, IMAP_HEADER * h, char *buf,
FILE * fp);
-static int msg_has_flag (LIST * flag_list, const char *flag);
+static int msg_has_flag (string_list_t * flag_list, const char *flag);
static int msg_parse_fetch (IMAP_HEADER * h, char *s);
static char *msg_parse_flags (IMAP_HEADER * h, char *s);
int rc, mfhrc, oldmsgcount;
int fetchlast = 0;
const char *want_headers =
- "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST X-LABEL";
+ "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES string_list_t-POST X-LABEL";
#ifdef USE_HCACHE
void *hc = NULL;
/* imap_add_keywords: concatenate custom IMAP tags to list, if they
* appear in the folder flags list. Why wouldn't they? */
-void imap_add_keywords (char *s, HEADER * h, LIST * mailbox_flags,
+void imap_add_keywords (char *s, HEADER * h, string_list_t * mailbox_flags,
size_t slen)
{
- LIST *keywords;
+ string_list_t *keywords;
if (!mailbox_flags || !HEADER_DATA (h) || !HEADER_DATA (h)->keywords)
return;
void imap_free_header_data (void **data)
{
/* this should be safe even if the list wasn't used */
- mutt_free_list (&(((IMAP_HEADER_DATA *) * data)->keywords));
+ string_list_wipe(&(((IMAP_HEADER_DATA *) * data)->keywords));
p_delete(data);
}
ctx->changed &= ~readonly;
ctx->readonly = readonly;
- mutt_free_list (&(HEADER_DATA (h)->keywords));
+ string_list_wipe(&(HEADER_DATA (h)->keywords));
HEADER_DATA (h)->keywords = newh.data->keywords;
p_delete(&newh.data);
/* msg_has_flag: do a caseless comparison of the flag against a flag list,
* return 1 if found or flag list has '\*', 0 otherwise */
-static int msg_has_flag (LIST * flag_list, const char *flag)
+static int msg_has_flag (string_list_t * flag_list, const char *flag)
{
if (!flag_list)
return 0;
char *flag_word = s;
if (!h->data->keywords)
- h->data->keywords = mutt_new_list ();
+ h->data->keywords = string_item_new();
while (*s && !ISSPACE (*s) && *s != ')')
s++;
/* IMAP-specific header data, stored as HEADER->data */
typedef struct imap_header_data {
unsigned int uid; /* 32-bit Message UID */
- LIST *keywords;
+ string_list_t *keywords;
} IMAP_HEADER_DATA;
typedef struct {
return;
p_delete(&(*idata)->capstr);
- mutt_free_list (&(*idata)->flags);
+ string_list_wipe(&(*idata)->flags);
p_delete(&((*idata)->cmd.buf));
p_delete(idata);
}
char* errbuf __attribute__ ((unused)), size_t errlen __attribute__ ((unused))) {
if (!dst)
return (0);
- address_delete ((address_t**) dst->data);
+ address_list_wipe((address_t**) dst->data);
if (val && *val)
*((address_t**) dst->data) = rfc822_parse_adrlist (NULL, val);
return (1);
/* not reached */
}
-static void add_to_list (LIST ** list, const char *str)
+static void add_to_list (string_list_t ** list, const char *str)
{
- LIST *t, *last = NULL;
+ string_list_t *t, *last = NULL;
/* don't add a NULL or empty string to the list */
if (!str || *str == '\0')
}
if (!*list || last) {
- t = p_new(LIST, 1);
+ t = p_new(string_list_t, 1);
t->data = m_strdup(str);
if (last) {
last->next = t;
}
-static void remove_from_list (LIST ** l, const char *str)
+static void remove_from_list (string_list_t ** l, const char *str)
{
- LIST *p, *last = NULL;
+ string_list_t *p, *last = NULL;
if (m_strcmp("*", str) == 0)
- mutt_free_list (l); /* ``unCMD *'' means delete all current entries */
+ string_list_wipe(l); /* ``unCMD *'' means delete all current entries */
else {
p = *l;
last = NULL;
{
do {
mutt_extract_token (buf, s, 0);
- add_to_list ((LIST **) data, buf->data);
+ add_to_list ((string_list_t **) data, buf->data);
}
while (MoreArgs (s));
* Check for deletion of entire list
*/
if (m_strcmp(buf->data, "*") == 0) {
- mutt_free_list ((LIST **) data);
+ string_list_wipe((string_list_t **) data);
break;
}
- remove_from_list ((LIST **) data, buf->data);
+ remove_from_list ((string_list_t **) data, buf->data);
}
while (MoreArgs (s));
}
}
-static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata,
+static int parse_attach_list (BUFFER *buf, BUFFER *s, string_list_t **ldata,
BUFFER *err __attribute__ ((unused))) {
ATTACH_MATCH *a;
- LIST *listp, *lastp;
+ string_list_t *listp, *lastp;
char *p;
char *tmpminor;
int len;
debug_print (5, ("parse_attach_list: added %s/%s [%d]\n",
a->major, a->minor, a->major_int));
- listp = p_new(LIST, 1);
+ listp = p_new(string_list_t, 1);
listp->data = (char *)a;
listp->next = NULL;
if (lastp) {
return 0;
}
-static int parse_unattach_list (BUFFER *buf, BUFFER *s, LIST **ldata,
+static int parse_unattach_list (BUFFER *buf, BUFFER *s, string_list_t **ldata,
BUFFER *err __attribute__ ((unused))) {
ATTACH_MATCH *a;
- LIST *lp, *lastp, *newlp;
+ string_list_t *lp, *lastp, *newlp;
char *tmp;
int major;
char *minor;
major = mutt_check_mime_type(tmp);
/* We must do our own walk here because remove_from_list() will only
- * remove the LIST->data, not anything pointed to by the LIST->data. */
+ * remove the string_list_t->data, not anything pointed to by the string_list_t->data. */
lastp = NULL;
for(lp = *ldata; lp; ) {
a = (ATTACH_MATCH *)lp->data;
return 0;
}
-static int print_attach_list (LIST *lp, char op, const char *name) {
+static int print_attach_list (string_list_t *lp, char op, const char *name) {
while (lp) {
printf("attachments %c%s %s/%s\n", op, name,
((ATTACH_MATCH *)lp->data)->major,
unsigned long data __attribute__ ((unused)),
BUFFER *err) {
char op, *category;
- LIST **listp;
+ string_list_t **listp;
mutt_extract_token(buf, s, 0);
if (!buf->data || *buf->data == '\0') {
static int parse_unattachments (BUFFER *buf, BUFFER *s, unsigned long data __attribute__ ((unused)), BUFFER *err) {
char op, *p;
- LIST **listp;
+ string_list_t **listp;
mutt_extract_token(buf, s, 0);
if (!buf->data || *buf->data == '\0') {
set_option (OPTFORCEREDRAWINDEX);
}
else
- alias_delete(&Aliases);
+ alias_list_wipe(&Aliases);
break;
}
else
else
Aliases = tmp->next;
tmp->next = NULL;
- alias_delete(&tmp);
+ alias_list_wipe(&tmp);
break;
}
last = tmp;
}
else {
/* override the previous value */
- address_delete (&tmp->addr);
+ address_list_wipe(&tmp->addr);
if (CurrentMenu == MENU_ALIAS)
set_option (OPTFORCEREDRAWINDEX);
}
unsigned long data __attribute__ ((unused)),
BUFFER * err __attribute__ ((unused)))
{
- LIST *last = NULL;
- LIST *tmp = UserHeader;
- LIST *ptr;
+ string_list_t *last = NULL;
+ string_list_t *tmp = UserHeader;
+ string_list_t *ptr;
size_t l;
do {
mutt_extract_token (buf, s, 0);
if (m_strcmp("*", buf->data) == 0)
- mutt_free_list (&UserHeader);
+ string_list_wipe(&UserHeader);
else {
tmp = UserHeader;
last = NULL;
UserHeader = tmp->next;
tmp = tmp->next;
ptr->next = NULL;
- mutt_free_list (&ptr);
+ string_list_wipe(&ptr);
}
else {
last = tmp;
static int parse_my_hdr (BUFFER * buf, BUFFER * s, unsigned long data __attribute__ ((unused)),
BUFFER * err)
{
- LIST *tmp;
+ string_list_t *tmp;
size_t keylen;
char *p;
if (!tmp->next)
break;
}
- tmp->next = mutt_new_list ();
+ tmp->next = string_item_new();
tmp = tmp->next;
}
else {
- tmp = mutt_new_list ();
+ tmp = string_item_new();
UserHeader = tmp;
}
tmp->data = buf->data;
r = -1;
break;
} else if (DTYPE (option->type) == DT_ADDR)
- address_delete ((address_t **) option->data);
+ address_list_wipe((address_t **) option->data);
else if (DTYPE (option->type) == DT_USER)
/* to unset $user_ means remove */
hash_delete (ConfigOptions, option->option,
}
/* Implement the -Q command line flag */
-int mutt_query_variables (LIST * queries)
+int mutt_query_variables (string_list_t * queries)
{
- LIST *p;
+ string_list_t *p;
char errbuff[STRING];
char command[STRING];
return 0;
}
-static int mutt_execute_commands (LIST * p)
+static int mutt_execute_commands (string_list_t * p)
{
BUFFER err, token;
char errstr[SHORT_STRING];
return 0;
}
-void mutt_init (int skip_sys_rc, LIST * commands)
+void mutt_init (int skip_sys_rc, string_list_t * commands)
{
struct passwd *pw;
struct utsname utsname;
*/
-/* Convert LIST into a pattern string suitable to be passed to GPGME.
+/* Convert string_list_t into a pattern string suitable to be passed to GPGME.
We need to convert spaces in an item into a '+' and '%' into
"%25". */
-static char *list_to_pattern (LIST * list)
+static char *list_to_pattern (string_list_t * list)
{
- LIST *l;
+ string_list_t *l;
char *pattern, *p;
const char *s;
size_t n;
/* Return a list of keys which are candidates for the selection.
Select by looking at the HINTS list. */
-static crypt_key_t *get_candidates (LIST * hints, unsigned int app,
+static crypt_key_t *get_candidates (string_list_t * hints, unsigned int app,
int secret)
{
crypt_key_t *db, *k, **kend;
depending on the protocol. For gpg we don' t need percent
escaped pappert but simple strings passed in an array to the
keylist_ext_start function. */
- LIST *l;
+ string_list_t *l;
size_t n;
char **patarr;
/* Add the string STR to the list HINTS. This list is later used to
match addresses. */
-static LIST *crypt_add_string_to_hints (LIST * hints, const char *str)
+static string_list_t *crypt_add_string_to_hints (string_list_t * hints, const char *str)
{
char *scratch;
char *t;
unsigned int app, int *forced_valid)
{
address_t *r, *p;
- LIST *hints = NULL;
+ string_list_t *hints = NULL;
int weak = 0;
int invalid = 0;
mutt_message (_("Looking for keys matching \"%s\"..."), a->mailbox);
keys = get_candidates (hints, app, (abilities & KEYFLAG_CANSIGN));
- mutt_free_list (&hints);
+ string_list_wipe(&hints);
if (!keys)
return NULL;
|| !(validity & CRYPT_KV_ADDR)))
this_key_has_weak = 1;
}
- address_delete (&r);
+ address_list_wipe(&r);
if (match) {
crypt_key_t *tmp;
static crypt_key_t *crypt_getkeybystr (char *p, short abilities,
unsigned int app, int *forced_valid)
{
- LIST *hints = NULL;
+ string_list_t *hints = NULL;
crypt_key_t *keys;
crypt_key_t *matches = NULL;
crypt_key_t **matches_endp = &matches;
hints = crypt_add_string_to_hints (hints, p);
keys = get_candidates (hints, app, (abilities & KEYFLAG_CANSIGN));
- mutt_free_list (&hints);
+ string_list_wipe(&hints);
if (!keys)
return NULL;
}
else if (r == -1) {
p_delete(&keylist);
- address_delete (&tmp);
- address_delete (&addr);
+ address_list_wipe(&tmp);
+ address_list_wipe(&addr);
return NULL;
}
}
#endif
&forced_valid)) == NULL) {
p_delete(&keylist);
- address_delete (&tmp);
- address_delete (&addr);
+ address_list_wipe(&tmp);
+ address_list_wipe(&addr);
return NULL;
}
}
keylist_used = m_strlen(keylist);
crypt_free_key (&key);
- address_delete (&addr);
+ address_list_wipe(&addr);
}
- address_delete (&tmp);
+ address_list_wipe(&tmp);
return (keylist);
}
return k;
}
-pgp_key_t pgp_get_candidates (pgp_ring_t keyring, LIST * hints)
+pgp_key_t pgp_get_candidates (pgp_ring_t keyring, string_list_t * hints)
{
FILE *fp;
pid_t thepid;
}
else if (r == -1) {
p_delete(&keylist);
- address_delete (&tmp);
- address_delete (&addr);
+ address_list_wipe(&tmp);
+ address_list_wipe(&addr);
return NULL;
}
}
if ((key = pgp_ask_for_key (buf, q->mailbox,
KEYFLAG_CANENCRYPT, PGP_PUBRING)) == NULL) {
p_delete(&keylist);
- address_delete (&tmp);
- address_delete (&addr);
+ address_list_wipe(&tmp);
+ address_list_wipe(&addr);
return NULL;
}
}
keylist_used = m_strlen(keylist);
pgp_free_key (&key);
- address_delete (&addr);
+ address_list_wipe(&addr);
}
- address_delete (&tmp);
+ address_list_wipe(&tmp);
return (keylist);
}
int pgp_decrypt_mime (FILE *, FILE **, BODY *, BODY **);
-/* int pgp_string_matches_hint (const char *s, LIST * hints); */
+/* int pgp_string_matches_hint (const char *s, string_list_t * hints); */
-/* pgp_key_t gpg_get_candidates (struct pgp_vinfo *, pgp_ring_t, LIST *); */
+/* pgp_key_t gpg_get_candidates (struct pgp_vinfo *, pgp_ring_t, string_list_t *); */
pgp_key_t pgp_ask_for_key (char *, char *, short, pgp_ring_t);
-pgp_key_t pgp_get_candidates (pgp_ring_t, LIST *);
+pgp_key_t pgp_get_candidates (pgp_ring_t, string_list_t *);
pgp_key_t pgp_getkeybyaddr (address_t *, short, pgp_ring_t);
pgp_key_t pgp_getkeybystr (char *, short, pgp_ring_t);
const char *uids);
pid_t pgp_invoke_list_keys (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr,
int pgpinfd, int pgpoutfd, int pgperrfd,
- pgp_ring_t keyring, LIST * hints);
+ pgp_ring_t keyring, string_list_t * hints);
pid_t pgp_invoke_traditional (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr,
int pgpinfd, int pgpoutfd, int pgperrfd,
const char *fname, const char *uids, int flags);
pid_t pgp_invoke_list_keys (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr,
int pgpinfd, int pgpoutfd, int pgperrfd,
- pgp_ring_t keyring, LIST * hints)
+ pgp_ring_t keyring, string_list_t * hints)
{
char uids[HUGE_STRING];
char tmpuids[HUGE_STRING];
return att;
}
-static LIST *pgp_add_string_to_hints (LIST * hints, const char *str)
+static string_list_t *pgp_add_string_to_hints (string_list_t * hints, const char *str)
{
char *scratch;
char *t;
pgp_key_t pgp_getkeybyaddr (address_t * a, short abilities, pgp_ring_t keyring)
{
address_t *r, *p;
- LIST *hints = NULL;
+ string_list_t *hints = NULL;
int weak = 0;
int invalid = 0;
mutt_message (_("Looking for keys matching \"%s\"..."), a->mailbox);
keys = pgp_get_candidates (keyring, hints);
- mutt_free_list (&hints);
+ string_list_wipe(&hints);
if (!keys)
return NULL;
this_key_has_weak = 1;
}
- address_delete (&r);
+ address_list_wipe(&r);
}
if (match && !this_key_has_strong && this_key_has_invalid)
pgp_key_t pgp_getkeybystr (char *p, short abilities, pgp_ring_t keyring)
{
- LIST *hints = NULL;
+ string_list_t *hints = NULL;
pgp_key_t keys;
pgp_key_t matches = NULL;
pgp_key_t *last = &matches;
hints = pgp_add_string_to_hints (hints, p);
keys = pgp_get_candidates (keyring, hints);
- mutt_free_list (&hints);
+ string_list_wipe(&hints);
if (!keys)
return NULL;
}
if (!found && (t = mutt_default_from ())) {
_smime_getkeys (t->mailbox);
- address_delete (&t);
+ address_list_wipe(&t);
}
}
if (!keyID) {
mutt_message (_("No (valid) certificate found for %s."), q->mailbox);
p_delete(&keylist);
- address_delete (&tmp);
- address_delete (&addr);
+ address_list_wipe(&tmp);
+ address_list_wipe(&addr);
return NULL;
}
sprintf (keylist + keylist_used, "%s\n", keyID); /* __SPRINTF_CHECKED__ */
keylist_used = m_strlen(keylist);
- address_delete (&addr);
+ address_list_wipe(&addr);
}
- address_delete (&tmp);
+ address_list_wipe(&tmp);
return (keylist);
}
#include "str.h"
#include "list.h"
-LIST *mutt_copy_list(LIST *p) {
- LIST *t, *r = NULL, *l = NULL;
+string_list_t *string_list_dup(const string_list_t *p) {
+ string_list_t *res = NULL;
+ string_list_t **last = &res;
for (; p; p = p->next) {
- t = p_new(LIST, 1);
- t->data = m_strdup(p->data);
- t->next = NULL;
- if (l) {
- r->next = t;
- r = r->next;
- } else {
- l = r = t;
- }
+ *last = string_item_new();
+ (*last)->data = m_strdup(p->data);
+ last = &(*last)->next;
}
- return l;
+
+ return res;
}
-LIST *mutt_add_list_n(LIST *head, const void *data, size_t len) {
- LIST *tmp;
+string_list_t *mutt_add_list_n(string_list_t *head, const void *data, size_t len) {
+ string_list_t *tmp;
for (tmp = head; tmp && tmp->next; tmp = tmp->next);
if (tmp) {
- tmp->next = p_new(LIST, 1);
+ tmp->next = p_new(string_list_t, 1);
tmp = tmp->next;
} else {
- head = tmp = p_new(LIST, 1);
+ head = tmp = p_new(string_list_t, 1);
}
tmp->data = p_dup((const char *)data, len);
return head;
}
-void mutt_free_list(LIST **list) {
- LIST *p;
-
- if (list) {
- while (*list) {
- p = *list;
- *list = (*list)->next;
- p_delete(&p->data);
- p_delete(&p);
- }
- }
-}
#ifndef MUTT_LIB_LIB_LIST_H
#define MUTT_LIB_LIB_LIST_H
+#include "mem.h"
#include "str.h"
-typedef struct list_t {
- char *data;
- struct list_t *next;
-} LIST;
-
-#define mutt_new_list() p_new(LIST, 1)
-void mutt_free_list(LIST **);
-
-LIST *mutt_copy_list(LIST *);
-
-/* add an element to a list */
-LIST *mutt_add_list_n(LIST*, const void*, size_t len);
-static inline LIST *mutt_add_list(LIST *head, const char *data) {
- size_t len = m_strlen(data);
- return mutt_add_list_n(head, data, len ? len + 1 : 0);
-}
-
-#define DO_SLIST(type, prefix) \
+#define DO_SLIST(type, prefix, dtor) \
static inline type *prefix##_list_pop(type **list) { \
if (*list) { \
type *res = *list; \
*list = NULL; \
return list; \
} \
- static inline void prefix##_list_wipe(type **list, int del) { \
- if (del) { \
- while (*list) { \
- type *item = prefix##_list_pop(list); \
- prefix##_delete(&item); \
- } \
- } else { \
- *list = NULL; \
+ static inline void prefix##_list_wipe(type **list) { \
+ while (*list) { \
+ type *item = prefix##_list_pop(list); \
+ dtor(&item); \
} \
} \
+typedef struct string_list_t {
+ struct string_list_t *next;
+ char *data;
+} string_list_t;
+
+DO_INIT(string_list_t, string_item);
+static inline void string_item_wipe(string_list_t *it) {
+ p_delete(&it->data);
+}
+DO_NEW(string_list_t, string_item);
+DO_DELETE(string_list_t, string_item);
+DO_SLIST(string_list_t, string, string_item_delete);
+
+string_list_t *string_list_dup(const string_list_t *);
+
+/* add an element to a list */
+string_list_t *mutt_add_list_n(string_list_t*, const void*, size_t len);
+static inline string_list_t *mutt_add_list(string_list_t *head, const char *data) {
+ size_t len = m_strlen(data);
+ return mutt_add_list_n(head, data, len ? len + 1 : 0);
+}
} address_t;
DO_INIT(address_t, address);
-void address_wipe(address_t *);
+static inline void address_wipe(address_t *addr) {
+ p_delete(&addr->personal);
+ p_delete(&addr->mailbox);
+}
DO_NEW(address_t, address);
DO_DELETE(address_t, address);
-DO_SLIST(address_t, address);
-
+DO_SLIST(address_t, address, address_delete);
/****************************************************************************/
/* rfc822 header parameters */
} PARAMETER;
DO_INIT(PARAMETER, parameter);
-void parameter_wipe(PARAMETER *);
+static inline void parameter_wipe(PARAMETER *param) {
+ p_delete(¶m->attribute);
+ p_delete(¶m->value);
+}
DO_NEW(PARAMETER, parameter);
DO_DELETE(PARAMETER, parameter);
-DO_SLIST(PARAMETER, parameter);
+DO_SLIST(PARAMETER, parameter, parameter_delete);
/****************************************************************************/
char *x_comment_to;
#endif
BUFFER *spam;
- LIST *references; /* message references (in reverse order) */
- LIST *in_reply_to; /* in-reply-to header content */
- LIST *userhdrs; /* user defined headers */
+ string_list_t *references; /* message references (in reverse order) */
+ string_list_t *in_reply_to; /* in-reply-to header content */
+ string_list_t *userhdrs; /* user defined headers */
unsigned int irt_changed:1; /* In-Reply-To changed to link/break threads */
unsigned int refs_changed:1; /* References changed to break thread */
} ENVELOPE;
short attach_total;
#ifdef MIXMASTER
- LIST *chain;
+ string_list_t *chain;
#endif
int refno; /* message number on server */
"x-uuencoded",
};
-void address_wipe(address_t *addr)
-{
- p_delete(&addr->personal);
- p_delete(&addr->mailbox);
- address_delete(&addr->next);
-}
-
-void parameter_wipe(PARAMETER *param)
-{
- p_delete(¶m->attribute);
- p_delete(¶m->value);
- parameter_delete(¶m->next);
-}
-
void envelope_wipe(ENVELOPE *p)
{
- address_delete(&p->return_path);
- address_delete(&p->from);
- address_delete(&p->to);
- address_delete(&p->cc);
- address_delete(&p->bcc);
- address_delete(&p->sender);
- address_delete(&p->reply_to);
- address_delete(&p->mail_followup_to);
+ address_list_wipe(&p->return_path);
+ address_list_wipe(&p->from);
+ address_list_wipe(&p->to);
+ address_list_wipe(&p->cc);
+ address_list_wipe(&p->bcc);
+ address_list_wipe(&p->sender);
+ address_list_wipe(&p->reply_to);
+ address_list_wipe(&p->mail_followup_to);
p_delete(&p->list_post);
p_delete(&p->subject);
#endif
mutt_buffer_free (&p->spam);
- mutt_free_list(&p->references);
- mutt_free_list(&p->in_reply_to);
- mutt_free_list(&p->userhdrs);
+ string_list_wipe(&p->references);
+ string_list_wipe(&p->in_reply_to);
+ string_list_wipe(&p->userhdrs);
}
void header_wipe(HEADER *h)
p_delete(&h->tree);
p_delete(&h->path);
#ifdef MIXMASTER
- mutt_free_list(&h->chain);
+ string_list_wipe(&h->chain);
#endif
p_delete(&h->data);
}
int taglen;
- LIST **last = &e->userhdrs;
+ string_list_t **last = &e->userhdrs;
if (!(t = strchr (src, ':')))
return -1;
extern const char RFC822Specials[];
ssize_t mutt_read_rfc822_line(FILE*, char**, ssize_t*);
-LIST *mutt_parse_references(char *, int);
+string_list_t *mutt_parse_references(char *, int);
int mutt_check_encoding(const char *);
int mutt_check_mime_type(const char *);
void mutt_parse_content_type(char *, BODY *);
void mutt_parse_part(FILE *, BODY *);
BODY *mutt_parse_messageRFC822(FILE *, BODY *);
BODY *mutt_parse_multipart(FILE *, const char *, off_t, int);
-LIST **mutt_parse_rfc822_line(ENVELOPE *, HEADER *, char *line, char *p,
- short weed, short do_2047, LIST **);
+string_list_t **mutt_parse_rfc822_line(ENVELOPE *, HEADER *, char *line, char *p,
+ short weed, short do_2047, string_list_t **);
ENVELOPE *mutt_read_rfc822_header(FILE *, HEADER *, short, short);
int mutt_count_body_parts (HEADER *hdr, int flags);
if (!p->attribute || !p->value) {
*headp = p->next;
p->next = NULL;
- parameter_delete(&p);
+ parameter_list_wipe(&p);
} else {
headp = &(*headp)->next;
}
s = parse_address(phrase->buf, comment, cur);
if (s && *s && *s != ',' && *s != ';') {
- address_delete(&cur);
+ address_list_wipe(&cur);
return last;
}
stbuf_append_sp(&phrase);
s = next_phrase(s, &phrase);
if (!s) {
- address_delete(&top);
+ address_list_wipe(&top);
return NULL;
}
continue;
stbuf_append_sp(&comment);
s = parse_comment(s + 1, &comment);
if (!s) {
- address_delete(&top);
+ address_list_wipe(&top);
return NULL;
}
continue;
s = parse_address(skipspaces(s + 1), &comment, cur);
if (!s || *s != '>' || !cur->mailbox) {
- address_delete(&top);
- address_delete(&cur);
+ address_list_wipe(&top);
+ address_list_wipe(&cur);
return NULL;
}
}
/* TODO: Make that a string list somehow */
-LIST *mutt_parse_references(char *s, int in_reply_to)
+string_list_t *mutt_parse_references(char *s, int in_reply_to)
{
- LIST *lst = NULL;
+ string_list_t *lst = NULL;
int n = 0;
char *o = NULL;
*/
if (new) {
char *at = strchr(new, '@');
- LIST *tmp;
+ string_list_t *tmp;
if (!at || strchr(at + 1, '@') || (in_reply_to && at - new <= 8)) {
p_delete(&new);
continue;
}
- tmp = p_new(LIST, 1);
+ tmp = p_new(string_list_t, 1);
tmp->data = new;
tmp->next = lst;
lst = tmp;
char *subtype;
p_delete(&ct->subtype);
- parameter_delete(&ct->parameter);
+ parameter_list_wipe(&ct->parameter);
/* First extract any existing parameters */
if ((pc = strchr(s, ';')) != NULL) {
if ((s = mutt_get_parameter ("name", parms)))
ct->form_name = m_strdup(s);
- parameter_delete(&parms);
+ parameter_list_wipe(&parms);
}
}
return mutt_mktime(&tm, 0) + (zoccident ? 1 : -1) * (zhours * 3600 + zminutes * 60);
}
-LIST **mutt_parse_rfc822_line(ENVELOPE *e, HEADER *hdr, char *line, char *p,
- short weed, short do_2047, LIST **user_hdrs)
+string_list_t **mutt_parse_rfc822_line(ENVELOPE *e, HEADER *hdr, char *line, char *p,
+ short weed, short do_2047, string_list_t **user_hdrs)
{
switch (mime_which_token(line, -1)) {
case MIME_APPARENTLY_FROM:
break;
case MIME_IN_REPLY_TO:
- mutt_free_list(&e->in_reply_to);
+ string_list_wipe(&e->in_reply_to);
e->in_reply_to = mutt_parse_references(p, 1);
break;
break;
case MIME_MAIL_REPLY_TO:
- address_delete (&e->reply_to);
+ address_list_wipe(&e->reply_to);
e->reply_to = rfc822_parse_adrlist(e->reply_to, p);
break;
break;
case MIME_REFERENCES:
- mutt_free_list(&e->references);
+ string_list_wipe(&e->references);
e->references = mutt_parse_references(p, 0);
break;
break;
}
- *user_hdrs = mutt_new_list();
+ *user_hdrs = string_item_new();
(*user_hdrs)->data = m_strdup(line);
if (do_2047)
rfc2047_decode(&(*user_hdrs)->data);
mutt_read_rfc822_header(FILE *f, HEADER *hdr, short user_hdrs, short weed)
{
ENVELOPE *e = envelope_new();
- LIST **last = user_hdrs ? &e->userhdrs : NULL;
+ string_list_t **last = user_hdrs ? &e->userhdrs : NULL;
char *line = p_new(char, LONG_STRING);
ssize_t linelen = LONG_STRING;
}
/* Compares mime types to the ok and except lists */
-static int count_body_parts_check(LIST **checklist, BODY *b)
+static int count_body_parts_check(string_list_t **checklist, BODY *b)
{
- LIST *type;
+ string_list_t *type;
for (type = *checklist; type; type = type->next) {
ATTACH_MATCH *a = (ATTACH_MATCH *)type->data;
unsigned char peermd[EVP_MAX_MD_SIZE];
unsigned int peermdlen;
X509 *cert;
- LIST *scert;
+ string_list_t *scert;
if (!X509_digest (peercert, EVP_sha1(), peermd, &peermdlen))
return 0;
break;
}
else {
- LIST *ref = CURHDR->env->references;
+ string_list_t *ref = CURHDR->env->references;
if (!ref) {
mutt_error (_("Article has no parent reference!"));
m_strcpy(buf, sizeof(buf), CURHDR->env->message_id);
if (op == OP_RECONSTRUCT_THREAD) {
- LIST *ref = CURHDR->env->references;
+ string_list_t *ref = CURHDR->env->references;
while (ref) {
nntp_check_msgid (Context, ref->data);
char *draftFile = NULL;
char *newMagic = NULL;
HEADER *msg = NULL;
- LIST *attach = NULL;
- LIST *commands = NULL;
- LIST *queries = NULL;
- LIST *alias_queries = NULL;
+ string_list_t *attach = NULL;
+ string_list_t *commands = NULL;
+ string_list_t *queries = NULL;
+ string_list_t *alias_queries = NULL;
int sendflags = 0;
int flags = 0;
int version = 0;
/* set defaults and read init files */
mx_init ();
mutt_init (flags & M_NOSYSRC, commands);
- mutt_free_list (&commands);
+ string_list_wipe(&commands);
/* Initialize crypto */
crypt_init ();
p_delete(&bodytext);
if (attach) {
- LIST *t = attach;
+ string_list_t *t = attach;
BODY *a = NULL;
while (t) {
if (!option (OPTNOCURSES))
mutt_endwin (NULL);
fprintf (stderr, _("%s: unable to attach file.\n"), t->data);
- mutt_free_list (&attach);
+ string_list_wipe(&attach);
exit (1);
}
t = t->next;
}
- mutt_free_list (&attach);
+ string_list_wipe(&attach);
}
ci_send_message (sendflags, msg, tempfile, NULL, NULL);
#define mutt_new_spam_list() p_new(SPAM_LIST, 1)
void mutt_free_spam_list (SPAM_LIST **);
-int mutt_matches_ignore (const char *, LIST *);
+int mutt_matches_ignore (const char *, string_list_t *);
-void mutt_init (int, LIST *);
+void mutt_init (int, string_list_t *);
typedef struct thread {
unsigned int fake_thread:1;
a = a->next;
if (b->parameter)
- parameter_delete(&b->parameter);
+ parameter_list_wipe(&b->parameter);
if (b->unlink && b->filename) {
debug_print (1, ("unlinking %s.\n", b->filename));
unlink (b->filename);
}
/* returns true if the header contained in "s" is in list "t" */
-int mutt_matches_ignore (const char *s, LIST * t)
+int mutt_matches_ignore (const char *s, string_list_t * t)
{
for (; t; t = t->next) {
if (!ascii_strncasecmp (s, t->data, m_strlen(t->data))
if (ascii_strcasecmp (attribute, q->attribute) == 0) {
*p = q->next;
q->next = NULL;
- parameter_delete(&q);
+ parameter_list_wipe(&q);
return;
}
}
/* spam and user headers should never be hashed, and the new envelope may
* have better values. Use new versions regardless. */
mutt_buffer_free (&base->spam);
- mutt_free_list (&base->userhdrs);
+ string_list_wipe(&base->userhdrs);
MOVE_ELEM(spam);
MOVE_ELEM(userhdrs);
#undef MOVE_ELEM
return (1);
}
-int mutt_cmp_list (const LIST * a, const LIST * b)
+int mutt_cmp_list (const string_list_t * a, const string_list_t * b)
{
while (a && b) {
if (m_strcmp(a->data, b->data))
void nntp_add_to_list (NNTP_SERVER * s, NNTP_DATA * d)
{
- LIST *l;
+ string_list_t *l;
if (!s || !d)
return;
- l = p_new(LIST, 1);
+ l = p_new(string_list_t, 1);
if (s->list)
s->tail->next = l;
else
{
char file[_POSIX_PATH_MAX];
char *buf, *p;
- LIST *list;
+ string_list_t *list;
ACCOUNT acct;
NNTP_SERVER *serv;
CONNECTION *conn;
hash_destroy (&serv->newsgroups, nntp_delete_data);
for (list = serv->list; list; list = list->next)
list->data = NULL;
- mutt_free_list (&serv->list);
+ string_list_wipe(&serv->list);
p_delete(&serv->newsrc);
p_delete(&serv->cache);
p_delete(&serv);
{
char *buf, *line;
NNTP_DATA *data;
- LIST *tmp;
+ string_list_t *tmp;
int r = -1;
size_t len, llen;
void nntp_clear_cacheindex (NNTP_SERVER * news)
{
NNTP_DATA *data;
- LIST *tmp;
+ string_list_t *tmp;
if (option (OPTSAVEUNSUB) || !news)
return;
char file[_POSIX_PATH_MAX];
NNTP_DATA *d;
FILE *f;
- LIST *l;
+ string_list_t *l;
if (!news || !news->newsgroups)
return -1;
/* this routine gives the first newsgroup with new messages */
void nntp_buffy (char* dst, size_t dstlen) {
- LIST *list;
+ string_list_t *list;
int count = 0;
/* forward to current group */
if (data->nserv->hasXGTITLE)
snprintf (buf, sizeof (buf), "XGTITLE %s\r\n", mask);
else
- snprintf (buf, sizeof (buf), "LIST NEWSGROUPS %s\r\n", mask);
+ snprintf (buf, sizeof (buf), "string_list_t NEWSGROUPS %s\r\n", mask);
if (mutt_nntp_fetch (data, buf, msg, bar, parse_description, data->nserv, 0) !=
0) {
#ifdef DEBUG
hdr->env->subject = m_strdup(b);
break;
case 2:
- address_delete (&hdr->env->from);
+ address_list_wipe(&hdr->env->from);
hdr->env->from = rfc822_parse_adrlist (hdr->env->from, b);
/* same as for mutt_parse_rfc822_line():
* don't leave from info NULL if there's an invalid address (or
hdr->env->message_id = m_strdup(b);
break;
case 5:
- mutt_free_list (&hdr->env->references);
+ string_list_wipe(&hdr->env->references);
hdr->env->references = mutt_parse_references (b, 0);
break;
case 6:
}
if (m_strncmp("211", buf, 3)) {
- LIST *l = serv->list;
+ string_list_t *l = serv->list;
/* GROUP command failed */
if (!m_strncmp("411", buf, 3)) {
{
char buf[LONG_STRING];
NNTP_DATA nntp_data;
- LIST *l;
- LIST emp;
+ string_list_t *l;
+ string_list_t emp;
time_t now;
struct tm *t;
{
char msg[SHORT_STRING];
NNTP_DATA nntp_data;
- LIST *tmp;
+ string_list_t *tmp;
if (nntp_open_connection (serv) < 0)
return -1;
nntp_data.nserv = serv;
nntp_data.group = NULL;
- if (mutt_nntp_fetch (&nntp_data, "LIST\r\n", msg, NULL, add_group, serv, 0) < 0) {
+ if (mutt_nntp_fetch (&nntp_data, "string_list_t\r\n", msg, NULL, add_group, serv, 0) < 0) {
#ifdef DEBUG
- nntp_error ("nntp_get_active()", "LIST\r\n");
+ nntp_error ("nntp_get_active()", "string_list_t\r\n");
#endif
return -1;
}
time_t newgroups_time;
time_t check_time;
HASH *newsgroups;
- LIST *list; /* list of newsgroups */
- LIST *tail; /* last entry of list */
+ string_list_t *list; /* list of newsgroups */
+ string_list_t *tail; /* last entry of list */
CONNECTION *conn;
} NNTP_SERVER;
return pat->alladdr; /* No matches, or all matches if alladdr */
}
-static int match_reference (pattern_t* pat, LIST * refs)
+static int match_reference (pattern_t* pat, string_list_t * refs)
{
for (; refs; refs = refs->next)
if (patmatch (pat, refs->data) == 0)
return PFD_FUNCT_ERROR;
}
- snprintf (buf, sizeof (buf), "LIST %d\r\n", h->refno);
+ snprintf (buf, sizeof (buf), "string_list_t %d\r\n", h->refno);
ret = pop_query (pop_data, buf, sizeof (buf));
if (ret == PQ_OK) {
sscanf (buf, "+OK %d %ld", &index, &length);
{
HEADER *h;
int code = SENDPOSTPONED;
- LIST *tmp;
- LIST *last = NULL;
- LIST *next;
+ string_list_t *tmp;
+ string_list_t *last = NULL;
+ string_list_t *next;
char *p;
int opt_delete;
else
hdr->env->userhdrs = tmp->next;
tmp->next = NULL;
- mutt_free_list (&tmp);
+ string_list_wipe(&tmp);
tmp = next;
if (*cur)
code |= SENDREPLY;
else
hdr->env->userhdrs = tmp->next;
tmp->next = NULL;
- mutt_free_list (&tmp);
+ string_list_wipe(&tmp);
tmp = next;
}
else if ((m_strncmp("Pgp:", tmp->data, 4) == 0 /* this is generated
else
hdr->env->userhdrs = tmp->next;
tmp->next = NULL;
- mutt_free_list (&tmp);
+ string_list_wipe(&tmp);
tmp = next;
}
else if (m_strncmp("X-Mutt-SMIME:", tmp->data, 13) == 0) {
else
hdr->env->userhdrs = tmp->next;
tmp->next = NULL;
- mutt_free_list (&tmp);
+ string_list_wipe(&tmp);
tmp = next;
}
else if (m_strncmp("X-Mutt-Mix:", tmp->data, 11) == 0) {
char *t;
- mutt_free_list (&hdr->chain);
+ string_list_wipe(&hdr->chain);
t = strtok (tmp->data + 11, " \t\n");
while (t) {
else
hdr->env->userhdrs = tmp->next;
tmp->next = NULL;
- mutt_free_list (&tmp);
+ string_list_wipe(&tmp);
tmp = next;
}
#endif
CONTENT *mutt_get_content_info (const char *fname, BODY * b);
-LIST *mutt_make_references (ENVELOPE * e);
+string_list_t *mutt_make_references (ENVELOPE * e);
HEADER *mutt_dup_header (HEADER *);
int mutt_cmp_header (const HEADER*, const HEADER*);
int mutt_cmp_addr (const address_t * a, const address_t * b);
-int mutt_cmp_list (const LIST * a, const LIST * b);
+int mutt_cmp_list (const string_list_t * a, const string_list_t * b);
int mutt_cmp_env (const ENVELOPE * e1, const ENVELOPE * e2);
int mutt_cmp_param (const PARAMETER * p1, const PARAMETER * p2);
int mutt_cmp_body (const BODY * b1, const BODY * b2);
void mutt_account_hook (const char *url);
void mutt_add_to_reference_headers (ENVELOPE * env, ENVELOPE * curenv,
- LIST *** pp, LIST *** qq);
+ string_list_t *** pp, string_list_t *** qq);
void mutt_adv_mktemp (const char*, char*, size_t);
int mutt_bounce_message (FILE * fp, HEADER *, address_t *);
void mutt_canonical_charset (char *, size_t, const char *);
void mutt_tag_set_flag (int, int);
void mutt_update_encoding (BODY * a);
void mutt_version (void);
-void mutt_write_references (LIST *, FILE *);
+void mutt_write_references (string_list_t *, FILE *);
void mutt_write_address_list (address_t * adr, FILE * fp, int linelen,
int display);
int mutt_parse_unhook (BUFFER *, BUFFER *, unsigned long, BUFFER *);
int mutt_pattern_func (int, char *);
int mutt_query_complete (char *, size_t);
-int mutt_query_variables (LIST * queries);
+int mutt_query_variables (string_list_t * queries);
int _mutt_save_message (HEADER *, CONTEXT *, int, int, int);
int mutt_save_message (HEADER *, int, int, int, int *);
int mutt_search_command (int, int);
mutt_addrlist_to_local (tmpa);
buf[0] = '\0';
rfc822_write_address (buf, buflen, tmpa, 0);
- address_delete (&tmpa);
+ address_list_wipe(&tmpa);
mutt_clear_error ();
return (0);
}
if (op == OP_QUERY) {
queryp = results;
while (queryp) {
- address_delete (&queryp->addr);
+ address_list_wipe(&queryp->addr);
p_delete(&queryp->name);
p_delete(&queryp->other);
results = queryp->next;
address_t *a = result_to_addr (QueryTable[menu->current].data);
mutt_create_alias (NULL, a);
- address_delete (&a);
+ address_list_wipe(&a);
}
break;
tagged = 1;
rfc822_write_address (buf, buflen, tmpa, 0);
curpos = m_strlen(buf);
- address_delete (&tmpa);
+ address_list_wipe(&tmpa);
}
else if (curpos + 2 < buflen) {
address_t *tmpa = result_to_addr (QueryTable[i].data);
rfc822_write_address ((char *) buf + curpos + 1,
buflen - curpos - 1, tmpa, 0);
curpos = m_strlen(buf);
- address_delete (&tmpa);
+ address_list_wipe(&tmpa);
}
}
}
mutt_addrlist_to_local (tmpa);
rfc822_write_address (buf, buflen, tmpa, 0);
- address_delete (&tmpa);
+ address_list_wipe(&tmpa);
}
}
queryp = results;
while (queryp) {
- address_delete (&queryp->addr);
+ address_list_wipe(&queryp->addr);
p_delete(&queryp->name);
p_delete(&queryp->other);
results = queryp->next;
if (mutt_addrlist_to_idna (adr, &err) < 0) {
mutt_error (_("Bad IDN: '%s'"), err);
p_delete(&err);
- address_delete (&adr);
+ address_list_wipe(&adr);
return;
}
}
if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) {
- address_delete (&adr);
+ address_list_wipe(&adr);
CLEARLINE (LINES - 1);
mutt_message (p ? _("Message not bounced.") : _("Messages not bounced."));
return;
if (parent)
mutt_add_to_reference_headers (env, curenv, NULL, NULL);
else {
- LIST **p = NULL, **q = NULL;
+ string_list_t **p = NULL, **q = NULL;
for (i = 0; i < idxlen; i++) {
if (idx[i]->content->tagged)
};
-void mix_make_chain (LIST ** chainp, int *redraw)
+void mix_make_chain (string_list_t ** chainp, int *redraw)
{
- LIST *p;
+ string_list_t *p;
MIXCHAIN *chain;
int c_cur = 0, c_old = 0;
int m_len;
for (p = *chainp; p; p = p->next)
mix_chain_add (chain, (char *) p->data, type2_list);
- mutt_free_list (chainp);
+ string_list_wipe(chainp);
/* safety check */
for (i = 0; i < chain->cl; i++) {
return 0;
}
-int mix_send_message (LIST * chain, const char *tempfile)
+int mix_send_message (string_list_t * chain, const char *tempfile)
{
char cmd[HUGE_STRING];
char tmp[HUGE_STRING];
typedef struct mixchain MIXCHAIN;
-int mix_send_message (LIST *, const char *);
+int mix_send_message (string_list_t *, const char *);
int mix_check_message (HEADER * msg);
-void mix_make_chain (LIST **, int *);
+void mix_make_chain (string_list_t **, int *);
#endif /* MIXMASTER */
if (prev) {
prev->next = b->next;
b->next = NULL;
- address_delete (&b);
+ address_list_wipe(&b);
b = prev;
}
else {
top = top->next;
b->next = NULL;
- address_delete (&b);
+ address_list_wipe(&b);
b = top;
}
}
a = a->next;
if (!leave_only || a || last) {
tmp->next = NULL;
- address_delete (&tmp);
+ address_list_wipe(&tmp);
}
else
last = top = tmp;
rfc822_write_address (buf, sizeof (buf), *a, 0);
if (mutt_get_field (field, buf, sizeof (buf), M_ALIAS) != 0)
return (-1);
- address_delete (a);
+ address_list_wipe(a);
*a = mutt_expand_aliases (mutt_parse_adrlist (NULL, buf));
if ((idna_ok = mutt_addrlist_to_idna (*a, &err)) != 0) {
mutt_error (_("Error: '%s' is a bad IDN."), err);
static int edit_envelope (ENVELOPE * en, int flags)
{
char buf[HUGE_STRING];
- LIST *uh = UserHeader;
+ string_list_t *uh = UserHeader;
regmatch_t pat_match[1];
#ifdef USE_NNTP
static void process_user_recips (ENVELOPE * env)
{
- LIST *uh = UserHeader;
+ string_list_t *uh = UserHeader;
for (; uh; uh = uh->next) {
if (ascii_strncasecmp ("to:", uh->data, 3) == 0)
static void process_user_header (ENVELOPE * env)
{
- LIST *uh = UserHeader;
- LIST *last = env->userhdrs;
+ string_list_t *uh = UserHeader;
+ string_list_t *last = env->userhdrs;
if (last)
while (last->next)
for (; uh; uh = uh->next) {
if (ascii_strncasecmp ("from:", uh->data, 5) == 0) {
/* User has specified a default From: address. Remove default address */
- address_delete (&env->from);
+ address_list_wipe(&env->from);
env->from = rfc822_parse_adrlist (env->from, uh->data + 5);
}
else if (ascii_strncasecmp ("reply-to:", uh->data, 9) == 0) {
- address_delete (&env->reply_to);
+ address_list_wipe(&env->reply_to);
env->reply_to = rfc822_parse_adrlist (env->reply_to, uh->data + 9);
}
else if (ascii_strncasecmp ("message-id:", uh->data, 11) == 0)
ascii_strncasecmp ("supersedes:", uh->data, 11) != 0 &&
ascii_strncasecmp ("subject:", uh->data, 8) != 0) {
if (last) {
- last->next = mutt_new_list ();
+ last->next = string_item_new();
last = last->next;
}
else
- last = env->userhdrs = mutt_new_list ();
+ last = env->userhdrs = string_item_new();
last->data = m_strdup(uh->data);
}
}
return 0;
}
-LIST *mutt_make_references (ENVELOPE * e)
+string_list_t *mutt_make_references (ENVELOPE * e)
{
- LIST *t = NULL, *l = NULL;
+ string_list_t *t = NULL, *l = NULL;
if (e->references)
- l = mutt_copy_list (e->references);
+ l = string_list_dup(e->references);
else
- l = mutt_copy_list (e->in_reply_to);
+ l = string_list_dup(e->in_reply_to);
if (e->message_id) {
- t = mutt_new_list ();
+ t = string_item_new();
t->data = m_strdup(e->message_id);
t->next = l;
l = t;
}
void mutt_add_to_reference_headers (ENVELOPE * env, ENVELOPE * curenv,
- LIST *** pp, LIST *** qq)
+ string_list_t *** pp, string_list_t *** qq)
{
- LIST **p = NULL, **q = NULL;
+ string_list_t **p = NULL, **q = NULL;
if (pp)
p = *pp;
*p = mutt_make_references (curenv);
if (curenv->message_id) {
- *q = mutt_new_list ();
+ *q = string_item_new();
(*q)->data = m_strdup(curenv->message_id);
}
if (!curenv) {
HEADER *h;
- LIST **p = NULL, **q = NULL;
+ string_list_t **p = NULL, **q = NULL;
int i;
for (i = 0; i < ctx->vcount; i++) {
/* Use any list-post header as a template */
url_parse_mailto (msg->env, NULL, cur->env->list_post);
/* We don't let them set the sender's address. */
- address_delete (&msg->env->from);
+ address_list_wipe(&msg->env->from);
}
if (!(flags & (SENDKEY | SENDPOSTPONED | SENDRESEND))) {
msg->replied = 0;
if (killfrom) {
- address_delete (&msg->env->from);
+ address_list_wipe(&msg->env->from);
killfrom = 0;
}
}
mutt_select_fcc (fcc, sizeof (fcc), msg);
if (killfrom) {
- address_delete (&msg->env->from);
+ address_list_wipe(&msg->env->from);
killfrom = 0;
}
}
/* need to write the list in reverse because they are stored in reverse order
* when parsed to speed up threading
*/
-void mutt_write_references (LIST * r, FILE * f)
+void mutt_write_references (string_list_t * r, FILE * f)
{
- LIST **ref = NULL;
+ string_list_t **ref = NULL;
int refcnt = 0, refmax = 0;
for (; (TrimRef == 0 || refcnt < TrimRef) && r; r = r->next) {
{
char buffer[LONG_STRING];
char *p;
- LIST *tmp = env->userhdrs;
+ string_list_t *tmp = env->userhdrs;
int has_agent = 0; /* user defined user-agent header field exists */
list2_t* hdrs = list_from_str (EditorHeaders, " ");
return (ferror (fp) == 0 ? 0 : -1);
}
-static void encode_headers (LIST * h)
+static void encode_headers (string_list_t * h)
{
char *tmp;
char *p;
void mutt_unprepare_envelope (ENVELOPE * env)
{
- LIST *item;
+ string_list_t *item;
for (item = env->userhdrs; item; item = item->next)
rfc2047_decode (&item->data);
- address_delete (&env->mail_followup_to);
+ address_list_wipe(&env->mail_followup_to);
/* back conversions */
rfc2047_decode_adrlist (env->to);
ret = _mutt_bounce_message (fp, h, to, resent_from, from);
- address_delete (&from);
+ address_list_wipe(&from);
return ret;
}
*last = addr->next;
addr->next = NULL;
- address_delete (&addr);
+ address_list_wipe(&addr);
addr = *last;
}
*/
if (post && hdr->chain && hdr->chain) {
- LIST *p;
+ string_list_t *p;
fputs ("X-Mutt-Mix:", msg->fp);
for (p = hdr->chain; p; p = p->next)
* has no message, we have to make a list of all the subjects of its
* most immediate existing descendants. we also note the earliest
* date on any of the parents and put it in *dateptr. */
-static LIST *make_subject_list (THREAD * cur, time_t * dateptr)
+static string_list_t *make_subject_list (THREAD * cur, time_t * dateptr)
{
THREAD *start = cur;
ENVELOPE *env;
time_t thisdate;
- LIST *curlist, *oldlist, *newlist, *subjects = NULL;
+ string_list_t *curlist, *oldlist, *newlist, *subjects = NULL;
int rc = 0;
for (;;) {
break;
}
if (!curlist || rc > 0) {
- newlist = p_new(LIST, 1);
+ newlist = p_new(string_list_t, 1);
newlist->data = env->real_subj;
if (oldlist) {
newlist->next = oldlist->next;
struct hash_elem *ptr;
THREAD *tmp, *last = NULL;
int hash;
- LIST *subjects = NULL, *oldlist;
+ string_list_t *subjects = NULL, *oldlist;
time_t date = 0;
subjects = make_subject_list (cur, &date);
HEADER *cur;
int i, oldsort, using_refs = 0;
THREAD *thread, *new, *tmp, top;
- LIST *ref = NULL;
+ string_list_t *ref = NULL;
/* set Sort to the secondary method to support the set sort_aux=reverse-*
* settings. The sorting functions just look at the value of
static void clean_references (THREAD * brk, THREAD * cur)
{
THREAD *p;
- LIST *ref = NULL;
+ string_list_t *ref = NULL;
int done = 0;
for (; cur; cur = cur->next, done = 0) {
HEADER *h = cur->message;
/* clearing the References: header from obsolete Message-ID(s) */
- mutt_free_list (&ref->next);
+ string_list_wipe(&ref->next);
h->env->refs_changed = h->changed = 1;
}
void mutt_break_thread (HEADER * hdr)
{
- mutt_free_list (&hdr->env->in_reply_to);
- mutt_free_list (&hdr->env->references);
+ string_list_wipe(&hdr->env->in_reply_to);
+ string_list_wipe(&hdr->env->references);
hdr->env->irt_changed = hdr->env->refs_changed = hdr->changed = 1;
clean_references (hdr->thread, hdr->thread->child);
}
mutt_break_thread (child);
- child->env->in_reply_to = mutt_new_list ();
+ child->env->in_reply_to = string_item_new();
child->env->in_reply_to->data = m_strdup(parent->env->message_id);
mutt_set_flag (ctx, child, M_TAG, 0);