From cf80ab78008e3eca2c24fc42dd879ab2c9c8750d Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Tue, 16 Dec 2003 13:44:09 +0000 Subject: [PATCH] Added Relay.command. --- ChangeLog | 5 ++++- plugins/Relay.py | 37 ++++++++++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index e7cdfc674..cfda961b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,10 @@ + * Added Relay.command, a command for sending commands to the bot + on a different network. + * Changed all "zegrep" stuff to "zgrep -e" stuff, since zegrep is on fewer platforms than zgrep. - * Added Bugzilla.search, a new command for searching a bugzilla + * Added Bugzilla.search, a new command for searching a bugzilla installation 2003-12-12 Jeremy Fincher diff --git a/plugins/Relay.py b/plugins/Relay.py index 1ad1664a2..df1d476c2 100644 --- a/plugins/Relay.py +++ b/plugins/Relay.py @@ -94,11 +94,11 @@ def configure(onStart, afterConnect, advanced): afterConnect.append('relay color 2') -ircs = {} -ircstates = {} -lastmsg = {} +ircs = ircutils.IrcDict() +lastmsg = {} # Not IrcDict. channels = ircutils.IrcSet() -abbreviations = {} +ircstates = {} # Not IrcDict. +abbreviations = {} # Not IrcDict. originalIrc = None def reload(x=None): @@ -123,13 +123,12 @@ class Relay(callbacks.Privmsg, configurable.Mixin): callbacks.Privmsg.__init__(self) configurable.Mixin.__init__(self) self.ircs = ircs - self._color = 0 - self._whois = {} self.started = False self.ircstates = ircstates self.lastmsg = lastmsg self.channels = channels - self.abbreviations = {} + self._whois = ircutils.IrcDict() + self.abbreviations = abbreviations def __call__(self, irc, msg): if self.started: @@ -152,8 +151,7 @@ class Relay(callbacks.Privmsg, configurable.Mixin): def do376(self, irc, msg): if self.channels: irc.queueMsg(ircmsgs.joins(self.channels)) - do377 = do376 - do422 = do376 + do377 = do422 = do376 def start(self, irc, msg, args): """ @@ -273,6 +271,27 @@ class Relay(callbacks.Privmsg, configurable.Mixin): irc.reply(msg, conf.replySuccess) part = privmsgs.checkCapability(part, 'owner') + def command(self, irc, msg, args): + """ [ ...] + + Gives the bot (with its associated s) on . + """ + if not self.started: + irc.error(msg, 'You must use the start command first.') + return + if len(args) < 2: + raise callbacks.ArgumentError + network = args.pop(0) + try: + otherIrc = self.ircs[network] + except KeyError: + irc.error(msg, 'I\'m not currently on %s.' % network) + Owner = irc.getCallback('Owner') + Owner.disambiguate(irc, args) + self.Proxy(otherIrc, msg, args) + irc.reply(msg, conf.replySuccess) + command = privmsgs.checkCapability(command, 'admin') + def say(self, irc, msg, args): """ []