Ejemplo n.º 1
0
def ban(cn, seconds, reason, banner_cn):
	ip = sauerbomber.playerIpLong(cn)
	expiration = time.time() + seconds
	nick = sauerbomber.playerName(cn)
	if banner_cn != -1:
		banner_ip = sauerbomber.playerIpLong(banner_cn)
		banner_nick = sauerbomber.playerName(banner_cn)
	else:
		banner_ip = 0
		banner_nick = ''
	newban = Ban(ip, expiration, reason, nick, banner_ip, banner_nick, time.time())
	session.add(newban)
	session.commit()
	addTimer(200, sauerbomber.playerKick, (cn,))
	logging.info('Player %s (%s) banned for %s by %s (%s)',
		nick,
		ipLongToString(ip),
		reason,
		banner_nick,
		ipLongToString(banner_ip))
	sauerbomber.message(info(ban_message.substitute(colordict, name=nick, seconds=seconds, reason=reason)))
Ejemplo n.º 2
0
 def ipLong(self):
     """Ip of client as long"""
     return sauerbomber.playerIpLong(self.cn)