@@ -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,19 +96,17 @@ 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:
|
||||||
|
|
||||||
self._message_action_box = message_actions_box
|
self._message_action_box = message_actions_box
|
||||||
self._actions_box_widget = gtk_box
|
self._actions_box_widget = gtk_box
|
||||||
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
|
||||||
|
|||||||
@@ -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"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user