- for(q = *p; q; q = q->next)
- {
- if (ascii_strcasecmp (attribute, q->attribute) == 0)
- {
- mutt_str_replace (&q->value, value);
- return;
- }
- }
-
- q = mutt_new_parameter();
- q->attribute = safe_strdup(attribute);
- q->value = safe_strdup(value);
- q->next = *p;
- *p = q;
-}
-
-void mutt_delete_parameter (const char *attribute, PARAMETER **p)
-{
- PARAMETER *q;
-
- for (q = *p; q; p = &q->next, q = q->next)
- {
- if (ascii_strcasecmp (attribute, q->attribute) == 0)
- {
- *p = q->next;
- q->next = NULL;
- mutt_free_parameter (&q);
- return;
- }
- }
-}
-
-/* returns 1 if Mutt can't display this type of data, 0 otherwise */
-int mutt_needs_mailcap (BODY *m)
-{
- switch (m->type)
- {
- case TYPETEXT:
-
- if (!ascii_strcasecmp ("plain", m->subtype) ||
- !ascii_strcasecmp ("rfc822-headers", m->subtype) ||
- !ascii_strcasecmp ("enriched", m->subtype))
- return 0;
- break;
-
- case TYPEAPPLICATION:
- if((WithCrypto & APPLICATION_PGP) && mutt_is_application_pgp(m))
- return 0;
- if((WithCrypto & APPLICATION_SMIME) && mutt_is_application_smime(m))
- return 0;
- break;
-
- case TYPEMULTIPART:
- case TYPEMESSAGE:
- return 0;
- }
-
- return 1;
-}
-
-int mutt_is_text_part (BODY *b)
-{
- int t = b->type;
- char *s = b->subtype;
-
- if ((WithCrypto & APPLICATION_PGP) && mutt_is_application_pgp (b))
- return 0;
-
- if (t == TYPETEXT)
- return 1;
-
- if (t == TYPEMESSAGE)
- {
- if (!ascii_strcasecmp ("delivery-status", s))
- return 1;
- }
-
- if ((WithCrypto & APPLICATION_PGP) && t == TYPEAPPLICATION)
- {
- if (!ascii_strcasecmp ("pgp-keys", s))
- return 1;
- }
-
- return 0;
-}
-
-void mutt_free_envelope (ENVELOPE **p)
-{
- if (!*p) return;
- rfc822_free_address (&(*p)->return_path);
- rfc822_free_address (&(*p)->from);
- rfc822_free_address (&(*p)->to);
- rfc822_free_address (&(*p)->cc);
- rfc822_free_address (&(*p)->bcc);
- rfc822_free_address (&(*p)->sender);
- rfc822_free_address (&(*p)->reply_to);
- rfc822_free_address (&(*p)->mail_followup_to);
-
- FREE (&(*p)->list_post);
- FREE (&(*p)->subject);
- /* real_subj is just an offset to subject and shouldn't be freed */
- FREE (&(*p)->message_id);
- FREE (&(*p)->supersedes);
- FREE (&(*p)->date);
- FREE (&(*p)->x_label);
- FREE (&(*p)->organization);
-#ifdef USE_NNTP
- FREE (&(*p)->newsgroups);
- FREE (&(*p)->xref);
- FREE (&(*p)->followup_to);
- FREE (&(*p)->x_comment_to);
-#endif
-
- mutt_buffer_free (&(*p)->spam);
- mutt_free_list (&(*p)->references);
- mutt_free_list (&(*p)->in_reply_to);
- mutt_free_list (&(*p)->userhdrs);
- FREE (p);