mirror of
				https://github.com/jlu5/PyLink.git
				synced 2025-11-04 08:57:25 +01:00 
			
		
		
		
	protocols: sed -i 's/_getUid/_get_UID/g'
This commit is contained in:
		
							parent
							
								
									7ca98eb965
								
							
						
					
					
						commit
						a60d746e3b
					
				@ -333,7 +333,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
 | 
			
		||||
        else:
 | 
			
		||||
            return  # Nothing changed
 | 
			
		||||
 | 
			
		||||
    def _getUid(self, nick, ident=None, host=None):
 | 
			
		||||
    def _get_UID(self, nick, ident=None, host=None):
 | 
			
		||||
        """
 | 
			
		||||
        Fetches the UID for the given nick, creating one if it does not already exist.
 | 
			
		||||
 | 
			
		||||
@ -414,7 +414,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
 | 
			
		||||
                except ValueError:
 | 
			
		||||
                    ident = host = None  # Set ident and host as null for now.
 | 
			
		||||
                    nick = sender  # Treat the sender prefix we received as a nick.
 | 
			
		||||
                idsource = self._getUid(nick, ident, host)
 | 
			
		||||
                idsource = self._get_UID(nick, ident, host)
 | 
			
		||||
 | 
			
		||||
        try:
 | 
			
		||||
            func = getattr(self, 'handle_'+command.lower())
 | 
			
		||||
@ -649,7 +649,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
 | 
			
		||||
            # Get the PUID for the given nick. If one doesn't exist, spawn
 | 
			
		||||
            # a new virtual user. TODO: wait for WHO responses for each nick before
 | 
			
		||||
            # spawning in order to get a real ident/host.
 | 
			
		||||
            idsource = self._getUid(nick)
 | 
			
		||||
            idsource = self._get_UID(nick)
 | 
			
		||||
 | 
			
		||||
            # Queue these virtual users to be joined if they're not already in the channel,
 | 
			
		||||
            # or we're waiting for a kick acknowledgment for them.
 | 
			
		||||
 | 
			
		||||
@ -166,7 +166,7 @@ class IRCS2SProtocol(IRCCommonProtocol):
 | 
			
		||||
 | 
			
		||||
        # If the sender isn't in numeric format, try to convert it automatically.
 | 
			
		||||
        sender_sid = self._getSid(sender)
 | 
			
		||||
        sender_uid = self._getUid(sender)
 | 
			
		||||
        sender_uid = self._get_UID(sender)
 | 
			
		||||
 | 
			
		||||
        if sender_sid in self.irc.servers:
 | 
			
		||||
            # Sender is a server (converting from name to SID gave a valid result).
 | 
			
		||||
@ -217,7 +217,7 @@ class IRCS2SProtocol(IRCCommonProtocol):
 | 
			
		||||
        # P10:
 | 
			
		||||
        # <- ABAAA P AyAAA :privmsg text
 | 
			
		||||
        # <- ABAAA O AyAAA :notice text
 | 
			
		||||
        target = self._getUid(args[0])
 | 
			
		||||
        target = self._get_UID(args[0])
 | 
			
		||||
 | 
			
		||||
        # Coerse =#channel from Charybdis op moderated +z to @#channel.
 | 
			
		||||
        if target.startswith('='):
 | 
			
		||||
@ -316,7 +316,7 @@ class IRCS2SProtocol(IRCCommonProtocol):
 | 
			
		||||
        # WHOIS commands received are for us, since we don't host any real servers
 | 
			
		||||
        # to route it to.
 | 
			
		||||
 | 
			
		||||
        return {'target': self._getUid(args[-1])}
 | 
			
		||||
        return {'target': self._get_UID(args[-1])}
 | 
			
		||||
 | 
			
		||||
    def handle_quit(self, numeric, command, args):
 | 
			
		||||
        """Handles incoming QUIT commands."""
 | 
			
		||||
 | 
			
		||||
@ -1124,7 +1124,7 @@ class P10Protocol(IRCS2SProtocol):
 | 
			
		||||
        # <- ABAAA M GL -w
 | 
			
		||||
        # <- ABAAA M #test +v ABAAB 1460747615
 | 
			
		||||
        # <- ABAAA OM #test +h ABAAA
 | 
			
		||||
        target = self._getUid(args[0])
 | 
			
		||||
        target = self._get_UID(args[0])
 | 
			
		||||
        if utils.isChannel(target):
 | 
			
		||||
            target = self.irc.toLower(target)
 | 
			
		||||
 | 
			
		||||
@ -1204,7 +1204,7 @@ class P10Protocol(IRCS2SProtocol):
 | 
			
		||||
        # 2 <channel>
 | 
			
		||||
        # - note that the target is a nickname, not a numeric.
 | 
			
		||||
        # <- ABAAA I PyLink-devel #services 1460948992
 | 
			
		||||
        target = self._getUid(args[0])
 | 
			
		||||
        target = self._get_UID(args[0])
 | 
			
		||||
        channel = self.irc.toLower(args[1])
 | 
			
		||||
 | 
			
		||||
        return {'target': target, 'channel': channel}
 | 
			
		||||
 | 
			
		||||
@ -646,7 +646,7 @@ class TS6Protocol(TS6BaseProtocol):
 | 
			
		||||
 | 
			
		||||
    def handle_chghost(self, numeric, command, args):
 | 
			
		||||
        """Handles incoming CHGHOST commands."""
 | 
			
		||||
        target = self._getUid(args[0])
 | 
			
		||||
        target = self._get_UID(args[0])
 | 
			
		||||
        self.irc.users[target].host = newhost = args[1]
 | 
			
		||||
        return {'target': target, 'newhost': newhost}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -298,7 +298,7 @@ class TS6BaseProtocol(IRCS2SProtocol):
 | 
			
		||||
        """Handles incoming KICKs."""
 | 
			
		||||
        # :70MAAAAAA KICK #test 70MAAAAAA :some reason
 | 
			
		||||
        channel = self.irc.toLower(args[0])
 | 
			
		||||
        kicked = self._getUid(args[1])
 | 
			
		||||
        kicked = self._get_UID(args[1])
 | 
			
		||||
 | 
			
		||||
        try:
 | 
			
		||||
            reason = args[2]
 | 
			
		||||
@ -381,4 +381,4 @@ class TS6BaseProtocol(IRCS2SProtocol):
 | 
			
		||||
 | 
			
		||||
        # UnrealIRCd:
 | 
			
		||||
        # <- :services.midnight.vpn SVSNICK GL Guest87795 1468303726
 | 
			
		||||
        return {'target': self._getUid(args[0]), 'newnick': args[1]}
 | 
			
		||||
        return {'target': self._get_UID(args[0]), 'newnick': args[1]}
 | 
			
		||||
 | 
			
		||||
@ -624,7 +624,7 @@ class UnrealProtocol(TS6BaseProtocol):
 | 
			
		||||
                    # <- :002 SJOIN 1486361658 #idlerpg :@
 | 
			
		||||
                    continue
 | 
			
		||||
 | 
			
		||||
                user = self._getUid(user)  # Normalize nicks to UIDs for Unreal 3.2 links
 | 
			
		||||
                user = self._get_UID(user)  # Normalize nicks to UIDs for Unreal 3.2 links
 | 
			
		||||
                # Unreal uses slightly different prefixes in SJOIN. +q is * instead of ~,
 | 
			
		||||
                # and +a is ~ instead of &.
 | 
			
		||||
                modeprefix = (r.group(1) or '').replace("~", "&").replace("*", "~")
 | 
			
		||||
@ -769,7 +769,7 @@ class UnrealProtocol(TS6BaseProtocol):
 | 
			
		||||
    def handle_svsmode(self, numeric, command, args):
 | 
			
		||||
        """Handles SVSMODE, used by services for setting user modes on others."""
 | 
			
		||||
        # <- :source SVSMODE target +usermodes
 | 
			
		||||
        target = self._getUid(args[0])
 | 
			
		||||
        target = self._get_UID(args[0])
 | 
			
		||||
        modes = args[1:]
 | 
			
		||||
 | 
			
		||||
        parsedmodes = self.irc.parseModes(target, modes)
 | 
			
		||||
@ -817,7 +817,7 @@ class UnrealProtocol(TS6BaseProtocol):
 | 
			
		||||
        # <- :NickServ SVS2MODE 001SALZ01 +d GL
 | 
			
		||||
        # <- :NickServ SVS2MODE 001SALZ01 +r
 | 
			
		||||
 | 
			
		||||
        target = self._getUid(args[0])
 | 
			
		||||
        target = self._get_UID(args[0])
 | 
			
		||||
        parsedmodes = self.irc.parseModes(target, args[1:])
 | 
			
		||||
 | 
			
		||||
        if ('+r', None) in parsedmodes:
 | 
			
		||||
@ -911,14 +911,14 @@ class UnrealProtocol(TS6BaseProtocol):
 | 
			
		||||
    def handle_chgident(self, numeric, command, args):
 | 
			
		||||
        """Handles CHGIDENT, used for denoting ident changes."""
 | 
			
		||||
        # <- :GL CHGIDENT GL test
 | 
			
		||||
        target = self._getUid(args[0])
 | 
			
		||||
        target = self._get_UID(args[0])
 | 
			
		||||
        self.irc.users[target].ident = newident = args[1]
 | 
			
		||||
        return {'target': target, 'newident': newident}
 | 
			
		||||
 | 
			
		||||
    def handle_chghost(self, numeric, command, args):
 | 
			
		||||
        """Handles CHGHOST, used for denoting hostname changes."""
 | 
			
		||||
        # <- :GL CHGHOST GL some.host
 | 
			
		||||
        target = self._getUid(args[0])
 | 
			
		||||
        target = self._get_UID(args[0])
 | 
			
		||||
        self.irc.users[target].host = newhost = args[1]
 | 
			
		||||
 | 
			
		||||
        # When SETHOST or CHGHOST is used, modes +xt are implicitly set on the
 | 
			
		||||
@ -930,14 +930,14 @@ class UnrealProtocol(TS6BaseProtocol):
 | 
			
		||||
    def handle_chgname(self, numeric, command, args):
 | 
			
		||||
        """Handles CHGNAME, used for denoting real name/gecos changes."""
 | 
			
		||||
        # <- :GL CHGNAME GL :afdsafasf
 | 
			
		||||
        target = self._getUid(args[0])
 | 
			
		||||
        target = self._get_UID(args[0])
 | 
			
		||||
        self.irc.users[target].realname = newgecos = args[1]
 | 
			
		||||
        return {'target': target, 'newgecos': newgecos}
 | 
			
		||||
 | 
			
		||||
    def handle_invite(self, numeric, command, args):
 | 
			
		||||
        """Handles incoming INVITEs."""
 | 
			
		||||
        # <- :GL INVITE PyLink-devel :#a
 | 
			
		||||
        target = self._getUid(args[0])
 | 
			
		||||
        target = self._get_UID(args[0])
 | 
			
		||||
        channel = self.irc.toLower(args[1])
 | 
			
		||||
        # We don't actually need to process this; it's just something plugins/hooks can use
 | 
			
		||||
        return {'target': target, 'channel': channel}
 | 
			
		||||
@ -947,7 +947,7 @@ class UnrealProtocol(TS6BaseProtocol):
 | 
			
		||||
        # <- :GL| KILL GLolol :hidden-1C620195!GL| (test)
 | 
			
		||||
        # Use ts6_common's handle_kill, but coerse UIDs to nicks first.
 | 
			
		||||
 | 
			
		||||
        new_args = [self._getUid(args[0])]
 | 
			
		||||
        new_args = [self._get_UID(args[0])]
 | 
			
		||||
        new_args.extend(args[1:])
 | 
			
		||||
 | 
			
		||||
        return super().handle_kill(numeric, command, new_args)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user