mirror of
				https://github.com/jlu5/PyLink.git
				synced 2025-11-04 00:47:21 +01:00 
			
		
		
		
	protocols & coreplugin: add handlers for VERSION requests
This commit is contained in:
		
							parent
							
								
									45c2abdae7
								
							
						
					
					
						commit
						23056e97e3
					
				@ -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.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user