mirror of
				https://github.com/jlu5/PyLink.git
				synced 2025-10-31 15:07:25 +01:00 
			
		
		
		
	protocols: update nick TS on nick change (#267)
This commit is contained in:
		
							parent
							
								
									ade0fa707e
								
							
						
					
					
						commit
						16b162ffbe
					
				| @ -5,6 +5,7 @@ nefarious.py: Nefarious IRCu protocol module for PyLink. | ||||
| import base64 | ||||
| import struct | ||||
| from ipaddress import ip_address | ||||
| import time | ||||
| 
 | ||||
| from pylinkirc import utils, structures | ||||
| from pylinkirc.classes import * | ||||
| @ -417,9 +418,12 @@ class P10Protocol(IRCS2SProtocol): | ||||
|         if not self.irc.isInternalClient(numeric): | ||||
|             raise LookupError('No such PyLink client exists.') | ||||
| 
 | ||||
|         self._send(numeric, 'NICK %s %s' % (newnick, int(time.time()))) | ||||
|         self._send(numeric, 'N %s %s' % (newnick, int(time.time()))) | ||||
|         self.irc.users[numeric].nick = newnick | ||||
| 
 | ||||
|         # Update the NICK TS. | ||||
|         self.irc.users[numeric].ts = int(time.time()) | ||||
| 
 | ||||
|     def numeric(self, source, numeric, target, text): | ||||
|         """Sends raw numerics from a server to a remote client. This is used for WHOIS | ||||
|         replies.""" | ||||
| @ -852,7 +856,11 @@ class P10Protocol(IRCS2SProtocol): | ||||
|             # <- ABAAA N GL_ 1460753763 | ||||
|             oldnick = self.irc.users[source].nick | ||||
|             newnick = self.irc.users[source].nick = args[0] | ||||
|             return {'newnick': newnick, 'oldnick': oldnick, 'ts': int(args[1])} | ||||
| 
 | ||||
|             self.irc.users[source].ts = ts = int(args[1]) | ||||
| 
 | ||||
|             # Update the nick TS. | ||||
|             return {'newnick': newnick, 'oldnick': oldnick, 'ts': ts} | ||||
| 
 | ||||
|     def checkCloakChange(self, uid): | ||||
|         """Checks for cloak changes (ident and host) on the given UID.""" | ||||
|  | ||||
| @ -3,6 +3,7 @@ ts6_common.py: Common base protocol class with functions shared by the UnrealIRC | ||||
| """ | ||||
| 
 | ||||
| import string | ||||
| import time | ||||
| 
 | ||||
| from pylinkirc import utils, structures | ||||
| from pylinkirc.classes import * | ||||
| @ -196,9 +197,14 @@ class TS6BaseProtocol(IRCS2SProtocol): | ||||
|         """Changes the nick of a PyLink client.""" | ||||
|         if not self.irc.isInternalClient(numeric): | ||||
|             raise LookupError('No such PyLink client exists.') | ||||
| 
 | ||||
|         self._send(numeric, 'NICK %s %s' % (newnick, int(time.time()))) | ||||
| 
 | ||||
|         self.irc.users[numeric].nick = newnick | ||||
| 
 | ||||
|         # Update the NICK TS. | ||||
|         self.irc.users[numeric].ts = int(time.time()) | ||||
| 
 | ||||
|     def part(self, client, channel, reason=None): | ||||
|         """Sends a part from a PyLink client.""" | ||||
|         channel = self.irc.toLower(channel) | ||||
| @ -376,7 +382,11 @@ class TS6BaseProtocol(IRCS2SProtocol): | ||||
|         # <- :70MAAAAAA NICK GL-devel 1434744242 | ||||
|         oldnick = self.irc.users[numeric].nick | ||||
|         newnick = self.irc.users[numeric].nick = args[0] | ||||
|         return {'newnick': newnick, 'oldnick': oldnick, 'ts': int(args[1])} | ||||
| 
 | ||||
|         # Update the nick TS. | ||||
|         self.irc.users[numeric].ts = ts = int(args[1]) | ||||
| 
 | ||||
|         return {'newnick': newnick, 'oldnick': oldnick, 'ts': ts} | ||||
| 
 | ||||
|     def handle_quit(self, numeric, command, args): | ||||
|         """Handles incoming QUIT commands.""" | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 James Lu
						James Lu