NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
sort.c File Reference

Assorted sorting methods. More...

#include "config.h"
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "mutt/lib.h"
#include "address/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "alias/lib.h"
#include "sort.h"
#include "mutt_logging.h"
#include "mutt_thread.h"
#include "mx.h"
#include "options.h"
#include "score.h"
#include "nntp/lib.h"
+ Include dependency graph for sort.c:

Go to the source code of this file.

Data Structures

struct  EmailCompare
 Context for compare_email_shim() More...
 

Functions

static int compare_email_shim (const void *a, const void *b, void *arg)
 qsort_r comparator to drive mutt_compare_emails More...
 
static int compare_score (const struct Email *a, const struct Email *b, bool reverse)
 Compare two emails using their scores - Implements sort_mail_t. More...
 
static int compare_size (const struct Email *a, const struct Email *b, bool reverse)
 Compare the size of two emails - Implements sort_mail_t. More...
 
static int compare_date_sent (const struct Email *a, const struct Email *b, bool reverse)
 Compare the sent date of two emails - Implements sort_mail_t. More...
 
static int compare_subject (const struct Email *a, const struct Email *b, bool reverse)
 Compare the subject of two emails - Implements sort_mail_t. More...
 
const char * mutt_get_name (const struct Address *a)
 Pick the best name to display from an address. More...
 
static int compare_to (const struct Email *a, const struct Email *b, bool reverse)
 Compare the 'to' fields of two emails - Implements sort_mail_t. More...
 
static int compare_from (const struct Email *a, const struct Email *b, bool reverse)
 Compare the 'from' fields of two emails - Implements sort_mail_t. More...
 
static int compare_date_received (const struct Email *a, const struct Email *b, bool reverse)
 Compare the date received of two emails - Implements sort_mail_t. More...
 
static int compare_order (const struct Email *a, const struct Email *b, bool reverse)
 Restore the 'unsorted' order of emails - Implements sort_mail_t. More...
 
static int compare_spam (const struct Email *a, const struct Email *b, bool reverse)
 Compare the spam values of two emails - Implements sort_mail_t. More...
 
static int compare_label (const struct Email *a, const struct Email *b, bool reverse)
 Compare the labels of two emails - Implements sort_mail_t. More...
 
static sort_mail_t get_sort_func (enum SortType method, enum MailboxType type)
 Get the sort function for a given sort id. More...
 
int mutt_compare_emails (const struct Email *a, const struct Email *b, enum MailboxType type, short sort, short sort_aux)
 Compare two emails using up to two sort methods. More...
 
void mutt_sort_headers (struct Mailbox *m, struct ThreadsContext *threads, bool init, off_t *vsize)
 Sort emails by their headers. More...
 

Detailed Description

Assorted sorting methods.

Authors
  • Michael R. Elkins
  • Pietro Cerutti
  • R Primus

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file sort.c.

Function Documentation

◆ compare_email_shim()

static int compare_email_shim ( const void *  a,
const void *  b,
void *  arg 
)
static

qsort_r comparator to drive mutt_compare_emails

Parameters
aPointer to first email
bPointer to second email
argEmailCompare with needed context
Return values
<0a precedes b
0a identical to b (should not happen in practice)
>0b precedes a

Definition at line 70 of file sort.c.

71 {
72  const struct Email *ea = *(struct Email const *const *) a;
73  const struct Email *eb = *(struct Email const *const *) b;
74  const struct EmailCompare *cmp = arg;
75  return mutt_compare_emails(ea, eb, cmp->type, cmp->sort, cmp->sort_aux);
76 }
The envelope/body of an email.
Definition: email.h:37
Context for compare_email_shim()
Definition: sort.c:54
int mutt_compare_emails(const struct Email *a, const struct Email *b, enum MailboxType type, short sort, short sort_aux)
Compare two emails using up to two sort methods.
Definition: sort.c:328
enum MailboxType type
Current mailbox type.
Definition: sort.c:56
short sort
Primary sort.
Definition: sort.c:57
short sort_aux
Secondary sort.
Definition: sort.c:58
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare_score()

static int compare_score ( const struct Email a,
const struct Email b,
bool  reverse 
)
static

Compare two emails using their scores - Implements sort_mail_t.

