Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim-plugins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwurstsalat <mailtrash@posteo.de>2022-08-22 19:51:16 +0300
committerwurstsalat <mailtrash@posteo.de>2022-09-12 23:02:17 +0300
commita3ae4f19d91440edb36ff81e4e0977b1ab378982 (patch)
tree15e7e66a9a575b001a60c873b97e44ccbe10b3b7
parenta7cc8c6bfe200c5cf201d189e064cf1899af0bf2 (diff)
[triggers] 1.4.7changes-for-1.5
-rw-r--r--triggers/plugin-manifest.json4
-rw-r--r--triggers/triggers.py17
2 files changed, 8 insertions, 13 deletions
diff --git a/triggers/plugin-manifest.json b/triggers/plugin-manifest.json
index b2f96b7..0ee0175 100644
--- a/triggers/plugin-manifest.json
+++ b/triggers/plugin-manifest.json
@@ -12,8 +12,8 @@
"win32"
],
"requirements": [
- "gajim>=1.4.0"
+ "gajim>=1.5.0"
],
"short_name": "triggers",
- "version": "1.4.6"
+ "version": "1.4.7"
} \ No newline at end of file
diff --git a/triggers/triggers.py b/triggers/triggers.py
index 0ce8ccf..34b2305 100644
--- a/triggers/triggers.py
+++ b/triggers/triggers.py
@@ -31,7 +31,6 @@ from gajim.common.const import STOP_EVENT
from gajim.common.events import Notification
from gajim.common.events import GcMessageReceived
from gajim.common.events import MessageReceived
-from gajim.common.events import Notification
from gajim.common.helpers import exec_command
from gajim.common.helpers import play_sound_file
@@ -210,8 +209,8 @@ class Triggers(GajimPlugin):
@log_result
def _check_rule_status(self, event, rule: RuleT) -> bool:
rule_statuses = rule['status'].split()
- our_status = app.connections[event.account].status
- if rule['status'] != 'all' and our_status not in rule_statuses:
+ client = app.get_client(event.account)
+ if rule['status'] != 'all' and client.status not in rule_statuses:
return False
return True
@@ -221,7 +220,7 @@ class Triggers(GajimPlugin):
if rule['tab_opened'] == 'both':
return True
tab_opened = False
- if app.window.get_control(event.account, event.jid):
+ if app.window.chat_exists(event.account, event.jid):
tab_opened = True
if tab_opened and rule['tab_opened'] == 'no':
return False
@@ -237,14 +236,10 @@ class Triggers(GajimPlugin):
if rule['tab_opened'] == 'no':
# Does not apply in this case
return True
- ctrl = app.window.get_control(event.account, event.jid)
- if not ctrl:
- # Does not apply in this case
- return True
- has_focus = ctrl.has_focus()
- if has_focus and rule['has_focus'] == 'no':
+ chat_active = app.window.is_chat_active(event.account, event.jid)
+ if chat_active and rule['has_focus'] == 'no':
return False
- elif not has_focus and rule['has_focus'] == 'yes':
+ elif not chat_active and rule['has_focus'] == 'yes':
return False
return True