mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-18 16:12:43 +01:00
relay: use utils.checkAuthenticated() for checking oper status
This commit is contained in:
parent
d6c8d3037d
commit
70227bf3e0
@ -870,7 +870,7 @@ def handle_kill(irc, numeric, command, args):
|
|||||||
del relayusers[realuser][irc.name]
|
del relayusers[realuser][irc.name]
|
||||||
if killcache.setdefault(irc.name, 0) <= 5:
|
if killcache.setdefault(irc.name, 0) <= 5:
|
||||||
remoteirc = world.networkobjects[realuser[0]]
|
remoteirc = world.networkobjects[realuser[0]]
|
||||||
for remotechan in remoteirc.channels.copy():
|
for remotechan in remoteirc.users[realuser[1]].channels:
|
||||||
localchan = getRemoteChan(remoteirc, irc, remotechan)
|
localchan = getRemoteChan(remoteirc, irc, remotechan)
|
||||||
if localchan:
|
if localchan:
|
||||||
modes = getPrefixModes(remoteirc, irc, localchan, realuser[1])
|
modes = getPrefixModes(remoteirc, irc, localchan, realuser[1])
|
||||||
@ -1011,9 +1011,7 @@ def create(irc, source, args):
|
|||||||
if source not in irc.channels[channel].users:
|
if source not in irc.channels[channel].users:
|
||||||
irc.msg(source, 'Error: You must be in %r to complete this operation.' % channel)
|
irc.msg(source, 'Error: You must be in %r to complete this operation.' % channel)
|
||||||
return
|
return
|
||||||
if not utils.isOper(irc, source):
|
utils.checkAuthenticated(irc, source)
|
||||||
irc.msg(source, 'Error: You must be opered in order to complete this operation.')
|
|
||||||
return
|
|
||||||
db[(irc.name, channel)] = {'claim': [irc.name], 'links': set(), 'blocked_nets': set()}
|
db[(irc.name, channel)] = {'claim': [irc.name], 'links': set(), 'blocked_nets': set()}
|
||||||
initializeChannel(irc, channel)
|
initializeChannel(irc, channel)
|
||||||
irc.msg(source, 'Done.')
|
irc.msg(source, 'Done.')
|
||||||
@ -1031,9 +1029,7 @@ def destroy(irc, source, args):
|
|||||||
if not utils.isChannel(channel):
|
if not utils.isChannel(channel):
|
||||||
irc.msg(source, 'Error: Invalid channel %r.' % channel)
|
irc.msg(source, 'Error: Invalid channel %r.' % channel)
|
||||||
return
|
return
|
||||||
if not utils.isOper(irc, source):
|
utils.checkAuthenticated(irc, source)
|
||||||
irc.msg(source, 'Error: You must be opered in order to complete this operation.')
|
|
||||||
return
|
|
||||||
|
|
||||||
entry = (irc.name, channel)
|
entry = (irc.name, channel)
|
||||||
if entry in db:
|
if entry in db:
|
||||||
@ -1069,9 +1065,7 @@ def link(irc, source, args):
|
|||||||
if source not in irc.channels[localchan].users:
|
if source not in irc.channels[localchan].users:
|
||||||
irc.msg(source, 'Error: You must be in %r to complete this operation.' % localchan)
|
irc.msg(source, 'Error: You must be in %r to complete this operation.' % localchan)
|
||||||
return
|
return
|
||||||
if not utils.isOper(irc, source):
|
utils.checkAuthenticated(irc, source)
|
||||||
irc.msg(source, 'Error: You must be opered in order to complete this operation.')
|
|
||||||
return
|
|
||||||
if remotenet not in world.networkobjects:
|
if remotenet not in world.networkobjects:
|
||||||
irc.msg(source, 'Error: No network named %r exists.' % remotenet)
|
irc.msg(source, 'Error: No network named %r exists.' % remotenet)
|
||||||
return
|
return
|
||||||
@ -1113,9 +1107,7 @@ def delink(irc, source, args):
|
|||||||
remotenet = args[1].lower()
|
remotenet = args[1].lower()
|
||||||
except IndexError:
|
except IndexError:
|
||||||
remotenet = None
|
remotenet = None
|
||||||
if not utils.isOper(irc, source):
|
utils.checkAuthenticated(irc, source)
|
||||||
irc.msg(source, 'Error: You must be opered in order to complete this operation.')
|
|
||||||
return
|
|
||||||
if not utils.isChannel(channel):
|
if not utils.isChannel(channel):
|
||||||
irc.msg(source, 'Error: Invalid channel %r.' % channel)
|
irc.msg(source, 'Error: Invalid channel %r.' % channel)
|
||||||
return
|
return
|
||||||
@ -1165,9 +1157,7 @@ def linkacl(irc, source, args):
|
|||||||
Allows blocking / unblocking certain networks from linking to a relay, based on a blacklist.
|
Allows blocking / unblocking certain networks from linking to a relay, based on a blacklist.
|
||||||
LINKACL LIST returns a list of blocked networks for a channel, while the ALLOW and DENY subcommands allow manipulating this blacklist."""
|
LINKACL LIST returns a list of blocked networks for a channel, while the ALLOW and DENY subcommands allow manipulating this blacklist."""
|
||||||
missingargs = "Error: Not enough arguments. Needs 2-3: subcommand (ALLOW/DENY/LIST), channel, remote network (for ALLOW/DENY)."
|
missingargs = "Error: Not enough arguments. Needs 2-3: subcommand (ALLOW/DENY/LIST), channel, remote network (for ALLOW/DENY)."
|
||||||
if not utils.isOper(irc, source):
|
utils.checkAuthenticated(irc, source)
|
||||||
irc.msg(source, 'Error: You must be opered in order to complete this operation.')
|
|
||||||
return
|
|
||||||
try:
|
try:
|
||||||
cmd = args[0].lower()
|
cmd = args[0].lower()
|
||||||
channel = utils.toLower(irc, args[1])
|
channel = utils.toLower(irc, args[1])
|
||||||
@ -1245,12 +1235,9 @@ def save(irc, source, args):
|
|||||||
"""takes no arguments.
|
"""takes no arguments.
|
||||||
|
|
||||||
Saves the relay database to disk."""
|
Saves the relay database to disk."""
|
||||||
if utils.isOper(irc, source):
|
utils.checkAuthenticated(irc, source)
|
||||||
exportDB()
|
exportDB()
|
||||||
irc.msg(source, 'Done.')
|
irc.msg(source, 'Done.')
|
||||||
else:
|
|
||||||
irc.msg(source, 'Error: You are not authenticated!')
|
|
||||||
return
|
|
||||||
|
|
||||||
@utils.add_cmd
|
@utils.add_cmd
|
||||||
def claim(irc, source, args):
|
def claim(irc, source, args):
|
||||||
|
Loading…
Reference in New Issue
Block a user