[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gnus notification of replies to my articles

From: Clemens Schüller
Subject: Re: Gnus notification of replies to my articles
Date: Tue, 10 Mar 2020 22:09:32 +0100


On 10. Mär. 2020 at 18:49 Adam Sjøgren writes via info-gnus-english:
> Eric writes:

>> You could try adding an entry along the lines of
>> ("references"
>>   ("<some regex goes here>" 100 nil r))
>> to your .SCORE file where the regex is something that matches your
>> emails, i.e. the typical message-id of your emails (which, for instance,
>> is <> for the article I'm responding to).  What I
>> don't know is whether there is a regex that would work generally to
>> identify your articles.  Message IDs are a mystery to me.
> Yes, that works.
> I have this in my all.SCORE:
>    ("references"
>     ("<87[0-9a-z]+\\.fsf\\(_-_\\)?@.*>" nil nil r))
> I think the way Gnus generates Message-IDs, the first two chars are
> stable per machine (or perhaps user), or something like that.

Nope, the first 2 Chars in the MID a generated from the UID of the User:
In my Setup the fsf Part is replaced with the name of the current PC.

Here is the Code for this - perhaps you can better finetune the Scoring.

--8<---------------cut here---------------start------------->8---
(defun message-unique-id ()
  ;; Don't use microseconds from (current-time), they may be unsupported.
  ;; Instead we use this randomly inited counter.
  (setq message-unique-id-char
        (% (1+ (or message-unique-id-char
                   (random (ash 1 20))))
           ;; (current-time) returns 16-bit ints,
           ;; and 2^16*25 just fits into 4 digits i base 36.
           (* 25 25)))
  (let ((tm (current-time)))
     (if (or (eq system-type 'ms-dos)
             ;; message-number-base36 doesn't handle bigints.
             (floatp (user-uid)))
         (let ((user (downcase (user-login-name))))
           (while (string-match "[^a-z0-9_]" user)
             (aset user (match-beginning 0) ?_))
       (message-number-base36 (user-uid) -1))
     (message-number-base36 (+ (car tm)
                               (ash (% message-unique-id-char 25) 16)) 4)
     (message-number-base36 (+ (nth 1 tm)
                               (ash (/ message-unique-id-char 25) 16)) 4)
     ;; Append a given name, because while the generated ID is unique
     ;; to this newsreader, other newsreaders might otherwise generate
     ;; the same ID via another algorithm.
;;   ^^^^^^^^^^

;;   Replace warhorse with the current machine Name (or something else)
--8<---------------cut here---------------end--------------->8---

Best Regards, Clemens Schüller

reply via email to

[Prev in Thread] Current Thread [Next in Thread]