Definition at line 81 of file sort.c.

82 {
83  int result = b->score - a->score; /* note that this is reverse */
84  return reverse ? -result : result;
85 }
int score
Message score.
Definition: email.h:89
+ Here is the caller graph for this function:

◆ compare_size()

static int compare_size ( const struct Email a,
const struct Email b,
bool  reverse 
)
static

Compare the size of two emails - Implements sort_mail_t.

Definition at line 90 of file sort.c.

91 {
92  int result = a->body->length - b->body->length;
93  return reverse ? -result : result;
94 }
struct Body * body
List of MIME parts.
Definition: email.h:91
LOFF_T length
length (in bytes) of attachment
Definition: body.h:45
+ Here is the caller graph for this function:

◆ compare_date_sent()

static int compare_date_sent ( const struct Email a,
const struct Email b,
bool  reverse 
)
static

Compare the sent date of two emails - Implements sort_mail_t.

Definition at line 99 of file sort.c.

100 {
101  int result = a->date_sent - b->date_sent;
102  return reverse ? -result : result;
103 }
time_t date_sent
Time when the message was sent (UTC)
Definition: email.h:82
+ Here is the caller graph for this function:

◆ compare_subject()

static int compare_subject ( const struct Email a,
const struct Email b,
bool  reverse 
)
static

Compare the subject of two emails - Implements sort_mail_t.

Definition at line 108 of file sort.c.

109 {
110  int rc;
111 
112  if (!a->env->real_subj)
113  {
114  if (!b->env->real_subj)
115  rc = compare_date_sent(a, b, false);
116  else
117  rc = -1;
118  }
119  else if (!b->env->real_subj)
120  rc = 1;
121  else
122  rc = mutt_istr_cmp(a->env->real_subj, b->env->real_subj);
123  return reverse ? -rc : rc;
124 }
int mutt_istr_cmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:580
char * real_subj
Offset of the real subject.
Definition: envelope.h:67
struct Envelope * env
Envelope information.
Definition: email.h:90
static int compare_date_sent(const struct Email *a, const struct Email *b, bool reverse)
Compare the sent date of two emails - Implements sort_mail_t.
Definition: sort.c:99
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_get_name()

const char* mutt_get_name ( const struct Address a)

Pick the best name to display from an address.

Parameters
aAddress to use
Return values
ptrDisplay name

This function uses:

  1. Alias for email address
  2. Personal name
  3. Email address

Definition at line 136 of file sort.c.

137 {
138  struct Address *ali = NULL;
139 
140  if (a)
141  {
142  const bool c_reverse_alias = cs_subset_bool(NeoMutt->sub, "reverse_alias");
143  if (c_reverse_alias && (ali = alias_reverse_lookup(a)) && ali->personal)
144  return ali->personal;
145  if (a->personal)
146  return a->personal;
147  if (a->mailbox)
148  return mutt_addr_for_display(a);
149  }
150  /* don't return NULL to avoid segfault when printing/comparing */
151  return "";
152 }
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
An email address.
Definition: address.h:35
char * mailbox
Mailbox and host address.
Definition: address.h:38
Container for Accounts, Notifications.
Definition: neomutt.h:36
const char * mutt_addr_for_display(const struct Address *a)
Convert an Address for display purposes.
Definition: address.c:986
struct Address * alias_reverse_lookup(const struct Address *addr)
Does the user have an alias for the given address.
Definition: reverse.c:105
char * personal
Real name of address.
Definition: address.h:37
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare_to()

static int compare_to ( const struct Email a,
const struct Email b,
bool  reverse 
)
static

Compare the 'to' fields of two emails - Implements sort_mail_t.

Definition at line 157 of file sort.c.

158 {
159  char fa[128];
160 
161  mutt_str_copy(fa, mutt_get_name(TAILQ_FIRST(&a->env->to)), sizeof(fa));
162  const char *fb = mutt_get_name(TAILQ_FIRST(&b->env->to));
163  int result = mutt_istrn_cmp(fa, fb, sizeof(fa));
164  return reverse ? -result : result;
165 }
#define TAILQ_FIRST(head)
Definition: queue.h:723
struct Envelope * env
Envelope information.
Definition: email.h:90
int mutt_istrn_cmp(const char *a, const char *b, size_t num)
Compare two strings ignoring case (to a maximum), safely.
Definition: string.c:607
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:749
struct AddressList to
Email&#39;s &#39;To&#39; list.
Definition: envelope.h:58
const char * mutt_get_name(const struct Address *a)
Pick the best name to display from an address.
Definition: sort.c:136
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare_from()

