Beispiel #1
0
	def wrapped_fn(message, user, zone, name, *args):

		zone_original = zone
		zone = zone.strip('"')
		if zone not in get_zones():
			tell(user, "Zone does not exist.")
			print zone
			return
		zone = get_zones()[zone]
		if 'acls' not in zone:
			tell(user, "Sorry, that zone does not appear to support ACLs.\n"
			           "You may need to contact an op to resolve this.")
			return

		if name != 'EVERYONE':
			name = name.lower()
			if name not in all_users() and name not in zone['acls']:
				tell(user, "Warning: %s is not a player known to this server.\n"
				           "If you have made a mistake, type:\n/acls %s clear %s" % (zone_original, name))

		if ADMIN not in zone['acls'].get(user.username, zone['acls']['EVERYONE']) and user.username not in ops():
			tell(user, "You do not have permission to modify ACLs for this zone. "
			           "If you have accidentially locked yourself out, please contact an op for assistance.")
			return

		return fn(message, user, zone, name, *args)
Beispiel #2
0
def on_packet(packet, user_obj, to_server):
	if packet.name() == 'Chat message' and not to_server:
		prefs = users.get(user_obj.username, defaults)
		offlines = dict([(user, prefs['inactive']) for user in all_users()])
		onlines = dict([(user, prefs['active']) for user in active_users()])
		ops_dict = dict([(user, prefs['ops']) for user in ops()])
		player = {user_obj.username: prefs['me']}
		names = {}
		names.update(offlines)
		names.update(onlines)
		names.update(ops_dict)
		names.update(player)
		packet.data['text'] = prefs['all'] + packet.data['text']
		for name in names:
			packet.data['text'] = packet.data['text'].replace(name, names[name] + name + prefs['all'])
	return packet
Beispiel #3
0
def on_packet(packet, user_obj, to_server):
	if packet.name() == 'Chat message' and not to_server:
		prefs = users.get(user_obj.username, defaults)
		offlines = dict([(user, prefs['inactive']) for user in all_users()])
		onlines = dict([(user, prefs['active']) for user in active_users()])
		ops_dict = dict([(user, prefs['ops']) for user in ops()])
		player = {user_obj.username: prefs['me']}
		names = {}
		names.update(offlines)
		names.update(onlines)
		names.update(ops_dict)
		names.update(player)
		s = prefs['all'] + packet.data['text']
		for name in names:
			i = 0
			while i < len(s):
				if s[i:i+len(name)].lower() == name:
					s = s[:i] + names[name] + s[i:i+len(name)] + prefs['all'] + s[i+len(name):]
					i += len(name)
				else:
					i += 1
		if len(s) <= MAX_CHAT_LENGTH: # Do nort replace if overlength
			packet.data['text'] = s
	return packet