From 490fb0b140a3b638168b4bd86996ca69d38d4e7a Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 1 Jun 2005 21:08:30 +0000 Subject: [PATCH] Changed prefixName to prefixNick, which is more appropriate, and has always bothered me. Better now than later. --- plugins/Games/plugin.py | 4 ++-- plugins/Google/plugin.py | 4 ++-- plugins/Herald/plugin.py | 2 +- plugins/Insult/plugin.py | 4 ++-- plugins/Misc/plugin.py | 2 +- plugins/MoobotFactoids/plugin.py | 4 ++-- plugins/QuoteGrabs/plugin.py | 2 +- plugins/RSS/plugin.py | 2 +- plugins/Reply/plugin.py | 2 +- plugins/ShrinkUrl/plugin.py | 2 +- plugins/Utilities/plugin.py | 2 +- plugins/Web/plugin.py | 2 +- src/callbacks.py | 36 ++++++++++++++++---------------- test/test_callbacks.py | 2 +- 14 files changed, 35 insertions(+), 35 deletions(-) diff --git a/plugins/Games/plugin.py b/plugins/Games/plugin.py index b4c8edf37..6e8bbce85 100644 --- a/plugins/Games/plugin.py +++ b/plugins/Games/plugin.py @@ -121,7 +121,7 @@ class Games(callbacks.Plugin): """ if spin: self._rouletteBullet = random.randrange(0, 6) - irc.reply('*SPIN* Are you feeling lucky?', prefixName=False) + irc.reply('*SPIN* Are you feeling lucky?', prefixNick=False) return channel = msg.args[0] if self._rouletteChamber == self._rouletteBullet: @@ -131,7 +131,7 @@ class Games(callbacks.Plugin): irc.queueMsg(ircmsgs.kick(channel, msg.nick, 'BANG!')) else: irc.reply('*BANG* Hey, who put a blank in here?!', - prefixName=False) + prefixNick=False) irc.reply('reloads and spins the chambers.', action=True) else: irc.reply('*click*') diff --git a/plugins/Google/plugin.py b/plugins/Google/plugin.py index 175e3cc27..767b273d7 100644 --- a/plugins/Google/plugin.py +++ b/plugins/Google/plugin.py @@ -320,7 +320,7 @@ class Google(callbacks.PluginRegexp): return if data.results: url = data.results[0].URL - irc.reply(url, prefixName=False) + irc.reply(url, prefixNick=False) googleSnarfer = urlSnarfer(googleSnarfer) _ggThread = re.compile(r'Subject: ([^<]+)', re.I) @@ -355,7 +355,7 @@ class Google(callbacks.PluginRegexp): if mThread and mGroup: irc.reply(format('Google Groups: %s, %s', mGroup.group(1), mThread.group(1)), - prefixName=False) + prefixNick=False) else: self.log.debug('Unable to snarf. %s doesn\'t appear to be a ' 'proper Google Groups page.', match.group(1)) diff --git a/plugins/Herald/plugin.py b/plugins/Herald/plugin.py index c7269667a..4d6b39bcc 100644 --- a/plugins/Herald/plugin.py +++ b/plugins/Herald/plugin.py @@ -116,7 +116,7 @@ class Herald(callbacks.Plugin): return self.lastHerald[channel, id] = now herald = ircutils.standardSubstitute(irc, msg, herald) - irc.reply(herald, prefixName=False) + irc.reply(herald, prefixNick=False) def doPart(self, irc, msg): try: diff --git a/plugins/Insult/plugin.py b/plugins/Insult/plugin.py index 9dc38fc55..78a84a56a 100644 --- a/plugins/Insult/plugin.py +++ b/plugins/Insult/plugin.py @@ -72,10 +72,10 @@ class Insult(callbacks.Plugin): """ tempinsult = self._buildInsult() if not victim: - irc.reply(tempinsult, prefixName=False) + irc.reply(tempinsult, prefixNick=False) else: irc.reply(format('%s - %s ', victim, tempinsult), - prefixName=False) + prefixNick=False) insult = wrap(insult, [additional('text')]) diff --git a/plugins/Misc/plugin.py b/plugins/Misc/plugin.py index de30c2b2a..31c1beff6 100644 --- a/plugins/Misc/plugin.py +++ b/plugins/Misc/plugin.py @@ -384,7 +384,7 @@ class Misc(callbacks.Plugin): Checks to see if the bot is alive. """ - irc.reply('pong', prefixName=False) + irc.reply('pong', prefixNick=False) Class = Misc diff --git a/plugins/MoobotFactoids/plugin.py b/plugins/MoobotFactoids/plugin.py index 8a1997cb0..11ac45a54 100644 --- a/plugins/MoobotFactoids/plugin.py +++ b/plugins/MoobotFactoids/plugin.py @@ -347,9 +347,9 @@ class MoobotFactoids(callbacks.Plugin): if type == 'action': irc.reply(text, action=True) elif type == 'reply': - irc.reply(text, prefixName=False) + irc.reply(text, prefixNick=False) elif type == 'define': - irc.reply(format('%s is %s', key, text), prefixName=False) + irc.reply(format('%s is %s', key, text), prefixNick=False) else: assert False, 'Spurious type from _parseFactoid' else: diff --git a/plugins/QuoteGrabs/plugin.py b/plugins/QuoteGrabs/plugin.py index 0ecc80c92..8730f57bd 100644 --- a/plugins/QuoteGrabs/plugin.py +++ b/plugins/QuoteGrabs/plugin.py @@ -219,7 +219,7 @@ class QuoteGrabs(callbacks.Plugin): def _sendGrabMsg(self, irc, msg): s = 'jots down a new quote for %s' % msg.nick - irc.reply(s, action=True, prefixName=False) + irc.reply(s, action=True, prefixNick=False) def grab(self, irc, msg, args, channel, nick): """[] diff --git a/plugins/RSS/plugin.py b/plugins/RSS/plugin.py index 45be42700..00103c4dc 100644 --- a/plugins/RSS/plugin.py +++ b/plugins/RSS/plugin.py @@ -187,7 +187,7 @@ class RSS(callbacks.Plugin): sep = ircutils.bold(sep) headlines = self.buildHeadlines(newheadlines, channel) irc.replies(headlines, prefixer=pre, joiner=sep, - to=channel, prefixName=False, private=True) + to=channel, prefixNick=False, private=True) finally: self.releaseLock(url) diff --git a/plugins/Reply/plugin.py b/plugins/Reply/plugin.py index 9ee9d6893..1698c34b8 100644 --- a/plugins/Reply/plugin.py +++ b/plugins/Reply/plugin.py @@ -71,7 +71,7 @@ class Reply(callbacks.Plugin): Replies with . Equivalent to the alias, 'echo $nick: $1'. """ - irc.reply(text, prefixName=True) + irc.reply(text, prefixNick=True) reply = wrap(reply, ['text']) Class = Reply diff --git a/plugins/ShrinkUrl/plugin.py b/plugins/ShrinkUrl/plugin.py index 12258f636..2c87ba69e 100644 --- a/plugins/ShrinkUrl/plugin.py +++ b/plugins/ShrinkUrl/plugin.py @@ -137,7 +137,7 @@ class ShrinkUrl(callbacks.PluginRegexp): s = format('%u (at %s)', ircutils.bold(shorturl), domain) else: s = format('%u (at %s)', shorturl, domain) - m = irc.reply(s, prefixName=False) + m = irc.reply(s, prefixNick=False) m.tag('shrunken') shrinkSnarfer = urlSnarfer(shrinkSnarfer) diff --git a/plugins/Utilities/plugin.py b/plugins/Utilities/plugin.py index d6d0b8a7b..23ca7724f 100644 --- a/plugins/Utilities/plugin.py +++ b/plugins/Utilities/plugin.py @@ -80,7 +80,7 @@ class Utilities(callbacks.Plugin): handled appropriately. """ text = ircutils.standardSubstitute(irc, msg, text) - irc.reply(text, prefixName=False) + irc.reply(text, prefixNick=False) echo = wrap(echo, ['text']) def shuffle(self, irc, msg, args, things): diff --git a/plugins/Web/plugin.py b/plugins/Web/plugin.py index 55efb58d8..a1adb4a95 100644 --- a/plugins/Web/plugin.py +++ b/plugins/Web/plugin.py @@ -94,7 +94,7 @@ class Web(callbacks.PluginRegexp): domain = utils.web.getDomain(url) title = utils.web.htmlToText(parser.title.strip()) s = format('Title: %s (at %s)', title, domain) - irc.reply(s, prefixName=False) + irc.reply(s, prefixNick=False) titleSnarfer = urlSnarfer(titleSnarfer) def headers(self, irc, msg, args, url): diff --git a/src/callbacks.py b/src/callbacks.py index 697f0c144..ea5cf6fce 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -157,7 +157,7 @@ def canonicalName(command): command = command[:-1] return command.translate(utils.str.chars, special).lower() + reAppend -def reply(msg, s, prefixName=None, private=None, +def reply(msg, s, prefixNick=None, private=None, notice=None, to=None, action=None, error=False): msg.tag('repliedTo') # Ok, let's make the target: @@ -171,14 +171,14 @@ def reply(msg, s, prefixName=None, private=None, notice = conf.get(conf.supybot.reply.withNotice, channel) if private is None: private = conf.get(conf.supybot.reply.inPrivate, channel) - if prefixName is None: - prefixName = conf.get(conf.supybot.reply.withNickPrefix, channel) + if prefixNick is None: + prefixNick = conf.get(conf.supybot.reply.withNickPrefix, channel) if error: notice =conf.get(conf.supybot.reply.error.withNotice, channel) or notice private=conf.get(conf.supybot.reply.error.inPrivate, channel) or private s = 'Error: ' + s if private: - prefixName = False + prefixNick = False if to is None: target = msg.nick else: @@ -189,7 +189,7 @@ def reply(msg, s, prefixName=None, private=None, s = ircutils.safeArgument(s) if not s and not action: s = 'Error: I tried to send you an empty message.' - if prefixName and ircutils.isChannel(target): + if prefixNick and ircutils.isChannel(target): # Let's may sure we don't do, "#channel: foo.". if not ircutils.isChannel(to): s = '%s: %s' % (to, s) @@ -617,10 +617,10 @@ class NestedCommandsIrcProxy(ReplyIrcProxy): self.private = None self.noLengthCheck = None if ircutils.isChannel(self.msg.args[0]): - self.prefixName = conf.get(conf.supybot.reply.withNickPrefix, + self.prefixNick = conf.get(conf.supybot.reply.withNickPrefix, self.msg.args[0]) else: - self.prefixName = conf.supybot.reply.withNickPrefix() + self.prefixNick = conf.supybot.reply.withNickPrefix() def evalArgs(self): while self.counter < len(self.args): @@ -782,14 +782,14 @@ class NestedCommandsIrcProxy(ReplyIrcProxy): else: cb._callCommand(command, self, self.msg, args) - def reply(self, s, noLengthCheck=False, prefixName=None, + def reply(self, s, noLengthCheck=False, prefixNick=None, action=None, private=None, notice=None, to=None, msg=None): """reply(s) -> replies to msg with s Keyword arguments: noLengthCheck=False: True if the length shouldn't be checked (used for 'more' handling) - prefixName=True: False if the nick shouldn't be prefixed to the + prefixNick=True: False if the nick shouldn't be prefixed to the reply. action=False: True if the reply should be an action. private=False: True if the reply should be in private. @@ -805,18 +805,18 @@ class NestedCommandsIrcProxy(ReplyIrcProxy): 'Old code alert: there is no longer a "msg" argument to reply.' if msg is None: msg = self.msg - if prefixName is not None: - self.prefixName = prefixName + if prefixNick is not None: + self.prefixNick = prefixNick if action is not None: self.action = self.action or action - self.prefixName = False + self.prefixNick = False if notice is not None: self.notice = self.notice or notice if private is not None: self.private = self.private or private if to is not None: self.to = self.to or to - # action=True implies noLengthCheck=True and prefixName=False + # action=True implies noLengthCheck=True and prefixNick=False self.noLengthCheck=noLengthCheck or self.noLengthCheck or self.action target = self.private and self.to or self.msg.args[0] s = str(s) # Allow non-string esses. @@ -828,7 +828,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy): notice=self.notice, action=self.action, private=self.private, - prefixName=self.prefixName, + prefixNick=self.prefixNick, noLengthCheck=self.noLengthCheck) elif self.noLengthCheck: # noLengthCheck only matters to NestedCommandsIrcProxy, so @@ -837,7 +837,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy): notice=self.notice, action=self.action, private=self.private, - prefixName=self.prefixName) + prefixNick=self.prefixNick) self.irc.queueMsg(m) return m else: @@ -867,7 +867,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy): m = reply(msg, s, to=self.to, notice=self.notice, private=self.private, - prefixName=self.prefixName) + prefixNick=self.prefixNick) self.irc.queueMsg(m) return m msgs = ircutils.wrap(s, allowedLength) @@ -879,7 +879,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy): m = reply(msg, response, to=self.to, notice=self.notice, private=self.private, - prefixName=self.prefixName) + prefixNick=self.prefixNick) self.irc.queueMsg(m) # XXX We should somehow allow these to be returned, but # until someone complains, we'll be fine :) We @@ -909,7 +909,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy): action=self.action, notice=self.notice, private=self.private, - prefixName=self.prefixName) + prefixNick=self.prefixNick) self.irc.queueMsg(m) return m finally: diff --git a/test/test_callbacks.py b/test/test_callbacks.py index 61d87bb98..62e46cfc4 100644 --- a/test/test_callbacks.py +++ b/test/test_callbacks.py @@ -241,7 +241,7 @@ class FunctionsTestCase(SupyTestCase): callbacks.reply(channelMsg, 'foo')) self.assertEqual(ircmsgs.privmsg(channelMsg.args[0], 'foo'), - callbacks.reply(channelMsg, 'foo', prefixName=False)) + callbacks.reply(channelMsg, 'foo', prefixNick=False)) self.assertEqual(ircmsgs.notice(nonChannelMsg.nick, 'foo'), callbacks.reply(channelMsg, 'foo', notice=True, private=True))