mirror of
				https://github.com/jlu5/PyLink.git
				synced 2025-11-04 00:47:21 +01:00 
			
		
		
		
	Move _check_nick_collision to NetworkCoreWithUtils
This is useful for networks that emulate IRC as well, to prevent clashes between real clients and virtual ones.
This commit is contained in:
		
							parent
							
								
									47f3977554
								
							
						
					
					
						commit
						981e6c508f
					
				
							
								
								
									
										12
									
								
								classes.py
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								classes.py
									
									
									
									
									
								
							@ -1077,6 +1077,18 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
 | 
			
		||||
                _clear()
 | 
			
		||||
                _apply()
 | 
			
		||||
 | 
			
		||||
    def _check_nick_collision(self, nick):
 | 
			
		||||
        """
 | 
			
		||||
        Nick collision checker.
 | 
			
		||||
        """
 | 
			
		||||
        uid = self.nick_to_uid(nick)
 | 
			
		||||
        # If there is a nick collision, we simply alert plugins. Relay will purposely try to
 | 
			
		||||
        # lose fights and tag nicks instead, while other plugins can choose how to handle this.
 | 
			
		||||
        if uid:
 | 
			
		||||
            log.info('(%s) Nick collision on %s/%s, forwarding this to plugins', self.name,
 | 
			
		||||
                     uid, nick)
 | 
			
		||||
            self.call_hooks([self.sid, 'SAVE', {'target': uid}])
 | 
			
		||||
 | 
			
		||||
class IRCNetwork(PyLinkNetworkCoreWithUtils):
 | 
			
		||||
    S2S_BUFSIZE = 510
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -459,18 +459,6 @@ class IRCS2SProtocol(IRCCommonProtocol):
 | 
			
		||||
        self.channels[target].topicset = True
 | 
			
		||||
    topic_burst = topic
 | 
			
		||||
 | 
			
		||||
    def _check_nick_collision(self, nick):
 | 
			
		||||
        """
 | 
			
		||||
        Nick collision checker.
 | 
			
		||||
        """
 | 
			
		||||
        uid = self.nick_to_uid(nick)
 | 
			
		||||
        # If there is a nick collision, we simply alert plugins. Relay will purposely try to
 | 
			
		||||
        # lose fights and tag nicks instead, while other plugins can choose how to handle this.
 | 
			
		||||
        if uid:
 | 
			
		||||
            log.info('(%s) Nick collision on %s/%s, forwarding this to plugins', self.name,
 | 
			
		||||
                     uid, nick)
 | 
			
		||||
            self.call_hooks([self.sid, 'SAVE', {'target': uid}])
 | 
			
		||||
 | 
			
		||||
    def handle_away(self, numeric, command, args):
 | 
			
		||||
        """Handles incoming AWAY messages."""
 | 
			
		||||
        # TS6:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user