start some docs

This commit is contained in:
holger krekel
2020-02-26 15:10:57 +01:00
parent fb33c31378
commit 6213917089
8 changed files with 71 additions and 9 deletions

View File

@@ -78,6 +78,9 @@ def get_dc_event_name(integer, _DC_EVENTNAME_MAP={}):
def register_global_plugin(plugin):
""" Register a global plugin which implements one or more
of the :class:`deltachat.hookspec.Global` specs.
"""
gm = hookspec.Global._get_plugin_manager()
gm.register(plugin)
gm.check_pending()

View File

@@ -517,7 +517,9 @@ class Account(object):
#
def add_account_plugin(self, plugin):
""" add an account plugin whose hookimpls are called. """
""" add an account plugin which implements one or more of
the :class:`deltachat.hookspec.PerAccount` specs.
"""
self._pm.register(plugin)
self._pm.check_pending()
return plugin

View File

@@ -15,7 +15,7 @@ global_hookimpl = pluggy.HookimplMarker(_global_name)
class PerAccount:
""" per-Account-instance hook specifications.
Account hook implementations need to be registered with an Account instance.
If you write a plugin you need to implement one of the following hooks.
"""
@classmethod
def _make_plugin_manager(cls):
@@ -27,8 +27,8 @@ class PerAccount:
def process_ffi_event(self, ffi_event):
""" process a CFFI low level events for a given account.
ffi_event has "name", "data1", "data2" attributes according
to https://c.delta.chat/group__DC__EVENT.html
ffi_event has "name", "data1", "data2" values as specified
with `DC_EVENT_* <https://c.delta.chat/group__DC__EVENT.html>`_.
"""
@account_hookspec
@@ -47,6 +47,10 @@ class PerAccount:
def process_message_delivered(self, message):
""" Called when an outgoing message has been delivered to SMTP. """
@account_hookspec
def member_added(self, chat, contact):
""" Called for each contact added to a chat. """
class Global:
""" global hook specifications using a per-process singleton plugin manager instance.