From 20e730ba2b32d6cc9194625ac3ed187e48d25c66 Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 21 Dec 2017 01:27:00 -0800 Subject: [PATCH] p10: add inbound handlers for WALLCHOPS/WALLHOPS/WALLVOICES This essentially finishes off STATUSMSG support on P10. --- protocols/p10.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/protocols/p10.py b/protocols/p10.py index 5ec9104..2b1a91e 100644 --- a/protocols/p10.py +++ b/protocols/p10.py @@ -137,6 +137,7 @@ class P10Protocol(IRCS2SProtocol): 'USERIP': 'USERIP', 'V': 'VERSION', 'WC': 'WALLCHOPS', + 'WH': 'WALLHOPS', 'WA': 'WALLOPS', 'WU': 'WALLUSERS', 'WV': 'WALLVOICES', @@ -160,7 +161,10 @@ class P10Protocol(IRCS2SProtocol): # SID generator for P10. 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'} @@ -1305,4 +1309,14 @@ class P10Protocol(IRCS2SProtocol): # 2 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