Banned/Restricted people can't use the IRC gateway. Silenced people can't send messages on it.
This commit is contained in:
		@@ -310,6 +310,12 @@ class Client:
 | 
				
			|||||||
				self.reply("464 :Password incorrect")
 | 
									self.reply("464 :Password incorrect")
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								# Make sure that the user is not banned/restricted:
 | 
				
			||||||
 | 
								privileges = glob.db.fetch("SELECT privileges FROM users WHERE username = %s LIMIT 1", [self.supposedUsername]
 | 
				
			||||||
 | 
								if privileges & 3 != 3:
 | 
				
			||||||
 | 
									self.reply("465 :You're banned")
 | 
				
			||||||
 | 
									return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			# Make sure we are not connected to Bancho
 | 
								# Make sure we are not connected to Bancho
 | 
				
			||||||
			token = glob.tokens.getTokenFromUsername(chat.fixUsernameForBancho(nick), True)
 | 
								token = glob.tokens.getTokenFromUsername(chat.fixUsernameForBancho(nick), True)
 | 
				
			||||||
			if token is not None:
 | 
								if token is not None:
 | 
				
			||||||
@@ -466,6 +472,13 @@ class Client:
 | 
				
			|||||||
		recipientIRC = arguments[0]
 | 
							recipientIRC = arguments[0]
 | 
				
			||||||
		message = arguments[1]
 | 
							message = arguments[1]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							# Check if the user is silenced
 | 
				
			||||||
 | 
							# TODO: Maybe don't run a sql query every time
 | 
				
			||||||
 | 
							silence_end = glob.db.fetch("SELECT silence_end FROM users WHERE username = %s LIMIT 1", [self.supposedUsername])
 | 
				
			||||||
 | 
							if silence_end - int(time.time()) > 0:
 | 
				
			||||||
 | 
								self.reply("404 : You can't send messages.")
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# Send the message to bancho and reply
 | 
							# Send the message to bancho and reply
 | 
				
			||||||
		if not recipientIRC.startswith("#"):
 | 
							if not recipientIRC.startswith("#"):
 | 
				
			||||||
			recipientBancho = chat.fixUsernameForBancho(recipientIRC)
 | 
								recipientBancho = chat.fixUsernameForBancho(recipientIRC)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user