diff --git a/slackpost.py b/slackpost.py index f887e4e..ee3fcd3 100755 --- a/slackpost.py +++ b/slackpost.py @@ -4,6 +4,7 @@ import slack import sys +import quopri from email.parser import Parser @@ -35,7 +36,8 @@ split = headers.get_payload().split(reply) # We should have a two element list. The thread id # is in the text at the start of the second element. # -thread_id = split[-1].split()[0] +quoted = quopri.decodestring(split[-1]).decode() +thread_id = quoted.split()[0] if thread_id.find("thread=") == -1: print("Thread ID missing!") sys.exit(1) @@ -56,7 +58,6 @@ for line in split[0].split("\n"): while lines[-1] != "": lines.pop(len(lines) - 1) text = ' '.join(lines).strip() -print(text) thread = slack.find_thread(thread_id)