diff options
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-chatroom.c | 4 | ||||
-rw-r--r-- | libempathy/empathy-contact-manager.c | 6 | ||||
-rw-r--r-- | libempathy/empathy-idle.c | 6 | ||||
-rw-r--r-- | libempathy/empathy-status-presets.c | 49 | ||||
-rw-r--r-- | libempathy/empathy-status-presets.h | 1 | ||||
-rw-r--r-- | libempathy/empathy-time.c | 2 | ||||
-rw-r--r-- | libempathy/empathy-tp-chat.c | 2 | ||||
-rw-r--r-- | libempathy/empathy-tp-contact-list.c | 4 | ||||
-rw-r--r-- | libempathy/empathy-utils.c | 6 |
9 files changed, 57 insertions, 23 deletions
diff --git a/libempathy/empathy-chatroom.c b/libempathy/empathy-chatroom.c index 6575bb998..147fca0a9 100644 --- a/libempathy/empathy-chatroom.c +++ b/libempathy/empathy-chatroom.c @@ -407,11 +407,11 @@ empathy_chatroom_get_name (EmpathyChatroom *chatroom) g_return_val_if_fail (EMPATHY_IS_CHATROOM (chatroom), NULL); priv = GET_PRIV (chatroom); - + if (EMP_STR_EMPTY (priv->name)) { return priv->room; } - + return priv->name; } diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c index f415ec19f..073424485 100644 --- a/libempathy/empathy-contact-manager.c +++ b/libempathy/empathy-contact-manager.c @@ -123,7 +123,7 @@ contact_manager_invalidated_cb (TpProxy *connection, list = g_hash_table_lookup (priv->lists, connection); if (list) { empathy_tp_contact_list_remove_all (list); - g_hash_table_remove (priv->lists, connection); + g_hash_table_remove (priv->lists, connection); } } @@ -499,7 +499,7 @@ contact_manager_remove_group (EmpathyContactList *manager, const gchar *group) { EmpathyContactManagerPriv *priv = GET_PRIV (manager); - + g_return_if_fail (EMPATHY_IS_CONTACT_MANAGER (manager)); g_hash_table_foreach (priv->lists, @@ -529,7 +529,7 @@ empathy_contact_manager_can_add (EmpathyContactManager *manager, { EmpathyContactManagerPriv *priv = GET_PRIV (manager); EmpathyTpContactList *list; - + g_return_val_if_fail (EMPATHY_IS_CONTACT_MANAGER (manager), FALSE); list = g_hash_table_lookup (priv->lists, connection); diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c index c72307920..3ed58de92 100644 --- a/libempathy/empathy-idle.c +++ b/libempathy/empathy-idle.c @@ -91,6 +91,10 @@ idle_presence_changed_cb (MissionControl *mc, priv = GET_PRIV (idle); + if (state == TP_CONNECTION_PRESENCE_TYPE_UNSET) + /* Assume our presence is offline if MC reports UNSET */ + state = TP_CONNECTION_PRESENCE_TYPE_OFFLINE; + DEBUG ("Presence changed to '%s' (%d)", status, state); g_free (priv->status); @@ -729,7 +733,7 @@ empathy_idle_set_use_nm (EmpathyIdle *idle, g_clear_error (&error); nm_status = NM_STATE_ASLEEP; } - + idle_nm_state_change_cb (priv->nm_proxy, nm_status, idle); } else { priv->nm_connected = TRUE; diff --git a/libempathy/empathy-status-presets.c b/libempathy/empathy-status-presets.c index 9f9a2030b..135212cc5 100644 --- a/libempathy/empathy-status-presets.c +++ b/libempathy/empathy-status-presets.c @@ -131,16 +131,17 @@ status_presets_file_parse (const gchar *filename) if (state_str) { state = empathy_presence_from_str (state_str); - - if (is_default) { - DEBUG ("Default status preset state is:" - " '%s', status:'%s'", state_str, - status); - - status_presets_set_default (state, status); - } else { - preset = status_preset_new (state, status); - presets = g_list_append (presets, preset); + if (empathy_status_presets_is_valid (state)) { + if (is_default) { + DEBUG ("Default status preset state is:" + " '%s', status:'%s'", state_str, + status); + + status_presets_set_default (state, status); + } else { + preset = status_preset_new (state, status); + presets = g_list_append (presets, preset); + } } } @@ -405,3 +406,31 @@ empathy_status_presets_clear_default (void) status_presets_file_save (); } + +/** + * empathy_status_presets_is_valid: + * @state: a #TpConnectionPresenceType + * + * Check if a presence type can be used as a preset. + * + * Returns: %TRUE if the presence type can be used as a preset. + */ +gboolean +empathy_status_presets_is_valid (TpConnectionPresenceType state) +{ + switch (state) { + case TP_CONNECTION_PRESENCE_TYPE_UNSET: + case TP_CONNECTION_PRESENCE_TYPE_OFFLINE: + case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN: + case TP_CONNECTION_PRESENCE_TYPE_ERROR: + return FALSE; + + case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE: + case TP_CONNECTION_PRESENCE_TYPE_AWAY: + case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY: + case TP_CONNECTION_PRESENCE_TYPE_HIDDEN: + case TP_CONNECTION_PRESENCE_TYPE_BUSY: + return TRUE; + } + return FALSE; +} diff --git a/libempathy/empathy-status-presets.h b/libempathy/empathy-status-presets.h index 335dbcfcb..331c630d5 100644 --- a/libempathy/empathy-status-presets.h +++ b/libempathy/empathy-status-presets.h @@ -40,6 +40,7 @@ const gchar * empathy_status_presets_get_default_status (void); void empathy_status_presets_set_default (TpConnectionPresenceType state, const gchar *status); void empathy_status_presets_clear_default (void); +gboolean empathy_status_presets_is_valid (TpConnectionPresenceType state); G_END_DECLS diff --git a/libempathy/empathy-time.c b/libempathy/empathy-time.c index 5a934a5e3..19397e7a9 100644 --- a/libempathy/empathy-time.c +++ b/libempathy/empathy-time.c @@ -42,7 +42,7 @@ empathy_time_get_local_time (struct tm *tm) { const gchar *timezone; time_t t; - + timezone = g_getenv ("TZ"); g_setenv ("TZ", "", TRUE); diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index 794e3e3b7..ac61392e0 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -993,7 +993,7 @@ tp_chat_constructor (GType type, /* Get initial member contacts */ members = tp_channel_group_get_members (priv->channel); - handles = tp_intset_to_array (members); + handles = tp_intset_to_array (members); empathy_tp_contact_factory_get_from_handles (priv->factory, handles->len, (TpHandle *) handles->data, tp_chat_got_added_contacts_cb, NULL, NULL, chat); diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c index 58cb89cbe..cdb0431c4 100644 --- a/libempathy/empathy-tp-contact-list.c +++ b/libempathy/empathy-tp-contact-list.c @@ -205,7 +205,7 @@ tp_contact_list_group_members_changed_cb (TpChannel *channel, g_signal_emit_by_name (list, "groups-changed", contact, group_name, TRUE); - } + } for (i = 0; i < removed->len; i++) { EmpathyContact *contact; @@ -224,7 +224,7 @@ tp_contact_list_group_members_changed_cb (TpChannel *channel, g_signal_emit_by_name (list, "groups-changed", contact, group_name, FALSE); - } + } } static void diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index 47746f536..fca7fcb5f 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -193,7 +193,7 @@ empathy_xml_node_get_child_content (xmlNodePtr node, if (l) { return xmlNodeGetContent (l); } - + return NULL; } @@ -220,10 +220,10 @@ empathy_xml_node_find_child_prop_value (xmlNodePtr node, if (prop && strcmp (prop, prop_value) == 0) { found = l; } - + xmlFree (prop); } - + return found; } |