Make use of format() in a few more places.

This commit is contained in:
James Vega 2005-02-19 00:22:23 +00:00
parent 5985562a31
commit 21970da9f0

View File

@ -296,7 +296,7 @@ class Channel(callbacks.Plugin):
try: try:
bannedHostmask = irc.state.nickToHostmask(bannedNick) bannedHostmask = irc.state.nickToHostmask(bannedNick)
except KeyError: except KeyError:
irc.error('I haven\'t seen %s.' % bannedNick, Raise=True) irc.error(format('I haven\'t seen %s.', bannedNick), Raise=True)
capability = ircdb.makeChannelCapability(channel, 'op') capability = ircdb.makeChannelCapability(channel, 'op')
def makeBanmask(bannedHostmask, options): def makeBanmask(bannedHostmask, options):
(nick, user, host) = ircutils.splitHostmask(bannedHostmask) (nick, user, host) = ircutils.splitHostmask(bannedHostmask)
@ -350,8 +350,8 @@ class Channel(callbacks.Plugin):
if ircdb.checkCapability(bannedHostmask, capability): if ircdb.checkCapability(bannedHostmask, capability):
self.log.warning('%s tried to ban %q, but both have %s', self.log.warning('%s tried to ban %q, but both have %s',
msg.prefix, bannedHostmask, capability) msg.prefix, bannedHostmask, capability)
irc.error('%s has %s too, you can\'t ban him/her/it.' % irc.error(format('%s has %s too, you can\'t ban him/her/it.',
(bannedNick, capability)) bannedNick, capability))
else: else:
doBan() doBan()
else: else:
@ -385,8 +385,9 @@ class Channel(callbacks.Plugin):
bans.append(banmask) bans.append(banmask)
if bans: if bans:
irc.queueMsg(ircmsgs.unbans(channel, bans)) irc.queueMsg(ircmsgs.unbans(channel, bans))
irc.replySuccess('All bans on %s matching %s ' irc.replySuccess(format('All bans on %s matching %s '
'have been removed.' % (channel, msg.prefix)) 'have been removed.',
channel, msg.prefix))
else: else:
irc.error('No bans matching %s were found on %s.' % irc.error('No bans matching %s were found on %s.' %
(msg.prefix, channel)) (msg.prefix, channel))
@ -423,21 +424,21 @@ class Channel(callbacks.Plugin):
nick = ircutils.toLower(nick) nick = ircutils.toLower(nick)
replyIrc = self.invites.pop((irc, nick), None) replyIrc = self.invites.pop((irc, nick), None)
if replyIrc is not None: if replyIrc is not None:
replyIrc.error('%s is already in %s.' % (nick, channel)) replyIrc.error(format('%s is already in %s.', nick, channel))
def do401(self, irc, msg): def do401(self, irc, msg):
nick = msg.args[1] nick = msg.args[1]
nick = ircutils.toLower(nick) nick = ircutils.toLower(nick)
replyIrc = self.invites.pop((irc, nick), None) replyIrc = self.invites.pop((irc, nick), None)
if replyIrc is not None: if replyIrc is not None:
replyIrc.error('There is no %s on this network.' % nick) replyIrc.error(format('There is no %s on this network.', nick))
def do504(self, irc, msg): def do504(self, irc, msg):
nick = msg.args[1] nick = msg.args[1]
nick = ircutils.toLower(nick) nick = ircutils.toLower(nick)
replyIrc = self.invites.pop((irc, nick), None) replyIrc = self.invites.pop((irc, nick), None)
if replyirc is not None: if replyirc is not None:
replyIrc.error('There is no %s on this server.' % nick) replyIrc.error(format('There is no %s on this server.', nick))
def lobotomize(self, irc, msg, args, channel): def lobotomize(self, irc, msg, args, channel):
"""[<channel>] """[<channel>]
@ -695,15 +696,15 @@ class Channel(callbacks.Plugin):
if plugin.isCommand(command): if plugin.isCommand(command):
s = '-%s.%s' % (plugin.name(), command) s = '-%s.%s' % (plugin.name(), command)
else: else:
failMsg = 'The %s plugin does not have a command called %s.'\ failMsg = format('The %s plugin does not have a command '
% (plugin.name(), command) 'called %s.', plugin.name(), command)
elif command: elif command:
# findCallbackForCommand # findCallbackForCommand
if irc.findCallbackForCommand(command): if irc.findCallbackForCommand(command):
s = '-%s' % command s = '-%s' % command
else: else:
failMsg = 'No plugin or command named %s could be found.'\ failMsg = format('No plugin or command named %s could be '
% (command) 'found.', command)
else: else:
raise callbacks.ArgumentError raise callbacks.ArgumentError
if failMsg: if failMsg:
@ -733,15 +734,15 @@ class Channel(callbacks.Plugin):
if plugin.isCommand(command): if plugin.isCommand(command):
s = '-%s.%s' % (plugin.name(), command) s = '-%s.%s' % (plugin.name(), command)
else: else:
failMsg = 'The %s plugin does not have a command called %s.'\ failMsg = format('The %s plugin does not have a command '
% (plugin.name(), command) 'called %s.', plugin.name(), command)
elif command: elif command:
# findCallbackForCommand # findCallbackForCommand
if irc.findCallbackForCommand(command): if irc.findCallbackForCommand(command):
s = '-%s' % command s = '-%s' % command
else: else:
failMsg = 'No plugin or command named %s could be found.'\ failMsg = format('No plugin or command named %s could be '
% (command) 'found.', command)
else: else:
raise callbacks.ArgumentError raise callbacks.ArgumentError
if failMsg: if failMsg:
@ -754,7 +755,7 @@ class Channel(callbacks.Plugin):
fail.append(s) fail.append(s)
ircdb.channels.setChannel(channel, chan) ircdb.channels.setChannel(channel, chan)
if fail: if fail:
irc.error('%s was not disabled.' % s[1:]) irc.error(format('%s was not disabled.', s[1:]))
else: else:
irc.replySuccess() irc.replySuccess()
enable = wrap(enable, [('checkChannelCapability', 'op'), enable = wrap(enable, [('checkChannelCapability', 'op'),
@ -772,7 +773,7 @@ class Channel(callbacks.Plugin):
L.append(channel) L.append(channel)
if L: if L:
L.sort() L.sort()
s = 'I\'m currently lobotomized in %s.' % utils.str.commaAndify(L) s = format('I\'m currently lobotomized in %L.', L)
irc.reply(s) irc.reply(s)
else: else:
irc.reply('I\'m not currently lobotomized in any channels.') irc.reply('I\'m not currently lobotomized in any channels.')
@ -792,9 +793,9 @@ class Channel(callbacks.Plugin):
"""Internal message for notifying all the #channel,ops in a channel of """Internal message for notifying all the #channel,ops in a channel of
a given situation.""" a given situation."""
capability = ircdb.makeChannelCapability(channel, 'op') capability = ircdb.makeChannelCapability(channel, 'op')
s = 'Alert to all %s ops: %s' % (channel, s) s = format('Alert to all %s ops: %s', channel, s)
if frm is not None: if frm is not None:
s += ' (from %s)' % frm s += format(' (from %s)', frm)
for nick in irc.state.channels[channel].users: for nick in irc.state.channels[channel].users:
hostmask = irc.state.nickToHostmask(nick) hostmask = irc.state.nickToHostmask(nick)
if ircdb.checkCapability(hostmask, capability): if ircdb.checkCapability(hostmask, capability):