Example #1
0
def onInsertBan(cn, args):
	'''@description Intert ban for ip address
	   @usage <ip> <seconds> (reason)'''
	p = player(cn)
	args = args.split(' ')
	if len(args) < 2:
		raise UsageError('ip length (reason)')
	else:
		ip = ipStringToLong(args[0])
		length = int(args[1])
		try:
			reason = args[2]
		except IndexError:
		 	reason = 'Unspecified reason'
		expiration = time.time() + length
		newban = Ban(ip, expiration, reason, 'Unnamed', 0, 'Unnamed', time.time())
		session.add(newban)
		session.commit()
		p.message(info('Inserted ban for %s for %i seconds for %s.' % (ipLongToString(ip), length, reason)))
Example #2
0
File: bans.py Project: pguenth/xsbs
def onInsertBan(cn, args):
    '''@description Intert ban for ip address
	   @usage <ip> <seconds> (reason)'''
    p = player(cn)
    args = args.split(' ')
    if len(args) < 2:
        raise UsageError('ip length (reason)')
    else:
        ip = ipStringToLong(args[0])
        length = int(args[1])
        try:
            reason = args[2]
        except IndexError:
            reason = 'Unspecified reason'
        expiration = time.time() + length
        newban = Ban(ip, expiration, reason, 'Unnamed', 0, 'Unnamed',
                     time.time())
        session.add(newban)
        session.commit()
        p.message(
            info('Inserted ban for %s for %i seconds for %s.' %
                 (ipLongToString(ip), length, reason)))
Example #3
0
def playerByIpString(ip):
	'''Return Player instance with matching string ip'''
	return playerByIpLong(ipStringToLong(ip))
Example #4
0
def playerByIpString(ip):
    '''Return Player instance with matching string ip'''
    return playerByIpLong(ipStringToLong(ip))