Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
17ae6e75 by wurstsalat at 2022-06-12T14:24:36+02:00
fix: Chat banner: Show phone image if last message came from a phone
- - - - -
2 changed files:
- gajim/common/modules/contacts.py
- gajim/gtk/controls/chat.py
Changes:
=====================================
gajim/common/modules/contacts.py
=====================================
@@ -492,6 +492,17 @@ def identity_type(self) -> Optional[str]:
return None
+ @property
+ def is_phone(self):
+ disco_info = app.storage.cache.get_last_disco_info(self._jid)
+ if disco_info is None:
+ return False
+
+ for identity in disco_info.identities:
+ if identity.type == 'phone':
+ return True
+ return False
+
@property
def is_available(self) -> bool:
return self._presence.available
=====================================
gajim/gtk/controls/chat.py
=====================================
@@ -323,13 +323,6 @@ def _on_send_marker(self,
def _on_nickname_received(self, _event):
self.update_ui()
- def _on_update_client_info(self, event):
- # TODO: Test if this works
- contact = self._client.get_module('Contacts').get_contact(event.jid)
- if contact is None:
- return
- self.xml.phone_image.set_visible(contact.uses_phone)
-
def _on_chatstate_update(self,
_contact: types.BareContact,
_signal_name: str
@@ -382,6 +375,9 @@ def _on_message_received(self, event:
events.MessageReceived) -> None:
if event.properties.is_sent_carbon:
kind = 'outgoing'
+ resource_contact = self.contact.get_resource(event.resource)
+ self.xml.phone_image.set_visible(resource_contact.is_phone)
+
self.add_message(event.msgtxt,
kind,
tim=event.properties.timestamp,
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/17ae6e75b4fb7785377c31774d44922016163ece
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/17ae6e75b4fb7785377c31774d44922016163ece
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits