Skip to content

Commit

Permalink
Add multiline support to client.message()/client.notice().
Browse files Browse the repository at this point in the history
  • Loading branch information
shizmob committed Jan 30, 2014
1 parent c2e27a4 commit c941d2b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pydle/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,9 @@ def message(self, target, message):
# Leeway.
chunklen = protocol.MESSAGE_LENGTH_LIMIT - len('{hostmask} PRIVMSG {target} :'.format(hostmask=hostmask, target=target)) - 25

for msg in _chunkify(message, chunklen):
self.rawmsg('PRIVMSG', target, msg)
for line in message.replace('\r', '').split('\n'):
for chunk in _chunkify(line, chunklen):
self.rawmsg('PRIVMSG', target, chunk)

def notice(self, target, message):
""" Notice channel or user. """
Expand All @@ -386,8 +387,9 @@ def notice(self, target, message):
# Leeway.
chunklen = protocol.MESSAGE_LENGTH_LIMIT - len('{hostmask} NOTICE {target} :'.format(hostmask=hostmask, target=target)) - 25

for msg in _chunkify(message, chunklen):
self.rawmsg('NOTICE', target, msg)
for line in message.replace('\r', '').split('\n'):
for chunk in _chunkify(line, chunklen):
self.rawmsg('NOTICE', target, chunk)

def mode(self, target, *modes):
""" Set mode on target. """
Expand Down

0 comments on commit c941d2b

Please sign in to comment.