summaryrefslogtreecommitdiffstats
path: root/kittystore/utils.py
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2012-12-14 14:25:27 +0100
committerAurélien Bompard <aurelien@bompard.org>2012-12-14 14:25:27 +0100
commit8ea86d9987a3142b6e83596d6a0d1df8f6d14af7 (patch)
treebc16e9e570b34e7e5f97d61bd4b15a30c3d1ec05 /kittystore/utils.py
parent876b6c36f289f7523f2d4d157e1e70a282c6bcf8 (diff)
downloadkittystore-8ea86d9987a3142b6e83596d6a0d1df8f6d14af7.tar.gz
kittystore-8ea86d9987a3142b6e83596d6a0d1df8f6d14af7.tar.xz
kittystore-8ea86d9987a3142b6e83596d6a0d1df8f6d14af7.zip
Change the reply detection system
- The In-Reply-To header has the priority - The last message-id in the Reference header is used, not the first one
Diffstat (limited to 'kittystore/utils.py')
-rw-r--r--kittystore/utils.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/kittystore/utils.py b/kittystore/utils.py
index badf5af..d98537f 100644
--- a/kittystore/utils.py
+++ b/kittystore/utils.py
@@ -110,12 +110,12 @@ def get_ref_and_thread_id(message, list_name, store):
and not message.has_key("In-Reply-To")):
return None, None
# It's a reply, use the thread_id from the parent email
- ref_id = message.get("References")
- if ref_id is not None and ref_id.strip():
- # There can be multiple references, use the first one
- ref_id = ref_id.split()[0].strip()
- else:
- ref_id = message.get("In-Reply-To")
+ ref_id = message.get("In-Reply-To")
+ if ref_id is None or not ref_id.strip():
+ ref_id = message.get("References")
+ if ref_id is not None and ref_id.strip():
+ # There can be multiple references, use the last one
+ ref_id = ref_id.split()[-1].strip()
if ref_id is not None:
ref_id = IN_BRACKETS_RE.match(ref_id)
if ref_id is None: