Skip to content

Commit

Permalink
Prevent raw text from being sent - irc.py
Browse files Browse the repository at this point in the history
The true issue being that newlines didn't append the right command.
  • Loading branch information
Foxlet committed Aug 29, 2015
1 parent f258577 commit 3b8bf97
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions cloudbot/clients/irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,21 @@ def close(self):
self._transport.close()
self._connected = False

def message(self, target, *messages, newlines=False):
def message(self, target, *messages):
for text in messages:
if newlines == False:
text = text.replace("\n", "").replace("\r", "")
self.cmd("PRIVMSG", target, text)

def action(self, target, text, newlines=False):
if newlines == False:
text = text.replace("\n", "").replace("\r", "")
self.ctcp(target, "ACTION", text)

def notice(self, target, text, newlines=False):
if newlines == False:
text = text.replace("\n", "").replace("\r", "")
self.cmd("NOTICE", target, text)
text = text.splitlines()
for line in text:
self.cmd("PRIVMSG", target, line)

def action(self, target, text):
text = text.splitlines()
for line in text:
self.ctcp(target, "ACTION", line)

def notice(self, target, text):
text = text.splitlines()
for line in text:
self.cmd("NOTICE", target, line)

def set_nick(self, nick):
self.cmd("NICK", nick)
Expand Down

1 comment on commit 3b8bf97

@aikar
Copy link

@aikar aikar commented on 3b8bf97 Aug 29, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still vulnerable to repeating new lines in unencode, making the bot spam messages (and get kicked)

Result of .unencode directly should filter before passing to message. Then if PLUGINS call message with a new line, this behavior is desirable.

So not saying undo this, but to still filter result of unencode before it reaches this.

Please sign in to comment.