3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 03:29:28 +01:00

Irc.send: safeguard against newlines in input!

This commit is contained in:
James Lu 2015-07-09 17:25:10 -07:00
parent 070bba77cb
commit e54e17a0ea

View File

@ -75,6 +75,9 @@ class Irc():
sys.exit(1)
def send(self, data):
# Safeguard against newlines in input!! Otherwise, each line gets
# treated as a separate command, which is particularly nasty.
data = data.replace('\n', ' ')
data = data.encode("utf-8") + b"\n"
log.debug("-> %s", data.decode("utf-8").strip("\n"))
self.socket.send(data)