Converted to use generic command names.

This commit is contained in:
Jeremy Fincher 2003-10-21 04:09:48 +00:00
parent 62f371d848
commit 3310e0cb3e

View File

@ -82,7 +82,7 @@ def configure(onStart, afterConnect, advanced):
onStart.append('load Relay') onStart.append('load Relay')
startNetwork = anything('What is the name of the network you\'re ' \ startNetwork = anything('What is the name of the network you\'re ' \
'connecting to first?') 'connecting to first?')
onStart.append('startrelay %s' % startNetwork) onStart.append('relay start %s' % startNetwork)
while yn('Do you want to connect to another network for relaying?') == 'y': while yn('Do you want to connect to another network for relaying?') == 'y':
network = anything('What is the name of the network you want to ' \ network = anything('What is the name of the network you want to ' \
'connect to?') 'connect to?')
@ -152,7 +152,7 @@ class Relay(callbacks.Privmsg):
do377 = do376 do377 = do376
do422 = do376 do422 = do376
def startrelay(self, irc, msg, args): def start(self, irc, msg, args):
"""<network abbreviation for current server> """<network abbreviation for current server>
This command is necessary to start the Relay plugin; the This command is necessary to start the Relay plugin; the
@ -174,9 +174,9 @@ class Relay(callbacks.Privmsg):
self.lastmsg[realIrc] = ircmsgs.ping('this is just a fake message') self.lastmsg[realIrc] = ircmsgs.ping('this is just a fake message')
self.started = True self.started = True
irc.reply(msg, conf.replySuccess) irc.reply(msg, conf.replySuccess)
startrelay = privmsgs.checkCapability(startrelay, 'owner') start = privmsgs.checkCapability(start, 'owner')
def relayconnect(self, irc, msg, args): def connect(self, irc, msg, args):
"""<network abbreviation> <domain:port> (port defaults to 6667) """<network abbreviation> <domain:port> (port defaults to 6667)
Connects to another network at <domain:port>. The network Connects to another network at <domain:port>. The network
@ -184,7 +184,7 @@ class Relay(callbacks.Privmsg):
that network to other networks. that network to other networks.
""" """
if not self.started: if not self.started:
irc.error(msg, 'You must use the startrelay command first.') irc.error(msg, 'You must use the start command first.')
return return
abbreviation, server = privmsgs.getArgs(args, needed=2) abbreviation, server = privmsgs.getArgs(args, needed=2)
if isinstance(irc, irclib.Irc): if isinstance(irc, irclib.Irc):
@ -205,16 +205,16 @@ class Relay(callbacks.Privmsg):
self.ircstates[newIrc] = irclib.IrcState() self.ircstates[newIrc] = irclib.IrcState()
self.lastmsg[newIrc] = ircmsgs.ping('this is just a fake message') self.lastmsg[newIrc] = ircmsgs.ping('this is just a fake message')
irc.reply(msg, conf.replySuccess) irc.reply(msg, conf.replySuccess)
relayconnect = privmsgs.checkCapability(relayconnect, 'owner') connect = privmsgs.checkCapability(connect, 'owner')
def relaydisconnect(self, irc, msg, args): def disconnect(self, irc, msg, args):
"""<network> """<network>
Disconnects and ceases to relay to and from the network represented by Disconnects and ceases to relay to and from the network represented by
the network abbreviation <network>. the network abbreviation <network>.
""" """
if not self.started: if not self.started:
irc.error(msg, 'You must use the startrelay command first.') irc.error(msg, 'You must use the start command first.')
return return
network = privmsgs.getArgs(args) network = privmsgs.getArgs(args)
otherIrc = self.ircs[network] otherIrc = self.ircs[network]
@ -222,19 +222,19 @@ class Relay(callbacks.Privmsg):
del self.ircs[network] del self.ircs[network]
del self.abbreviations[otherIrc] del self.abbreviations[otherIrc]
irc.reply(msg, conf.replySuccess) irc.reply(msg, conf.replySuccess)
relaydisconnect = privmsgs.checkCapability(relaydisconnect, 'owner') disconnect = privmsgs.checkCapability(disconnect, 'owner')
def relayjoin(self, irc, msg, args): def join(self, irc, msg, args):
"""<channel> """<channel>
Starts relaying between the channel <channel> on all networks. If on a Starts relaying between the channel <channel> on all networks. If on a
network the bot isn't in <channel>, he'll join. This commands is network the bot isn't in <channel>, he'll join. This commands is
required even if the bot is in the channel on both networks; he won't required even if the bot is in the channel on both networks; he won't
relay between those channels unless he's told to relayjoin both relay between those channels unless he's told to oin both
channels. channels.
""" """
if not self.started: if not self.started:
irc.error(msg, 'You must use the startrelay command first.') irc.error(msg, 'You must use the start command first.')
return return
channel = privmsgs.getArgs(args) channel = privmsgs.getArgs(args)
self.channels.add(ircutils.toLower(channel)) self.channels.add(ircutils.toLower(channel))
@ -242,9 +242,9 @@ class Relay(callbacks.Privmsg):
if channel not in otherIrc.state.channels: if channel not in otherIrc.state.channels:
otherIrc.queueMsg(ircmsgs.join(channel)) otherIrc.queueMsg(ircmsgs.join(channel))
irc.reply(msg, conf.replySuccess) irc.reply(msg, conf.replySuccess)
relayjoin = privmsgs.checkCapability(relayjoin, 'owner') join = privmsgs.checkCapability(join, 'owner')
def relaypart(self, irc, msg, args): def part(self, irc, msg, args):
"""<channel> """<channel>
Ceases relaying between the channel <channel> on all networks. The bot Ceases relaying between the channel <channel> on all networks. The bot
@ -252,7 +252,7 @@ class Relay(callbacks.Privmsg):
channel. channel.
""" """
if not self.started: if not self.started:
irc.error(msg, 'You must use the startrelay command first.') irc.error(msg, 'You must use the start command first.')
return return
channel = privmsgs.getArgs(args) channel = privmsgs.getArgs(args)
self.channels.remove(ircutils.toLower(channel)) self.channels.remove(ircutils.toLower(channel))
@ -260,19 +260,19 @@ class Relay(callbacks.Privmsg):
if channel in otherIrc.state.channels: if channel in otherIrc.state.channels:
otherIrc.queueMsg(ircmsgs.part(channel)) otherIrc.queueMsg(ircmsgs.part(channel))
irc.reply(msg, conf.replySuccess) irc.reply(msg, conf.replySuccess)
relaypart = privmsgs.checkCapability(relaypart, 'owner') part = privmsgs.checkCapability(part, 'owner')
def relaysay(self, irc, msg, args): def say(self, irc, msg, args):
"""<network> [<channel>] <text> """<network> [<channel>] <text>
Says <text> on <channel> (using the current channel if unspecified) Says <text> on <channel> (using the current channel if unspecified)
on <network>. on <network>.
""" """
if not self.started: if not self.started:
irc.error(msg, 'You must use the startrelay command first.') irc.error(msg, 'You must use the start command first.')
return return
if not args: if not args:
raise callbacks.ArgumentError, 'relaysay' raise callbacks.ArgumentError
network = args.pop(0) network = args.pop(0)
channel = privmsgs.getChannel(msg, args) channel = privmsgs.getChannel(msg, args)
text = privmsgs.getArgs(args) text = privmsgs.getArgs(args)
@ -283,9 +283,9 @@ class Relay(callbacks.Privmsg):
irc.error(msg, 'I\'m not currently relaying to %s.' % channel) irc.error(msg, 'I\'m not currently relaying to %s.' % channel)
return return
self.ircs[network].queueMsg(ircmsgs.privmsg(channel, text)) self.ircs[network].queueMsg(ircmsgs.privmsg(channel, text))
relaysay = privmsgs.checkCapability(relaysay, 'admin') say = privmsgs.checkCapability(say, 'admin')
def relaynames(self, irc, msg, args): def names(self, irc, msg, args):
"""[<channel>] (only if not sent in the channel itself.) """[<channel>] (only if not sent in the channel itself.)
The <channel> argument is only necessary if the message isn't sent on The <channel> argument is only necessary if the message isn't sent on
@ -293,7 +293,7 @@ class Relay(callbacks.Privmsg):
the various networks the bot is connected to. the various networks the bot is connected to.
""" """
if not self.started: if not self.started:
irc.error(msg, 'You must use the startrelay command first.') irc.error(msg, 'You must use the start command first.')
return return
if isinstance(irc, irclib.Irc): if isinstance(irc, irclib.Irc):
realIrc = irc realIrc = irc
@ -311,13 +311,13 @@ class Relay(callbacks.Privmsg):
users.append('%s: %s' % (ircutils.bold(abbreviation), usersS)) users.append('%s: %s' % (ircutils.bold(abbreviation), usersS))
irc.reply(msg, '; '.join(users)) irc.reply(msg, '; '.join(users))
def relaywhois(self, irc, msg, args): def whois(self, irc, msg, args):
"""<nick>@<network> """<nick>@<network>
Returns the WHOIS response <network> gives for <nick>. Returns the WHOIS response <network> gives for <nick>.
""" """
if not self.started: if not self.started:
irc.error(msg, 'You must use the startrelay command first.') irc.error(msg, 'You must use the start command first.')
return return
nickAtNetwork = privmsgs.getArgs(args) nickAtNetwork = privmsgs.getArgs(args)
if isinstance(irc, irclib.Irc): if isinstance(irc, irclib.Irc):
@ -347,14 +347,14 @@ class Relay(callbacks.Privmsg):
otherIrc.queueMsg(ircmsgs.whois(nick, nick)) otherIrc.queueMsg(ircmsgs.whois(nick, nick))
self.whois[(otherIrc, nick)] = (irc, msg, {}) self.whois[(otherIrc, nick)] = (irc, msg, {})
def relaycolor(self, irc, msg, args): def color(self, irc, msg, args):
"""<0,1,2> """<0,1,2>
0 turns coloring of nicks/angle brackets off entirely. 1 colors the 0 turns coloring of nicks/angle brackets off entirely. 1 colors the
nicks, but not the angle brackets. 2 colors both. nicks, but not the angle brackets. 2 colors both.
""" """
if not self.started: if not self.started:
irc.error(msg, 'You must use the startrelay command first.') irc.error(msg, 'You must use the start command first.')
return return
try: try:
color = int(privmsgs.getArgs(args)) color = int(privmsgs.getArgs(args))
@ -364,7 +364,7 @@ class Relay(callbacks.Privmsg):
except ValueError: except ValueError:
raise callbacks.ArgumentError raise callbacks.ArgumentError
irc.reply(msg, conf.replySuccess) irc.reply(msg, conf.replySuccess)
relaycolor = privmsgs.checkCapability(relaycolor, 'admin') color = privmsgs.checkCapability(color, 'admin')
def do311(self, irc, msg): def do311(self, irc, msg):
if not isinstance(irc, irclib.Irc): if not isinstance(irc, irclib.Irc):