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

p10: add inbound handlers for WALLCHOPS/WALLHOPS/WALLVOICES

This essentially finishes off STATUSMSG support on P10.
This commit is contained in:
James Lu 2017-12-21 01:27:00 -08:00
parent 2cc1195ff9
commit 20e730ba2b

View File

@ -137,6 +137,7 @@ class P10Protocol(IRCS2SProtocol):
'USERIP': 'USERIP', 'USERIP': 'USERIP',
'V': 'VERSION', 'V': 'VERSION',
'WC': 'WALLCHOPS', 'WC': 'WALLCHOPS',
'WH': 'WALLHOPS',
'WA': 'WALLOPS', 'WA': 'WALLOPS',
'WU': 'WALLUSERS', 'WU': 'WALLUSERS',
'WV': 'WALLVOICES', 'WV': 'WALLVOICES',
@ -160,7 +161,10 @@ class P10Protocol(IRCS2SProtocol):
# SID generator for P10. # SID generator for P10.
self.sidgen = P10SIDGenerator(self) self.sidgen = P10SIDGenerator(self)
self.hook_map = {'END_OF_BURST': 'ENDBURST', 'OPMODE': 'MODE', 'CLEARMODE': 'MODE', 'BURST': 'JOIN'} self.hook_map = {'END_OF_BURST': 'ENDBURST', 'OPMODE': 'MODE',
'CLEARMODE': 'MODE', 'BURST': 'JOIN',
'WALLCHOPS': 'NOTICE', 'WALLHOPS': 'NOTICE',
'WALLVOICES': 'NOTICE'}
self.protocol_caps |= {'slash-in-hosts', 'underscore-in-hosts'} self.protocol_caps |= {'slash-in-hosts', 'underscore-in-hosts'}
@ -1305,4 +1309,14 @@ class P10Protocol(IRCS2SProtocol):
# 2 <new nick> # 2 <new nick>
return {'target': args[0], 'newnick': args[1]} return {'target': args[0], 'newnick': args[1]}
def handle_wallchops(self, source, command, args):
"""Handles WALLCHOPS/WALLHOPS/WALLVOICES, the equivalent of @#channel
messages and the like on P10."""
# <- ABAAA WC #magichouse :@ test
# <- ABAAA WH #magichouse :% test
# <- ABAAA WV #magichouse :+ test
prefix, text = args[-1].split(' ', 1)
return {'target': prefix+args[0], 'text': text}
handle_wallhops = handle_wallvoices = handle_wallchops
Class = P10Protocol Class = P10Protocol