]> granicus.if.org Git - neomutt/commitdiff
factor out Context from mutt_messages_in_thread()
authorRichard Russon <rich@flatcap.org>
Thu, 22 Nov 2018 12:27:40 +0000 (12:27 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 22 Nov 2018 13:45:24 +0000 (13:45 +0000)
hdrline.c
index.c
mutt_thread.c
mutt_thread.h

index 1482e61352b59c72eb18a26a2f39ba9a3ebb9cae..4531a28b83cb07b8ccf19d32112249969de476c7 100644 (file)
--- a/hdrline.c
+++ b/hdrline.c
@@ -828,16 +828,16 @@ static const char *index_format_str(char *buf, size_t buflen, size_t col, int co
 
     case 'e':
       snprintf(fmt, sizeof(fmt), "%%%sd", prec);
-      snprintf(buf, buflen, fmt, mutt_messages_in_thread(ctx, e, 1));
+      snprintf(buf, buflen, fmt, mutt_messages_in_thread(ctx->mailbox, e, 1));
       break;
 
     case 'E':
       if (!optional)
       {
         snprintf(fmt, sizeof(fmt), "%%%sd", prec);
-        snprintf(buf, buflen, fmt, mutt_messages_in_thread(ctx, e, 0));
+        snprintf(buf, buflen, fmt, mutt_messages_in_thread(ctx->mailbox, e, 0));
       }
-      else if (mutt_messages_in_thread(ctx, e, 0) <= 1)
+      else if (mutt_messages_in_thread(ctx->mailbox, e, 0) <= 1)
         optional = 0;
       break;
 
diff --git a/index.c b/index.c
index 1c1e089a9e93e2eab02c272740bfd7d3a3056e1f..bae14396c9f4ece0cbf8feb9d57952e2a44661e0 100644 (file)
--- a/index.c
+++ b/index.c
@@ -1491,7 +1491,7 @@ int mutt_index_menu(void)
         {
           struct Email *e = Context->mailbox->hdrs[i - 1];
 
-          if (mutt_messages_in_thread(Context, e, 1) > 1)
+          if (mutt_messages_in_thread(Context->mailbox, e, 1) > 1)
           {
             mutt_uncollapse_thread(Context, e);
             mutt_set_virtual(Context);
index 7be6e211049746eef71935717cbbda7f391bc6e7..13c017bb71cd61c10b43f620c610fd6b708a0d14 100644 (file)
@@ -1380,21 +1380,19 @@ int mutt_traverse_thread(struct Context *ctx, struct Email *cur, int flag)
 
 /**
  * mutt_messages_in_thread - Count the messages in a thread
- * @param ctx  Mailbox
- * @param e  Email
+ * @param m    Mailbox
+ * @param e    Email
  * @param flag Flag, see notes below
  * @retval num Number of message / Our position
  *
  * If flag is 0, we want to know how many messages are in the thread.
  * If flag is 1, we want to know our position in the thread.
  */
-int mutt_messages_in_thread(struct Context *ctx, struct Email *e, int flag)
+int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, int flag)
 {
-  if (!ctx || !ctx->mailbox || !e)
+  if (!m || !e)
     return 1;
 
-  struct Mailbox *m = ctx->mailbox;
-
   struct MuttThread *threads[2];
   int rc;
 
index 5590c5e1276d149deb08490810134d44c4bacc2c..2cf9bedfd574d5c5691411f247fe445c5adf561c 100644 (file)
@@ -64,7 +64,7 @@ int mutt_traverse_thread(struct Context *ctx, struct Email *cur, int flag);
 #define mutt_thread_next_unread(x, y)      mutt_traverse_thread(x, y, MUTT_THREAD_NEXT_UNREAD)
 
 bool mutt_link_threads(struct Email *cur, struct Email *last, struct Context *ctx);
-int mutt_messages_in_thread(struct Context *ctx, struct Email *e, int flag);
+int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, int flag);
 void mutt_draw_tree(struct Context *ctx);
 
 void mutt_clear_threads(struct Context *ctx);