diff --git a/gajim/chat_control.py b/gajim/chat_control.py
index eea631fa1..20abe3dcd 100644
--- a/gajim/chat_control.py
+++ b/gajim/chat_control.py
@@ -225,6 +225,9 @@ class ChatControl(ChatControlBase):
app.ged.register_event_handler('pep-received', ged.GUI1,
self._nec_pep_received)
+ app.ged.register_event_handler('update-client-info', ged.GUI1,
+ self._on_update_client_info)
+
if self.TYPE_ID == message_control.TYPE_CHAT:
# Dont connect this when PrivateChatControl is used
app.ged.register_event_handler('update-roster-avatar', ged.GUI1,
@@ -435,6 +438,17 @@ class ChatControl(ChatControlBase):
else:
self.update_pep(obj.pep_type)
+ def _on_update_client_info(self, event):
+ if event.account != self.account:
+ return
+ if event.jid != self.contact.jid:
+ return
+ contact = app.contacts.get_contact(
+ self.account, event.jid, event.resource)
+ if contact is None:
+ return
+ self.xml.get_object('phone_image').set_visible(contact.uses_phone)
+
def _update_jingle(self, jingle_type):
if jingle_type not in ('audio', 'video'):
return
@@ -1063,6 +1077,9 @@ class ChatControl(ChatControlBase):
app.ged.remove_event_handler('pep-received', ged.GUI1,
self._nec_pep_received)
+ app.ged.remove_event_handler('update-client-info', ged.GUI1,
+ self._on_update_client_info)
+
if self.TYPE_ID == message_control.TYPE_CHAT:
app.ged.remove_event_handler('update-roster-avatar', ged.GUI1,
self._nec_update_avatar)
diff --git a/gajim/common/caps_cache.py b/gajim/common/caps_cache.py
index 6a6ea9a07..5220cbf59 100644
--- a/gajim/common/caps_cache.py
+++ b/gajim/common/caps_cache.py
@@ -77,6 +77,14 @@ def client_supports(client_caps, requested_feature):
return requested_feature not in FEATURE_BLACKLIST
return False
+def get_client_identity(client_caps):
+ lookup_item = client_caps.get_cache_lookup_strategy()
+ cache_item = lookup_item(capscache)
+
+ for identity in cache_item.identities:
+ if identity.get('category') == 'client':
+ return identity.get('type')
+
def create_suitable_client_caps(node, caps_hash, hash_method, fjid=None):
"""
Create and return a suitable ClientCaps object for the given node,
diff --git a/gajim/common/contacts.py b/gajim/common/contacts.py
index 63b2d3363..b574f6c0d 100644
--- a/gajim/common/contacts.py
+++ b/gajim/common/contacts.py
@@ -116,6 +116,10 @@ class CommonContact(XMPPEntity):
return False
return caps_cache.client_supports(self.client_caps, requested_feature)
+ @property
+ def uses_phone(self):
+ return caps_cache.get_client_identity(self.client_caps) == 'phone'
+
class Contact(CommonContact):
"""
diff --git a/gajim/common/modules/message.py b/gajim/common/modules/message.py
index cb6e5a9d9..888a9d894 100644
--- a/gajim/common/modules/message.py
+++ b/gajim/common/modules/message.py
@@ -207,6 +207,11 @@ class Message:
'gc_control': gc_control
}
+ app.nec.push_incoming_event(NetworkEvent('update-client-info',
+ account=self._account,
+ jid=jid,
+ resource=resource))
+
event = MessageReceivedEvent(None, **event_attr)
app.nec.push_incoming_event(event)
diff --git a/gajim/data/gui/chat_control.ui b/gajim/data/gui/chat_control.ui
index 65bedc2cd..47a2971ca 100644
--- a/gajim/data/gui/chat_control.ui
+++ b/gajim/data/gui/chat_control.ui
@@ -407,12 +407,13 @@
-
+
+
+ False
+ True
+ The last message was written on a mobile client
+ start
+ 4
+ phone-apple-iphone-symbolic
+
+
+ 0
+ 1
- True
+ False
True
1