mutt_message ("Sorting mailbox...");
mutt_message _("Sorting mailbox...");
void mutt_sort_headers (CONTEXT *ctx, int init){  int i;  sort_t *sortfunc;  int collapse = (option (OPTSORTCOLLAPSE)) ? 0 : 1;    unset_option (OPTNEEDRESORT);  if (!ctx)    return;  if (!ctx->msgcount)  {    /* this function gets called by mutt_sync_mailbox(), which may have just     * deleted all the messages.  the virtual message numbers are not updated     * in that routine, so we must make sure to zero the vcount member.     */    ctx->vcount = 0;    ctx->tree = 0;    return; /* nothing to do! */  }  if (!ctx->quiet)    mutt_message ("Sorting mailbox...");  /* threads may be bogus, so clear the links */  if (init)    mutt_clear_threads (ctx);  if (option (OPTNEEDRESCORE))  {    for (i = 0; i < ctx->msgcount; i++)      mutt_score_message (ctx->hdrs[i]);    unset_option (OPTNEEDRESCORE);  }  if ((Sort & SORT_MASK) == SORT_THREADS)  {    AuxSort = NULL;    /* if $sort_aux changed after the mailbox is sorted, then all the       subthreads need to be resorted */    if (option (OPTSORTSUBTHREADS))    {      ctx->tree = mutt_sort_subthreads (ctx->tree, mutt_get_sort_func (SortAux));      unset_option (OPTSORTSUBTHREADS);    }    mutt_sort_threads (ctx, init);  }  else if ((sortfunc = mutt_get_sort_func (Sort)) == NULL ||	   (AuxSort = mutt_get_sort_func (SortAux)) == NULL)  {    mutt_error ("Could not find sorting function! [report this bug]");    sleep (1);    return;  }  else     qsort ((void *) ctx->hdrs, ctx->msgcount, sizeof (HEADER *), sortfunc);  /* the threading function find_reference() needs to know how the mailbox   * is currently sorted in memory in order to speed things up a bit   */  ctx->revsort = (Sort & SORT_REVERSE) ? 1 : 0;  /* adjust the virtual message numbers */  ctx->vcount = 0;  if (collapse)    ctx->collapsed = 0;  for (i = 0; i < ctx->msgcount; i++)  {    HEADER *cur = ctx->hdrs[i];    if (cur->virtual != -1 || (collapse && cur->collapsed && (!ctx->pattern || cur->limited)))    {      cur->virtual = ctx->vcount;      ctx->v2r[ctx->vcount] = i;      ctx->vcount++;    }    cur->msgno = i;    cur->num_hidden = mutt_get_hidden (ctx, cur);    if (collapse)      cur->collapsed = 0;  }  mutt_cache_index_colors(ctx);  if (!ctx->quiet)    mutt_clear_error ();}