summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorLasse Aagren <laa@one.com>2016-05-22 08:32:45 +0200
committerLasse Aagren <laa@one.com>2016-05-22 08:32:45 +0200
commit51025b8d7841deebb6c7873208b79f5fba5a4d9c (patch)
treef908c96fb42e77e14aa5632426c569a464fbe2c0 /plugins
parent38399f2cae9ffad42c4f2756802bbceaa60d0e92 (diff)
downloadpoezio-51025b8d7841deebb6c7873208b79f5fba5a4d9c.tar.gz
poezio-51025b8d7841deebb6c7873208b79f5fba5a4d9c.tar.bz2
poezio-51025b8d7841deebb6c7873208b79f5fba5a4d9c.tar.xz
poezio-51025b8d7841deebb6c7873208b79f5fba5a4d9c.zip
add optional muc_list to configuration of simple_notify, as a whitelist of MUCs you want to be notified from.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/simple_notify.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/simple_notify.py b/plugins/simple_notify.py
index 461f1faf..00355fcd 100644
--- a/plugins/simple_notify.py
+++ b/plugins/simple_notify.py
@@ -50,10 +50,15 @@ Third example:
[simple_notify]
command = notify-send -i /path/to/poezio/data/poezio_80.png "New message from %(from)s" "%(body)s"
muc_too = true
+ muc_list = someroom@conference.jabber.org,someotherroom@conference.jabber.org
If present and set to ``True``, the ``muc_too`` option will also trigger a
notification when a new message arrives on a Multi User Chat you've joined.
+If present and set to a comma separated list of muc JIDs, muc_list together
+with muc_too = true will only notify when a new message arrives on a Multi
+User Chat, you've joined if it is present on the list.
+
.. note:: If you set the :term:`exec_remote` option to ``true`` into the
main configuration file, the command will be executed remotely
(as explained in the :ref:`link-plugin` plugin help).
@@ -107,12 +112,17 @@ class Plugin(BasePlugin):
self.do_notify(message, fro)
def on_muc_msg(self, message, tab):
- fro = message['from'].bare
+ fro = message['from'].full
+ muc = message['from'].bare
+ whitelist=self.config.get('muc_list', '').split(',')
+
# Prevent old messages to be notified
# find_delayed_tag(message) returns (True, the datetime) or
# (False, None)
if not common.find_delayed_tag(message)[0]:
- self.do_notify(message, fro)
+ # Only notify if whitelist is empty or muc in whitelist
+ if whitelist == [''] or muc in whitelist:
+ self.do_notify(message, fro)
def do_notify(self, message, fro):
body = get_body_from_message_stanza(message, use_xhtml=False)