[length_notifier] 1.4.7

Fixes #608
This commit is contained in:
wurstsalat
2022-11-05 16:06:32 +01:00
parent d99a6d33e4
commit 2fbc937b12
2 changed files with 14 additions and 10 deletions

View File

@@ -57,7 +57,7 @@ class LengthNotifierPlugin(GajimPlugin):
self.config_dialog = partial(LengthNotifierConfigDialog, self) self.config_dialog = partial(LengthNotifierConfigDialog, self)
self.gui_extension_points = { self.gui_extension_points = {
'message_actions_box': (self._connect, None), 'message_actions_box': (self._message_actions_box_created, None),
'switch_contact': (self._on_switch_contact, None) 'switch_contact': (self._on_switch_contact, None)
} }
@@ -85,6 +85,7 @@ class LengthNotifierPlugin(GajimPlugin):
def deactivate(self) -> None: def deactivate(self) -> None:
assert self._counter is not None assert self._counter is not None
self._counter.reset()
self._counter.destroy() self._counter.destroy()
del self._counter del self._counter
@@ -95,7 +96,7 @@ class LengthNotifierPlugin(GajimPlugin):
self.config) self.config)
self._actions_box_widget.pack_end(self._counter, False, False, 0) self._actions_box_widget.pack_end(self._counter, False, False, 0)
def _connect(self, def _message_actions_box_created(self,
message_actions_box: MessageActionsBox, message_actions_box: MessageActionsBox,
gtk_box: Gtk.Box gtk_box: Gtk.Box
) -> None: ) -> None:
@@ -105,9 +106,7 @@ class LengthNotifierPlugin(GajimPlugin):
self._create_counter() self._create_counter()
def _on_switch_contact(self, contact: types.ChatContactT) -> None: def _on_switch_contact(self, contact: types.ChatContactT) -> None:
if self._counter is None: assert self._counter is not None
return
self._contact = contact self._contact = contact
self._counter.update_contact(contact) self._counter.update_contact(contact)
@@ -211,7 +210,12 @@ class Counter(Gtk.Label):
return False return False
def _jid_allowed(self, current_jid: JID) -> bool: def _jid_allowed(self, current_jid: JID) -> bool:
jids = cast(str, self._config['JIDS']) jids = self._config['JIDS']
if isinstance(jids, list):
# Gajim 1.0 stored this as list[str]
jids = ','.join(jids)
assert isinstance(jids, str)
if not len(jids): if not len(jids):
# Not restricted to any JIDs # Not restricted to any JIDs
return True return True

View File

@@ -16,5 +16,5 @@
"gajim>=1.5.0" "gajim>=1.5.0"
], ],
"short_name": "length_notifier", "short_name": "length_notifier",
"version": "1.4.6" "version": "1.4.7"
} }