mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-12 21:22:36 +01:00
commands: Consolidate state.channel checks into getChannel
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
parent
6361b1e856
commit
56a6799deb
@ -303,7 +303,6 @@ def getNetworkIrc(irc, msg, args, state, errorIfNoMatch=False):
|
|||||||
state.args.append(irc)
|
state.args.append(irc)
|
||||||
|
|
||||||
def getHaveOp(irc, msg, args, state, action='do that'):
|
def getHaveOp(irc, msg, args, state, action='do that'):
|
||||||
if not state.channel:
|
|
||||||
getChannel(irc, msg, args, state)
|
getChannel(irc, msg, args, state)
|
||||||
if state.channel not in irc.state.channels:
|
if state.channel not in irc.state.channels:
|
||||||
state.error('I\'m not even in %s.' % state.channel, Raise=True)
|
state.error('I\'m not even in %s.' % state.channel, Raise=True)
|
||||||
@ -329,7 +328,6 @@ def getHostmask(irc, msg, args, state):
|
|||||||
|
|
||||||
def getBanmask(irc, msg, args, state):
|
def getBanmask(irc, msg, args, state):
|
||||||
getHostmask(irc, msg, args, state)
|
getHostmask(irc, msg, args, state)
|
||||||
if not state.channel:
|
|
||||||
getChannel(irc, msg, args, state)
|
getChannel(irc, msg, args, state)
|
||||||
channel = state.channel
|
channel = state.channel
|
||||||
banmaskstyle = conf.supybot.protocols.irc.banmask
|
banmaskstyle = conf.supybot.protocols.irc.banmask
|
||||||
@ -406,6 +404,8 @@ def getSeenNick(irc, msg, args, state, errmsg=None):
|
|||||||
state.error(errmsg, Raise=True)
|
state.error(errmsg, Raise=True)
|
||||||
|
|
||||||
def getChannel(irc, msg, args, state):
|
def getChannel(irc, msg, args, state):
|
||||||
|
if state.channel:
|
||||||
|
return
|
||||||
if args and irc.isChannel(args[0]):
|
if args and irc.isChannel(args[0]):
|
||||||
channel = args.pop(0)
|
channel = args.pop(0)
|
||||||
elif irc.isChannel(msg.args[0]):
|
elif irc.isChannel(msg.args[0]):
|
||||||
@ -437,7 +437,6 @@ def getChannelDb(irc, msg, args, state, **kwargs):
|
|||||||
state.args.append(channel)
|
state.args.append(channel)
|
||||||
|
|
||||||
def inChannel(irc, msg, args, state):
|
def inChannel(irc, msg, args, state):
|
||||||
if not state.channel:
|
|
||||||
getChannel(irc, msg, args, state)
|
getChannel(irc, msg, args, state)
|
||||||
if state.channel not in irc.state.channels:
|
if state.channel not in irc.state.channels:
|
||||||
state.error('I\'m not in %s.' % state.channel, Raise=True)
|
state.error('I\'m not in %s.' % state.channel, Raise=True)
|
||||||
@ -478,7 +477,6 @@ def getChannelOrNone(irc, msg, args, state):
|
|||||||
state.args.append(None)
|
state.args.append(None)
|
||||||
|
|
||||||
def checkChannelCapability(irc, msg, args, state, cap):
|
def checkChannelCapability(irc, msg, args, state, cap):
|
||||||
if not state.channel:
|
|
||||||
getChannel(irc, msg, args, state)
|
getChannel(irc, msg, args, state)
|
||||||
cap = ircdb.canonicalCapability(cap)
|
cap = ircdb.canonicalCapability(cap)
|
||||||
cap = ircdb.makeChannelCapability(state.channel, cap)
|
cap = ircdb.makeChannelCapability(state.channel, cap)
|
||||||
|
Loading…
Reference in New Issue
Block a user