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

protocols & coreplugin: add handlers for VERSION requests

This commit is contained in:
James Lu 2016-03-26 11:27:07 -07:00
parent 45c2abdae7
commit 23056e97e3
3 changed files with 18 additions and 0 deletions

View File

@ -147,6 +147,14 @@ def handle_services_login(irc, source, command, args):
utils.add_hook(handle_services_login, 'CLIENT_SERVICES_LOGIN')
def handle_version(irc, source, command, args):
"""Handles requests for the PyLink server version."""
# 351 syntax is usually "<server version>. <server hostname> :<anything else you want to add>
fullversion = 'PyLink-%s. %s :[protocol:%s]' % (world.version, irc.serverdata['hostname'], irc.protoname)
irc.proto.numeric(irc.sid, 351, source, fullversion)
utils.add_hook(handle_version, 'VERSION')
# Essential, core commands go here so that the "commands" plugin with less-important,
# but still generic functions can be reloaded.

View File

@ -697,4 +697,10 @@ class InspIRCdProtocol(TS6BaseProtocol):
self.irc.callHooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': args[-1]}])
def handle_version(self, numeric, command, args):
"""
Stub VERSION handler (does nothing) to override the one in ts6_common.
"""
pass
Class = InspIRCdProtocol

View File

@ -339,3 +339,7 @@ class TS6BaseProtocol(Protocol):
except IndexError: # User is unsetting away status
self.irc.users[numeric].away = text = ''
return {'text': text}
def handle_version(self, numeric, command, args):
"""Handles requests for the PyLink server version."""
return {} # See coreplugin.py for how this hook is used