mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Add support for IRCv3.2 subcommand CAP DEL.
This commit is contained in:
parent
b338a23708
commit
73ed9635b5
@ -1028,12 +1028,15 @@ class Irc(IrcCommandDispatcher, log.Firewalled):
|
|||||||
self.sendMsg(ircmsgs.IrcMsg(command='AUTHENTICATE', args=(authstring,)))
|
self.sendMsg(ircmsgs.IrcMsg(command='AUTHENTICATE', args=(authstring,)))
|
||||||
|
|
||||||
def doCap(self, msg):
|
def doCap(self, msg):
|
||||||
if msg.args[1] == 'ACK':
|
subcommand = msg.args[1]
|
||||||
|
if subcommand == 'ACK':
|
||||||
self.doCapAck(msg)
|
self.doCapAck(msg)
|
||||||
elif msg.args[1] == 'NAK':
|
elif subcommand == 'NAK':
|
||||||
self.doCapNak(msg)
|
self.doCapNak(msg)
|
||||||
elif msg.args[1] == 'LS':
|
elif subcommand == 'LS':
|
||||||
self.doCapLs(msg)
|
self.doCapLs(msg)
|
||||||
|
elif subcommand == 'DEL':
|
||||||
|
self.doCapDel(msg)
|
||||||
def doCapAck(self, msg):
|
def doCapAck(self, msg):
|
||||||
if len(msg.args) != 3:
|
if len(msg.args) != 3:
|
||||||
log.warning('Bad CAP ACK from server: %r', msg)
|
log.warning('Bad CAP ACK from server: %r', msg)
|
||||||
@ -1086,6 +1089,24 @@ class Irc(IrcCommandDispatcher, log.Firewalled):
|
|||||||
else:
|
else:
|
||||||
log.warning('Bad CAP LS from server: %r', msg)
|
log.warning('Bad CAP LS from server: %r', msg)
|
||||||
return
|
return
|
||||||
|
def doCapDel(self, msg):
|
||||||
|
if len(msg.args) != 3:
|
||||||
|
log.warning('Bad CAP DEL from server: %r', msg)
|
||||||
|
return
|
||||||
|
caps = msg.args[2].split()
|
||||||
|
assert caps, 'Empty list of capabilities'
|
||||||
|
for cap in caps:
|
||||||
|
# The spec says "If capability negotiation 3.2 was used, extensions
|
||||||
|
# listed MAY contain values." for CAP NEW and CAP DEL
|
||||||
|
cap = cap.split('=')[0]
|
||||||
|
try:
|
||||||
|
del self.state.capabilities_ls[cap]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
del self.state.capabilities_ack[cap]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
def monitor(self, targets):
|
def monitor(self, targets):
|
||||||
"""Increment a counter of how many callbacks monitor each target;
|
"""Increment a counter of how many callbacks monitor each target;
|
||||||
|
Loading…
Reference in New Issue
Block a user