3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

plugins: support FANTASY (where reasonable) by using irc.msg(irc.called_by, ...) instead of irc.msg(source, ...)

This commit is contained in:
James Lu 2015-09-26 09:39:45 -07:00
parent f55d227329
commit 8e444c5dbe
5 changed files with 92 additions and 89 deletions

View File

@ -20,7 +20,7 @@ def spawnclient(irc, source, args):
try:
nick, ident, host = args[:3]
except ValueError:
irc.msg(source, "Error: Not enough arguments. Needs 3: nick, user, host.")
irc.msg(irc.called_by, "Error: Not enough arguments. Needs 3: nick, user, host.")
return
irc.proto.spawnClient(nick, ident, host, manipulatable=True)
@ -33,15 +33,15 @@ def quit(irc, source, args):
try:
nick = args[0]
except IndexError:
irc.msg(source, "Error: Not enough arguments. Needs 1-2: nick, reason (optional).")
irc.msg(irc.called_by, "Error: Not enough arguments. Needs 1-2: nick, reason (optional).")
return
if irc.pseudoclient.uid == utils.nickToUid(irc, nick):
irc.msg(source, "Error: Cannot quit the main PyLink PseudoClient!")
irc.msg(irc.called_by, "Error: Cannot quit the main PyLink PseudoClient!")
return
u = utils.nickToUid(irc, nick)
quitmsg = ' '.join(args[1:]) or 'Client Quit'
if not utils.isManipulatableClient(irc, u):
irc.msg(source, "Error: Cannot force quit a protected PyLink services client.")
irc.msg(irc.called_by, "Error: Cannot force quit a protected PyLink services client.")
return
irc.proto.quitClient(u, quitmsg)
irc.callHooks([u, 'PYLINK_BOTSPLUGIN_QUIT', {'text': quitmsg, 'parse_as': 'QUIT'}])
@ -57,15 +57,15 @@ def joinclient(irc, source, args):
if not clist:
raise IndexError
except IndexError:
irc.msg(source, "Error: Not enough arguments. Needs 2: nick, comma separated list of channels.")
irc.msg(irc.called_by, "Error: Not enough arguments. Needs 2: nick, comma separated list of channels.")
return
u = utils.nickToUid(irc, nick)
if not utils.isManipulatableClient(irc, u):
irc.msg(source, "Error: Cannot force join a protected PyLink services client.")
irc.msg(irc.called_by, "Error: Cannot force join a protected PyLink services client.")
return
for channel in clist:
if not utils.isChannel(channel):
irc.msg(source, "Error: Invalid channel name %r." % channel)
irc.msg(irc.called_by, "Error: Invalid channel name %r." % channel)
return
irc.proto.joinClient(u, channel)
irc.callHooks([u, 'PYLINK_BOTSPLUGIN_JOIN', {'channel': channel, 'users': [u],
@ -83,16 +83,16 @@ def nick(irc, source, args):
nick = args[0]
newnick = args[1]
except IndexError:
irc.msg(source, "Error: Not enough arguments. Needs 2: nick, newnick.")
irc.msg(irc.called_by, "Error: Not enough arguments. Needs 2: nick, newnick.")
return
u = utils.nickToUid(irc, nick)
if newnick in ('0', u):
newnick = u
elif not utils.isNick(newnick):
irc.msg(source, 'Error: Invalid nickname %r.' % newnick)
irc.msg(irc.called_by, 'Error: Invalid nickname %r.' % newnick)
return
elif not utils.isManipulatableClient(irc, u):
irc.msg(source, "Error: Cannot force nick changes for a protected PyLink services client.")
irc.msg(irc.called_by, "Error: Cannot force nick changes for a protected PyLink services client.")
return
irc.proto.nickClient(u, newnick)
irc.callHooks([u, 'PYLINK_BOTSPLUGIN_NICK', {'newnick': newnick, 'oldnick': nick, 'parse_as': 'NICK'}])
@ -108,15 +108,15 @@ def part(irc, source, args):
clist = args[1].split(',')
reason = ' '.join(args[2:])
except IndexError:
irc.msg(source, "Error: Not enough arguments. Needs 2: nick, comma separated list of channels.")
irc.msg(irc.called_by, "Error: Not enough arguments. Needs 2: nick, comma separated list of channels.")
return
u = utils.nickToUid(irc, nick)
if not utils.isManipulatableClient(irc, u):
irc.msg(source, "Error: Cannot force part a protected PyLink services client.")
irc.msg(irc.called_by, "Error: Cannot force part a protected PyLink services client.")
return
for channel in clist:
if not utils.isChannel(channel):
irc.msg(source, "Error: Invalid channel name %r." % channel)
irc.msg(irc.called_by, "Error: Invalid channel name %r." % channel)
return
irc.proto.partClient(u, channel, reason)
irc.callHooks([u, 'PYLINK_BOTSPLUGIN_PART', {'channels': clist, 'text': reason, 'parse_as': 'PART'}])
@ -133,12 +133,12 @@ def kick(irc, source, args):
target = args[2]
reason = ' '.join(args[3:])
except IndexError:
irc.msg(source, "Error: Not enough arguments. Needs 3-4: source nick, channel, target, reason (optional).")
irc.msg(irc.called_by, "Error: Not enough arguments. Needs 3-4: source nick, channel, target, reason (optional).")
return
u = utils.nickToUid(irc, nick) or nick
targetu = utils.nickToUid(irc, target)
if not utils.isChannel(channel):
irc.msg(source, "Error: Invalid channel name %r." % channel)
irc.msg(irc.called_by, "Error: Invalid channel name %r." % channel)
return
if utils.isInternalServer(irc, u):
irc.proto.kickServer(u, channel, targetu, reason)
@ -155,20 +155,20 @@ def mode(irc, source, args):
try:
modesource, target, modes = args[0], args[1], args[2:]
except IndexError:
irc.msg(source, 'Error: Not enough arguments. Needs 3: source nick, target, modes to set.')
irc.msg(irc.called_by, 'Error: Not enough arguments. Needs 3: source nick, target, modes to set.')
return
target = utils.nickToUid(irc, target) or target
extclient = target in irc.users and not utils.isInternalClient(irc, target)
parsedmodes = utils.parseModes(irc, target, modes)
ischannel = target in irc.channels
if not (target in irc.users or ischannel):
irc.msg(source, "Error: Invalid channel or nick %r." % target)
irc.msg(irc.called_by, "Error: Invalid channel or nick %r." % target)
return
elif not parsedmodes:
irc.msg(source, "Error: No valid modes were given.")
irc.msg(irc.called_by, "Error: No valid modes were given.")
return
elif not (ischannel or utils.isManipulatableClient(irc, target)):
irc.msg(source, "Error: Can only set modes on channels or non-protected PyLink clients.")
irc.msg(irc.called_by, "Error: Can only set modes on channels or non-protected PyLink clients.")
return
if utils.isInternalServer(irc, modesource):
# Setting modes from a server.
@ -189,21 +189,21 @@ def msg(irc, source, args):
try:
msgsource, target, text = args[0], args[1], ' '.join(args[2:])
except IndexError:
irc.msg(source, 'Error: Not enough arguments. Needs 3: source nick, target, text.')
irc.msg(irc.called_by, 'Error: Not enough arguments. Needs 3: source nick, target, text.')
return
sourceuid = utils.nickToUid(irc, msgsource)
if not sourceuid:
irc.msg(source, 'Error: Unknown user %r.' % msgsource)
irc.msg(irc.called_by, 'Error: Unknown user %r.' % msgsource)
return
if not utils.isChannel(target):
real_target = utils.nickToUid(irc, target)
if real_target is None:
irc.msg(source, 'Error: Unknown user %r.' % target)
irc.msg(irc.called_by, 'Error: Unknown user %r.' % target)
return
else:
real_target = target
if not text:
irc.msg(source, 'Error: No text given.')
irc.msg(irc.called_by, 'Error: No text given.')
return
irc.proto.messageClient(sourceuid, real_target, text)
irc.callHooks([sourceuid, 'PYLINK_BOTSPLUGIN_MSG', {'target': real_target, 'text': text, 'parse_as': 'PRIVMSG'}])

View File

@ -16,16 +16,19 @@ def status(irc, source, args):
Returns your current PyLink login status."""
identified = irc.users[source].identified
if identified:
irc.msg(source, 'You are identified as \x02%s\x02.' % identified)
irc.msg(irc.called_by, 'You are identified as \x02%s\x02.' % identified)
else:
irc.msg(source, 'You are not identified as anyone.')
irc.msg(source, 'Operator access: \x02%s\x02' % bool(utils.isOper(irc, source)))
irc.msg(irc.called_by, 'You are not identified as anyone.')
irc.msg(irc.called_by, 'Operator access: \x02%s\x02' % bool(utils.isOper(irc, source)))
@utils.add_cmd
def identify(irc, source, args):
"""<username> <password>
Logs in to PyLink using the configured administrator account."""
if utils.isChannel(irc.called_by):
irc.msg(irc.called_by, 'Error: This command must be sent in private. '
'(Would you really type a password inside a public channel?)')
try:
username, password = args[0], args[1]
except IndexError:
@ -54,8 +57,8 @@ def listcommands(irc, source, args):
nfuncs = len(world.bot_commands[cmd])
if nfuncs > 1:
cmds[idx] = '%s(x%s)' % (cmd, nfuncs)
irc.msg(source, 'Available commands include: %s' % ', '.join(cmds))
irc.msg(source, 'To see help on a specific command, type \x02help <command>\x02.')
irc.msg(irc.called_by, 'Available commands include: %s' % ', '.join(cmds))
irc.msg(irc.called_by, 'To see help on a specific command, type \x02help <command>\x02.')
utils.add_cmd(listcommands, 'list')
@utils.add_cmd
@ -74,7 +77,7 @@ def help(irc, source, args):
else:
funcs = world.bot_commands[command]
if len(funcs) > 1:
irc.msg(source, 'The following \x02%s\x02 plugins bind to the \x02%s\x02 command: %s'
irc.msg(irc.called_by, 'The following \x02%s\x02 plugins bind to the \x02%s\x02 command: %s'
% (len(funcs), command, ', '.join([func.__module__ for func in funcs])))
for func in funcs:
doc = func.__doc__
@ -85,7 +88,7 @@ def help(irc, source, args):
# arguments the command takes.
lines[0] = '\x02%s %s\x02 (plugin: %r)' % (command, lines[0], mod)
for line in lines:
irc.msg(source, line.strip())
irc.msg(irc.called_by, line.strip())
else:
irc.msg(source, "Error: Command %r (from plugin %r) "
"doesn't offer any help." % (command, mod))
@ -99,14 +102,14 @@ def showuser(irc, source, args):
try:
target = args[0]
except IndexError:
irc.msg(source, "Error: Not enough arguments. Needs 1: nick.")
irc.msg(irc.called_by, "Error: Not enough arguments. Needs 1: nick.")
return
u = utils.nickToUid(irc, target) or target
# Only show private info if the person is calling 'showuser' on themselves,
# or is an oper.
verbose = utils.isOper(irc, source) or u == source
if u not in irc.users:
irc.msg(source, 'Error: Unknown user %r.' % target)
irc.msg(irc.called_by, 'Error: Unknown user %r.' % target)
return
f = lambda s: irc.msg(source, s)
@ -134,10 +137,10 @@ def showchan(irc, source, args):
try:
channel = utils.toLower(irc, args[0])
except IndexError:
irc.msg(source, "Error: Not enough arguments. Needs 1: channel.")
irc.msg(irc.called_by, "Error: Not enough arguments. Needs 1: channel.")
return
if channel not in irc.channels:
irc.msg(source, 'Error: Unknown channel %r.' % channel)
irc.msg(irc.called_by, 'Error: Unknown channel %r.' % channel)
return
f = lambda s: irc.msg(source, s)
@ -191,5 +194,5 @@ def version(irc, source, args):
"""takes no arguments.
Returns the version of the currently running PyLink instance."""
irc.msg(source, "PyLink version \x02%s\x02, released under the Mozilla Public License version 2.0." % world.version)
irc.msg(source, "The source of this program is available at \x02%s\x02." % world.source)
irc.msg(irc.called_by, "PyLink version \x02%s\x02, released under the Mozilla Public License version 2.0." % world.version)
irc.msg(irc.called_by, "The source of this program is available at \x02%s\x02." % world.source)

View File

@ -14,7 +14,7 @@ def _exec(irc, source, args):
utils.checkAuthenticated(irc, source, allowOper=False)
args = ' '.join(args)
if not args.strip():
irc.msg(source, 'No code entered!')
irc.msg(irc.called_by, 'No code entered!')
return
log.info('(%s) Executing %r for %s', irc.name, args, utils.getHostmask(irc, source))
exec(args, globals(), locals())
@ -28,8 +28,8 @@ def _eval(irc, source, args):
utils.checkAuthenticated(irc, source, allowOper=False)
args = ' '.join(args)
if not args.strip():
irc.msg(source, 'No code entered!')
irc.msg(irc.called_by, 'No code entered!')
return
log.info('(%s) Evaluating %r for %s', irc.name, args, utils.getHostmask(irc, source))
irc.msg(source, eval(args))
irc.msg(irc.called_by, eval(args))
utils.add_cmd(_eval, 'eval')

View File

@ -22,12 +22,12 @@ def disconnect(irc, source, args):
netname = args[0]
network = world.networkobjects[netname]
except IndexError: # No argument given.
irc.msg(source, 'Error: Not enough arguments (needs 1: network name (case sensitive)).')
irc.msg(irc.called_by, 'Error: Not enough arguments (needs 1: network name (case sensitive)).')
return
except KeyError: # Unknown network.
irc.msg(source, 'Error: No such network "%s" (case sensitive).' % netname)
irc.msg(irc.called_by, 'Error: No such network "%s" (case sensitive).' % netname)
return
irc.msg(source, "Done.")
irc.msg(irc.called_by, "Done.")
# Abort the connection! Simple as that.
network.aborted.set()
@ -41,18 +41,18 @@ def connect(irc, source, args):
netname = args[0]
network = world.networkobjects[netname]
except IndexError: # No argument given.
irc.msg(source, 'Error: Not enough arguments (needs 1: network name (case sensitive)).')
irc.msg(irc.called_by, 'Error: Not enough arguments (needs 1: network name (case sensitive)).')
return
except KeyError: # Unknown network.
irc.msg(source, 'Error: No such network "%s" (case sensitive).' % netname)
irc.msg(irc.called_by, 'Error: No such network "%s" (case sensitive).' % netname)
return
if network.connection_thread.is_alive():
irc.msg(source, 'Error: Network "%s" seems to be already connected.' % netname)
irc.msg(irc.called_by, 'Error: Network "%s" seems to be already connected.' % netname)
else: # Reconnect the network!
network.initVars()
network.connection_thread = threading.Thread(target=network.connect)
network.connection_thread.start()
irc.msg(source, "Done.")
irc.msg(irc.called_by, "Done.")
@utils.add_cmd
def autoconnect(irc, source, args):
@ -66,13 +66,13 @@ def autoconnect(irc, source, args):
seconds = float(args[1])
network = world.networkobjects[netname]
except IndexError: # Arguments not given.
irc.msg(source, 'Error: Not enough arguments (needs 2: network name (case sensitive), autoconnect time (in seconds)).')
irc.msg(irc.called_by, 'Error: Not enough arguments (needs 2: network name (case sensitive), autoconnect time (in seconds)).')
return
except KeyError: # Unknown network.
irc.msg(source, 'Error: No such network "%s" (case sensitive).' % netname)
irc.msg(irc.called_by, 'Error: No such network "%s" (case sensitive).' % netname)
return
except ValueError:
irc.msg(source, 'Error: Invalid argument "%s" for <seconds>.' % seconds)
irc.msg(irc.called_by, 'Error: Invalid argument "%s" for <seconds>.' % seconds)
return
network.serverdata['autoconnect'] = seconds
irc.msg(source, "Done.")
irc.msg(irc.called_by, "Done.")

View File

@ -1033,22 +1033,22 @@ def create(irc, source, args):
try:
channel = utils.toLower(irc, args[0])
except IndexError:
irc.msg(source, "Error: Not enough arguments. Needs 1: channel.")
irc.msg(irc.called_by, "Error: Not enough arguments. Needs 1: channel.")
return
if not utils.isChannel(channel):
irc.msg(source, 'Error: Invalid channel %r.' % channel)
irc.msg(irc.called_by, 'Error: Invalid channel %r.' % channel)
return
if source not in irc.channels[channel].users:
irc.msg(source, 'Error: You must be in %r to complete this operation.' % channel)
irc.msg(irc.called_by, 'Error: You must be in %r to complete this operation.' % channel)
return
utils.checkAuthenticated(irc, source)
localentry = getRelay((irc.name, channel))
if localentry:
irc.msg(source, 'Error: Channel %r is already part of a relay.' % channel)
irc.msg(irc.called_by, 'Error: Channel %r is already part of a relay.' % channel)
return
db[(irc.name, channel)] = {'claim': [irc.name], 'links': set(), 'blocked_nets': set()}
initializeChannel(irc, channel)
irc.msg(source, 'Done.')
irc.msg(irc.called_by, 'Done.')
@utils.add_cmd
def destroy(irc, source, args):
@ -1058,10 +1058,10 @@ def destroy(irc, source, args):
try:
channel = utils.toLower(irc, args[0])
except IndexError:
irc.msg(source, "Error: Not enough arguments. Needs 1: channel.")
irc.msg(irc.called_by, "Error: Not enough arguments. Needs 1: channel.")
return
if not utils.isChannel(channel):
irc.msg(source, 'Error: Invalid channel %r.' % channel)
irc.msg(irc.called_by, 'Error: Invalid channel %r.' % channel)
return
utils.checkAuthenticated(irc, source)
@ -1071,9 +1071,9 @@ def destroy(irc, source, args):
removeChannel(world.networkobjects.get(link[0]), link[1])
removeChannel(irc, channel)
del db[entry]
irc.msg(source, 'Done.')
irc.msg(irc.called_by, 'Done.')
else:
irc.msg(source, 'Error: No such relay %r exists.' % channel)
irc.msg(irc.called_by, 'Error: No such relay %r exists.' % channel)
return
@utils.add_cmd
@ -1086,7 +1086,7 @@ def link(irc, source, args):
channel = utils.toLower(irc, args[1])
remotenet = args[0].lower()
except IndexError:
irc.msg(source, "Error: Not enough arguments. Needs 2-3: remote netname, channel, local channel name (optional).")
irc.msg(irc.called_by, "Error: Not enough arguments. Needs 2-3: remote netname, channel, local channel name (optional).")
return
try:
localchan = utils.toLower(irc, args[2])
@ -1094,37 +1094,37 @@ def link(irc, source, args):
localchan = channel
for c in (channel, localchan):
if not utils.isChannel(c):
irc.msg(source, 'Error: Invalid channel %r.' % c)
irc.msg(irc.called_by, 'Error: Invalid channel %r.' % c)
return
if source not in irc.channels[localchan].users:
irc.msg(source, 'Error: You must be in %r to complete this operation.' % localchan)
irc.msg(irc.called_by, 'Error: You must be in %r to complete this operation.' % localchan)
return
utils.checkAuthenticated(irc, source)
if remotenet not in world.networkobjects:
irc.msg(source, 'Error: No network named %r exists.' % remotenet)
irc.msg(irc.called_by, 'Error: No network named %r exists.' % remotenet)
return
localentry = getRelay((irc.name, localchan))
if localentry:
irc.msg(source, 'Error: Channel %r is already part of a relay.' % localchan)
irc.msg(irc.called_by, 'Error: Channel %r is already part of a relay.' % localchan)
return
try:
entry = db[(remotenet, channel)]
except KeyError:
irc.msg(source, 'Error: No such relay %r exists.' % channel)
irc.msg(irc.called_by, 'Error: No such relay %r exists.' % channel)
return
else:
if irc.name in entry['blocked_nets']:
irc.msg(source, 'Error: Access denied (network is banned from linking to this channel).')
irc.msg(irc.called_by, 'Error: Access denied (network is banned from linking to this channel).')
return
for link in entry['links']:
if link[0] == irc.name:
irc.msg(source, "Error: Remote channel '%s%s' is already"
irc.msg(irc.called_by, "Error: Remote channel '%s%s' is already"
" linked here as %r." % (remotenet,
channel, link[1]))
return
entry['links'].add((irc.name, localchan))
initializeChannel(irc, localchan)
irc.msg(source, 'Done.')
irc.msg(irc.called_by, 'Done.')
@utils.add_cmd
def delink(irc, source, args):
@ -1135,7 +1135,7 @@ def delink(irc, source, args):
try:
channel = utils.toLower(irc, args[0])
except IndexError:
irc.msg(source, "Error: Not enough arguments. Needs 1-2: channel, remote netname (optional).")
irc.msg(irc.called_by, "Error: Not enough arguments. Needs 1-2: channel, remote netname (optional).")
return
try:
remotenet = args[1].lower()
@ -1143,13 +1143,13 @@ def delink(irc, source, args):
remotenet = None
utils.checkAuthenticated(irc, source)
if not utils.isChannel(channel):
irc.msg(source, 'Error: Invalid channel %r.' % channel)
irc.msg(irc.called_by, 'Error: Invalid channel %r.' % channel)
return
entry = getRelay((irc.name, channel))
if entry:
if entry[0] == irc.name: # We own this channel.
if not remotenet:
irc.msg(source, "Error: You must select a network to "
irc.msg(irc.called_by, "Error: You must select a network to "
"delink, or use the 'destroy' command to remove "
"this relay entirely (it was created on the current "
"network).")
@ -1162,9 +1162,9 @@ def delink(irc, source, args):
else:
removeChannel(irc, channel)
db[entry]['links'].remove((irc.name, channel))
irc.msg(source, 'Done.')
irc.msg(irc.called_by, 'Done.')
else:
irc.msg(source, 'Error: No such relay %r.' % channel)
irc.msg(irc.called_by, 'Error: No such relay %r.' % channel)
@utils.add_cmd
def linked(irc, source, args):
@ -1206,37 +1206,37 @@ def linkacl(irc, source, args):
cmd = args[0].lower()
channel = utils.toLower(irc, args[1])
except IndexError:
irc.msg(source, missingargs)
irc.msg(irc.called_by, missingargs)
return
if not utils.isChannel(channel):
irc.msg(source, 'Error: Invalid channel %r.' % channel)
irc.msg(irc.called_by, 'Error: Invalid channel %r.' % channel)
return
relay = getRelay((irc.name, channel))
if not relay:
irc.msg(source, 'Error: No such relay %r exists.' % channel)
irc.msg(irc.called_by, 'Error: No such relay %r exists.' % channel)
return
if cmd == 'list':
s = 'Blocked networks for \x02%s\x02: \x02%s\x02' % (channel, ', '.join(db[relay]['blocked_nets']) or '(empty)')
irc.msg(source, s)
irc.msg(irc.called_by, s)
return
try:
remotenet = args[2]
except IndexError:
irc.msg(source, missingargs)
irc.msg(irc.called_by, missingargs)
return
if cmd == 'deny':
db[relay]['blocked_nets'].add(remotenet)
irc.msg(source, 'Done.')
irc.msg(irc.called_by, 'Done.')
elif cmd == 'allow':
try:
db[relay]['blocked_nets'].remove(remotenet)
except KeyError:
irc.msg(source, 'Error: Network %r is not on the blacklist for %r.' % (remotenet, channel))
irc.msg(irc.called_by, 'Error: Network %r is not on the blacklist for %r.' % (remotenet, channel))
else:
irc.msg(source, 'Done.')
irc.msg(irc.called_by, 'Done.')
else:
irc.msg(source, 'Error: Unknown subcommand %r: valid ones are ALLOW, DENY, and LIST.' % cmd)
irc.msg(irc.called_by, 'Error: Unknown subcommand %r: valid ones are ALLOW, DENY, and LIST.' % cmd)
@utils.add_cmd
def showuser(irc, source, args):
@ -1281,7 +1281,7 @@ def save(irc, source, args):
Saves the relay database to disk."""
utils.checkAuthenticated(irc, source)
exportDB()
irc.msg(source, 'Done.')
irc.msg(irc.called_by, 'Done.')
@utils.add_cmd
def claim(irc, source, args):
@ -1294,25 +1294,25 @@ def claim(irc, source, args):
try:
channel = utils.toLower(irc, args[0])
except IndexError:
irc.msg(source, "Error: Not enough arguments. Needs 1-2: channel, list of networks (optional).")
irc.msg(irc.called_by, "Error: Not enough arguments. Needs 1-2: channel, list of networks (optional).")
return
# We override getRelay() here to limit the search to the current network.
relay = (irc.name, channel)
if relay not in db:
irc.msg(source, 'Error: No such relay %r exists.' % channel)
irc.msg(irc.called_by, 'Error: No such relay %r exists.' % channel)
return
claimed = db[relay]["claim"]
try:
nets = args[1].strip()
except IndexError: # No networks given.
irc.msg(source, 'Channel \x02%s\x02 is claimed by: %s' %
(channel, ', '.join(claimed) or '\x1D(none)\x1D'))
irc.msg(irc.called_by, 'Channel \x02%s\x02 is claimed by: %s' %
(channel, ', '.join(claimed) or '\x1D(none)\x1D'))
else:
if nets == '-' or not nets:
claimed = set()
else:
claimed = set(nets.split(','))
db[relay]["claim"] = claimed
irc.msg(source, 'CLAIM for channel \x02%s\x02 set to: %s' %
(channel, ', '.join(claimed) or '\x1D(none)\x1D'))
irc.msg(irc.called_by, 'CLAIM for channel \x02%s\x02 set to: %s' %
(channel, ', '.join(claimed) or '\x1D(none)\x1D'))