⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compose.c

📁 mutt-1.5.12 源代码。linux 下邮件接受的工具。
💻 C
📖 第 1 页 / 共 3 页
字号:
      case OP_COMPOSE_UPDATE_ENCODING:        CHECK_COUNT;        if (menu->tagprefix)        {	  BODY *top;	  for (top = msg->content; top; top = top->next)	  {	    if (top->tagged)	      mutt_update_encoding (top);	  }	  menu->redraw = REDRAW_FULL;	}        else        {          mutt_update_encoding(idx[menu->current]->content);	  menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;	}        mutt_message_hook (NULL, msg, M_SEND2HOOK);        break;            case OP_COMPOSE_TOGGLE_DISPOSITION:	/* toggle the content-disposition between inline/attachment */	idx[menu->current]->content->disposition = (idx[menu->current]->content->disposition == DISPINLINE) ? DISPATTACH : DISPINLINE;	menu->redraw = REDRAW_CURRENT;	break;      case OP_EDIT_TYPE:	CHECK_COUNT;        {	  mutt_edit_content_type (NULL, idx[menu->current]->content, NULL);	  /* this may have been a change to text/something */	  mutt_update_encoding (idx[menu->current]->content);	  menu->redraw = REDRAW_CURRENT;	}        mutt_message_hook (NULL, msg, M_SEND2HOOK);        break;      case OP_COMPOSE_EDIT_ENCODING:	CHECK_COUNT;	strfcpy (buf, ENCODING (idx[menu->current]->content->encoding),							      sizeof (buf));	if (mutt_get_field ("Content-Transfer-Encoding: ", buf,					    sizeof (buf), 0) == 0 && buf[0])	{	  if ((i = mutt_check_encoding (buf)) != ENCOTHER && i != ENCUUENCODED)	  {	    idx[menu->current]->content->encoding = i;	    menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;	    mutt_clear_error();	  }	  else	    mutt_error _("Invalid encoding.");	}        mutt_message_hook (NULL, msg, M_SEND2HOOK);        break;      case OP_COMPOSE_SEND_MESSAGE:        /* Note: We don't invoke send2-hook here, since we want to leave	 * users an opportunity to change settings from the ":" prompt.	 */              if(check_attachments(idx, idxlen) != 0)        {	  menu->redraw = REDRAW_FULL;	  break;	}      #ifdef MIXMASTER        if (msg->chain && mix_check_message (msg) != 0)	  break;#endif      	if (!fccSet && *fcc)	{	  if ((i = query_quadoption (OPT_COPY,				_("Save a copy of this message?"))) == -1)	    break;	  else if (i == M_NO)	    *fcc = 0;	}	loop = 0;	r = 0;	break;      case OP_COMPOSE_EDIT_FILE:	CHECK_COUNT;	mutt_edit_file (NONULL(Editor), idx[menu->current]->content->filename);	mutt_update_encoding (idx[menu->current]->content);	menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;        mutt_message_hook (NULL, msg, M_SEND2HOOK);	break;      case OP_COMPOSE_TOGGLE_UNLINK:	CHECK_COUNT;	idx[menu->current]->content->unlink = !idx[menu->current]->content->unlink;#if 0        /* OPTRESOLVE is otherwise ignored on this menu.	 * Where's the bug?	 */        if (option (OPTRESOLVE) && menu->current + 1 < menu->max)	  menu->current++;# endif	menu->redraw = REDRAW_INDEX;        /* No send2hook since this doesn't change the message. */	break;      case OP_COMPOSE_GET_ATTACHMENT:        CHECK_COUNT;        if(menu->tagprefix)        {	  BODY *top;	  for(top = msg->content; top; top = top->next)	  {	    if(top->tagged)	      mutt_get_tmp_attachment(top);	  }	  menu->redraw = REDRAW_FULL;	}        else if (mutt_get_tmp_attachment(idx[menu->current]->content) == 0)	  menu->redraw = REDRAW_CURRENT;        /* No send2hook since this doesn't change the message. */        break;            case OP_COMPOSE_RENAME_FILE:	CHECK_COUNT;	strfcpy (fname, idx[menu->current]->content->filename, sizeof (fname));	mutt_pretty_mailbox (fname);	if (mutt_get_field (_("Rename to: "), fname, sizeof (fname), M_FILE)							== 0 && fname[0])	{	  if (stat(idx[menu->current]->content->filename, &st) == -1)	  {	    mutt_error (_("Can't stat %s: %s"), fname, strerror (errno));	    break;	  }	  mutt_expand_path (fname, sizeof (fname));	  if(mutt_rename_file (idx[menu->current]->content->filename, fname))	    break;	  	  mutt_str_replace (&idx[menu->current]->content->filename, fname);	  menu->redraw = REDRAW_CURRENT;	  if(idx[menu->current]->content->stamp >= st.st_mtime)	    mutt_stamp_attachment(idx[menu->current]->content);	  	}        mutt_message_hook (NULL, msg, M_SEND2HOOK);        break;      case OP_COMPOSE_NEW_MIME:	{	  char type[STRING];	  char *p;	  int itype;	  FILE *fp;	  CLEARLINE (LINES-1);	  fname[0] = 0;	  if (mutt_get_field (_("New file: "), fname, sizeof (fname), M_FILE)	      != 0 || !fname[0])	    continue;	  mutt_expand_path (fname, sizeof (fname));	  /* Call to lookup_mime_type () ?  maybe later */	  type[0] = 0;	  if (mutt_get_field ("Content-Type: ", type, sizeof (type), 0) != 0 	      || !type[0])	    continue;	  if (!(p = strchr (type, '/')))	  {	    mutt_error _("Content-Type is of the form base/sub");	    continue;	  }	  *p++ = 0;	  if ((itype = mutt_check_mime_type (type)) == TYPEOTHER)	  {	    mutt_error (_("Unknown Content-Type %s"), type);	    continue;	  }	  if (idxlen == idxmax)	  {	    safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5));	    menu->data = idx;	  }	  idx[idxlen] = (ATTACHPTR *) safe_calloc (1, sizeof (ATTACHPTR));	  /* Touch the file */	  if (!(fp = safe_fopen (fname, "w")))	  {	    mutt_error (_("Can't create file %s"), fname);	    FREE (&idx[idxlen]);	    continue;	  }	  fclose (fp);	  if ((idx[idxlen]->content = mutt_make_file_attach (fname)) == NULL)	  {	    mutt_error _("What we have here is a failure to make an attachment");	    continue;	  }	  update_idx (menu, idx, idxlen++);	  idx[menu->current]->content->type = itype;	  mutt_str_replace (&idx[menu->current]->content->subtype, p);	  idx[menu->current]->content->unlink = 1;	  menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;	  if (mutt_compose_attachment (idx[menu->current]->content))	  {	    mutt_update_encoding (idx[menu->current]->content);	    menu->redraw = REDRAW_FULL;	  }	}        mutt_message_hook (NULL, msg, M_SEND2HOOK);            break;      case OP_COMPOSE_EDIT_MIME:	CHECK_COUNT;	if (mutt_edit_attachment (idx[menu->current]->content))	{	  mutt_update_encoding (idx[menu->current]->content);	  menu->redraw = REDRAW_FULL;	}        mutt_message_hook (NULL, msg, M_SEND2HOOK);        break;      case OP_VIEW_ATTACH:      case OP_DISPLAY_HEADERS:	CHECK_COUNT;	mutt_attach_display_loop (menu, op, NULL, NULL, NULL, &idx, &idxlen, NULL, 0);	menu->redraw = REDRAW_FULL;        /* no send2hook, since this doesn't modify the message */	break;      case OP_SAVE:	CHECK_COUNT;	mutt_save_attachment_list (NULL, menu->tagprefix, menu->tagprefix ?  msg->content : idx[menu->current]->content, NULL, menu);	MAYBE_REDRAW (menu->redraw);        /* no send2hook, since this doesn't modify the message */	break;      case OP_PRINT:	CHECK_COUNT;	mutt_print_attachment_list (NULL, menu->tagprefix, menu->tagprefix ? msg->content : idx[menu->current]->content);        /* no send2hook, since this doesn't modify the message */	break;      case OP_PIPE:      case OP_FILTER:        CHECK_COUNT;	mutt_pipe_attachment_list (NULL, menu->tagprefix, menu->tagprefix ? msg->content : idx[menu->current]->content, op == OP_FILTER);	if (op == OP_FILTER) /* cte might have changed */	  menu->redraw = menu->tagprefix ? REDRAW_FULL : REDRAW_CURRENT;        menu->redraw |= REDRAW_STATUS;        mutt_message_hook (NULL, msg, M_SEND2HOOK);	break;      case OP_EXIT:	if ((i = query_quadoption (OPT_POSTPONE, _("Postpone this message?"))) == M_NO)	{	  while (idxlen-- > 0)	  {	    /* avoid freeing other attachments */	    idx[idxlen]->content->next = NULL;	    idx[idxlen]->content->parts = NULL;            if (idx[idxlen]->unowned)              idx[idxlen]->content->unlink = 0;	    mutt_free_body (&idx[idxlen]->content);	    FREE (&idx[idxlen]->tree);	    FREE (&idx[idxlen]);	  }	  FREE (&idx);	  idxlen = 0;	  idxmax = 0;	  r = -1;	  loop = 0;	  break;	}	else if (i == -1)	  break; /* abort */	/* fall through to postpone! */      case OP_COMPOSE_POSTPONE_MESSAGE:        if(check_attachments(idx, idxlen) != 0)        {	  menu->redraw = REDRAW_FULL;	  break;	}      	loop = 0;	r = 1;	break;      case OP_COMPOSE_ISPELL:	endwin ();	snprintf (buf, sizeof (buf), "%s -x %s", NONULL(Ispell), msg->content->filename);	if (mutt_system (buf) == -1)	  mutt_error (_("Error running \"%s\"!"), buf);	else        {	  mutt_update_encoding (msg->content);	  menu->redraw |= REDRAW_STATUS;	}	break;      case OP_COMPOSE_WRITE_MESSAGE:       fname[0] = '\0';       if (Context)       {	 strfcpy (fname, NONULL (Context->path), sizeof (fname));	 mutt_pretty_mailbox (fname);       }       if (idxlen)         msg->content = idx[0]->content;       if (mutt_enter_fname (_("Write message to mailbox"), fname, sizeof (fname),                             &menu->redraw, 1) != -1 && fname[0])       {         mutt_message (_("Writing message to %s ..."), fname);         mutt_expand_path (fname, sizeof (fname));         if (msg->content->next)           msg->content = mutt_make_multipart (msg->content);         if (mutt_write_fcc (NONULL (fname), msg, NULL, 1, NULL) < 0)           msg->content = mutt_remove_multipart (msg->content);         else           mutt_message _("Message written.");       }       break;      case OP_COMPOSE_PGP_MENU:        if (!(WithCrypto & APPLICATION_PGP))          break;	if ((WithCrypto & APPLICATION_SMIME)            && msg->security & APPLICATION_SMIME)	{	  if (mutt_yesorno (_("S/MIME already selected. Clear & continue ? "),			     M_YES) != M_YES)	  {	    mutt_clear_error ();	    break;	  }	  msg->security = 0;	}	msg->security = crypt_pgp_send_menu (msg, &menu->redraw);	redraw_crypt_lines (msg);        mutt_message_hook (NULL, msg, M_SEND2HOOK);        break;      case OP_FORGET_PASSPHRASE:	crypt_forget_passphrase ();	break;      case OP_COMPOSE_SMIME_MENU:        if (!(WithCrypto & APPLICATION_SMIME))          break;	if ((WithCrypto & APPLICATION_PGP)            && msg->security & APPLICATION_PGP)	{	  if (mutt_yesorno (_("PGP already selected. Clear & continue ? "),			      M_YES) != M_YES)	  {	     mutt_clear_error ();	     break;	  }	  msg->security = 0;	}	msg->security = crypt_smime_send_menu(msg, &menu->redraw);	redraw_crypt_lines (msg);        mutt_message_hook (NULL, msg, M_SEND2HOOK);        break;#ifdef MIXMASTER      case OP_COMPOSE_MIX:            	mix_make_chain (&msg->chain, &menu->redraw);        mutt_message_hook (NULL, msg, M_SEND2HOOK);        break;#endif    }    /* Draw formated compose status line */    if (menu->redraw & REDRAW_STATUS)     {       	compose_status_line (buf, sizeof (buf), menu, NONULL(ComposeFormat));	CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES-2);	SETCOLOR (MT_COLOR_STATUS);	printw ("%-*.*s", COLS, COLS, buf);	SETCOLOR (MT_COLOR_NORMAL);	menu->redraw &= ~REDRAW_STATUS;    }  }  mutt_menuDestroy (&menu);  if (idxlen)  {    msg->content = idx[0]->content;    for (i = 0; i < idxlen; i++)    {      idx[i]->content->aptr = NULL;      FREE (&idx[i]);    }  }  else    msg->content = NULL;  FREE (&idx);  return (r);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -