Changed to make 'too long a message' error messages less inaccurate.

This commit is contained in:
Jeremy Fincher 2003-08-26 15:03:34 +00:00
parent ab562416bf
commit ed92fcad2b
3 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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)

View File

@ -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: