mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 19:52:54 +01:00
Store the list of server capabilities in IrcState.
This commit is contained in:
parent
a81d3ddae6
commit
7448c04760
@ -349,7 +349,8 @@ class IrcState(IrcCommandDispatcher):
|
|||||||
__metaclass__ = log.MetaFirewall
|
__metaclass__ = log.MetaFirewall
|
||||||
__firewalled__ = {'addMsg': None}
|
__firewalled__ = {'addMsg': None}
|
||||||
def __init__(self, history=None, supported=None,
|
def __init__(self, history=None, supported=None,
|
||||||
nicksToHostmasks=None, channels=None):
|
nicksToHostmasks=None, channels=None,
|
||||||
|
capabilities_ack=None, capabilities_nak=None):
|
||||||
if history is None:
|
if history is None:
|
||||||
history = RingBuffer(conf.supybot.protocols.irc.maxHistoryLength())
|
history = RingBuffer(conf.supybot.protocols.irc.maxHistoryLength())
|
||||||
if supported is None:
|
if supported is None:
|
||||||
@ -358,6 +359,8 @@ class IrcState(IrcCommandDispatcher):
|
|||||||
nicksToHostmasks = ircutils.IrcDict()
|
nicksToHostmasks = ircutils.IrcDict()
|
||||||
if channels is None:
|
if channels is None:
|
||||||
channels = ircutils.IrcDict()
|
channels = ircutils.IrcDict()
|
||||||
|
self.capabilities_ack = capabilities_ack or set()
|
||||||
|
self.capabilities_nak = capabilities_nak or set()
|
||||||
self.ircd = None
|
self.ircd = None
|
||||||
self.supported = supported
|
self.supported = supported
|
||||||
self.history = history
|
self.history = history
|
||||||
@ -1016,24 +1019,27 @@ class Irc(IrcCommandDispatcher):
|
|||||||
self.queueMsg(ircmsgs.IrcMsg(command='AUTHENTICATE', args=(authstring,)))
|
self.queueMsg(ircmsgs.IrcMsg(command='AUTHENTICATE', args=(authstring,)))
|
||||||
|
|
||||||
def doCap(self, msg):
|
def doCap(self, msg):
|
||||||
if len(msg.args) == 3:
|
if len(msg.args) != 3:
|
||||||
for cap in msg.args[2].split(' '):
|
return
|
||||||
if msg.args[1] == 'ACK':
|
for cap in msg.args[2].split(' '):
|
||||||
log.info('%s: Server acknowledged capability %r',
|
if msg.args[1] == 'ACK':
|
||||||
self.network, cap)
|
log.info('%s: Server acknowledged capability %r',
|
||||||
|
self.network, cap)
|
||||||
|
self.state.capabilities_ack.add(cap)
|
||||||
|
|
||||||
if cap == 'sasl':
|
if cap == 'sasl':
|
||||||
self.queueMsg(ircmsgs.IrcMsg(
|
self.queueMsg(ircmsgs.IrcMsg(
|
||||||
command='AUTHENTICATE',
|
command='AUTHENTICATE',
|
||||||
args=(self.sasl.upper(),)))
|
args=(self.sasl.upper(),)))
|
||||||
elif msg.args[1] == 'NAK':
|
elif msg.args[1] == 'NAK':
|
||||||
log.warning('%s: Server refused capability %r',
|
self.state.capabilities_nak.add(cap)
|
||||||
self.network, cap)
|
log.warning('%s: Server refused capability %r',
|
||||||
|
self.network, cap)
|
||||||
|
|
||||||
if cap == 'sasl':
|
if cap == 'sasl':
|
||||||
self.queueMsg(ircmsgs.IrcMsg(
|
self.queueMsg(ircmsgs.IrcMsg(
|
||||||
command='CAP',
|
command='CAP',
|
||||||
args=('END',)))
|
args=('END',)))
|
||||||
|
|
||||||
def do903(self, msg):
|
def do903(self, msg):
|
||||||
log.info('%s: SASL authentication successful', self.network)
|
log.info('%s: SASL authentication successful', self.network)
|
||||||
|
Loading…
Reference in New Issue
Block a user