Converted some plugin stuff to use format.

This commit is contained in:
Jeremy Fincher 2005-01-28 15:14:39 +00:00
parent e1fe232e9b
commit 90d95a006c
2 changed files with 13 additions and 16 deletions

View File

@ -157,7 +157,7 @@ class Admin(callbacks.Privmsg):
L = irc.state.channels.keys() L = irc.state.channels.keys()
if L: if L:
utils.sortBy(ircutils.toLower, L) utils.sortBy(ircutils.toLower, L)
irc.reply(utils.str.commaAndify(L)) irc.reply(format('%L', L))
else: else:
irc.reply('I\'m not currently in any channels.') irc.reply('I\'m not currently in any channels.')
channels = wrap(channels, ['private']) channels = wrap(channels, ['private'])
@ -325,7 +325,7 @@ class Admin(callbacks.Privmsg):
""" """
# XXX Add the expirations. # XXX Add the expirations.
if ircdb.ignores.hostmasks: if ircdb.ignores.hostmasks:
irc.reply(utils.str.commaAndify(map(repr,ircdb.ignores.hostmasks))) irc.reply(format('%L', (map(repr,ircdb.ignores.hostmasks))))
else: else:
irc.reply('I\'m not currently globally ignoring anyone.') irc.reply('I\'m not currently globally ignoring anyone.')
ignores = wrap(ignores) ignores = wrap(ignores)

View File

@ -99,10 +99,10 @@ class NoSuitableDatabase(Exception):
self.suitable.sort() self.suitable.sort()
def __str__(self): def __str__(self):
return 'No suitable databases were found. Suitable databases ' \ return format('No suitable databases were found. Suitable databases '
'include %s. If you have one of these databases installed, ' \ 'include %L. If you have one of these databases '
'make sure it is listed in the supybot.databases ' \ 'installed, make sure it is listed in the '
'configuration variable.' % utils.str.commaAndify(self.suitable) 'supybot.databases configuration variable.',self.suitable)
def DB(filename, types): def DB(filename, types):
filename = conf.supybot.directories.data.dirize(filename) filename = conf.supybot.directories.data.dirize(filename)
@ -467,10 +467,10 @@ class ChannelIdDatabasePlugin(callbacks.Privmsg):
L.append(self.searchSerializeRecord(record)) L.append(self.searchSerializeRecord(record))
if L: if L:
L.sort() L.sort()
irc.reply('%s found: %s' % (len(L), utils.str.commaAndify(L))) irc.reply(format('%s found: %L', len(L), L))
else: else:
irc.reply('No matching %s were found.' % what = self.name().lower()
utils.str.pluralize(self.name().lower())) irc.reply(format('No matching %p were found.', what))
search = wrap(search, ['channeldb', search = wrap(search, ['channeldb',
getopts({'by': 'otherUser', getopts({'by': 'otherUser',
'regexp': 'regexpMatcher'}), 'regexp': 'regexpMatcher'}),
@ -478,11 +478,8 @@ class ChannelIdDatabasePlugin(callbacks.Privmsg):
def showRecord(self, record): def showRecord(self, record):
name = getUserName(record.by) name = getUserName(record.by)
at = time.localtime(record.at) return format('%s #%s: %q (added by %s at %t)',
timeS = time.strftime(conf.supybot.reply.format.time(), at) self.name(), record.id, record.text, name, record.at)
return '%s #%s: %s (added by %s at %s)' % \
(self.name(), record.id,
utils.str.quoted(record.text), name, timeS)
def get(self, irc, msg, args, channel, id): def get(self, irc, msg, args, channel, id):
"""[<channel>] <id> """[<channel>] <id>
@ -523,8 +520,8 @@ class ChannelIdDatabasePlugin(callbacks.Privmsg):
itself. itself.
""" """
n = self.db.size(channel) n = self.db.size(channel)
irc.reply('There %s %s in my database.' % whats = self.name().lower()
(utils.str.be(n), utils.str.nItems(self.name().lower(), n))) irc.reply(format('There %b %n in my database.', n, (n, whats)))
stats = wrap(stats, ['channeldb']) stats = wrap(stats, ['channeldb'])