Plugins architecture
SàT use a plugin architecture on the backend side, which allow to easily extends the functionality, with XMPP extensions or things which have nothing to do with XMPP.
Plugin file
A plugin file must be named plugin_XXX.py and be placed in src/plugins directory. They will be automatically loaded by the backend.
The plugins related to XEP should be named plugin_xep_xxxx.py, with xxxx being the XEP number, but this is not mandatory.
Experimental plugins should be named plugin_exp_xxx.py
General purpose plugins should be named plugin_misc_xxx.py
plugin info
A plugin has a header in the following form (here is the plugin_xep_0115.py example):
PLUGIN_INFO = {
"name": "XEP 0115 Plugin",
"import_name": "XEP-0115",
"type": "XEP",
"protocols": ["XEP-0115"],
"dependencies": [],
"main": "XEP_0115",
"handler": "yes",
"description": _("""Implementation of entity capabilities""")
}
- name is the human readable name of the plugin
- import_name is a short name used to reference it from other plugins
- type can be currently on of XEP, Misc, Game, EXP for respectively XMPP Extension, Miscelanous, Game, Experimental
- protocoles list the protocols managed by this plugin
- dependencies list the others plugins needed to use this one
- main is the name of the main class to instanciate
- handler: if yes, a handler will be created on profile connection, the plugin need to had a getHandler(self, profile) method.
- description: human readable full description of the plugin
The plugin can also have a profileConnected(self, profile) method: if present, it will be called on profile connection, which can be usefull to initiate some profile-specific things. Similarly profileDisconnected(self, profile) can be used to free profile-specific resources.