mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Changed to make 'too long a message' error messages less inaccurate.
This commit is contained in:
parent
ab562416bf
commit
ed92fcad2b
@ -97,8 +97,6 @@ def reply(msg, s):
|
|||||||
m = ircmsgs.privmsg(msg.args[0], '%s: %s' % (msg.nick, s))
|
m = ircmsgs.privmsg(msg.args[0], '%s: %s' % (msg.nick, s))
|
||||||
else:
|
else:
|
||||||
m = ircmsgs.privmsg(msg.nick, s)
|
m = ircmsgs.privmsg(msg.nick, s)
|
||||||
if len(m) > 512:
|
|
||||||
m = reply(msg, 'My response would\'ve been too long.')
|
|
||||||
return m
|
return m
|
||||||
|
|
||||||
def error(msg, s):
|
def error(msg, s):
|
||||||
@ -317,6 +315,8 @@ class IrcObjectProxy:
|
|||||||
self.irc.reply(msg, s)
|
self.irc.reply(msg, s)
|
||||||
else:
|
else:
|
||||||
s = ircutils.safeArgument(s)
|
s = ircutils.safeArgument(s)
|
||||||
|
if len(s) + len(self.irc.prefix) > 512:
|
||||||
|
s = 'My response would\'ve been too long.'
|
||||||
self.irc.queueMsg(reply(msg, s))
|
self.irc.queueMsg(reply(msg, s))
|
||||||
else:
|
else:
|
||||||
self.args[self.counter] = s
|
self.args[self.counter] = s
|
||||||
|
@ -486,6 +486,9 @@ class Irc(object):
|
|||||||
self.driver.scheduleReconnect()
|
self.driver.scheduleReconnect()
|
||||||
if self.driver:
|
if self.driver:
|
||||||
self.driver.die()
|
self.driver.die()
|
||||||
|
elif msg.command == 'PRIVMSG':
|
||||||
|
if msg.nick == self.nick:
|
||||||
|
self.prefix = msg.prefix
|
||||||
# Now update the IrcState object.
|
# Now update the IrcState object.
|
||||||
try:
|
try:
|
||||||
self.state.addMsg(self, msg)
|
self.state.addMsg(self, msg)
|
||||||
|
@ -147,8 +147,8 @@ class IrcMsg(object):
|
|||||||
self._len = 0
|
self._len = 0
|
||||||
if self.prefix:
|
if self.prefix:
|
||||||
self._len += len(self.prefix)
|
self._len += len(self.prefix)
|
||||||
else:
|
## else:
|
||||||
self._len += 42 # Ironically, the average length of an IRC prefix.
|
## self._len += 42
|
||||||
self._len += len(self.command)
|
self._len += len(self.command)
|
||||||
if self.args:
|
if self.args:
|
||||||
for arg in self.args:
|
for arg in self.args:
|
||||||
|
Loading…
Reference in New Issue
Block a user