added '~*' pattern as score on realname (email addr. and >=2 name fields; esp. for usenet)
git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@95
e385b8ad-14ed-0310-8656-
cc95a2468c6d
~z [MIN]-[MAX] messages with a size in the range MIN to MAX *)
~= duplicated messages (see $duplicate_threads)
~$ unreferenced messages (requires threaded view)
~z [MIN]-[MAX] messages with a size in the range MIN to MAX *)
~= duplicated messages (see $duplicate_threads)
~$ unreferenced messages (requires threaded view)
+~* ``From'' contains realname and (syntactically) valid
+ address (excluded are addresses matching against
+ alternates or any alias)
</verb></tscreen>
Where EXPR, USER, ID, and SUBJECT are
</verb></tscreen>
Where EXPR, USER, ID, and SUBJECT are
/*
* Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2004 g10 Code GmbH
/*
* Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2004 g10 Code GmbH
M_LIMIT,
M_EXPIRED,
M_SUPERSEDED,
M_LIMIT,
M_EXPIRED,
M_SUPERSEDED,
/* actions for mutt_pattern_comp/mutt_pattern_exec */
M_AND,
/* actions for mutt_pattern_comp/mutt_pattern_exec */
M_AND,
{ 'z', M_SIZE, 0, eat_range },
{ '=', M_DUPLICATED, 0, NULL },
{ '$', M_UNREFERENCED, 0, NULL },
{ 'z', M_SIZE, 0, eat_range },
{ '=', M_DUPLICATED, 0, NULL },
{ '$', M_UNREFERENCED, 0, NULL },
+ { '*', M_REALNAME, 0, NULL },
+/* test if name is considered a real name, i.e. consists of at least 2
+ * space-separated words of which none may end in a dot
+ */
+static int valid_realname (const char* name)
+{
+ const char* p = name;
+ int ret = 0;
+ while (*p)
+ {
+ if (isspace (*p))
+ ret++;
+ else if (*p == '.')
+ /* skip abbr. parts of names (e.g. 'J. User') */
+ ret--;
+ p++;
+ }
+ return (ret >= 1);
+}
+
/* flags
M_MATCH_FULL_ADDRESS match both personal and machine address */
int
/* flags
M_MATCH_FULL_ADDRESS match both personal and machine address */
int
return (pat->not ^ (h->thread && h->thread->duplicate_thread));
case M_UNREFERENCED:
return (pat->not ^ (h->thread && !h->thread->child));
return (pat->not ^ (h->thread && h->thread->duplicate_thread));
case M_UNREFERENCED:
return (pat->not ^ (h->thread && !h->thread->child));
+ case M_REALNAME:
+ /* realname filter:
+ * we have a match if
+ * - From: matches $alternates
+ * - or we have an alias for current address
+ * - or From: contains valid email address _and_ name has >= 2 fields
+ */
+ return (pat->not ^ (h->env && h->env->from && (
+ mutt_addr_is_user (h->env->from) ||
+ (alias_reverse_lookup (h->env->from) != NULL) ||
+ (h->env->from->personal && valid_realname (h->env->from->personal) && h->env->from->mailbox)
+ )));
#ifdef USE_NNTP
case M_NEWSGROUPS:
return (pat->not ^ (h->env->newsgroups && regexec (pat->rx, h->env->newsgroups, 0, NULL, 0) == 0));
#ifdef USE_NNTP
case M_NEWSGROUPS:
return (pat->not ^ (h->env->newsgroups && regexec (pat->rx, h->env->newsgroups, 0, NULL, 0) == 0));