def makeconfigs(): from tl.lib.config import makedefaultconfig fleet = getfleet() makedefaultconfig('irc', ddir) fleet.addnametype("default-irc", "irc") makedefaultconfig('sleek', ddir) fleet.addnametype("default-sleek", "sleek")
def do_opts(type="console", args=[], *argslist, **kwargs): from tl.version import getversion if not args: args = sys.argv if type != "console": print("TIMELINE %s" % getversion(type.upper())) cfg = None if type == "irc": target = api_opts + bot_opts + irc_opts elif type == "xmpp": target = api_opts + bot_opts + xmpp_opts elif type == "fleet": target = api_opts + fleet_opts elif type == "init": target = [] elif type == "console": target = bot_opts + console_opts else: target = [] opts = make_opts(args, target, *argslist, **kwargs) if type == "console": ll = "error" else: ll = "warn" if opts.datadir: setdatadir(opts.datadir) else: setdatadir(homedir + os.sep + ".tl") setloglevel(opts.loglevel or ll) if opts.bork: tl.utils.exception.bork = True ; logging.warn("bork mode enabled") if opts.nourl: tl.utils.url.enabled = False ; logging.warn("url fetching disabled") if opts.nocolors: tl.utils.log.docolor = False ; logging.warn("colors in logging is disabled") from tl.lib.users import getusers u = getusers() if opts.owner and u: u.make_owner(opts.owner) from tl.lib.config import getmainconfig maincfg = getmainconfig(opts.datadir) if type == "irc": cfg = makeircconfig(opts, opts.name) elif type == "xmpp" or type == "xmpp": cfg = makexmppconfig(opts, opts.name) elif type == "console": cfg = makeconsoleconfig(opts, opts.name) else: cfg = makedefaultconfig(opts, opts.name) if opts.anon: cfg.auto_register = True ; cfg.guestasuser = True else: cfg.auto_register = False if maincfg.dbtype: logging.warn("database type is %s" % maincfg.dbtype) return (opts, cfg)