Changeset 835:6f4b052f193a for compose.c
Legend:
- Unmodified
- Added
- Removed
-
compose.c
r827 r835 391 391 char buff[SHORT_STRING]; 392 392 393 if ( b->type != TYPETEXT)393 if (!mutt_is_text_type (b->type, b->subtype)) 394 394 { 395 395 mutt_error _("Can't change character set for non-text attachments!"); … … 404 404 if (mutt_is_utf8(buff)) 405 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) 406 if (!b->noconv) 407 { 408 mutt_error (_("UTF-8 encoding attachments has not yet been implemented.")); 409 return 0; 410 } 411 } 412 else if (mutt_get_charset (buff) == NULL) 411 413 { 412 414 mutt_error (_("Character set %s is unknown."), buff); … … 762 764 break; 763 765 764 case OP_COMPOSE_NORECODE: 766 #define CURRENT idx[menu->current]->content 767 768 case OP_COMPOSE_TOGGLE_RECODE: 769 { 765 770 CHECK_COUNT; 766 if ( idx[menu->current]->content->type != TYPETEXT)771 if (!mutt_is_text_type (CURRENT->type, CURRENT->subtype)) 767 772 { 768 mutt_error (_("Recoding only affects text /plainattachments."));773 mutt_error (_("Recoding only affects text attachments.")); 769 774 break; 770 775 } 771 idx[menu->current]->content->noconv = !idx[menu->current]->content->noconv; 772 if (idx[menu->current]->content->noconv) 776 if (mutt_is_utf8 (mutt_get_parameter ("charset", CURRENT->parameter))) 777 { 778 mutt_error (_("We currently can't encode to utf-8.")); 779 break; 780 } 781 CURRENT->noconv = !CURRENT->noconv; 782 if (CURRENT->noconv) 773 783 mutt_message (_("The current attachment won't be converted.")); 774 784 else … … 776 786 menu->redraw = REDRAW_CURRENT; 777 787 break; 778 788 } 789 790 case OP_COMPOSE_RECODE: 791 { 792 const char *chs; 793 int rv; 794 795 CHECK_COUNT; 796 if (!mutt_is_text_type (CURRENT->type, CURRENT->subtype)) 797 { 798 mutt_error (_("Recoding only affetcs text attachments.")); 799 break; 800 } 801 802 if (!(chs = mutt_get_parameter ("charset", CURRENT->parameter))) 803 chs = SendCharset; 804 805 if (CURRENT->noconv) 806 rv = mutt_recode_file (CURRENT->filename, chs, Charset); 807 else 808 rv = mutt_recode_file (CURRENT->filename, Charset, chs); 809 810 mutt_update_encoding (CURRENT); 811 812 if (rv == 0) 813 { 814 mutt_message (_("Recoding successful.")); 815 CURRENT->noconv = !CURRENT->noconv; 816 } 817 818 menu->redraw = REDRAW_CURRENT; 819 break; 820 } 821 #undef CURRENT 822 779 823 case OP_COMPOSE_EDIT_DESCRIPTION: 780 824 CHECK_COUNT;