static int compare_from ( const struct Email a,
const struct Email b,
bool  reverse 
)
static

Compare the 'from' fields of two emails - Implements sort_mail_t.

Definition at line 170 of file sort.c.

171 {
172  char fa[128];
173 
174  mutt_str_copy(fa, mutt_get_name(TAILQ_FIRST(&a->env->from)), sizeof(fa));
175  const char *fb = mutt_get_name(TAILQ_FIRST(&b->env->from));
176  int result = mutt_istrn_cmp(fa, fb, sizeof(fa));
177  return reverse ? -result : result;
178 }
#define TAILQ_FIRST(head)
Definition: queue.h:723
struct AddressList from
Email&#39;s &#39;From&#39; list.
Definition: envelope.h:57
struct Envelope * env
Envelope information.
Definition: email.h:90
int mutt_istrn_cmp(const char *a, const char *b, size_t num)
Compare two strings ignoring case (to a maximum), safely.
Definition: string.c:607
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:749
const char * mutt_get_name(const struct Address *a)
Pick the best name to display from an address.
Definition: sort.c:136
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare_date_received()

static int compare_date_received ( const struct Email a,
const struct Email b,
bool  reverse 
)
static

Compare the date received of two emails - Implements sort_mail_t.

Definition at line 183 of file sort.c.

184 {
185  int result = a->received - b->received;
186  return reverse ? -result : result;
187 }
time_t received
Time when the message was placed in the mailbox.
Definition: email.h:83
+ Here is the caller graph for this function:

◆ compare_order()

static int compare_order ( const struct Email a,
const struct Email b,
bool  reverse 
)
static

Restore the 'unsorted' order of emails - Implements sort_mail_t.

Definition at line 192 of file sort.c.

193 {
194  int result = a->index - b->index;
195  return reverse ? -result : result;
196 }
int index
The absolute (unsorted) message number.
Definition: email.h:86
+ Here is the caller graph for this function:

◆ compare_spam()

static int compare_spam ( const struct Email a,
const struct Email b,
bool  reverse 
)
static

Compare the spam values of two emails - Implements sort_mail_t.

Definition at line 201 of file sort.c.

202 {
203  char *aptr = NULL, *bptr = NULL;
204  int ahas, bhas;
205  int result = 0;
206  double difference;
207 
208  /* Firstly, require spam attributes for both msgs */
209  /* to compare. Determine which msgs have one. */
210  ahas = a->env && !mutt_buffer_is_empty(&a->env->spam);
211  bhas = b->env && !mutt_buffer_is_empty(&b->env->spam);
212 
213  /* If one msg has spam attr but other does not, sort the one with first. */
214  if (ahas && !bhas)
215  return reverse ? -1 : 1;
216  if (!ahas && bhas)
217  return reverse ? 1 : -1;
218 
219  /* Else, if neither has a spam attr, presume equality. Fall back on aux. */
220  if (!ahas && !bhas)
221  return 0;
222 
223  /* Both have spam attrs. */
224 
225  /* preliminary numeric examination */
226  difference = (strtod(a->env->spam.data, &aptr) - strtod(b->env->spam.data, &bptr));
227 
228  /* map double into comparison (-1, 0, or 1) */
229  result = ((difference < 0.0) ? -1 : (difference > 0.0) ? 1 : 0);
230 
231  /* If either aptr or bptr is equal to data, there is no numeric */
232  /* value for that spam attribute. In this case, compare lexically. */
233  if ((aptr == a->env->spam.data) || (bptr == b->env->spam.data))
234  {
235  result = strcmp(aptr, bptr);
236  return reverse ? -result : result;
237  }
238 
239  /* Otherwise, we have numeric value for both attrs. If these values */
240  /* are equal, then we first fall back upon string comparison, then */
241  /* upon auxiliary sort. */
242  if (result == 0)
243  result = strcmp(aptr, bptr);
244  return reverse ? -result : result;
245 }
struct Envelope * env
Envelope information.
Definition: email.h:90
char * data
Pointer to data.
Definition: buffer.h:35
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:252
struct Buffer spam
Spam header.
Definition: envelope.h:80
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare_label()

