attempt to give up if we're doing too many splits
This commit is contained in:
parent
827d1b2c86
commit
466eb6eff1
@ -45,12 +45,18 @@ class DrBotServerConnection(irclib.ServerConnection):
|
|||||||
splitspace = space - (len(splitter) + 1)
|
splitspace = space - (len(splitter) + 1)
|
||||||
|
|
||||||
if len(text) > space:
|
if len(text) > space:
|
||||||
|
times = 1
|
||||||
|
|
||||||
while len(text) > splitspace:
|
while len(text) > splitspace:
|
||||||
splitpos = text.rfind(' ', 0, splitspace)
|
splitpos = text.rfind(' ', 0, splitspace)
|
||||||
splittext = text[0:splitpos] + ' ' + splitter
|
splittext = text[0:splitpos] + ' ' + splitter
|
||||||
text = splitter + ' ' + text[splitpos+1:]
|
text = splitter + ' ' + text[splitpos+1:]
|
||||||
self.send_raw("PRIVMSG %s :%s" % (target, unicode(splittext).encode('utf-8')))
|
self.send_raw("PRIVMSG %s :%s" % (target, unicode(splittext).encode('utf-8')))
|
||||||
|
|
||||||
|
times = times + 1
|
||||||
|
if times >= 4:
|
||||||
|
return
|
||||||
|
|
||||||
# done splitting
|
# done splitting
|
||||||
try:
|
try:
|
||||||
text = unicode(text).encode('utf-8')
|
text = unicode(text).encode('utf-8')
|
||||||
|
Loading…
Reference in New Issue
Block a user