slackpost: Decode reply as quoted-printable text
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
14e44c1734
commit
673bac86bc
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
import slack
|
import slack
|
||||||
import sys
|
import sys
|
||||||
|
import quopri
|
||||||
from email.parser import Parser
|
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
|
# We should have a two element list. The thread id
|
||||||
# is in the text at the start of the second element.
|
# 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:
|
if thread_id.find("thread=") == -1:
|
||||||
print("Thread ID missing!")
|
print("Thread ID missing!")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -56,7 +58,6 @@ for line in split[0].split("\n"):
|
||||||
while lines[-1] != "":
|
while lines[-1] != "":
|
||||||
lines.pop(len(lines) - 1)
|
lines.pop(len(lines) - 1)
|
||||||
text = ' '.join(lines).strip()
|
text = ' '.join(lines).strip()
|
||||||
print(text)
|
|
||||||
|
|
||||||
|
|
||||||
thread = slack.find_thread(thread_id)
|
thread = slack.find_thread(thread_id)
|
||||||
|
|
Loading…
Reference in New Issue