mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-23 19:19:31 +01:00
Irc: s/isServiceBot/getServiceBot/g (#355)
This function is renamed to better reflect its return value (ServiceBot object instead of boolean True).
This commit is contained in:
parent
08fa64c3cc
commit
377df413ed
@ -902,7 +902,7 @@ class Irc():
|
||||
"""
|
||||
return self.isInternalClient(uid) and self.users[uid].manipulatable
|
||||
|
||||
def isServiceBot(self, uid):
|
||||
def getServiceBot(self, uid):
|
||||
"""
|
||||
Checks whether the given UID is a registered service bot. If True,
|
||||
returns the cooresponding ServiceBot object.
|
||||
|
@ -94,7 +94,7 @@ utils.add_hook(handle_endburst, 'ENDBURST')
|
||||
def handle_kill(irc, source, command, args):
|
||||
"""Handle KILLs to PyLink service bots, respawning them as needed."""
|
||||
target = args['target']
|
||||
sbot = irc.isServiceBot(target)
|
||||
sbot = irc.getServiceBot(target)
|
||||
if sbot:
|
||||
spawn_service(irc, source, command, {'name': sbot.name})
|
||||
return
|
||||
@ -104,7 +104,7 @@ def handle_kick(irc, source, command, args):
|
||||
"""Handle KICKs to the PyLink service bots, rejoining channels as needed."""
|
||||
kicked = args['target']
|
||||
channel = args['channel']
|
||||
sbot = irc.isServiceBot(kicked)
|
||||
sbot = irc.getServiceBot(kicked)
|
||||
if sbot:
|
||||
sbot.join(irc, channel)
|
||||
utils.add_hook(handle_kick, 'KICK')
|
||||
@ -114,7 +114,7 @@ def handle_commands(irc, source, command, args):
|
||||
target = args['target']
|
||||
text = args['text']
|
||||
|
||||
sbot = irc.isServiceBot(target)
|
||||
sbot = irc.getServiceBot(target)
|
||||
if sbot:
|
||||
sbot.call_cmd(irc, source, text)
|
||||
|
||||
|
@ -74,7 +74,7 @@ def joinclient(irc, source, args):
|
||||
irc.reply("Error: No valid channels given.")
|
||||
return
|
||||
|
||||
if not (irc.isManipulatableClient(u) or irc.isServiceBot(u)):
|
||||
if not (irc.isManipulatableClient(u) or irc.getServiceBot(u)):
|
||||
irc.reply("Error: Cannot force join a protected PyLink services client.")
|
||||
return
|
||||
|
||||
@ -116,7 +116,7 @@ def nick(irc, source, args):
|
||||
irc.reply('Error: Invalid nickname %r.' % newnick)
|
||||
return
|
||||
|
||||
elif not (irc.isManipulatableClient(u) or irc.isServiceBot(u)):
|
||||
elif not (irc.isManipulatableClient(u) or irc.getServiceBot(u)):
|
||||
irc.reply("Error: Cannot force nick changes for a protected PyLink services client.")
|
||||
return
|
||||
|
||||
@ -158,7 +158,7 @@ def part(irc, source, args):
|
||||
irc.reply("Error: No valid channels given.")
|
||||
return
|
||||
|
||||
if not (irc.isManipulatableClient(u) or irc.isServiceBot(u)):
|
||||
if not (irc.isManipulatableClient(u) or irc.getServiceBot(u)):
|
||||
irc.reply("Error: Cannot force part a protected PyLink services client.")
|
||||
return
|
||||
|
||||
|
@ -393,7 +393,7 @@ def getRemoteUser(irc, remoteirc, user, spawnIfMissing=True, times_tagged=0):
|
||||
irc.connected.wait(5)
|
||||
|
||||
# Don't spawn clones for registered service bots.
|
||||
sbot = irc.isServiceBot(user)
|
||||
sbot = irc.getServiceBot(user)
|
||||
if sbot:
|
||||
return sbot.uids.get(remoteirc.name)
|
||||
|
||||
@ -1196,7 +1196,7 @@ def handle_kick(irc, source, command, args):
|
||||
return
|
||||
|
||||
# Don't relay kicks to protected service bots.
|
||||
if relay is None or irc.isServiceBot(target):
|
||||
if relay is None or irc.getServiceBot(target):
|
||||
return
|
||||
|
||||
origuser = getOrigUser(irc, target)
|
||||
|
@ -89,7 +89,7 @@ def cb_relay_core(irc, source, command, args):
|
||||
text_template = string.Template(text_template)
|
||||
|
||||
if text_template:
|
||||
if irc.isServiceBot(source):
|
||||
if irc.getServiceBot(source):
|
||||
# HACK: service bots are global and lack the relay state we look for.
|
||||
# just pretend the message comes from the current network.
|
||||
log.debug('(%s) relay_cb_core: Overriding network origin to local (source=%s)', irc.name, source)
|
||||
|
Loading…
Reference in New Issue
Block a user