# HG changeset patch # User Goffi # Date 1526062089 -7200 # Node ID a826c70beda2f12dd3e83508c26b7b1090219f0f # Parent ab3f5173ef5c15d875ed2bbf0b7f7dc2b501b371 chat: avoid multiple notifications when there are several cloned chats (i.e. with same target) diff -r ab3f5173ef5c -r a826c70beda2 cagou/plugins/plugin_wid_chat.py --- a/cagou/plugins/plugin_wid_chat.py Fri May 11 20:07:17 2018 +0200 +++ b/cagou/plugins/plugin_wid_chat.py Fri May 11 20:08:09 2018 +0200 @@ -369,8 +369,13 @@ For group chat, note will be added on mention, with a desktop notification if window has not focus. """ + visible_clones = [w for w in G.host.getVisibleList(self.__class__) if w.target == self.target] + if len(visible_clones) > 1 and visible_clones.index(self) > 0: + # to avoid multiple notifications in case of multiple cloned widgets + # we only handle first clone + return + is_visible = bool(visible_clones) if self.type == C.CHAT_ONE2ONE: - is_visible = self.target in [w.target for w in G.host.getVisibleList(self.__class__)] if (not Window.focus or not is_visible) and not mess_data.history: notif_msg = self._get_notif_msg(mess_data) G.host.desktop_notif(