Added mores group and instant.

This commit is contained in:
Jeremy Fincher 2004-07-31 12:38:38 +00:00
parent 0fcb77243e
commit 2a611309a7
2 changed files with 19 additions and 2 deletions

View File

@ -618,7 +618,7 @@ class IrcObjectProxy(RichReplyMethods):
else:
s = ircutils.safeArgument(s)
allowedLength = 450 - len(self.irc.prefix)
maximumMores = conf.supybot.reply.maximumMores()
maximumMores = conf.supybot.reply.mores.maximum()
maximumLength = allowedLength * maximumMores
if len(s) > maximumLength:
log.warning('Truncating to %s bytes from %s bytes',
@ -641,6 +641,16 @@ class IrcObjectProxy(RichReplyMethods):
return
msgs = ircutils.wrap(s, allowedLength-30) # -30 is for nick:
msgs.reverse()
instant = conf.supybot.reply.mores.instant()
while instant > 1 and msgs:
instant -= 1
response = msgs.pop()
self.irc.queueMsg(reply(msg, response, to=self.to,
notice=self.notice,
private=self.private,
prefixName=self.prefixName))
if not msgs:
return
response = msgs.pop()
if msgs:
n = ircutils.bold('(%s)')

View File

@ -284,10 +284,17 @@ registerChannelValue(supybot.reply, 'truncate',
messages instead of breaking up long messages and using the 'more' command
to get the remaining chunks."""))
registerChannelValue(supybot.reply, 'maximumMores',
registerGroup(supybot.reply, 'mores')
registerChannelValue(supybot.reply.mores, 'maximum',
registry.PositiveInteger(50, """Determines what the maximum number of
chunks (for use with the 'more' command) will be."""))
registerChannelValue(supybot.reply.mores, 'instant',
registry.PositiveInteger(1, """Determines how many mores will be sent
instantly (i.e., without the use of the more command, immediately when
they are formed). Defaults to 1, which means that a more command will be
required for all but the first chunk."""))
registerGlobalValue(supybot.reply, 'oneToOne',
registry.Boolean(True, """Determines whether the bot will send
multi-message replies in a single messsage or in multiple messages. For