mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +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))
|
||||
else:
|
||||
m = ircmsgs.privmsg(msg.nick, s)
|
||||
if len(m) > 512:
|
||||
m = reply(msg, 'My response would\'ve been too long.')
|
||||
return m
|
||||
|
||||
def error(msg, s):
|
||||
@ -317,6 +315,8 @@ class IrcObjectProxy:
|
||||
self.irc.reply(msg, s)
|
||||
else:
|
||||
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))
|
||||
else:
|
||||
self.args[self.counter] = s
|
||||
|
@ -486,6 +486,9 @@ class Irc(object):
|
||||
self.driver.scheduleReconnect()
|
||||
if self.driver:
|
||||
self.driver.die()
|
||||
elif msg.command == 'PRIVMSG':
|
||||
if msg.nick == self.nick:
|
||||
self.prefix = msg.prefix
|
||||
# Now update the IrcState object.
|
||||
try:
|
||||
self.state.addMsg(self, msg)
|
||||
|
@ -147,8 +147,8 @@ class IrcMsg(object):
|
||||
self._len = 0
|
||||
if self.prefix:
|
||||
self._len += len(self.prefix)
|
||||
else:
|
||||
self._len += 42 # Ironically, the average length of an IRC prefix.
|
||||
## else:
|
||||
## self._len += 42
|
||||
self._len += len(self.command)
|
||||
if self.args:
|
||||
for arg in self.args:
|
||||
|
Loading…
Reference in New Issue
Block a user