def handle_nickchg(event, message): if (message.source is None or message.source == ""): #new nick usermodes = virtualhost = cloakedhost = nickipaddr = None nick, hopcount, timestamp, username, hostname, server, servicestamp = message.parameters[ 0:7] if (ffservices.protoctl["NICKv2"]): usermodes, virtualhost = message.parameters[7:9] if (ffservices.protoctl["CLK"]): cloakedhost = message.parameters[9] if (ffservices.protoctl["NICKIP"]): nickipaddr = message.parameters[10] else: if (ffservices.protoctl["NICKIP"]): nickipaddr = message.parameters[9] realname = message.parameters[-1] c = Client(nick, hopcount, timestamp, username, hostname, server, servicestamp, usermodes, virtualhost, cloakedhost, nickipaddr, realname) log.info("Client connecting at %s: %s (%s@%s[%s])", c.server, c.nick, c.username, c.ip, c.hostname) if (not Client.addClient(c)): #if we can't add the client, that means that nick already exists. If the #nick already exists, it is a services pseudoclient -- so we kill the #non-services client c.kill("Nick Collision") else: #nick change who = message.source newnick, timestamp = message.parameters client = Client.findByNick(who) if (client is None): return if (client.changeNick(newnick, timestamp)): return #nick collision client.kill("Nick Collision")
def run(plugin_list: bool, plugins: str): """ Version 3.0 work in progress """ config = Config() if plugin_list: pluginManager = PluginManager() pluginManager.print_plugins_list() exit(0) if plugins is not None: plugins = PluginManager(plugins) print("Loaded : {0} plugins".format(plugins.plugin_loaded())) # todo load data dataDriver file.json or mongo # check if app running in docker environment and run server or client code if config.docker_mode: if os.environ.get("IS_SERVER"): # run server mode server = Server() else: # run client mode client = Client() exit(0) print("No arg detected :/") print("Please run 'python3 Toudoum.py run --help'")
def client(): return Client()