sipmlify plugins and tests and remove superflous core event

This commit is contained in:
holger krekel
2020-03-06 12:09:23 +01:00
parent 724e1ea97e
commit a1d5120e58
6 changed files with 53 additions and 55 deletions

View File

@@ -1,8 +1,9 @@
import sys
from . import capi, const, hookspec
from .capi import ffi
from .account import Account # noqa
from . import eventlogger
from .util import lazydecorator
from pkg_resources import get_distribution, DistributionNotFound
try:
@@ -111,10 +112,10 @@ def run_cmdline(argv=None, account_plugins=None):
args = parser.parse_args(argv[1:])
assert args.db, "you must specify --db"
ac = deltachat.Account(args.db)
ac = Account(args.db)
if args.show_ffi:
log = deltachat.eventlogger.FFIEventLogger(ac, "echo")
log = eventlogger.FFIEventLogger(ac, "echo")
ac.add_account_plugin(log)
if not ac.is_configured():
@@ -126,7 +127,8 @@ def run_cmdline(argv=None, account_plugins=None):
ac.set_config("mvbox_watch", "0")
ac.set_config("sentbox_watch", "0")
ac.add_account_plugin(SimpleEchoPlugin())
for plugin in account_plugins or []:
ac.add_account_plugin(plugin)
# start IO threads and configure if neccessary
ac.start()

View File

@@ -54,11 +54,11 @@ class Account(object):
self._shutdown_event = Event()
# open database
self.db_path = db_path
if hasattr(db_path, "encode"):
db_path = db_path.encode("utf8")
if not lib.dc_open(self._dc_context, db_path, ffi.NULL):
raise ValueError("Could not dc_open: {}".format(db_path))
self.db_path = db_path
self._configkeys = self.get_config("sys.config_keys").split()
atexit.register(self.shutdown)