Beispiel #1
0
def init(plugin,root_config):
	global config;
	global lconfig;
	
	config = root_config;

	lconfig = register_plugin(plugin, config, plugin_name, plugin_description, plugin_version);
	
	if not "reg_users" in lconfig:
		lconfig["reg_users"] = {}
	if not "users" in lconfig:
		lconfig["users"] = {}
	if not "commands" in lconfig:
		lconfig["commands"] = {}
	if not "on_welcome_send" in lconfig:
		lconfig["on_welcome_send"] = {}
	
	set_level("reload_plugins",5);
	set_level("reload_config", 5);
	set_level("browse_config", 5);
	set_level("set_config", 5);
	set_level("help", 0);
	set_level("disconnect", 5);
	set_level("quit", 5);
	set_level("login", 0);
	set_level("join", 3);
	set_level("leave", 3);
	set_level("quote", 5);
	
	register_command(config, plugin, "reload_plugins", cmd_reload_plugins, "Reload all plugins");
	register_command(config, plugin, "reload_config", cmd_reload_config, "Reload config");
	register_command(config, plugin, "browse_config", cmd_browse_config, "Browse config");
	register_command(config, plugin, "set_config", cmd_set_config, "Set config options");
	register_command(config, plugin, "help", cmd_help, "Print help");
	register_command(config, plugin, "disconnect", cmd_disconnect, "Disconnect from server");
	register_command(config, plugin, "quit", cmd_quit, "Shutdown");
	register_command(config, plugin, "login", cmd_login, "login <user> <pw>");
	register_command(config, plugin, "join", cmd_join, "join <channel> [<pw>]");
	register_command(config, plugin, "leave", cmd_leave, "leave <channel>");
	register_command(config, plugin, "quote", cmd_quote, "Send raw commands");
	register_callback(config, plugin, "part", "login", on_part);
	register_callback(config, plugin, "quit", "login", on_quit);
	register_callback(config, plugin, "nick", "login", on_nick);
	register_callback(config, plugin, "welcome", "login", on_welcome);
	register_callback(config, plugin, "auth", "login", is_allowed);
Beispiel #2
0
def init(plugin,root_config):
	global config;
	global lconfig;
	global bot;
	global dl;
	
	config = root_config;
	
	bot = config["main"]["bot_handle"];

	lconfig = register_plugin(plugin, config, plugin_name, plugin_description, plugin_version);
	
	if (not "ldap" in lconfig):
		lconfig["ldap"] = {};
	if not "server" in lconfig["ldap"]:
		lconfig["ldap"]["server"] = "ldap://localhost"
	if not "login" in lconfig["ldap"]:
		lconfig["ldap"]["login"] = ""
	if not "password" in lconfig["ldap"]:
		lconfig["ldap"]["password"] = ""
	
	if (not "auth" in lconfig):
		lconfig["auth"] = {};
	if not "people_base" in lconfig["auth"]:
		lconfig["auth"]["people_base"] = ""
	if not "group_base" in lconfig["auth"]:
		lconfig["auth"]["group_base"] = ""
	
	if (not "diff" in lconfig):
		lconfig["diff"] = {};
	
	register_callback(config, plugin, "join", "ldapplugin", on_join);
	register_callback(config, plugin, "channels", "ldapplugin", on_channels);
	#register_command(config, plugin, "auth_channel", cmd_auth_channel, 5, "try to authenticate all users in #channel");
	#register_callback(config, plugin, "join", "hadinet", on_join);
	
	if "interval" in lconfig["diff"]:
		dl = DiffLoop(int(lconfig["diff"]["interval"]));
	else:
		dl = DiffLoop();
	dl.start();