How to use the deltachat.set_context_callback function in deltachat

To help you get started, we’ve selected a few deltachat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deltachat / deltachat-core / python / src / deltachat / account.py View on Github external
:param db_path: a path to the account database. The database
                        will be created if it doesn't exist.
        :param logid: an optional logging prefix that should be used with
                      the default internal logging.
        """
        self._dc_context = ffi.gc(
            lib.dc_context_new(lib.py_dc_callback, ffi.NULL, ffi.NULL),
            _destroy_dc_context,
        )
        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._evhandler = EventHandler(self._dc_context)
        self._evlogger = EventLogger(self._dc_context, logid)
        deltachat.set_context_callback(self._dc_context, self._process_event)
        self._threads = IOThreads(self._dc_context)
        self._configkeys = self.get_config("sys.config_keys").split()