summaryrefslogtreecommitdiff
path: root/poezio/poezio.py
diff options
context:
space:
mode:
Diffstat (limited to 'poezio/poezio.py')
-rw-r--r--poezio/poezio.py31
1 files changed, 11 insertions, 20 deletions
diff --git a/poezio/poezio.py b/poezio/poezio.py
index e38871c6..b149abd4 100644
--- a/poezio/poezio.py
+++ b/poezio/poezio.py
@@ -3,7 +3,7 @@
# This file is part of Poezio.
#
# Poezio is free software: you can redistribute it and/or modify
-# it under the terms of the zlib license. See the COPYING file.
+# it under the terms of the GPL-3.0+ license. See the COPYING file.
"""
Starting point of poezio. Launches both the Connection and Gui
"""
@@ -79,57 +79,48 @@ def main():
sys.stdout.write("\x1b]0;poezio\x07")
sys.stdout.flush()
+ from poezio.args import run_cmdline_args
+ options, firstrun = run_cmdline_args()
from poezio import config
- config.run_cmdline_args()
- config.create_global_config()
- config.setup_logging()
- config.post_logging_setup()
+ config.create_global_config(options.filename)
+ config.setup_logging(options.debug)
import logging
logging.raiseExceptions = False
- from poezio.config import options
-
if options.check_config:
config.check_config()
sys.exit(0)
- from poezio.asyncio import monkey_patch_asyncio_slixmpp
+ from poezio.asyncio_fix import monkey_patch_asyncio_slixmpp
monkey_patch_asyncio_slixmpp()
from poezio import theming
theming.update_themes_dir()
- from poezio import logger
- logger.create_logger()
+ from poezio.logger import logger
+ logger.log_dir = config.LOG_DIR
from poezio import roster
- roster.create_roster()
+ roster.roster.reset()
from poezio.core.core import Core
signal.signal(signal.SIGINT, signal.SIG_IGN) # ignore ctrl-c
- cocore = Core()
+ cocore = Core(options.custom_version, firstrun)
signal.signal(signal.SIGUSR1, cocore.sigusr_handler) # reload the config
signal.signal(signal.SIGHUP, cocore.exit_from_signal)
signal.signal(signal.SIGTERM, cocore.exit_from_signal)
- if options.debug:
- cocore.debug = True
cocore.start()
from slixmpp.exceptions import IqError, IqTimeout
- def swallow_iqerrors(loop, context):
- """Do not log unhandled iq errors and timeouts"""
- if not isinstance(context['exception'], (IqError, IqTimeout)):
- loop.default_exception_handler(context)
-
# Warning: asyncio must always be imported after the config. Otherwise
# the asyncio logger will not follow our configuration and won't write
# the tracebacks in the correct file, etc
import asyncio
loop = asyncio.get_event_loop()
- loop.set_exception_handler(swallow_iqerrors)
+ loop.set_exception_handler(cocore.loop_exception_handler)
loop.add_reader(sys.stdin, cocore.on_input_readable)
loop.add_signal_handler(signal.SIGWINCH, cocore.sigwinch_handler)