static int compare_label ( const struct Email a,
const struct Email b,
bool  reverse 
)
static

Compare the labels of two emails - Implements sort_mail_t.

Definition at line 250 of file sort.c.

251 {
252  int ahas, bhas, result = 0;
253 
254  /* As with compare_spam, not all messages will have the x-label
255  * property. Blank X-Labels are treated as null in the index
256  * display, so we'll consider them as null for sort, too. */
257  ahas = a->env && a->env->x_label && *(a->env->x_label);
258  bhas = b->env && b->env->x_label && *(b->env->x_label);
259 
260  /* First we bias toward a message with a label, if the other does not. */
261  if (ahas && !bhas)
262  return reverse ? 1 : -1;
263  if (!ahas && bhas)
264  return reverse ? -1 : 1;
265 
266  /* If neither has a label, use aux sort. */
267  if (!ahas && !bhas)
268  return 0;
269 
270  /* If both have a label, we just do a lexical compare. */
271  result = mutt_istr_cmp(a->env->x_label, b->env->x_label);
272  return reverse ? -result : result;
273 }
int mutt_istr_cmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:580
struct Envelope * env
Envelope information.
Definition: email.h:90
char * x_label
X-Label.
Definition: envelope.h:72
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_sort_func()

static sort_mail_t get_sort_func ( enum SortType  method,
enum MailboxType  type 
)
static

Get the sort function for a given sort id.

Parameters
methodSort type, see SortType
typeThe Mailbox type
Return values
ptrsort function - Implements sort_mail_t

Definition at line 281 of file sort.c.

282 {
283  switch (method)
284  {
285  case SORT_DATE:
286  return compare_date_sent;
287  case SORT_FROM:
288  return compare_from;
289  case SORT_LABEL:
290  return compare_label;
291  case SORT_ORDER:
292 #ifdef USE_NNTP
293  if (type == MUTT_NNTP)
294  return nntp_compare_order;
295  else
296 #endif
297  return compare_order;
298  case SORT_RECEIVED:
299  return compare_date_received;
300  case SORT_SCORE:
301  return compare_score;
302  case SORT_SIZE:
303  return compare_size;
304  case SORT_SPAM:
305  return compare_spam;
306  case SORT_SUBJECT:
307  return compare_subject;
308  case SORT_TO:
309  return compare_to;
310  default:
311  mutt_error(_("Could not find sorting function [report this bug]"));
312  return NULL;
313  }
314  /* not reached */
315 }
static int compare_order(const struct Email *a, const struct Email *b, bool reverse)
Restore the &#39;unsorted&#39; order of emails - Implements sort_mail_t.
Definition: sort.c:192
&#39;NNTP&#39; (Usenet) Mailbox type
Definition: mailbox.h:52
#define mutt_error(...)
Definition: logging.h:88
static int compare_to(const struct Email *a, const struct Email *b, bool reverse)
Compare the &#39;to&#39; fields of two emails - Implements sort_mail_t.
Definition: sort.c:157
Sort by the email&#39;s From field.
Definition: sort2.h:47
#define _(a)
Definition: message.h:28
Sort by the email&#39;s score.
Definition: sort2.h:52
Sort by the emails label.
Definition: sort2.h:62
static int compare_subject(const struct Email *a, const struct Email *b, bool reverse)
Compare the subject of two emails - Implements sort_mail_t.
Definition: sort.c:108
Sort by the size of the email.
Definition: sort2.h:44
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:48
int nntp_compare_order(const struct Email *a, const struct Email *b, bool reverse)
Sort to mailbox order - Implements sort_mail_t.
Definition: nntp.c:2280
static int compare_from(const struct Email *a, const struct Email *b, bool reverse)
Compare the &#39;from&#39; fields of two emails - Implements sort_mail_t.
Definition: sort.c:170
static int compare_label(const struct Email *a, const struct Email *b, bool reverse)
Compare the labels of two emails - Implements sort_mail_t.
Definition: sort.c:250
static int compare_spam(const struct Email *a, const struct Email *b, bool reverse)
Compare the spam values of two emails - Implements sort_mail_t.
Definition: sort.c:201
Sort by the email&#39;s spam score.
Definition: sort2.h:57
static int compare_date_received(const struct Email *a, const struct Email *b, bool reverse)
Compare the date received of two emails - Implements sort_mail_t.
Definition: sort.c:183
Sort by the email&#39;s To field.
Definition: sort2.h:51
static int compare_score(const struct Email *a, const struct Email *b, bool reverse)
Compare two emails using their scores - Implements sort_mail_t.
Definition: sort.c:81
static int compare_size(const struct Email *a, const struct Email *b, bool reverse)
Compare the size of two emails - Implements sort_mail_t.
Definition: sort.c:90
Sort by when the message were delivered locally.
Definition: sort2.h:50
Sort by the date the email was sent.
Definition: sort2.h:43
static int compare_date_sent(const struct Email *a, const struct Email *b, bool reverse)
Compare the sent date of two emails - Implements sort_mail_t.
Definition: sort.c:99
Sort by the email&#39;s subject.
Definition: sort2.h:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_compare_emails()

