mirror of
https://github.com/ArcaneChat/core.git
synced 2026-07-03 14:05:33 +02:00
cf6391d51b
some api cleanups
30 lines
896 B
Python
30 lines
896 B
Python
""" Hooks for Python bindings to Delta Chat Core Rust CFFI"""
|
|
|
|
import pluggy
|
|
|
|
__all__ = ["account_hookspec", "account_hookimpl", "AccountHookSpecs"]
|
|
|
|
_account_name = "deltachat-account"
|
|
account_hookspec = pluggy.HookspecMarker(_account_name)
|
|
account_hookimpl = pluggy.HookimplMarker(_account_name)
|
|
|
|
|
|
class AccountHookSpecs:
|
|
""" per-Account-instance hook specifications.
|
|
|
|
Account hook implementations need to be registered with an Account instance.
|
|
"""
|
|
@classmethod
|
|
def _make_plugin_manager(cls):
|
|
pm = pluggy.PluginManager(_account_name)
|
|
pm.add_hookspecs(cls)
|
|
return pm
|
|
|
|
@account_hookspec
|
|
def process_low_level_event(self, event_name, data1, data2):
|
|
""" process a CFFI low level events for a given account. """
|
|
|
|
@account_hookspec
|
|
def configure_completed(self, success):
|
|
""" Called when a configure process completed. """
|