mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-26 04:32:51 +01:00
pr/insp: add OPERTYPE command handler
This is sent by InspIRCd for oper ups; there is no MODE command for it.
This commit is contained in:
parent
7a37f50a1a
commit
cbfabb2ba1
@ -17,7 +17,7 @@ from classes import *
|
|||||||
# XXX figure out a way to not force-map ENCAP to KNOCK, since other commands are sent
|
# XXX figure out a way to not force-map ENCAP to KNOCK, since other commands are sent
|
||||||
# through it too.
|
# through it too.
|
||||||
hook_map = {'FJOIN': 'JOIN', 'RSQUIT': 'SQUIT', 'FMODE': 'MODE',
|
hook_map = {'FJOIN': 'JOIN', 'RSQUIT': 'SQUIT', 'FMODE': 'MODE',
|
||||||
'FTOPIC': 'TOPIC', 'ENCAP': 'KNOCK'}
|
'FTOPIC': 'TOPIC', 'ENCAP': 'KNOCK', 'OPERTYPE': 'MODE'}
|
||||||
|
|
||||||
def _sendFromServer(irc, sid, msg):
|
def _sendFromServer(irc, sid, msg):
|
||||||
irc.send(':%s %s' % (sid, msg))
|
irc.send(':%s %s' % (sid, msg))
|
||||||
@ -508,3 +508,11 @@ def handle_notice(irc, numeric, command, args):
|
|||||||
# <- :70MAAAAAA NOTICE #dev :afasfsa
|
# <- :70MAAAAAA NOTICE #dev :afasfsa
|
||||||
# <- :70MAAAAAA NOTICE 0ALAAAAAA :afasfsa
|
# <- :70MAAAAAA NOTICE 0ALAAAAAA :afasfsa
|
||||||
return {'target': args[0], 'text': args[1]}
|
return {'target': args[0], 'text': args[1]}
|
||||||
|
|
||||||
|
def handle_opertype(irc, numeric, command, args):
|
||||||
|
# This is used by InspIRCd to denote an oper up; there is no MODE
|
||||||
|
# command sent for it.
|
||||||
|
# <- :70MAAAAAB OPERTYPE Network_Owner
|
||||||
|
omode = [('+o', None)]
|
||||||
|
utils.applyModes(irc, numeric, omode)
|
||||||
|
return {'target': numeric, 'modes': omode}
|
||||||
|
@ -359,5 +359,14 @@ class TestProtoInspIRCd(unittest.TestCase):
|
|||||||
hookdata = self.irc.takeHooks()[0]
|
hookdata = self.irc.takeHooks()[0]
|
||||||
del hookdata['ts']
|
del hookdata['ts']
|
||||||
self.assertEqual(hookdata, {'target': '9PYAAAAAA', 'channel': '#blah'})
|
self.assertEqual(hookdata, {'target': '9PYAAAAAA', 'channel': '#blah'})
|
||||||
|
|
||||||
|
def testHandleOpertype(self):
|
||||||
|
self.irc.run('SERVER whatever. abcd 0 10X :Whatever Server - Hellas Planitia, Mars')
|
||||||
|
self.irc.run(':10X UID 10XAAAAAB 1429934638 GL 0::1 '
|
||||||
|
'hidden-7j810p.9mdf.lrek.0000.0000.IP gl 0::1 1429934638 '
|
||||||
|
'+Wioswx +ACGKNOQXacfgklnoqvx :realname')
|
||||||
|
self.irc.run(':10XAAAAAB OPERTYPE Network_Owner')
|
||||||
|
self.assertIn(('o', None), self.irc.users['10XAAAAAB'].modes)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user