int mutt_compare_emails ( const struct Email a,
const struct Email b,
enum MailboxType  type,
short  sort,
short  sort_aux 
)

Compare two emails using up to two sort methods.

Parameters
aFirst email
bSecond email
typeMailbox type
sortPrimary sort to use (generally $sort)
sort_auxSecondary sort (generally $sort_aux or SORT_ORDER)
Return values
<0a precedes b
0a and b are identical (should not happen in practice)
>0b precedes a

Definition at line 328 of file sort.c.

330 {
331  sort_mail_t func = get_sort_func(sort & SORT_MASK, type);
332  int retval = func(a, b, (sort & SORT_REVERSE) != 0);
333  if (retval == 0)
334  {
335  func = get_sort_func(sort_aux & SORT_MASK, type);
336  retval = func(a, b, (sort_aux & SORT_REVERSE) != 0);
337  }
338  if (retval == 0)
339  {
340  /* Fallback of last resort to preserve stable order; will only
341  * return 0 if a and b have the same index, which is probably a
342  * bug in the code. */
343  func = compare_order;
344  retval = func(a, b, false);
345  }
346  return retval;
347 }
static int compare_order(const struct Email *a, const struct Email *b, bool reverse)
Restore the &#39;unsorted&#39; order of emails - Implements sort_mail_t.
Definition: sort.c:192
int(* sort_mail_t)(const struct Email *a, const struct Email *b, bool reverse)
Prototype for comparing two emails.
Definition: sort.h:55
static sort_mail_t get_sort_func(enum SortType method, enum MailboxType type)
Get the sort function for a given sort id.
Definition: sort.c:281
#define SORT_REVERSE
Reverse the order of the sort.
Definition: sort2.h:79
#define SORT_MASK
Mask for the sort id.
Definition: sort2.h:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_sort_headers()

void mutt_sort_headers ( struct Mailbox m,
struct ThreadsContext threads,
bool  init,
off_t *  vsize 
)

Sort emails by their headers.

Parameters
mMailbox
threadsThreads context
initIf true, rebuild the thread
[out]vsizeSize in bytes of the messages in view

Definition at line 356 of file sort.c.

