mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 21:19:31 +01:00
ts6: implement KLINE support (#139)
This commit is contained in:
parent
ab8a922809
commit
410ade3b60
@ -227,6 +227,20 @@ class TS6Protocol(TS6BaseProtocol):
|
||||
# No text value is supported here; drop it.
|
||||
self._send_with_prefix(numeric, 'KNOCK %s' % target)
|
||||
|
||||
def set_server_ban(self, source, duration, user='*', host='*', reason='User banned'):
|
||||
"""
|
||||
Sets a server ban.
|
||||
"""
|
||||
# source: user
|
||||
# parameters: target server mask, duration, user mask, host mask, reason
|
||||
assert not (user == host == '*'), "Refusing to set ridiculous ban on *@*"
|
||||
|
||||
if not source in self.users:
|
||||
log.debug('(%s) Forcing KLINE sender to %s as TS6 does not allow KLINEs from servers', self.name, self.pseudoclient.uid)
|
||||
source = self.pseudoclient.uid
|
||||
|
||||
self._send_with_prefix(source, 'ENCAP * KLINE %s %s %s :%s' % (duration, user, host, reason))
|
||||
|
||||
def update_client(self, target, field, text):
|
||||
"""Updates the hostname of any connected client."""
|
||||
field = field.upper()
|
||||
@ -340,7 +354,8 @@ class TS6Protocol(TS6BaseProtocol):
|
||||
# RSFNC: states that we support RSFNC (forced nick changed attempts). XXX: With atheme services,
|
||||
# does this actually do anything?
|
||||
# EOPMOD: supports ETB (extended TOPIC burst) and =#channel messages for opmoderated +z
|
||||
f('CAPAB :QS ENCAP EX CHW IE KNOCK SAVE SERVICES TB EUID RSFNC EOPMOD SAVETS_100')
|
||||
# KLN: supports remote KLINEs
|
||||
f('CAPAB :QS ENCAP EX CHW IE KNOCK SAVE SERVICES TB EUID RSFNC EOPMOD SAVETS_100 KLN')
|
||||
|
||||
f('SERVER %s 0 :%s' % (self.serverdata["hostname"],
|
||||
self.serverdata.get('serverdesc') or conf.conf['bot']['serverdesc']))
|
||||
|
Loading…
Reference in New Issue
Block a user