Dedupe message decoding to string

This commit is contained in:
Midgard 2019-09-03 00:47:54 +02:00
parent 378b668f7a
commit c3524a6536

View file

@ -85,14 +85,16 @@ def messages_post():
if not message:
return "No message found"
if "spam" in str(message, "UTF-8").lower():
message_str = message.decode()
if "spam" in message_str.lower():
messages.append(Message(time, "1.3.3.7", "ip", "Nee"))
return "OK"
if sender != "somebody":
message = "<" + sender + "> " + message.decode()
message_str = "<{}> {}".format(sender, message_str)
messages.append(Message(time, sender, sendertype, message))
messages.append(Message(time, sender, sendertype, message_str))
url = 'http://10.0.5.42:8000/' # Set destination URL here
post_fields = {'X-Messages': base64.b64encode(message)}