]> git.notmuchmail.org Git - notmuch/commitdiff
vim: generate custom message-id
authorFelipe Contreras <felipe.contreras@gmail.com>
Mon, 14 Oct 2013 06:19:05 +0000 (01:19 -0500)
committerFelipe Contreras <felipe.contreras@gmail.com>
Wed, 20 Nov 2013 13:23:29 +0000 (07:23 -0600)
Using Mail as a reference.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
vim/notmuch.vim

index 4bd5f131aa564a9f4176d2f527ef511a03c32443..64038eb5d498cd1b0c4ff31de8f8a88a5dd6367b 100644 (file)
@@ -421,6 +421,7 @@ ruby << EOF
        require 'notmuch'
        require 'rubygems'
        require 'tempfile'
+       require 'socket'
        begin
                require 'mail'
        rescue LoadError
@@ -492,6 +493,14 @@ ruby << EOF
                end
        end
 
+       def generate_message_id
+               t = Time.now
+               random_tag = sprintf('%x%x_%x%x%x',
+                       t.to_i, t.tv_usec,
+                       $$, Thread.current.object_id.abs, rand(255))
+               return "<#{random_tag}@#{Socket.gethostname}.notmuch>"
+       end
+
        def open_reply(orig)
                help_lines = [
                        'Notmuch-Help: Type in your message here; to help you use these bindings:',
@@ -505,6 +514,7 @@ ruby << EOF
                        end
                        m.cc = orig[:cc]
                        m.from = $email
+                       m.message_id = generate_message_id
                        m.charset = 'utf-8'
                        m.content_transfer_encoding = '7bit'
                end