358 {
359  if (!m || !m->emails[0])
360  return;
361 
362  OptNeedResort = false;
363 
364  if (m->msg_count == 0)
365  {
366  /* this function gets called by mutt_sync_mailbox(), which may have just
367  * deleted all the messages. the virtual message numbers are not updated
368  * in that routine, so we must make sure to zero the vcount member. */
369  m->vcount = 0;
370  mutt_clear_threads(threads);
371  *vsize = 0;
372  return; /* nothing to do! */
373  }
374 
375  if (m->verbose)
376  mutt_message(_("Sorting mailbox..."));
377 
378  const bool c_score = cs_subset_bool(NeoMutt->sub, "score");
379  if (OptNeedRescore && c_score)
380  {
381  for (int i = 0; i < m->msg_count; i++)
382  {
383  struct Email *e = m->emails[i];
384  if (!e)
385  break;
386  mutt_score_message(m, e, true);
387  }
388  }
389  OptNeedRescore = false;
390 
391  if (OptResortInit)
392  {
393  OptResortInit = false;
394  init = true;
395  }
396 
397  if (init)
398  mutt_clear_threads(threads);
399 
400  const bool threaded = mutt_using_threads();
401  if (threaded)
402  {
403  mutt_sort_threads(threads, init);
404  }
405  else
406  {
407  struct EmailCompare cmp;
408  cmp.type = mx_type(m);
409  cmp.sort = cs_subset_sort(NeoMutt->sub, "sort");
410  cmp.sort_aux = cs_subset_sort(NeoMutt->sub, "sort_aux");
411  mutt_qsort_r((void *) m->emails, m->msg_count, sizeof(struct Email *),
412  compare_email_shim, &cmp);
413  }
414 
415  /* adjust the virtual message numbers */
416  m->vcount = 0;
417  for (int i = 0; i < m->msg_count; i++)
418  {
419  struct Email *e_cur = m->emails[i];
420  if (!e_cur)
421  break;
422 
423  if ((e_cur->vnum != -1) || (e_cur->collapsed && e_cur->visible))
424  {
425  e_cur->vnum = m->vcount;
426  m->v2r[m->vcount] = i;
427  m->vcount++;
428  }
429  e_cur->msgno = i;
430  }
431 
432  /* re-collapse threads marked as collapsed */
433  if (threaded)
434  {
436  *vsize = mutt_set_vnum(m);
437  }
438 
439  if (m->verbose)
441 
442  return;
443 }
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
int msg_count
Total number of messages.
Definition: mailbox.h:91
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
The envelope/body of an email.
Definition: email.h:37
WHERE bool OptNeedResort
(pseudo) used to force a re-sort
Definition: options.h:42
void mutt_thread_collapse_collapsed(struct ThreadsContext *tctx)
re-collapse threads marked as collapsed
Definition: mutt_thread.c:1723
bool threaded
Used for threading.
Definition: email.h:56
void mutt_score_message(struct Mailbox *m, struct Email *e, bool upd_mbox)
Apply scoring to an email.
Definition: score.c:161
#define _(a)
Definition: message.h:28
void mutt_sort_threads(struct ThreadsContext *tctx, bool init)
Sort email threads.
Definition: mutt_thread.c:1007
WHERE bool OptNeedRescore
(pseudo) set when the &#39;score&#39; command is used
Definition: options.h:41
Container for Accounts, Notifications.
Definition: neomutt.h:36
int vcount
The number of virtual messages.
Definition: mailbox.h:102
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
Definition: mutt_thread.c:714
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:112
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:292
bool visible
Is this message part of the view?
Definition: email.h:74
Context for compare_email_shim()
Definition: sort.c:54
void mutt_qsort_r(void *base, size_t nmemb, size_t size, qsort_r_compar_t compar, void *arg)
Sort an array, where the comparator has access to opaque data rather than requiring global variables...
Definition: qsort_r.c:68
bool collapsed
Is this message part of a collapsed thread?
Definition: email.h:73
bool verbose
Display status messages?
Definition: mailbox.h:118
int vnum
Virtual message number.
Definition: email.h:88
WHERE bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition: options.h:50
#define mutt_using_threads()
Definition: mutt_thread.h:95
int * v2r
Mapping from virtual to real msgno.
Definition: mailbox.h:101
enum MailboxType type
Current mailbox type.
Definition: sort.c:56
#define mutt_message(...)
Definition: logging.h:87
static int compare_email_shim(const void *a, const void *b, void *arg)
qsort_r comparator to drive mutt_compare_emails
Definition: sort.c:70
enum MailboxType mx_type(struct Mailbox *m)
Return the type of the Mailbox.
Definition: mx.c:1819
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
off_t mutt_set_vnum(struct Mailbox *m)
Set the virtual index number of all the messages in a mailbox.
Definition: mutt_thread.c:1370
int msgno
Number displayed to the user.
Definition: email.h:87
+ Here is the call graph for this function:
+ Here is the caller graph for this function: