/mutt_thread.h

https://github.com/neomutt/neomutt · C Header · 112 lines · 72 code · 13 blank · 27 comment · 0 complexity · 63f8a2eba196d084dfc5643d33321f90 MD5 · raw file

  1. /**
  2. * @file
  3. * Create/manipulate threading in emails
  4. *
  5. * @authors
  6. * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
  7. *
  8. * @copyright
  9. * This program is free software: you can redistribute it and/or modify it under
  10. * the terms of the GNU General Public License as published by the Free Software
  11. * Foundation, either version 2 of the License, or (at your option) any later
  12. * version.
  13. *
  14. * This program is distributed in the hope that it will be useful, but WITHOUT
  15. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17. * details.
  18. *
  19. * You should have received a copy of the GNU General Public License along with
  20. * this program. If not, see <http://www.gnu.org/licenses/>.
  21. */
  22. #ifndef MUTT_MUTT_THREAD_H
  23. #define MUTT_MUTT_THREAD_H
  24. #include <stdbool.h>
  25. #include <stdint.h>
  26. struct Email;
  27. struct EmailList;
  28. struct Mailbox;
  29. struct MuttThread;
  30. struct ThreadsContext;
  31. /* These Config Variables are only used in mutt_thread.c */
  32. extern bool C_CollapseFlagged;
  33. extern bool C_CollapseUnread;
  34. extern bool C_DuplicateThreads;
  35. extern bool C_HideLimited;
  36. extern bool C_HideMissing;
  37. extern bool C_HideThreadSubject;
  38. extern bool C_HideTopLimited;
  39. extern bool C_HideTopMissing;
  40. extern bool C_NarrowTree;
  41. extern bool C_SortRe;
  42. extern bool C_StrictThreads;
  43. extern bool C_ThreadReceived;
  44. /**
  45. * enum TreeChar - Tree characters for menus
  46. *
  47. * @sa linearize_tree(), print_enriched_string()
  48. */
  49. enum TreeChar
  50. {
  51. MUTT_TREE_LLCORNER = 1, ///< Lower left corner
  52. MUTT_TREE_ULCORNER, ///< Upper left corner
  53. MUTT_TREE_LTEE, ///< Left T-piece
  54. MUTT_TREE_HLINE, ///< Horizontal line
  55. MUTT_TREE_VLINE, ///< Vertical line
  56. MUTT_TREE_SPACE, ///< Blank space
  57. MUTT_TREE_RARROW, ///< Right arrow
  58. MUTT_TREE_STAR, ///< Star character (for threads)
  59. MUTT_TREE_HIDDEN, ///< Ampersand character (for threads)
  60. MUTT_TREE_EQUALS, ///< Equals (for threads)
  61. MUTT_TREE_TTEE, ///< Top T-piece
  62. MUTT_TREE_BTEE, ///< Bottom T-piece
  63. MUTT_TREE_MISSING, ///< Question mark
  64. MUTT_TREE_MAX,
  65. MUTT_SPECIAL_INDEX = MUTT_TREE_MAX, ///< Colour indicator
  66. };
  67. typedef uint8_t MuttThreadFlags; ///< Flags, e.g. #MUTT_THREAD_COLLAPSE
  68. #define MUTT_THREAD_NO_FLAGS 0 ///< No flags are set
  69. #define MUTT_THREAD_COLLAPSE (1 << 0) ///< Collapse an email thread
  70. #define MUTT_THREAD_UNCOLLAPSE (1 << 1) ///< Uncollapse an email thread
  71. #define MUTT_THREAD_UNREAD (1 << 2) ///< Count unread emails in a thread
  72. #define MUTT_THREAD_NEXT_UNREAD (1 << 3) ///< Find the next unread email
  73. #define MUTT_THREAD_FLAGGED (1 << 4) ///< Count flagged emails in a thread
  74. int mutt_traverse_thread(struct Email *e, MuttThreadFlags flag);
  75. #define mutt_collapse_thread(e) mutt_traverse_thread(e, MUTT_THREAD_COLLAPSE)
  76. #define mutt_uncollapse_thread(e) mutt_traverse_thread(e, MUTT_THREAD_UNCOLLAPSE)
  77. #define mutt_thread_contains_unread(e) mutt_traverse_thread(e, MUTT_THREAD_UNREAD)
  78. #define mutt_thread_contains_flagged(e) mutt_traverse_thread(e, MUTT_THREAD_FLAGGED)
  79. #define mutt_thread_next_unread(e) mutt_traverse_thread(e, MUTT_THREAD_NEXT_UNREAD)
  80. int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads);
  81. #define mutt_next_thread(e) mutt_aside_thread(e, true, false)
  82. #define mutt_previous_thread(e) mutt_aside_thread(e, false, false)
  83. #define mutt_next_subthread(e) mutt_aside_thread(e, true, true)
  84. #define mutt_previous_subthread(e) mutt_aside_thread(e, false, true)
  85. struct ThreadsContext *mutt_thread_ctx_init (struct Mailbox *m);
  86. void mutt_thread_ctx_free (struct ThreadsContext **tctx);
  87. void mutt_thread_collapse_collapsed(struct ThreadsContext *tctx);
  88. void mutt_thread_collapse (struct ThreadsContext *tctx, bool collapse);
  89. bool mutt_thread_can_collapse (struct Email *e);
  90. void mutt_clear_threads (struct ThreadsContext *tctx);
  91. void mutt_draw_tree (struct ThreadsContext *tctx);
  92. bool mutt_link_threads (struct Email *parent, struct EmailList *children, struct Mailbox *m);
  93. struct HashTable * mutt_make_id_hash (struct Mailbox *m);
  94. int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, int flag);
  95. int mutt_parent_message (struct Email *e, bool find_root);
  96. off_t mutt_set_vnum (struct Mailbox *m);
  97. void mutt_sort_subthreads (struct ThreadsContext *tctx, bool init);
  98. void mutt_sort_threads (struct ThreadsContext *tctx, bool init);
  99. #endif /* MUTT_MUTT_THREAD_H */