status = empathy_presence_get_default_message (priv->presence_type);
}
- if (!priv->is_group && priv->types != NULL && g_strv_length (priv->types) > 0
- && !tp_strdiff (priv->types[0], "phone")) {
+ if (!priv->is_group &&
+ empathy_client_types_contains_mobile_device (priv->types)) {
on_a_phone = TRUE;
/* We want the phone black. */
if (attr_color)
types = tp_contact_get_client_types (priv->contact);
- if (types != NULL
- && g_strv_length ((gchar **) types) > 0
- && !tp_strdiff (types[0], "phone"))
+ if (empathy_client_types_contains_mobile_device ((GStrv) types))
{
gtk_widget_show (priv->hbox_client_types);
}
update_alias (self);
}
-static gboolean
-is_phone (FolksIndividual *individual)
-{
- const gchar * const *types;
-
- types = empathy_individual_get_client_types (individual);
- if (types == NULL)
- return FALSE;
-
- if (g_strv_length ((GStrv) types) <= 0)
- return FALSE;
-
- return !tp_strdiff (types[0], "phone");
-}
-
static void
update_presence_msg (EmpathyRosterContact *self)
{
const gchar *msg;
+ GStrv types;
msg = folks_presence_details_get_presence_message (
FOLKS_PRESENCE_DETAILS (self->priv->individual));
gtk_widget_show (self->priv->presence_msg);
}
+ types = (GStrv) empathy_individual_get_client_types (self->priv->individual);
+
gtk_widget_set_visible (self->priv->phone_icon,
- is_phone (self->priv->individual));
+ empathy_client_types_contains_mobile_device (types));
}
static void
*can_video_call = can_video;
}
+gboolean
+empathy_client_types_contains_mobile_device (const GStrv types) {
+ int i;
+
+ if (types == NULL)
+ return FALSE;
+
+ for (i = 0; types[i] != NULL; i++)
+ if (!tp_strdiff (types[i], "phone") || !tp_strdiff (types[i], "handheld"))
+ return TRUE;
+
+ return FALSE;
+}
+
static FolksIndividual *
create_individual_from_persona (FolksPersona *persona)
{
gboolean *can_video_call,
EmpathyContact **out_contact);
+gboolean empathy_client_types_contains_mobile_device (
+ const GStrv types);
+
FolksIndividual * empathy_create_individual_from_tp_contact (
TpContact *contact);
const gchar * const *types;
types = empathy_contact_get_client_types (remote_contact);
- if (types != NULL && !tp_strdiff (types[0], "phone"))
+ if (empathy_client_types_contains_mobile_device ((GStrv) types))
{
- /* I'm on a phone ! */
+ /* I'm on a mobile device ! */
gchar *tmp = name;
name = g_strdup_printf ("☎ %s", name);