<<< Date Index >>>     <<< Thread Index >>>

[james@xxxxxx: Patch for mutt message scores]



Patch attached.

----- Forwarded message from James Raftery <james@xxxxxx> -----

From: James Raftery <james@xxxxxx>
To: mutt-dev@xxxxxxxx
Subject: Patch for mutt message scores
Date: Thu, 15 Jul 2004 16:26:44 +0100

Hi,

I've been running with a patch for a while now without a problem so
I'll let it loose:

        http://romana.now.ie/#mutt-rescore

It updates message scores as a message's status changes (not just when a
folder is opened). My work mail lives on a slow IMAP server so waiting
90 seconds to close and reopen my bulging INBOX to update scores (and
the sorting based on them) is a major PITA. That patch should fix that.


ATB,
james
-- 
Time flies like an arrow. Fruit flies like bananas.

----- End forwarded message -----
diff -ruN mutt-1.4.2.1.orig/flags.c mutt-1.4.2.1/flags.c
--- mutt-1.4.2.1.orig/flags.c   Tue Jan 15 21:18:11 2002
+++ mutt-1.4.2.1/flags.c        Mon Jun 21 11:27:03 2004
@@ -21,7 +21,7 @@
 #include "sort.h"
 #include "mx.h"
 
-void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
+void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx, 
int recompute_score)
 {
   int changed = h->changed;
   int deleted = ctx->deleted;
@@ -209,6 +209,11 @@
       }
       break;
   }
+
+  /* Recompute the message's score to take account of any flag changes.
+   * James Raftery <james@xxxxxx> 17 June 2004.
+   */
+  if (recompute_score) mutt_score_message (ctx, h, 1);
 
   mutt_set_header_color(ctx, h);
 
diff -ruN mutt-1.4.2.1.orig/protos.h mutt-1.4.2.1/protos.h
--- mutt-1.4.2.1.orig/protos.h  Mon Apr 29 18:12:18 2002
+++ mutt-1.4.2.1/protos.h       Fri Jun 18 18:48:05 2004
@@ -213,8 +213,8 @@
 #define mutt_select_file(A,B,C) _mutt_select_file(A,B,C,NULL,NULL)
 void _mutt_select_file (char *, size_t, int, char ***, int *);
 void mutt_message_hook (CONTEXT *, HEADER *, int);
-void _mutt_set_flag (CONTEXT *, HEADER *, int, int, int);
-#define mutt_set_flag(a,b,c,d) _mutt_set_flag(a,b,c,d,1)
+void _mutt_set_flag (CONTEXT *, HEADER *, int, int, int, int);
+#define mutt_set_flag(a,b,c,d) _mutt_set_flag(a,b,c,d,1,1)
 void mutt_set_followup_to (ENVELOPE *);
 void mutt_shell_escape (void);
 void mutt_show_error (void);
diff -ruN mutt-1.4.2.1.orig/score.c mutt-1.4.2.1/score.c
--- mutt-1.4.2.1.orig/score.c   Fri Mar  3 10:10:14 2000
+++ mutt-1.4.2.1/score.c        Fri Jun 18 18:54:47 2004
@@ -133,11 +133,11 @@
     hdr->score = 0;
   
   if (hdr->score <= ScoreThresholdDelete)
-    _mutt_set_flag (ctx, hdr, M_DELETE, 1, upd_ctx);
+    _mutt_set_flag (ctx, hdr, M_DELETE, 1, upd_ctx, 0);
   if (hdr->score <= ScoreThresholdRead)
-    _mutt_set_flag (ctx, hdr, M_READ, 1, upd_ctx);
+    _mutt_set_flag (ctx, hdr, M_READ, 1, upd_ctx, 0);
   if (hdr->score >= ScoreThresholdFlag)
-    _mutt_set_flag (ctx, hdr, M_FLAG, 1, upd_ctx);
+    _mutt_set_flag (ctx, hdr, M_FLAG, 1, upd_ctx, 0);
 }
 
 int mutt_parse_unscore (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER 
*err)