summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2019-09-29 17:41:26 +0200
committermathieui <mathieui@mathieui.net>2020-05-09 19:46:17 +0200
commit558f4fa8b33dee7cc678664ea939194cbb2bdb57 (patch)
treeb7c6547ab6edc37fd57f64846fb93cd639e4475e
parent076314fc21aa6cfb64412cedbcda1ab40c6adaae (diff)
downloadpoezio-558f4fa8b33dee7cc678664ea939194cbb2bdb57.tar.gz
poezio-558f4fa8b33dee7cc678664ea939194cbb2bdb57.tar.bz2
poezio-558f4fa8b33dee7cc678664ea939194cbb2bdb57.tar.xz
poezio-558f4fa8b33dee7cc678664ea939194cbb2bdb57.zip
Fix attention handler
-rw-r--r--poezio/core/handlers.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py
index a68b6986..2232f723 100644
--- a/poezio/core/handlers.py
+++ b/poezio/core/handlers.py
@@ -1484,17 +1484,16 @@ class HandlerCore:
"""
jid_from = message['from']
self.core.information('%s requests your attention!' % jid_from, 'Info')
- for tab in self.core.tabs:
- if tab.jid == jid_from:
- tab.state = 'attention'
- self.core.refresh_tab_win()
- return
- for tab in self.core.tabs:
- if tab.jid.bare == jid_from.bare:
- tab.state = 'attention'
- self.core.refresh_tab_win()
- return
- self.core.information('%s tab not found.' % jid_from, 'Error')
+ tab = (
+ self.core.tabs.by_name_and_class(
+ jid_from.full, tabs.ChatTab
+ ) or self.core.tabs.by_name_and_class(
+ jid_from.bare, tabs.ChatTab
+ )
+ )
+ if tab and tab is not self.core.tabs.current_tab:
+ tab.state = "attention"
+ self.core.refresh_tab_win()
def outgoing_stanza(self, stanza):
"""