NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
sort.c File Reference
#include "config.h"
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "mutt/lib.h"
#include "address/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "alias/lib.h"
#include "sort.h"
#include "context.h"
#include "mutt_globals.h"
#include "mutt_logging.h"
#include "mutt_thread.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.

Functions

int perform_auxsort (int retval, const void *a, const void *b)
 Compare two emails using the auxiliary sort method. More...
 
static int compare_score (const void *a, const void *b)
 Compare two emails using their scores - Implements sort_t. More...
 
static int compare_size (const void *a, const void *b)
 Compare the size of two emails - Implements sort_t. More...
 
static int compare_date_sent (const void *a, const void *b)
 Compare the sent date of two emails - Implements sort_t. More...
 
static int compare_subject (const void *a, const void *b)
 Compare the subject of two emails - Implements sort_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 void *a, const void *b)
 Compare the 'to' fields of two emails - Implements sort_t. More...
 
static int compare_from (const void *a, const void *b)
 Compare the 'from' fields of two emails - Implements sort_t. More...
 
static int compare_date_received (const void *a, const void *b)
 Compare the date received of two emails - Implements sort_t. More...
 
static int compare_order (const void *a, const void *b)
 Restore the 'unsorted' order of emails - Implements sort_t. More...
 
static int compare_spam (const void *a, const void *b)
 Compare the spam values of two emails - Implements sort_t. More...
 
static int compare_label (const void *a, const void *b)
 Compare the labels of two emails - Implements sort_t. More...
 
sort_t mutt_get_sort_func (enum SortType method)
 Get the sort function for a given sort id. More...
 
void mutt_sort_headers (struct Mailbox *m, struct ThreadsContext *threads, bool init, off_t *vsize)
 Sort emails by their headers. More...
 

Variables

bool C_ReverseAlias
 Config: Display the alias in the index, rather than the message's sender. More...
 
static sort_t AuxSort = NULL
 

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

◆ perform_auxsort()

int perform_auxsort ( int  retval,
const void *  a,
const void *  b 
)

Compare two emails using the auxiliary sort method.

Parameters
retvalResult of normal sort method
aFirst email
bSecond email
Return values
-1a precedes b
0a and b are identical
1b precedes a

Definition at line 66 of file sort.c.

67 {
68  /* If the items compared equal by the main sort
69  * and we're not already doing an 'aux' sort... */
70  if ((retval == 0) && AuxSort && !OptAuxSort)
71  {
72  OptAuxSort = true;
73  retval = AuxSort(a, b);
74  OptAuxSort = false;
75  if (retval != 0)
76  return retval;
77  }
78  /* If the items still match, use their index positions
79  * to maintain a stable sort order */
80  if (retval == 0)
81  {
82  retval = (*((struct Email const *const *) a))->index -
83  (*((struct Email const *const *) b))->index;
84  }
85  return retval;
86 }
+ Here is the caller graph for this function:

◆ compare_score()

static int compare_score ( const void *  a,
const void *  b 
)
static

Compare two emails using their scores - Implements sort_t.

Definition at line 91 of file sort.c.

