mirror of
				https://github.com/jlu5/PyLink.git
				synced 2025-11-04 00:47:21 +01:00 
			
		
		
		
	protocols: raise NotImplementedError with proper reasons
This commit is contained in:
		
							parent
							
								
									938a1fb9d7
								
							
						
					
					
						commit
						d6243d9f89
					
				@ -715,10 +715,13 @@ class P10Protocol(IRCS2SProtocol):
 | 
				
			|||||||
        """Updates the ident or host of any connected client."""
 | 
					        """Updates the ident or host of any connected client."""
 | 
				
			||||||
        uobj = self.irc.users[target]
 | 
					        uobj = self.irc.users[target]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ircd = self.irc.serverdata.get('p10_ircd', 'nefarious').lower()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if self.irc.isInternalClient(target):
 | 
					        if self.irc.isInternalClient(target):
 | 
				
			||||||
            # Host changing via SETHOST is only supported on nefarious and snircd.
 | 
					            # Host changing via SETHOST is only supported on nefarious and snircd.
 | 
				
			||||||
            if self.irc.serverdata.get('p10_ircd', 'nefarious').lower() not in ('nefarious', 'snircd'):
 | 
					            if ircd not in ('nefarious', 'snircd'):
 | 
				
			||||||
                raise NotImplementedError
 | 
					                raise NotImplementedError("Host changing for internal clients (via SETHOST) is only "
 | 
				
			||||||
 | 
					                                          "available on nefarious and snircd, and we're using p10_ircd=%r" % ircd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # Use SETHOST (umode +h) for internal clients.
 | 
					            # Use SETHOST (umode +h) for internal clients.
 | 
				
			||||||
            if field == 'HOST':
 | 
					            if field == 'HOST':
 | 
				
			||||||
@ -731,11 +734,13 @@ class P10Protocol(IRCS2SProtocol):
 | 
				
			|||||||
                self.mode(target, target, [('-h', None)])
 | 
					                self.mode(target, target, [('-h', None)])
 | 
				
			||||||
                self.mode(target, target, [('+x', None), ('+h', '%s@%s' % (text, uobj.host))])
 | 
					                self.mode(target, target, [('+x', None), ('+h', '%s@%s' % (text, uobj.host))])
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                raise NotImplementedError
 | 
					                raise NotImplementedError("Changing field %r of a client is "
 | 
				
			||||||
 | 
					                                          "unsupported by this protocol." % field)
 | 
				
			||||||
        elif field == 'HOST':
 | 
					        elif field == 'HOST':
 | 
				
			||||||
            # Host changing via FAKE is only supported on nefarious.
 | 
					            # Host changing via FAKE is only supported on nefarious.
 | 
				
			||||||
            if self.irc.serverdata.get('p10_ircd', 'nefarious').lower() != 'nefarious':
 | 
					            if ircd != 'nefarious':
 | 
				
			||||||
                raise NotImplementedError
 | 
					                raise NotImplementedError("vHost changing for non-PyLink clients (via FAKE) is "
 | 
				
			||||||
 | 
					                                          "only available on nefarious, and we're using p10_ircd=%r" % ircd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # Use FAKE (FA) for external clients.
 | 
					            # Use FAKE (FA) for external clients.
 | 
				
			||||||
            self._send(self.irc.sid, 'FA %s %s' % (target, text))
 | 
					            self._send(self.irc.sid, 'FA %s %s' % (target, text))
 | 
				
			||||||
@ -745,7 +750,8 @@ class P10Protocol(IRCS2SProtocol):
 | 
				
			|||||||
            self.irc.applyModes(target, [('+f', text)])
 | 
					            self.irc.applyModes(target, [('+f', text)])
 | 
				
			||||||
            self.mode(self.irc.sid, target, [('+x', None)])
 | 
					            self.mode(self.irc.sid, target, [('+x', None)])
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            raise NotImplementedError
 | 
					            raise NotImplementedError("Changing field %r of a client is "
 | 
				
			||||||
 | 
					                                      "unsupported by this protocol." % field)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # P10 cloaks aren't as simple as just replacing the displayed host with the one we're
 | 
					        # P10 cloaks aren't as simple as just replacing the displayed host with the one we're
 | 
				
			||||||
        # sending. Check for cloak changes properly.
 | 
					        # sending. Check for cloak changes properly.
 | 
				
			||||||
 | 
				
			|||||||
@ -82,7 +82,7 @@ class RatboxProtocol(TS6Protocol):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def updateClient(self, target, field, text):
 | 
					    def updateClient(self, target, field, text):
 | 
				
			||||||
        """updateClient() stub for ratbox."""
 | 
					        """updateClient() stub for ratbox."""
 | 
				
			||||||
        raise NotImplementedError
 | 
					        raise NotImplementedError("User data changing is not supported on ircd-ratbox.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def handle_realhost(self, uid, command, args):
 | 
					    def handle_realhost(self, uid, command, args):
 | 
				
			||||||
        """Handles real host propagation."""
 | 
					        """Handles real host propagation."""
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user