buffy.c
charset.c
crypt.c
+score.c
config.h
charset.gperf
buffy.cpkg
charset.cpkg
crypt.cpkg
+ score.cpkg
account.c
attach.c
recvattach.c
recvcmd.c
remailer.c
- score.c
send.c
sendlib.c
send_smtp.c
WHERE short MaxDispRecips;
WHERE short MaxLineLength;
-WHERE short ScoreThresholdDelete;
-WHERE short ScoreThresholdRead;
-WHERE short ScoreThresholdFlag;
-
WHERE short DrawFullLine INITVAL (0);
WHERE short SidebarWidth;
* please see the file GPL in the top level source directory.
*/
-#ifdef _MAKEDOC
-# include "config.h"
-#else
-# include "sort.h"
-#endif
-
+#include "sort.h"
#include "mutt.h"
+#include "score.h"
#ifndef _MAKEDOC
#define DT_MASK 0x0f
** possibly including eventual real names. When it is \fIunset\fP, Madmutt will
** override any such real names with the setting of the $realname variable.
*/
- {"score", DT_BOOL, R_NONE, OPTSCORE, "yes" },
- /*
- ** .pp
- ** When this variable is \fIunset\fP, scoring is turned off. This can
- ** be useful to selectively disable scoring for certain folders when the
- ** ``$$score_threshold_delete'' variable and friends are used.
- **
- */
- {"score_threshold_delete", DT_NUM, R_NONE, UL &ScoreThresholdDelete, "-1" },
- /*
- ** .pp
- ** Messages which have been assigned a score equal to or lower than the value
- ** of this variable are automatically marked for deletion by Madmutt. Since
- ** Madmutt scores are always greater than or equal to zero, the default setting
- ** of this variable will never mark a message for deletion.
- */
- {"score_threshold_flag", DT_NUM, R_NONE, UL &ScoreThresholdFlag, "9999" },
- /*
- ** .pp
- ** Messages which have been assigned a score greater than or equal to this
- ** variable's value are automatically marked ``flagged''.
- */
- {"score_threshold_read", DT_NUM, R_NONE, UL &ScoreThresholdRead, "-1" },
- /*
- ** .pp
- ** Messages which have been assigned a score equal to or lower than the value
- ** of this variable are automatically marked as read by Madmutt. Since
- ** Madmutt scores are always greater than or equal to zero, the default setting
- ** of this variable will never mark a message read.
- */
#ifdef USE_NNTP
{"nntp_save_unsubscribed", DT_BOOL, R_NONE, OPTSAVEUNSUB, "no" },
/*
## dsn_notify
## dsn_return
## editor
+## enable
## envelope_from_address
## file_charset
## force_tls
## spam_separator
## starttls
## sysconfdir
+## threshold_delete
+## threshold_flag
+## threshold_read
## tmpdir
## use_8bitmime
## use_domain
#include <lib-lib/lib-lib.h>
#include <lib-lua/lib-lua.h>
-#include "../alias.h"
#include "../mutt.h"
-#include "../charset.h"
-#include "../buffy.h"
-#include "../crypt.h"
+#include "../alias.li"
+#include "../buffy.li"
+#include "../charset.li"
+#include "../crypt.li"
+#include "../score.li"
#include <lib-sys/mutt_ssl.li>
static lua_State *L;
{"Buffy", luaopen_Buffy},
{"mod_ssl", luaopen_mod_ssl},
{"mod_crypt", luaopen_mod_crypt},
+ {"mod_score", luaopen_mod_score},
};
int i;
#include "copy.h"
#include "keymap.h"
#include "compress.h"
+#include "score.h"
#include "dotlock.h"
#include <imap/imap.h>
/* p_delete(&h->env->supersedes); should I ? */
if (h2) {
h2->superseded = 1;
- if (!ctx->counting && option (OPTSCORE))
+ if (!ctx->counting && mod_score.enable)
mutt_score_message (ctx, h2, 1);
}
}
if (ctx->subj_hash && h->env->real_subj)
hash_insert (ctx->subj_hash, h->env->real_subj, h);
- if (option (OPTSCORE))
+ if (mod_score.enable)
mutt_score_message (ctx, h, 0);
}
#include "recvattach.h"
#include "buffy.h"
#include "thread.h"
+#include "score.h"
#include <imap/imap_private.h>
OPTREVALIAS,
OPTREVNAME,
OPTREVREAL,
- OPTSCORE,
OPTSIGDASHES,
OPTSORTRE,
OPTSPAMSEP,
void mutt_add_to_reference_headers (ENVELOPE * env, ENVELOPE * curenv,
string_list_t *** pp, string_list_t *** qq);
int mutt_bounce_message (FILE * fp, HEADER *, address_t *);
-void mutt_check_rescore (CONTEXT *);
void mutt_default_save (char *, ssize_t, HEADER *);
void mutt_display_address (ENVELOPE *);
void mutt_edit_content_type (HEADER *, BODY *, FILE *);
void mutt_print_message (HEADER *);
void mutt_safe_path (char *s, ssize_t l, address_t * a);
void mutt_save_path (char *s, ssize_t l, address_t * a);
-void mutt_score_message (CONTEXT *, HEADER *, int);
void mutt_select_fcc (char *, ssize_t, HEADER *);
#define mutt_select_file(A,B,C) _mutt_select_file(A,B,C,NULL,NULL)
int mutt_parse_macro (BUFFER *, BUFFER *, unsigned long, BUFFER *);
int mutt_parse_push (BUFFER *, BUFFER *, unsigned long, BUFFER *);
int mutt_parse_rc_line (const char *, BUFFER *, BUFFER *);
-int mutt_parse_score (BUFFER *, BUFFER *, unsigned long, BUFFER *);
-int mutt_parse_unscore (BUFFER *, BUFFER *, unsigned long, BUFFER *);
int mutt_parse_unhook (BUFFER *, BUFFER *, unsigned long, BUFFER *);
int mutt_query_variables (string_list_t * queries);
int _mutt_save_message (HEADER *, CONTEXT *, int, int, int);
#include "mutt.h"
#include "sort.h"
#include "pattern.h"
+#include "score.h"
+@import "lib-lua/base.cpkg"
+
+@package mod_score {
+ bool enable = 1;
+ /*
+ ** .pp
+ ** When this variable is \fIunset\fP, scoring is turned off. This can
+ ** be useful to selectively disable scoring for certain folders when the
+ ** ``$$score_threshold_delete'' variable and friends are used.
+ **
+ */
+ int threshold_flag = 9999;
+ /*
+ ** .pp
+ ** Messages which have been assigned a score greater than or equal to this
+ ** variable's value are automatically marked ``flagged''.
+ */
+ int threshold_delete = -1;
+ /*
+ ** .pp
+ ** Messages which have been assigned a score equal to or lower than the value
+ ** of this variable are automatically marked for deletion by Madmutt. Since
+ ** Madmutt scores are always greater than or equal to zero, the default setting
+ ** of this variable will never mark a message for deletion.
+ */
+ int threshold_read = -1;
+ /*
+ ** .pp
+ ** Messages which have been assigned a score equal to or lower than the value
+ ** of this variable are automatically marked as read by Madmutt. Since
+ ** Madmutt scores are always greater than or equal to zero, the default setting
+ ** of this variable will never mark a message read.
+ */
+};
typedef struct score_t {
char *str;
{
int i;
- if (option (OPTNEEDRESCORE) && option (OPTSCORE)) {
+ if (option (OPTNEEDRESCORE) && mod_score.enable) {
if ((Sort & SORT_MASK) == SORT_SCORE ||
(SortAux & SORT_MASK) == SORT_SCORE) {
set_option (OPTNEEDRESORT);
if (hdr->score < 0)
hdr->score = 0;
- if (hdr->score <= ScoreThresholdDelete)
+ if (hdr->score <= mod_score.threshold_delete)
_mutt_set_flag (ctx, hdr, M_DELETE, 1, upd_ctx);
- if (hdr->score <= ScoreThresholdRead)
+ if (hdr->score <= mod_score.threshold_flag)
_mutt_set_flag (ctx, hdr, M_READ, 1, upd_ctx);
- if (hdr->score >= ScoreThresholdFlag)
+ if (hdr->score >= mod_score.threshold_flag)
_mutt_set_flag (ctx, hdr, M_FLAG, 1, upd_ctx);
}
set_option (OPTNEEDRESCORE);
return 0;
}
+
+/* vim:set ft=c: */
--- /dev/null
+/*
+ * Copyright notice from original mutt:
+ * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
+ *
+ * This file is part of mutt-ng, see http://www.muttng.org/.
+ * It's licensed under the GNU General Public License,
+ * please see the file GPL in the top level source directory.
+ */
+
+#ifndef MUTT_SCORE_H
+#define MUTT_SCORE_H
+
+void mutt_check_rescore (CONTEXT *);
+int mutt_parse_score (BUFFER *, BUFFER *, unsigned long, BUFFER *);
+void mutt_score_message (CONTEXT *, HEADER *, int);
+int mutt_parse_unscore (BUFFER *, BUFFER *, unsigned long, BUFFER *);
+
+#include "score.li"
+#endif
#include "alias.h"
#include "sort.h"
#include "thread.h"
+#include "score.h"
#include "mutt_idna.h"
#define SORTCODE(x) (Sort & SORT_REVERSE) ? -(x) : x
if (!ctx->quiet)
mutt_message _("Sorting mailbox...");
- if (option (OPTNEEDRESCORE) && option (OPTSCORE)) {
+ if (option (OPTNEEDRESCORE) && mod_score.enable) {
for (i = 0; i < ctx->msgcount; i++)
mutt_score_message (ctx, ctx->hdrs[i], 1);
}