diff options
-rw-r--r-- | peebz/bz2pi.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/peebz/bz2pi.py b/peebz/bz2pi.py index 0559d53..77eea1f 100644 --- a/peebz/bz2pi.py +++ b/peebz/bz2pi.py @@ -6,10 +6,12 @@ import argparse import peebz import datetime +import time import re import b4 import email.message +import email.utils from fnmatch import fnmatch @@ -19,6 +21,7 @@ logger = peebz.logger def process_new_comments(bid: int, privacy_mode: bool = False, dry_run: bool = False): config = peebz.get_config() cdatas = peebz.bz_get_newest_comments_for_bid(bid) + msgts = int(time.time()) for cdata in cdatas: # Check if we've already notified about this bug cid = cdata['id'] @@ -88,6 +91,11 @@ def process_new_comments(bid: int, privacy_mode: bool = False, dry_run: bool = F msg = email.message.EmailMessage() if not privacy_mode: msg['Reply-To'] = b4.format_addrs([('', cdata['creator'])]) + # A little hack to make sure Date: is consecutive for threads + try: + msg['Date'] = email.utils.formatdate(msgts + int(cdata['count']), localtime=True) + except ValueError: + pass body = bodytpt.safe_substitute(bodyvals) body = peebz.add_bot_signature(body) msg.set_payload(body, charset='utf-8') |