diff options
author | mathieui <mathieui@mathieui.net> | 2016-06-05 13:48:04 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2016-06-05 13:48:04 +0200 |
commit | 0a2238def5c01f56ce5fb9b451071ab9f8121c88 (patch) | |
tree | 2939aaf5694e657671a7a4605de3995c4ed4d744 /plugins | |
parent | c00cfecdf86175446fe89480184fdf419b9c1c2a (diff) | |
download | poezio-0a2238def5c01f56ce5fb9b451071ab9f8121c88.tar.gz poezio-0a2238def5c01f56ce5fb9b451071ab9f8121c88.tar.bz2 poezio-0a2238def5c01f56ce5fb9b451071ab9f8121c88.tar.xz poezio-0a2238def5c01f56ce5fb9b451071ab9f8121c88.zip |
Add a manual CSI plugin
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/csi.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/plugins/csi.py b/plugins/csi.py new file mode 100644 index 00000000..5fe41666 --- /dev/null +++ b/plugins/csi.py @@ -0,0 +1,45 @@ +""" +This plugin lets you set the CSI_ state manually, when the autoaway plugin +is not sufficient for your usage. + +Commands +-------- + +.. glossary:: + + /csi_active + **Usage:** ``/csi_active`` + + Set CSI state to ``active``. + + /csi_inactive + **Usage:** ``/csi_inactive`` + + Set CSI state to ``inactive``. + +.. _CSI: https://xmpp.org/extensions/xep-0352.html +""" + +from plugin import BasePlugin +import tabs + +class Plugin(BasePlugin): + def init(self): + self.api.add_command('csi_active', self.command_active, + help='Set the client state indication to “active”', + short='Manual set active') + self.api.add_command('csi_inactive', self.command_inactive, + help='Set the client state indication to “inactive”', + short='Manual set inactive') + + def command_active(self, args): + if not self.core.xmpp.plugin['xep_0352'].enabled: + self.api.information('CSI is not enabled in this server', 'Warning') + else: + self.core.xmpp.plugin['xep_0352'].send_active() + + def command_inactive(self, args): + if not self.core.xmpp.plugin['xep_0352'].enabled: + self.api.information('CSI is not enabled in this server', 'Warning') + else: + self.core.xmpp.plugin['xep_0352'].send_inactive() |