92 {
93  struct Email const *const *pa = (struct Email const *const *) a;
94  struct Email const *const *pb = (struct Email const *const *) b;
95  int result = (*pb)->score - (*pa)->score; /* note that this is reverse */
96  result = perform_auxsort(result, a, b);
97  return SORT_CODE(result);
98 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare_size()

static int compare_size ( const void *  a,
const void *  b 
)
static

Compare the size of two emails - Implements sort_t.

Definition at line 103 of file sort.c.

104 {
105  struct Email const *const *pa = (struct Email const *const *) a;
106  struct Email const *const *pb = (struct Email const *const *) b;
107  int result = (*pa)->body->length - (*pb)->body->length;
108  result = perform_auxsort(result, a, b);
109  return SORT_CODE(result);
110 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare_date_sent()

static int compare_date_sent ( const void *  a,
const void *  b 
)
static

Compare the sent date of two emails - Implements sort_t.

Definition at line 115 of file sort.c.

116 {
117  struct Email const *const *pa = (struct Email const *const *) a;
118  struct Email const *const *pb = (struct Email const *const *) b;
119  int result = (*pa)->date_sent - (*pb)->date_sent;
120  result = perform_auxsort(result, a, b);
121  return SORT_CODE(result);
122 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare_subject()

static int compare_subject ( const void *  a,
const void *  b 
)
static

Compare the subject of two emails - Implements sort_t.

Definition at line 127 of file sort.c.

128 {
129  struct Email const *const *pa = (struct Email const *const *) a;
130  struct Email const *const *pb = (struct Email const *const *) b;
131  int rc;
132 
133  if (!(*pa)->env->real_subj)
134  {
135  if (!(*pb)->env->real_subj)
136  rc = compare_date_sent(pa, pb);
137  else
138  rc = -1;
139  }
140  else if (!(*pb)->env->real_subj)
141  rc = 1;
142  else
143  rc = mutt_istr_cmp((*pa)->env->real_subj, (*pb)->env->real_subj);
144  rc = perform_auxsort(rc, a, b);
145  return SORT_CODE(rc);
146 }
+ 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 158 of file sort.c.

159 {
160  struct Address *ali = NULL;
161 
162  if (a)
163  {
164  if (C_ReverseAlias && (ali = alias_reverse_lookup(a)) && ali->personal)
165  return ali->personal;
166  if (a->personal)
167  return a->personal;
168  if (a->mailbox)
169  return mutt_addr_for_display(a);
170  }
171  /* don't return NULL to avoid segfault when printing/comparing */
172  return "";
173 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare_to()

static int compare_to ( const void *  a,
const void *  b 
)
static

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

Definition at line 178 of file sort.c.

179 {
180  struct Email const *const *ppa = (struct Email const *const *) a;
181  struct Email const *const *ppb = (struct Email const *const *) b;
182  char fa[128];
183 
184  mutt_str_copy(fa, mutt_get_name(TAILQ_FIRST(&(*ppa)->env->to)), sizeof(fa));
185  const char *fb = mutt_get_name(TAILQ_FIRST(&(*ppb)->env->to));
186  int result = mutt_istrn_cmp(fa, fb, sizeof(fa));
187  result = perform_auxsort(result, a, b);
188  return SORT_CODE(result);
189 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare_from()

static int compare_from ( const void *  a,
const void *  b 
)
static

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

Definition at line 194 of file sort.c.

195 {
196  struct Email const *const *ppa = (struct Email const *const *) a;
197  struct Email const *const *ppb = (struct Email const *const *) b;
198  char fa[128];
199 
200  mutt_str_copy(fa, mutt_get_name(TAILQ_FIRST(&(*ppa)->env->from)), sizeof(fa));
201  const char *fb = mutt_get_name(TAILQ_FIRST(&(*ppb)->env->from));
202  int result = mutt_istrn_cmp(fa, fb, sizeof(fa));
203  result = perform_auxsort(result, a, b);
204  return SORT_CODE(result);
205 }
+ 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 void *  a,
const void *  b 
)
static

Compare the date received of two emails - Implements sort_t.

Definition at line 210 of file sort.c.

211 {
212  struct Email const *const *pa = (struct Email const *const *) a;
213  struct Email const *const *pb = (struct Email const *const *) b;
214  int result = (*pa)->received - (*pb)->received;
215  result = perform_auxsort(result, a, b);
216  return SORT_CODE(result);
217 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare_order()

static int compare_order ( const void *  a,
const void *  b 
)
static

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

Definition at line 222 of file sort.c.

223 {
224  struct Email const *const *ea = (struct Email const *const *) a;
225  struct Email const *const *eb = (struct Email const *const *) b;
226 
227  /* no need to auxsort because you will never have equality here */
228  return SORT_CODE((*ea)->index - (*eb)->index);
229 }
+ Here is the caller graph for this function:

◆ compare_spam()

static int compare_spam ( const void *  a,
const void *  b 
)
static

Compare the spam values of two emails - Implements sort_t.

Definition at line 234 of file sort.c.

235 {
236  struct Email const *const *ppa = (struct Email const *const *) a;
237  struct Email const *const *ppb = (struct Email const *const *) b;
238  char *aptr = NULL, *bptr = NULL;
239  int ahas, bhas;
240  int result = 0;
241  double difference;
242 
243  /* Firstly, require spam attributes for both msgs */
244  /* to compare. Determine which msgs have one. */
245  ahas = (*ppa)->env && !mutt_buffer_is_empty(&(*ppa)->env->spam);
246  bhas = (*ppb)->env && !mutt_buffer_is_empty(&(*ppb)->env->spam);
247 
248  /* If one msg has spam attr but other does not, sort the one with first. */
249  if (ahas && !bhas)
250  return SORT_CODE(1);
251  if (!ahas && bhas)
252  return SORT_CODE(-1);
253 
254  /* Else, if neither has a spam attr, presume equality. Fall back on aux. */
255  if (!ahas && !bhas)
256  {
257  result = perform_auxsort(result, a, b);
258  return SORT_CODE(result);
259  }
260 
261  /* Both have spam attrs. */
262 
263  /* preliminary numeric examination */
264  difference =
265  (strtod((*ppa)->env->spam.data, &aptr) - strtod((*ppb)->env->spam.data, &bptr));
266 
267  /* map double into comparison (-1, 0, or 1) */
268  result = ((difference < 0.0) ? -1 : (difference > 0.0) ? 1 : 0);
269 
270  /* If either aptr or bptr is equal to data, there is no numeric */
271  /* value for that spam attribute. In this case, compare lexically. */
272  if ((aptr == (*ppa)->env->spam.data) || (bptr == (*ppb)->env->spam.data))
273  return SORT_CODE(strcmp(aptr, bptr));
274 
275  /* Otherwise, we have numeric value for both attrs. If these values */
276  /* are equal, then we first fall back upon string comparison, then */
277  /* upon auxiliary sort. */
278  if (result == 0)
279  {
280  result = strcmp(aptr, bptr);
281  result = perform_auxsort(result, a, b);
282  }
283 
284  return SORT_CODE(result);
285 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare_label()

static int compare_label ( const void *  a,
const void *  b 
)
static

Compare the labels of two emails - Implements sort_t.

Definition at line 290 of file sort.c.

291 {
292  struct Email const *const *ppa = (struct Email const *const *) a;
293  struct Email const *const *ppb = (struct Email const *const *) b;
294  int ahas, bhas, result = 0;
295 
296  /* As with compare_spam, not all messages will have the x-label
297  * property. Blank X-Labels are treated as null in the index
298  * display, so we'll consider them as null for sort, too. */
299  ahas = (*ppa)->env && (*ppa)->env->x_label && *((*ppa)->env->x_label);
300  bhas = (*ppb)->env && (*ppb)->env->x_label && *((*ppb)->env->x_label);
301 
302  /* First we bias toward a message with a label, if the other does not. */
303  if (ahas && !bhas)
304  return SORT_CODE(-1);
305  if (!ahas && bhas)
306  return SORT_CODE(1);
307 
308  /* If neither has a label, use aux sort. */
309  if (!ahas && !bhas)
310  {
311  result = perform_auxsort(result, a, b);
312  return SORT_CODE(result);
313  }
314 
315  /* If both have a label, we just do a lexical compare. */
316  result = mutt_istr_cmp((*ppa)->env->x_label, (*ppb)->env->x_label);
317  return SORT_CODE(result);
318 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_get_sort_func()

sort_t mutt_get_sort_func ( enum SortType  method)

Get the sort function for a given sort id.

Parameters
methodSort type, see SortType
Return values
ptrsort function - Implements sort_t

Definition at line 325 of file sort.c.

326 {
327  switch (method)
328  {
329  case SORT_DATE:
330  return compare_date_sent;
331  case SORT_FROM:
332  return compare_from;
333  case SORT_LABEL:
334  return compare_label;
335  case SORT_ORDER:
336 #ifdef USE_NNTP
338  return nntp_compare_order;
339  else
340 #endif
341  return compare_order;
342  case SORT_RECEIVED:
343  return compare_date_received;
344  case SORT_SCORE:
345  return compare_score;
346  case SORT_SIZE:
347  return compare_size;
348  case SORT_SPAM:
349  return compare_spam;
350  case SORT_SUBJECT:
351  return compare_subject;
352  case SORT_TO:
353  return compare_to;
354  default:
355  return NULL;
356  }
357  /* not reached */
358 }
+ 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 367 of file sort.c.

369 {
370  if (!m || !m->emails[0])
371  return;
372 
373  sort_t sortfunc = NULL;
374 
375  OptNeedResort = false;
376 
377  if (m->msg_count == 0)
378  {
379  /* this function gets called by mutt_sync_mailbox(), which may have just
380  * deleted all the messages. the virtual message numbers are not updated
381  * in that routine, so we must make sure to zero the vcount member. */
382  m->vcount = 0;
383  mutt_clear_threads(threads);
384  *vsize = 0;
385  return; /* nothing to do! */
386  }
387 
388  if (m->verbose)
389  mutt_message(_("Sorting mailbox..."));
390 
391  if (OptNeedRescore && C_Score)
392  {
393  for (int i = 0; i < m->msg_count; i++)
394  {
395  struct Email *e = m->emails[i];
396  if (!e)
397  break;
398  mutt_score_message(m, e, true);
399  }
400  }
401  OptNeedRescore = false;
402 
403  if (OptResortInit)
404  {
405  OptResortInit = false;
406  init = true;
407  }
408 
409  if (init)
410  mutt_clear_threads(threads);
411 
412  if ((C_Sort & SORT_MASK) == SORT_THREADS)
413  {
414  AuxSort = NULL;
415  /* if $sort_aux changed after the mailbox is sorted, then all the
416  * subthreads need to be resorted */
417  if (OptSortSubthreads)
418  {
419  int i = C_Sort;
420  C_Sort = C_SortAux;
421  mutt_sort_subthreads(threads, true);
422  C_Sort = i;
423  OptSortSubthreads = false;
424  }
425  mutt_sort_threads(threads, init);
426  }
427  else if (!(sortfunc = mutt_get_sort_func(C_Sort & SORT_MASK)) ||
429  {
430  mutt_error(_("Could not find sorting function [report this bug]"));
431  return;
432  }
433  else
434  {
435  qsort((void *) m->emails, m->msg_count, sizeof(struct Email *), sortfunc);
436  }
437 
438  /* adjust the virtual message numbers */
439  m->vcount = 0;
440  for (int i = 0; i < m->msg_count; i++)
441  {
442  struct Email *e_cur = m->emails[i];
443  if (!e_cur)
444  break;
445 
446  if ((e_cur->vnum != -1) || (e_cur->collapsed && e_cur->visible))
447  {
448  e_cur->vnum = m->vcount;
449  m->v2r[m->vcount] = i;
450  m->vcount++;
451  }
452  e_cur->msgno = i;
453  }
454 
455  /* re-collapse threads marked as collapsed */
456  if ((C_Sort & SORT_MASK) == SORT_THREADS)
457  {
459  *vsize = mutt_set_vnum(m);
460  }
461 
462  if (m->verbose)
464 
465  return;
466 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ C_ReverseAlias

bool C_ReverseAlias

Config: Display the alias in the index, rather than the message's sender.

Definition at line 52 of file sort.c.

◆ AuxSort

sort_t AuxSort = NULL
static

Definition at line 55 of file sort.c.

compare_label
static int compare_label(const void *a, const void *b)
Compare the labels of two emails - Implements sort_t.
Definition: sort.c:290
Email::date_sent
time_t date_sent
Time when the message was sent (UTC)
Definition: email.h:82
compare_size
static int compare_size(const void *a, const void *b)
Compare the size of two emails - Implements sort_t.
Definition: sort.c:103
Email::msgno
int msgno
Number displayed to the user.
Definition: email.h:87
mutt_istr_cmp
int mutt_istr_cmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:580
SORT_SPAM
@ SORT_SPAM
Sort by the email's spam score.
Definition: sort2.h:59
compare_order
static int compare_order(const void *a, const void *b)
Restore the 'unsorted' order of emails - Implements sort_t.
Definition: sort.c:222
compare_to
static int compare_to(const void *a, const void *b)
Compare the 'to' fields of two emails - Implements sort_t.
Definition: sort.c:178
SORT_TO
@ SORT_TO
Sort by the email's To field.
Definition: sort2.h:53
_
#define _(a)
Definition: message.h:28
SORT_THREADS
@ SORT_THREADS
Sort by email threads.
Definition: sort2.h:51
OptNeedResort
WHERE bool OptNeedResort
(pseudo) used to force a re-sort
Definition: options.h:43
Mailbox::v2r
int * v2r
Mapping from virtual to real msgno.
Definition: mailbox.h:101
Mailbox::emails
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
Address::personal
char * personal
Real name of address.
Definition: address.h:36
ctx_mailbox
struct Mailbox * ctx_mailbox(struct Context *ctx)
wrapper to get the mailbox in a Context, or NULL
Definition: context.c:429
mutt_get_name
const char * mutt_get_name(const struct Address *a)
Pick the best name to display from an address.
Definition: sort.c:158
OptAuxSort
WHERE bool OptAuxSort
(pseudo) using auxiliary sort function
Definition: options.h:35
mutt_buffer_is_empty
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:252
Envelope::x_label
char * x_label
X-Label.
Definition: envelope.h:72
Context
The "current" mailbox.
Definition: context.h:38
nntp_compare_order
int nntp_compare_order(const void *a, const void *b)
Sort to mailbox order - Implements sort_t.
Definition: nntp.c:2257
mutt_istrn_cmp
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
C_ReverseAlias
bool C_ReverseAlias
Config: Display the alias in the index, rather than the message's sender.
Definition: sort.c:52
mutt_sort_subthreads
void mutt_sort_subthreads(struct ThreadsContext *tctx, bool init)
Sort the children of a thread.
Definition: mutt_thread.c:687
mutt_score_message
void mutt_score_message(struct Mailbox *m, struct Email *e, bool upd_mbox)
Apply scoring to an email.
Definition: score.c:173
mutt_get_sort_func
sort_t mutt_get_sort_func(enum SortType method)
Get the sort function for a given sort id.
Definition: sort.c:325
SORT_MASK
#define SORT_MASK
Mask for the sort id.
Definition: sort2.h:80
sort_t
int(* sort_t)(const void *a, const void *b)
Prototype for a function to compare two emails.
Definition: sort.h:50
mutt_set_vnum
off_t mutt_set_vnum(struct Mailbox *m)
Set the virtual index number of all the messages in a mailbox.
Definition: mutt_thread.c:1232
AuxSort
static sort_t AuxSort
Definition: sort.c:55
Mailbox::vcount
int vcount
The number of virtual messages.
Definition: mailbox.h:102
OptNeedRescore
WHERE bool OptNeedRescore
(pseudo) set when the 'score' command is used
Definition: options.h:42
C_Score
WHERE bool C_Score
Config: Use message scoring.
Definition: mutt_globals.h:159
Email::received
time_t received
Time when the message was placed in the mailbox.
Definition: email.h:83
TAILQ_FIRST
#define TAILQ_FIRST(head)
Definition: queue.h:716
compare_spam
static int compare_spam(const void *a, const void *b)
Compare the spam values of two emails - Implements sort_t.
Definition: sort.c:234
MUTT_NNTP
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition: mailbox.h:52
Mailbox::type
enum MailboxType type
Mailbox type.
Definition: mailbox.h:105
perform_auxsort
int perform_auxsort(int retval, const void *a, const void *b)
Compare two emails using the auxiliary sort method.
Definition: sort.c:66
Email::visible
bool visible
Is this message part of the view?
Definition: email.h:74
SORT_SUBJECT
@ SORT_SUBJECT
Sort by the email's subject.
Definition: sort2.h:48
Body::length
LOFF_T length
length (in bytes) of attachment
Definition: body.h:45
SORT_SCORE
@ SORT_SCORE
Sort by the email's score.
Definition: sort2.h:54
Mailbox::msg_count
int msg_count
Total number of messages.
Definition: mailbox.h:91
mutt_clear_error
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
Context::mailbox
struct Mailbox * mailbox
Definition: context.h:50
Email::env
struct Envelope * env
Envelope information.
Definition: email.h:90
compare_subject
static int compare_subject(const void *a, const void *b)
Compare the subject of two emails - Implements sort_t.
Definition: sort.c:127
OptResortInit
WHERE bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition: options.h:51
Mailbox::verbose
bool verbose
Display status messages?
Definition: mailbox.h:118
SORT_ORDER
@ SORT_ORDER
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:50
Email::collapsed
bool collapsed
Is this message part of a collapsed thread?
Definition: email.h:73
Email::score
int score
Message score.
Definition: email.h:89
Address::mailbox
char * mailbox
Mailbox and host address.
Definition: address.h:37
SORT_RECEIVED
@ SORT_RECEIVED
Sort by when the message were delivered locally.
Definition: sort2.h:52
compare_date_sent
static int compare_date_sent(const void *a, const void *b)
Compare the sent date of two emails - Implements sort_t.
Definition: sort.c:115
C_Sort
WHERE short C_Sort
Config: Sort method for the index.
Definition: sort.h:60
mutt_sort_threads
void mutt_sort_threads(struct ThreadsContext *tctx, bool init)
Sort email threads.
Definition: mutt_thread.c:870
mutt_thread_collapse_collapsed
void mutt_thread_collapse_collapsed(struct ThreadsContext *tctx)
re-collapse threads marked as collapsed
Definition: mutt_thread.c:1583
compare_from
static int compare_from(const void *a, const void *b)
Compare the 'from' fields of two emails - Implements sort_t.
Definition: sort.c:194
SORT_FROM
@ SORT_FROM
Sort by the email's From field.
Definition: sort2.h:49
compare_score
static int compare_score(const void *a, const void *b)
Compare two emails using their scores - Implements sort_t.
Definition: sort.c:91
OptSortSubthreads
WHERE bool OptSortSubthreads
(pseudo) used when $sort_aux changes
Definition: options.h:54
Email::vnum
int vnum
Virtual message number.
Definition: email.h:88
Email::index
int index
The absolute (unsorted) message number.
Definition: email.h:86
SORT_LABEL
@ SORT_LABEL
Sort by the emails label.
Definition: sort2.h:64
alias_reverse_lookup
struct Address * alias_reverse_lookup(const struct Address *addr)
Does the user have an alias for the given address.
Definition: reverse.c:105
Email
The envelope/body of an email.
Definition: email.h:37
SORT_SIZE
@ SORT_SIZE
Sort by the size of the email.
Definition: sort2.h:46
mutt_message
#define mutt_message(...)
Definition: logging.h:83
mutt_clear_threads
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
Definition: mutt_thread.c:637
C_SortAux
WHERE short C_SortAux
Config: Secondary sort method for the index.
Definition: sort.h:61
SORT_DATE
@ SORT_DATE
Sort by the date the email was sent.
Definition: sort2.h:45
compare_date_received
static int compare_date_received(const void *a, const void *b)
Compare the date received of two emails - Implements sort_t.
Definition: sort.c:210
Address
An email address.
Definition: address.h:34
mutt_addr_for_display
const char * mutt_addr_for_display(const struct Address *a)
Convert an Address for display purposes.
Definition: address.c:986
Email::body
struct Body * body
List of MIME parts.
Definition: email.h:91
mutt_error
#define mutt_error(...)
Definition: logging.h:84
SORT_CODE
#define SORT_CODE(x)
Definition: sort.h:40
mutt_str_copy
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:716