3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

clientbot: make oper status tracking a network-specific option

This commit is contained in:
James Lu 2016-10-09 19:03:46 -07:00
parent 288a2fffd7
commit 7917502799
2 changed files with 16 additions and 10 deletions

View File

@ -283,6 +283,11 @@ servers:
#autoperform: #autoperform:
# - "NOTICE somebody :hello, i've connected" # - "NOTICE somebody :hello, i've connected"
# Determines whether oper statuses should be tracked on this Clientbot network. This
# defaults to False for the best security, since oper status may allow more access to the
# entire PyLink service than what's desired, even when PyLink is only connected as a bot.
track_oper_statuses: false
# Plugins to load (omit the .py extension) # Plugins to load (omit the .py extension)
plugins: plugins:
# Commands plugin: Provides core commands such as logging in, shutting down # Commands plugin: Provides core commands such as logging in, shutting down

View File

@ -503,16 +503,17 @@ class ClientbotWrapperProtocol(Protocol):
else: else:
log.warning('(%s) handle_352: got wrong string %s for away status', self.irc.name, status[0]) log.warning('(%s) handle_352: got wrong string %s for away status', self.irc.name, status[0])
if '*' in status: # Track IRCop status if self.irc.serverdata.get('track_oper_statuses'):
if not self.irc.isOper(uid, allowAuthed=False): if '*' in status: # Track IRCop status
# Don't send duplicate oper ups if the target is already oper. if not self.irc.isOper(uid, allowAuthed=False):
self.irc.applyModes(uid, [('+o', None)]) # Don't send duplicate oper ups if the target is already oper.
self.irc.callHooks([uid, 'MODE', {'target': uid, 'modes': {('+o', None)}}]) self.irc.applyModes(uid, [('+o', None)])
self.irc.callHooks([uid, 'CLIENT_OPERED', {'text': 'IRC Operator'}]) self.irc.callHooks([uid, 'MODE', {'target': uid, 'modes': {('+o', None)}}])
elif self.irc.isOper(uid, allowAuthed=False) and not self.irc.isInternalClient(uid): self.irc.callHooks([uid, 'CLIENT_OPERED', {'text': 'IRC Operator'}])
# Track deopers elif self.irc.isOper(uid, allowAuthed=False) and not self.irc.isInternalClient(uid):
self.irc.applyModes(uid, [('-o', None)]) # Track deopers
self.irc.callHooks([uid, 'MODE', {'target': uid, 'modes': {('-o', None)}}]) self.irc.applyModes(uid, [('-o', None)])
self.irc.callHooks([uid, 'MODE', {'target': uid, 'modes': {('-o', None)}}])
self.who_received.add(uid) self.who_received.add(uid)