Changeset 827:08dd55cf4de1 for compose.c

Show
Ignore:
Timestamp:
1999-02-02 07:47:44 (10 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
HEAD
Message:

Merging the external character set patch into unstable.
Additionally, this change introduces a M_CHARCONV state flag which
gives us some more control about when character set conversions are
actually done. Current versions of mutt would happily apply
character set conversions when, e.g., saving a text/plain attachment
to a file. (We had at least one corrupt russing translation file
due to this mis-feature.)

Additionally, we clean up some of the character set related code in
handler.c. Most of that is now done by the decoder functions in
charset.c.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • compose.c

    r799 r827  
    2626#include "mailbox.h" 
    2727#include "sort.h" 
     28#include "charset.h" 
    2829 
    2930#ifdef MIXMASTER 
     
    386387} 
    387388 
     389static int change_attachment_charset (BODY *b) 
     390{ 
     391  char buff[SHORT_STRING]; 
     392 
     393  if (b->type != TYPETEXT) 
     394  { 
     395    mutt_error _("Can't change character set for non-text attachments!"); 
     396    return 0; 
     397  } 
     398 
     399  mutt_get_send_charset (buff, sizeof(buff), b, 0); 
     400   
     401  if (mutt_get_field (_("Enter character set: "), buff, sizeof(buff), 0) == -1) 
     402    return 0; 
     403     
     404  if (mutt_is_utf8(buff)) 
     405  { 
     406    mutt_error (_("UTF-8 encoding attachments has not yet been implemented.")); 
     407    return 0; 
     408  } 
     409   
     410  if (mutt_get_charset (buff) == NULL) 
     411  { 
     412    mutt_error (_("Character set %s is unknown."), buff); 
     413    return 0; 
     414  } 
     415   
     416  mutt_set_body_charset (b, buff); 
     417  return REDRAW_CURRENT; 
     418} 
    388419 
    389420/* return values: 
     
    726757        break; 
    727758 
     759      case OP_COMPOSE_CHANGE_CHARSET: 
     760        CHECK_COUNT; 
     761        menu->redraw = change_attachment_charset(idx[menu->current]->content); 
     762        break; 
     763 
     764      case OP_COMPOSE_NORECODE: 
     765        CHECK_COUNT; 
     766        if (idx[menu->current]->content->type != TYPETEXT) 
     767        { 
     768          mutt_error (_("Recoding only affects text/plain attachments.")); 
     769          break; 
     770        } 
     771        idx[menu->current]->content->noconv = !idx[menu->current]->content->noconv; 
     772        if (idx[menu->current]->content->noconv) 
     773          mutt_message (_("The current attachment won't be converted.")); 
     774        else 
     775          mutt_message (_("The current attachment will be converted.")); 
     776        menu->redraw = REDRAW_CURRENT; 
     777        break; 
     778       
    728779      case OP_COMPOSE_EDIT_DESCRIPTION: 
    729780        CHECK_COUNT; 
     
    866917        CHECK_COUNT; 
    867918        idx[menu->current]->content->unlink = !idx[menu->current]->content->unlink; 
    868         if (option (OPTRESOLVE) && menu->current + 1 < menu->max) 
     919 
     920#if 0 
     921        /* OPTRESOLVE is otherwise ignored on this menu. 
     922         * Where's the bug? 
     923         */ 
     924 
     925        if (option (OPTRESOLVE) && menu->current + 1 < menu->max) 
    869926          menu->current++; 
     927# endif 
    870928        menu->redraw = REDRAW_INDEX; 
    871929        break; 
     
    11141172#endif /* _PGPPATH */ 
    11151173 
     1174 
    11161175#ifdef MIXMASTER 
    11171176      case OP_COMPOSE_MIX: