diff hgext/notify.py @ 7673:af4871b73be7

notify: fix neglect of custom headers set via template e981725da3fe introduced a bug that discarded all custom headers. Add custom header to test template.
author Christian Ebert <blacktrash@gmx.net>
date Thu, 15 Jan 2009 01:38:52 +0100
parents 64840fcb79e1
children c55e68e8f256
line wrap: on
line diff
--- a/hgext/notify.py	Mon Jan 19 12:36:06 2009 +0100
+++ b/hgext/notify.py	Thu Jan 15 01:38:52 2009 +0100
@@ -185,10 +185,16 @@
 
         # store sender and subject
         sender, subject = msg['From'], msg['Subject']
+        del msg['From'], msg['Subject']
+        # store remaining headers
+        headers = msg.items()
         # create fresh mime message from msg body
         text = msg.get_payload()
         # for notification prefer readability over data precision
         msg = mail.mimeencode(self.ui, text, self.charsets, self.test)
+        # reinstate custom headers
+        for k, v in headers:
+            msg[k] = v
 
         def fix_subject(subject):
             '''try to make subject line exist and be useful.'''