- if ('LIST done' in target.cap_neg_state
- and 'listed' not in target.cap_neg_state):
- target.send(IrcMessage(verb='CAP', params=('END',)))
- target.log('# available server capabilities (enabled: "+"):')
- for cap_name, config in target.caps.items():
- target.log(f'# {"+" if config[0] else "-"} {cap_name}'
- + (f' ({config[1]})' if config[1] else ''))
- target.cap_neg_state.add('listed')
- elif ('LS done' in target.cap_neg_state
- and 'LIST wait' not in target.cap_neg_state):
- target.send(IrcMessage(verb='CAP', params=('LIST',)))
+ elif msg.params[1] == {'ACK', 'NAK'}:
+ cap_names = msg.params[-1].split()
+ for cap_name in cap_names:
+ target.cap_neg_set(f'REQ:{cap_name}', done=True)
+ target.caps[cap_name].enabled = msg.params[1] == 'ACK'
+ if target.cap_neg_done('LIST'):
+ target.try_send_cap('END')
+ if not target.cap_neg('printing'):
+ target.log('# server capabilities (enabled: "+"):')
+ for cap_name, cap in target.caps.items():
+ target.log('# ' + cap.str_for_log(cap_name))
+ target.cap_neg_set('printing', done=True)
+ elif target.cap_neg_done('LS'):
+ for cap_name in ('server-time', 'account-tag', 'sasl'):
+ if (cap_name in target.caps
+ and (not target.caps[cap_name].enabled)):
+ target.try_send_cap('REQ', cap_name, key_fused=True)
+ target.try_send_cap('LIST')