Show
Ignore:
Timestamp:
2000-01-08 01:38:10 (9 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
HEAD
Message:

Unified edit-type function for the index, compose, and
receive-attachment menus. Mostly by Michael Elkins.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • commands.c

    r1423 r1426  
    751751  mutt_message ("Mutt %s (%s)", MUTT_VERSION, ReleaseDate); 
    752752} 
     753 
     754void mutt_edit_content_type (HEADER *h, BODY *b) 
     755{ 
     756  char buf[LONG_STRING]; 
     757  char tmp[STRING]; 
     758  PARAMETER *p; 
     759   
     760  snprintf (buf, sizeof (buf), "%s/%s", TYPE (b), b->subtype); 
     761  if (b->parameter) 
     762  { 
     763    size_t l; 
     764     
     765    for (p = b->parameter; p; p = p->next) 
     766    { 
     767      l = strlen (buf); 
     768 
     769      rfc822_cat (tmp, sizeof (tmp), p->value, MimeSpecials); 
     770      snprintf (buf + l, sizeof (buf) - l, "; %s=%s", p->attribute, tmp); 
     771    } 
     772  } 
     773   
     774  if (mutt_get_field ("Content-Type: ", buf, sizeof (buf), 0) != 0 || 
     775      buf[0] == 0) 
     776    return; 
     777   
     778  /* clean up previous junk */ 
     779  mutt_free_parameter (&b->parameter); 
     780  FREE (&b->subtype); 
     781   
     782  mutt_parse_content_type (buf, b); 
     783   
     784  mutt_message ("Content-Type changed to %s/%s.", TYPE (b), 
     785                NONULL (b->subtype)); 
     786   
     787  if (!is_multipart (b) && b->parts) 
     788    mutt_free_body (&b->parts); 
     789  if (!mutt_is_message_type (b->type, b->subtype) && b->hdr) 
     790  { 
     791    b->hdr->content = NULL; 
     792    mutt_free_header (&b->hdr); 
     793  } 
     794 
     795#ifdef _PGPPATH 
     796  if (h) 
     797  { 
     798    if (h->content == b) 
     799      h->pgp = 0; 
     800    h->pgp |= pgp_query (b); 
     801  } 
     802#endif /* _PGPPATH */ 
     803 
     804}