Gnus development mailing list
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: ding@gnus.org
Subject: Re: Custom Message-ID
Date: Mon, 15 Aug 2016 15:59:13 +0200	[thread overview]
Message-ID: <yu.86eg5qxhe6.fsf@student.uu.se> (raw)
In-Reply-To: <8737m78ri3.fsf@alex.chromebook>

Byung-Hee HWANG "(황병희)" wrote:

> Firstly, i would like to give "Big Thanks" to
> Jorge and Emanuel about two weeks ago, thanks
> to them, i got my style's citiation in Gnus.
> That is so happy.

Well, obviously you are welcome, but thank us
even more by making sure always to process the
information (even when it doesn't help or you
don't agree), that way, helping you solve
problem A will given time and effort prepare
you to solve problem O without help, and with
even more time and efforts you can help someone
else - perhaps even us - solve yet
another problem!

> Today i have more question.
>
> Really i am literary man rather than computing
> man.

You can be both! Start today!

> In Message-ID of Gnus, i want to put a prefix
> "yw" into front of Message-ID. The "yw" is
> special to me. That is all. But i failed to
> search a way.

> As you know, i am not ... elisp expert

Who is? :)

> I searched google, and i looked some .el
> files in gnus directory. Maybe message.el
> seems to have hints. But i don't know what
> key is.

I don't think this is a problem that a lot of
people have solved because it is in the
mageo-mythical domain :)

> Anyway i want a Message-ID as below: (example)
>
>        <yw.87jdfsfms7838.fsf@myhost.fqdn>

There are 93 occurrences of "Message-ID" in the
Gnus manual, and 8 in the "message manual" (or
info file).

It is a good start and probably a quick check
(open the file in Emacs, then do normal search,
or use the Emacs info interface if you are
comfortable with that).

    93   emacs     /usr/share/info/emacs-24/gnus.info
     8   emacs     /usr/share/info/emacs-24/message.info

The Message-ID header "contains a unique
identifier for this electronic mail message.
This is constructed by using the originator's
domain name for the domain component along with
a locally generated string". [1, p. 96]

Now, if something is unique, and you append
something to it, is there a hazard the result
won't be unique? Well, it depends, but I think
it should be safe.

Here is the code you need, from

    /usr/share/emacs/24.4/lisp/gnus/message.el.gz

starting at line 5544, with only one change (at
line 15, or "5559").

;; If you ever change this function, make sure the new version
;; cannot generate IDs that the old version could.
;; You might for example insert a "." somewhere (not next to another dot
;; or string boundary), or modify the "fsf" string.
(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
		   (logand (random most-positive-fixnum) (1- (lsh 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)))
    (concat
     "yw."
     (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) ?_))
	   user)
       (message-number-base36 (user-uid) -1))
     (message-number-base36 (+ (car tm)
			       (lsh (% message-unique-id-char 25) 16)) 4)
     (message-number-base36 (+ (nth 1 tm)
			       (lsh (/ 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.
     ".fsf")))

[1] @book{internet-message,
  title      = {The Internet Message: Closing the Book with Electronic Mail},
  author     = {Marshall Rose},
  publisher  = {Prentice-Hall},
  year       = 1993,
  ISBN       = {0-13-092941-7},
}

--
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 66 Blogomatic articles -




  parent reply	other threads:[~2016-08-15 13:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-14 12:27 Byung-Hee HWANG (황병희)
2016-08-14 13:41 ` Eric Abrahamsen
2016-08-15 14:07   ` Byung-Hee HWANG (황병희)
2016-08-15 16:30     ` Ted Zlatanov
2016-08-15 17:12       ` Emanuel Berg
2016-08-15 17:07     ` Andreas Schwab
2016-08-15 17:15       ` Emanuel Berg
2016-08-15 17:27       ` Emanuel Berg
2016-08-17 11:58       ` Byung-Hee HWANG (황병희)
2016-08-18 14:23         ` Byung-Hee HWANG (황병희)
2016-08-15 13:59 ` Emanuel Berg [this message]
2016-08-15 14:31   ` Byung-Hee HWANG (황병희)
2016-08-15 17:10     ` Emanuel Berg
2016-08-18 14:50       ` Byung-Hee HWANG (황병희)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yu.86eg5qxhe6.fsf@student.uu.se \
    --to=embe8573@student.uu.se \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).