Codebase list empathy / 55ce28e
Recognize both handheld and phone clienttypes as mobile devices Empathy currently displays a phone icon for clients which indicate that they're phones. However some mobile clients use the "handheld" client type instead (e.g. Xabber on android devices). While changing things around, i've also refactored the code a bit to ensure that the determination will stay consistent in the various location if it's changed in future. Sjoerd Simons 11 years ago
6 changed file(s) with 26 addition(s) and 23 deletion(s). Raw diff Collapse all Expand all
11211121 *can_video_call = can_video;
11221122 }
11231123
1124 gboolean
1125 empathy_client_types_contains_mobile_device (const GStrv types) {
1126 int i;
1127
1128 if (types == NULL)
1129 return FALSE;
1130
1131 for (i = 0; types[i] != NULL; i++)
1132 if (!tp_strdiff (types[i], "phone") || !tp_strdiff (types[i], "handheld"))
1133 return TRUE;
1134
1135 return FALSE;
1136 }
1137
11241138 static FolksIndividual *
11251139 create_individual_from_persona (FolksPersona *persona)
11261140 {
114114 gboolean *can_video_call,
115115 EmpathyContact **out_contact);
116116
117 gboolean empathy_client_types_contains_mobile_device (
118 const GStrv types);
119
117120 FolksIndividual * empathy_create_individual_from_tp_contact (
118121 TpContact *contact);
119122
363363 status = empathy_presence_get_default_message (priv->presence_type);
364364 }
365365
366 if (!priv->is_group && priv->types != NULL && g_strv_length (priv->types) > 0
367 && !tp_strdiff (priv->types[0], "phone")) {
366 if (!priv->is_group &&
367 empathy_client_types_contains_mobile_device (priv->types)) {
368368 on_a_phone = TRUE;
369369 /* We want the phone black. */
370370 if (attr_color)
807807
808808 types = tp_contact_get_client_types (priv->contact);
809809
810 if (types != NULL
811 && g_strv_length ((gchar **) types) > 0
812 && !tp_strdiff (types[0], "phone"))
810 if (empathy_client_types_contains_mobile_device ((GStrv) types))
813811 {
814812 gtk_widget_show (priv->hbox_client_types);
815813 }
172172 update_alias (self);
173173 }
174174
175 static gboolean
176 is_phone (FolksIndividual *individual)
177 {
178 const gchar * const *types;
179
180 types = empathy_individual_get_client_types (individual);
181 if (types == NULL)
182 return FALSE;
183
184 if (g_strv_length ((GStrv) types) <= 0)
185 return FALSE;
186
187 return !tp_strdiff (types[0], "phone");
188 }
189
190175 static void
191176 update_presence_msg (EmpathyRosterContact *self)
192177 {
193178 const gchar *msg;
179 GStrv types;
194180
195181 msg = folks_presence_details_get_presence_message (
196182 FOLKS_PRESENCE_DETAILS (self->priv->individual));
232218 gtk_widget_show (self->priv->presence_msg);
233219 }
234220
221 types = (GStrv) empathy_individual_get_client_types (self->priv->individual);
222
235223 gtk_widget_set_visible (self->priv->phone_icon,
236 is_phone (self->priv->individual));
224 empathy_client_types_contains_mobile_device (types));
237225 }
238226
239227 static void
985985 const gchar * const *types;
986986
987987 types = empathy_contact_get_client_types (remote_contact);
988 if (types != NULL && !tp_strdiff (types[0], "phone"))
988 if (empathy_client_types_contains_mobile_device ((GStrv) types))
989989 {
990 /* I'm on a phone ! */
990 /* I'm on a mobile device ! */
991991 gchar *tmp = name;
992992
993993 name = g_strdup_printf ("☎ %s", name);