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

📄 curs_main.c

📁 mutt-1.5.12 源代码。linux 下邮件接受的工具。
💻 C
📖 第 1 页 / 共 4 页
字号:
	  FREE (&Context);	}        mutt_sleep (0);      	/* Set CurrentMenu to MENU_MAIN before executing any folder	 * hooks so that all the index menu functions are available to	 * the exec command.	 */	CurrentMenu = MENU_MAIN;	mutt_folder_hook (buf);	if ((Context = mx_open_mailbox (buf, 					(option (OPTREADONLY) || op == OP_MAIN_CHANGE_FOLDER_READONLY) ?					M_READONLY : 0, NULL)) != NULL)	{	  menu->current = ci_first_message ();	}	else	  menu->current = 0;	mutt_clear_error ();	mutt_buffy_check(1); /* force the buffy check after we have changed			      the folder */	menu->redraw = REDRAW_FULL;	set_option (OPTSEARCHINVALID);	break;      case OP_DISPLAY_MESSAGE:      case OP_DISPLAY_HEADERS: /* don't weed the headers */	CHECK_MSGCOUNT;        CHECK_VISIBLE;	/*	 * toggle the weeding of headers so that a user can press the key	 * again while reading the message.	 */	if (op == OP_DISPLAY_HEADERS)	  toggle_option (OPTWEED);	unset_option (OPTNEEDRESORT);	if ((Sort & SORT_MASK) == SORT_THREADS && CURHDR->collapsed)	{	  mutt_uncollapse_thread (Context, CURHDR);	  mutt_set_virtual (Context);	  if (option (OPTUNCOLLAPSEJUMP))	    menu->current = mutt_thread_next_unread (Context, CURHDR);	} 	if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) 	  mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);	if ((op = mutt_display_message (CURHDR)) == -1)	{	  unset_option (OPTNEEDRESORT);	  break;	}	menu->menu = MENU_PAGER; 	menu->oldcurrent = menu->current;	continue;      case OP_EXIT:	close = op;	if (menu->menu == MENU_MAIN && attach_msg)	{	 done = 1;	 break;	}	if ((menu->menu == MENU_MAIN)	    && (query_quadoption (OPT_QUIT, 				  _("Exit Mutt without saving?")) == M_YES))	{	  if (Context)	  {	    mx_fastclose_mailbox (Context);	    FREE (&Context);	  }	  done = 1;	}	break;      case OP_MAIN_BREAK_THREAD:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	CHECK_READONLY;        if ((Sort & SORT_MASK) != SORT_THREADS)	  mutt_error _("Threading is not enabled.");	else	{	  {	    HEADER *oldcur = CURHDR;	    mutt_break_thread (CURHDR);	    mutt_sort_headers (Context, 1);	    menu->current = oldcur->virtual;	  }	  Context->changed = 1;	  mutt_message _("Thread broken");	  if (menu->menu == MENU_PAGER)	  {	    op = OP_DISPLAY_MESSAGE;	    continue;	  }	  else	    menu->redraw |= REDRAW_INDEX;	}	  break;      case OP_MAIN_LINK_THREADS:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	CHECK_READONLY;	CHECK_IMAP_ACL(IMAP_ACL_DELETE);        if ((Sort & SORT_MASK) != SORT_THREADS)	  mutt_error _("Threading is not enabled.");	else if (!CURHDR->env->message_id)	  mutt_error _("No Message-ID: header available to link thread");	else if (!tag && (!Context->last_tag || !Context->last_tag->tagged))	  mutt_error _("First, please tag a message to be linked here");	else 	{	  HEADER *oldcur = CURHDR;	  if (mutt_link_threads (CURHDR, tag ? NULL : Context->last_tag,				 Context))	  {	    mutt_sort_headers (Context, 1);	    menu->current = oldcur->virtual;	    	    Context->changed = 1;	    mutt_message _("Threads linked");	  }	  else	    mutt_error _("No thread linked");	}	if (menu->menu == MENU_PAGER)	{	  op = OP_DISPLAY_MESSAGE;	  continue;	}	else	  menu->redraw |= REDRAW_STATUS | REDRAW_INDEX;	break;      case OP_EDIT_TYPE:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	CHECK_ATTACH;	mutt_edit_content_type (CURHDR, CURHDR->content, NULL);	/* if we were in the pager, redisplay the message */	if (menu->menu == MENU_PAGER)	{	  op = OP_DISPLAY_MESSAGE;	  continue;	}        else	  menu->redraw = REDRAW_CURRENT;	break;      case OP_MAIN_NEXT_UNDELETED:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	if (menu->current >= Context->vcount - 1)	{	  if (menu->menu == MENU_MAIN)	    mutt_error _("You are on the last message.");	  break;	}	if ((menu->current = ci_next_undeleted (menu->current)) == -1)	{	  menu->current = menu->oldcurrent;	  if (menu->menu == MENU_MAIN)	    mutt_error _("No undeleted messages.");	}	else if (menu->menu == MENU_PAGER)	{	  op = OP_DISPLAY_MESSAGE;	  continue;	}	else	  menu->redraw = REDRAW_MOTION;	break;      case OP_NEXT_ENTRY:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	if (menu->current >= Context->vcount - 1)	{	  if (menu->menu == MENU_MAIN)	    mutt_error _("You are on the last message.");	  break;	}	menu->current++;	if (menu->menu == MENU_PAGER)	{	  op = OP_DISPLAY_MESSAGE;	  continue;	}	else	  menu->redraw = REDRAW_MOTION;	break;      case OP_MAIN_PREV_UNDELETED:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	if (menu->current < 1)	{	  mutt_error _("You are on the first message.");	  break;	}	if ((menu->current = ci_previous_undeleted (menu->current)) == -1)	{	  menu->current = menu->oldcurrent;	  if (menu->menu == MENU_MAIN)	    mutt_error _("No undeleted messages.");	}	else if (menu->menu == MENU_PAGER)	{	  op = OP_DISPLAY_MESSAGE;	  continue;	}	else	  menu->redraw = REDRAW_MOTION;	break;      case OP_PREV_ENTRY:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	if (menu->current < 1)	{	  if (menu->menu == MENU_MAIN) mutt_error _("You are on the first message.");	  break;	}	menu->current--;	if (menu->menu == MENU_PAGER)	{	  op = OP_DISPLAY_MESSAGE;	  continue;	}	else	  menu->redraw = REDRAW_MOTION;	break;      case OP_DECRYPT_COPY:      case OP_DECRYPT_SAVE:        if (!WithCrypto)          break;           /* fall thru */      case OP_COPY_MESSAGE:      case OP_SAVE:      case OP_DECODE_COPY:      case OP_DECODE_SAVE:	CHECK_MSGCOUNT;        CHECK_VISIBLE;        if (mutt_save_message (tag ? NULL : CURHDR,			       (op == OP_DECRYPT_SAVE) ||			       (op == OP_SAVE) || (op == OP_DECODE_SAVE),			       (op == OP_DECODE_SAVE) || (op == OP_DECODE_COPY),			       (op == OP_DECRYPT_SAVE) || (op == OP_DECRYPT_COPY) ||			       0,			       &menu->redraw) == 0 &&	     (op == OP_SAVE || op == OP_DECODE_SAVE || op == OP_DECRYPT_SAVE)	    )	{	  if (tag)	    menu->redraw |= REDRAW_INDEX;	  else if (option (OPTRESOLVE))	  {	    if ((menu->current = ci_next_undeleted (menu->current)) == -1)	    {	      menu->current = menu->oldcurrent;	      menu->redraw |= REDRAW_CURRENT;	    }	    else	      menu->redraw |= REDRAW_MOTION_RESYNCH;	  }	  else	    menu->redraw |= REDRAW_CURRENT;	}	break;      case OP_MAIN_NEXT_NEW:      case OP_MAIN_NEXT_UNREAD:      case OP_MAIN_PREV_NEW:      case OP_MAIN_PREV_UNREAD:      case OP_MAIN_NEXT_NEW_THEN_UNREAD:      case OP_MAIN_PREV_NEW_THEN_UNREAD:      {	int first_unread = -1;	int first_new    = -1;		CHECK_MSGCOUNT;        CHECK_VISIBLE;	i = menu->current;	menu->current = -1;	for (j = 0; j != Context->vcount; j++)	{#define CURHDRi Context->hdrs[Context->v2r[i]] 	  if (op == OP_MAIN_NEXT_NEW || op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_NEXT_NEW_THEN_UNREAD)	  {	    i++;	    if (i > Context->vcount - 1)	    {	      mutt_message _("Search wrapped to top.");	      i = 0;	    }	  }	  else	  {	    i--;	    if (i < 0)	    {	      mutt_message _("Search wrapped to bottom.");	      i = Context->vcount - 1;	    }	  }	  if (CURHDRi->collapsed && (Sort & SORT_MASK) == SORT_THREADS)	  {	    if (UNREAD (CURHDRi) && first_unread == -1)	      first_unread = i;	    if (UNREAD (CURHDRi) == 1 && first_new == -1)	      first_new = i;	  }	  else if ((!CURHDRi->deleted && !CURHDRi->read))	  {	    if (first_unread == -1)	      first_unread = i;	    if ((!CURHDRi->old) && first_new == -1)	      first_new = i;	  }	  	  if ((op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_PREV_UNREAD) &&	      first_unread != -1)	    break;	  if ((op == OP_MAIN_NEXT_NEW || op == OP_MAIN_PREV_NEW ||	       op == OP_MAIN_NEXT_NEW_THEN_UNREAD || op == OP_MAIN_PREV_NEW_THEN_UNREAD)	      && first_new != -1)	    break;	}#undef CURHDRi	if ((op == OP_MAIN_NEXT_NEW || op == OP_MAIN_PREV_NEW ||	     op == OP_MAIN_NEXT_NEW_THEN_UNREAD || op == OP_MAIN_PREV_NEW_THEN_UNREAD) 	    && first_new != -1)	  menu->current = first_new;	else if ((op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_PREV_UNREAD ||		  op == OP_MAIN_NEXT_NEW_THEN_UNREAD || op == OP_MAIN_PREV_NEW_THEN_UNREAD)		 && first_unread != -1)	  menu->current = first_unread;	if (menu->current == -1)	{	  menu->current = menu->oldcurrent;	  mutt_error ("%s%s.", (op == OP_MAIN_NEXT_NEW || op == OP_MAIN_PREV_NEW) ? _("No new messages") : _("No unread messages"),		      Context->pattern ? _(" in this limited view") : "");	}	else if (menu->menu == MENU_PAGER)	{	  op = OP_DISPLAY_MESSAGE;	  continue;	}	else	  menu->redraw = REDRAW_MOTION;	break;      }      case OP_FLAG_MESSAGE:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	CHECK_READONLY;	CHECK_IMAP_ACL(IMAP_ACL_WRITE);#ifdef USE_POP	if (Context->magic == M_POP)	{	  mutt_flushinp ();	  mutt_error _("Can't change 'important' flag on POP server.");	  break;	}#endif        if (tag)        {	  for (j = 0; j < Context->vcount; j++)	  {	    if (Context->hdrs[Context->v2r[j]]->tagged)	      mutt_set_flag (Context, Context->hdrs[Context->v2r[j]],			     M_FLAG, !Context->hdrs[Context->v2r[j]]->flagged);	  }	  menu->redraw |= REDRAW_INDEX;	}        else        {	  mutt_set_flag (Context, CURHDR, M_FLAG, !CURHDR->flagged);	  if (option (OPTRESOLVE))	  {	    if ((menu->current = ci_next_undeleted (menu->current)) == -1)	    {	      menu->current = menu->oldcurrent;	      menu->redraw = REDRAW_CURRENT;	    }	    else	      menu->redraw = REDRAW_MOTION_RESYNCH;	  }	  else	    menu->redraw = REDRAW_CURRENT;	}	menu->redraw |= REDRAW_STATUS;	break;      case OP_TOGGLE_NEW:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	CHECK_READONLY;	CHECK_IMAP_ACL(IMAP_ACL_SEEN);	if (tag)	{	  for (j = 0; j < Context->vcount; j++)	  {	    if (Context->hdrs[Context->v2r[j]]->tagged)	    {	      if (Context->hdrs[Context->v2r[j]]->read ||		  Context->hdrs[Context->v2r[j]]->old)		mutt_set_flag (Context, Context->hdrs[Context->v2r[j]], M_NEW, 1);	      else		mutt_set_flag (Context, Context->hdrs[Context->v2r[j]], M_READ, 1);	    }	  }	  menu->redraw = REDRAW_STATUS | REDRAW_INDEX;	}	else	{	  if (CURHDR->read || CURHDR->old)	    mutt_set_flag (Context, CURHDR, M_NEW, 1);	  else	    mutt_set_flag (Context, CURHDR, M_READ, 1);	  if (option (OPTRESOLVE))	  {	    if ((menu->current = ci_next_undeleted (menu->current)) == -1)	    {	      menu->current = menu->oldcurrent;	      menu->redraw = REDRAW_CURRENT;	    }	    else	      menu->redraw = REDRAW_MOTION_RESYNCH;	  }	  else	    menu->redraw = REDRAW_CURRENT;	  menu->redraw |= REDRAW_STATUS;	}	break;      case OP_TOGGLE_WRITE:	CHECK_IN_MAILBOX;	if (mx_toggle_write (Context) == 0)	  menu->redraw |= REDRAW_STATUS;	break;      case OP_MAIN_NEXT_THREAD:      case OP_MAIN_NEXT_SUBTHREAD:      case OP_MAIN_PREV_THREAD:      case OP_MAIN_PREV_SUBTHREAD:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	switch (op)	{	  case OP_MAIN_NEXT_THREAD:	    menu->current = mutt_next_thread (CURHDR);	    break;	  case OP_MAIN_NEXT_SUBTHREAD:	    menu->current = mutt_next_subthread (CURHDR);	    break;	    	  case OP_MAIN_PREV_THREAD:	    menu->current = mutt_previous_thread (CURHDR);	    break;	  case OP_MAIN_PREV_SUBTHREAD:	    menu->current = mutt_previous_subthread (CURHDR);	    break;	}	if (menu->current < 0)	{	  menu->current = menu->oldcurrent;	  if (op == OP_MAIN_NEXT_THREAD || op == OP_MAIN_NEXT_SUBTHREAD)	    mutt_error _("No more threads.");	  else	    mutt_error _("You are on the first thread.");	}	else if (menu->menu == MENU_PAGER)	{	  op = OP_DISPLAY_MESSAGE;	  continue;	}	else	  menu->redraw = REDRAW_MOTION;	break;      case OP_MAIN_PARENT_MESSAGE:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	if ((menu->current = mutt_parent_message (Context, CURHDR)) < 0)	{	  menu->current = menu->oldcurrent;	}	else if (menu->menu == MENU_PAGER)        {          op = OP_DISPLAY_MESSAGE;          continue;        }        else          menu->redraw = REDRAW_MOTION;	break;      case OP_MAIN_SET_FLAG:      case OP_MAIN_CLEAR_FLAG:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	CHECK_READONLY;	/* CHECK_IMAP_ACL(IMAP_ACL_WRITE); */	if (mutt_change_flag (tag ? NULL : CURHDR, (op == OP_MAIN_SET_FLAG)) == 0)	{	  menu->redraw = REDRAW_STATUS;

⌨️ 快捷键说明

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