Implementing Plugin Hooks¶
The Delta Chat Python bindings use pluggy for managing global and per-account plugin registration, and performing hook calls. There are two kinds of plugins:
Global plugins that are active for all accounts; they can implement hooks at account-creation and account-shutdown time.
Account plugins that are only active during the lifetime of a single Account instance.
Registering a plugin¶
Register a global plugin which implements one or more of the
add an account plugin which implements one or more of the
Per-Account Hook specifications¶
per-Account-instance hook specifications.
All hooks are executed in a dedicated Event thread. Hooks are not allowed to block/last long as this blocks overall event processing on the python side.
process a CFFI low level events for a given account.
ffi_event has “name”, “data1”, “data2” values as specified with DC_EVENT_*.
DANGER: this hook is executed from the callback invoked by core. Hook implementations need to be short running and can typically not call back into core because this would easily cause recursion issues.
log a message related to the account.
Called when a configure process completed.
Called on any incoming message (to deaddrop or chat).
Called on each outgoing message (both system and “normal”).
Called when an outgoing message has been delivered to SMTP.
Chat was created or modified regarding membership, avatar, title.
ac_member_added(chat, contact, message)¶
Called for each contact added to an accepted chat.
ac_member_removed(chat, contact, message)¶
Called for each contact removed from a chat.