mirror of
				https://github.com/jlu5/PyLink.git
				synced 2025-11-04 00:47:21 +01:00 
			
		
		
		
	IRCS2SProtocol: handle both killpath-based and preformatted kill reasons
Also drop the override in protocols/inspircd, as it is no longer needed.
This commit is contained in:
		
							parent
							
								
									1e5985b608
								
							
						
					
					
						commit
						56c8b90362
					
				@ -767,19 +767,6 @@ class InspIRCdProtocol(TS6BaseProtocol):
 | 
			
		||||
        Stub VERSION handler (does nothing) to override the one in ts6_common.
 | 
			
		||||
        """
 | 
			
		||||
 | 
			
		||||
    def handle_kill(self, source, command, args):
 | 
			
		||||
        """Handles incoming KILLs."""
 | 
			
		||||
        killed = args[0]
 | 
			
		||||
        # Depending on whether the IRCd sends explicit QUIT messages for
 | 
			
		||||
        # killed clients, the user may or may not have automatically been
 | 
			
		||||
        # removed from our user list.
 | 
			
		||||
        # If not, we have to assume that KILL = QUIT and remove them
 | 
			
		||||
        # ourselves.
 | 
			
		||||
        data = self.users.get(killed)
 | 
			
		||||
        if data:
 | 
			
		||||
            self._remove_client(killed)
 | 
			
		||||
        return {'target': killed, 'text': args[1], 'userdata': data}
 | 
			
		||||
 | 
			
		||||
    def handle_sakick(self, source, command, args):
 | 
			
		||||
        """Handles forced kicks (SAKICK)."""
 | 
			
		||||
        # <- :1MLAAAAAD ENCAP 0AL SAKICK #test 0ALAAAAAB :test
 | 
			
		||||
 | 
			
		||||
@ -518,18 +518,26 @@ class IRCS2SProtocol(IRCCommonProtocol):
 | 
			
		||||
        # What we actually want is to format a pretty kill message, in the form
 | 
			
		||||
        # "Killed (killername (reason))".
 | 
			
		||||
 | 
			
		||||
        try:
 | 
			
		||||
            # Get the nick or server name of the caller.
 | 
			
		||||
            killer = self.get_friendly_name(source)
 | 
			
		||||
        except KeyError:
 | 
			
		||||
            # Killer was... neither? We must have aliens or something. Fallback
 | 
			
		||||
            # to the given "UID".
 | 
			
		||||
            killer = source
 | 
			
		||||
        if '!' in args[1].split(" ", 1)[0]:
 | 
			
		||||
            try:
 | 
			
		||||
                # Get the nick or server name of the caller.
 | 
			
		||||
                killer = self.get_friendly_name(source)
 | 
			
		||||
            except KeyError:
 | 
			
		||||
                # Killer was... neither? We must have aliens or something. Fallback
 | 
			
		||||
                # to the given "UID".
 | 
			
		||||
                killer = source
 | 
			
		||||
 | 
			
		||||
        # Get the reason, which is enclosed in brackets.
 | 
			
		||||
        reason = ' '.join(args[1].split(" ")[1:])
 | 
			
		||||
            # Get the reason, which is enclosed in brackets.
 | 
			
		||||
            reason = ' '.join(args[1].split(" ")[1:])
 | 
			
		||||
 | 
			
		||||
        killmsg = "Killed (%s %s)" % (killer, reason)
 | 
			
		||||
            killmsg = "Killed (%s %s)" % (killer, reason)
 | 
			
		||||
        else:
 | 
			
		||||
            # We already have a preformatted kill, so just pass it on as is.
 | 
			
		||||
            # InspIRCd:
 | 
			
		||||
            # <- :1MLAAAAA1 KILL 0ALAAAAAC :Killed (GL (test))
 | 
			
		||||
            # ngIRCd:
 | 
			
		||||
            # <- :GL KILL PyLink-devel :KILLed by GL: ?
 | 
			
		||||
            killmsg = args[1]
 | 
			
		||||
 | 
			
		||||
        return {'target': killed, 'text': killmsg, 'userdata': data}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user