From d43f0e52d8c5b5a99023fd392478b9457c1443c8 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 27 May 2015 16:18:08 -0400 Subject: [PATCH] Update reply handler What we really want to do is look for the first line beginning with ">" and discard everything after it (and the line immediately before it, just to be safe) Signed-off-by: Anna Schumaker --- slackpost.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/slackpost.py b/slackpost.py index f671de1..ab0faff 100755 --- a/slackpost.py +++ b/slackpost.py @@ -26,12 +26,12 @@ if channel == None: sys.exit(1) lines = headers.get_payload().strip().split("\n") +for i in range(len(lines)): + if len(lines[i]) == 0: + continue + if lines[i][0] == ">": + break -# Strip out quoted text -if lines[-1][0] == ">": - while lines[-1][0] == ">": - lines.pop(-1) - lines.pop(-1) - +lines = lines[0:i-1] text = ' '.join(lines).strip() channel.post(text)