diff options
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-contact.c | 63 | ||||
-rw-r--r-- | libempathy/empathy-contact.h | 7 | ||||
-rw-r--r-- | libempathy/empathy-dispatcher.h | 3 | ||||
-rw-r--r-- | libempathy/empathy-ft-handler.c | 2 | ||||
-rw-r--r-- | libempathy/empathy-gsettings.h | 3 | ||||
-rw-r--r-- | libempathy/empathy-individual-manager.c | 34 | ||||
-rw-r--r-- | libempathy/empathy-individual-manager.h | 4 | ||||
-rw-r--r-- | libempathy/empathy-tp-chat.c | 2 |
8 files changed, 64 insertions, 54 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index 324f41f64..260543155 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -85,7 +85,11 @@ static void empathy_contact_set_location (EmpathyContact *contact, static void set_capabilities_from_tp_caps (EmpathyContact *self, TpCapabilities *caps); +static void contact_set_avatar (EmpathyContact *contact, + EmpathyAvatar *avatar); static void contact_set_avatar_from_tp_contact (EmpathyContact *contact); +static gboolean contact_load_avatar_cache (EmpathyContact *contact, + const gchar *token); G_DEFINE_TYPE (EmpathyContact, empathy_contact, G_TYPE_OBJECT); @@ -266,7 +270,7 @@ empathy_contact_class_init (EmpathyContactClass *class) "Avatar image", "The avatar image", EMPATHY_TYPE_AVATAR, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_PRESENCE, @@ -478,9 +482,6 @@ contact_set_property (GObject *object, case PROP_ALIAS: empathy_contact_set_alias (contact, g_value_get_string (value)); break; - case PROP_AVATAR: - empathy_contact_set_avatar (contact, g_value_get_boxed (value)); - break; case PROP_PRESENCE: empathy_contact_set_presence (contact, g_value_get_uint (value)); break; @@ -531,29 +532,12 @@ empathy_contact_from_tpl_contact (TpAccount *account, NULL); if (!EMP_STR_EMPTY (tpl_entity_get_avatar_token (tpl_entity))) - empathy_contact_load_avatar_cache (retval, + contact_load_avatar_cache (retval, tpl_entity_get_avatar_token (tpl_entity)); return retval; } -EmpathyContact * -empathy_contact_new_for_log (TpAccount *account, - const gchar *id, - const gchar *alias, - gboolean is_user) -{ - g_return_val_if_fail (id != NULL, NULL); - g_assert (account != NULL); - - return g_object_new (EMPATHY_TYPE_CONTACT, - "account", account, - "id", id, - "alias", alias, - "is-user", is_user, - NULL); -} - TpContact * empathy_contact_get_tp_contact (EmpathyContact *contact) { @@ -724,9 +708,9 @@ empathy_contact_get_avatar (EmpathyContact *contact) return priv->avatar; } -void -empathy_contact_set_avatar (EmpathyContact *contact, - EmpathyAvatar *avatar) +static void +contact_set_avatar (EmpathyContact *contact, + EmpathyAvatar *avatar) { EmpathyContactPriv *priv; @@ -1048,8 +1032,10 @@ empathy_contact_is_online (EmpathyContact *contact) case TP_CONNECTION_PRESENCE_TYPE_OFFLINE: case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN: case TP_CONNECTION_PRESENCE_TYPE_ERROR: - case TP_CONNECTION_PRESENCE_TYPE_UNSET: return FALSE; + /* Contacts without presence are considered online so we can display IRC + * contacts in rooms. */ + case TP_CONNECTION_PRESENCE_TYPE_UNSET: case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE: case TP_CONNECTION_PRESENCE_TYPE_AWAY: case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY: @@ -1167,9 +1153,9 @@ contact_get_avatar_filename (EmpathyContact *contact, return avatar_file; } -gboolean -empathy_contact_load_avatar_cache (EmpathyContact *contact, - const gchar *token) +static gboolean +contact_load_avatar_cache (EmpathyContact *contact, + const gchar *token) { EmpathyAvatar *avatar = NULL; gchar *filename; @@ -1195,9 +1181,8 @@ empathy_contact_load_avatar_cache (EmpathyContact *contact, if (data) { DEBUG ("Avatar loaded from %s", filename); - avatar = empathy_avatar_new ((guchar *) data, len, NULL, g_strdup (token), - filename); - empathy_contact_set_avatar (contact, avatar); + avatar = empathy_avatar_new ((guchar *) data, len, NULL, filename); + contact_set_avatar (contact, avatar); empathy_avatar_unref (avatar); } else @@ -1228,11 +1213,10 @@ empathy_avatar_get_type (void) * @data: the avatar data * @len: the size of avatar data * @format: the mime type of the avatar image - * @token: the token of the avatar * @filename: the filename where the avatar is stored in cache * * Create a #EmpathyAvatar from the provided data. This function takes the - * ownership of @data, @format, @token and @filename. + * ownership of @data, @format and @filename. * * Returns: a new #EmpathyAvatar */ @@ -1240,7 +1224,6 @@ EmpathyAvatar * empathy_avatar_new (guchar *data, gsize len, gchar *format, - gchar *token, gchar *filename) { EmpathyAvatar *avatar; @@ -1249,7 +1232,6 @@ empathy_avatar_new (guchar *data, avatar->data = data; avatar->len = len; avatar->format = format; - avatar->token = token; avatar->filename = filename; avatar->refcount = 1; @@ -1266,7 +1248,6 @@ empathy_avatar_unref (EmpathyAvatar *avatar) { g_free (avatar->data); g_free (avatar->format); - g_free (avatar->token); g_free (avatar->filename); g_slice_free (EmpathyAvatar, avatar); } @@ -1650,10 +1631,8 @@ contact_set_avatar_from_tp_contact (EmpathyContact *contact) { EmpathyContactPriv *priv = GET_PRIV (contact); const gchar *mime; - const gchar *token; GFile *file; - token = tp_contact_get_avatar_token (priv->tp_contact); mime = tp_contact_get_avatar_mime_type (priv->tp_contact); file = tp_contact_get_avatar_file (priv->tp_contact); @@ -1664,14 +1643,14 @@ contact_set_avatar_from_tp_contact (EmpathyContact *contact) gsize len; g_file_load_contents (file, NULL, &data, &len, NULL, NULL); - avatar = empathy_avatar_new ((guchar *) data, len, g_strdup (mime), g_strdup (token), + avatar = empathy_avatar_new ((guchar *) data, len, g_strdup (mime), g_file_get_path (file)); - empathy_contact_set_avatar (contact, avatar); + contact_set_avatar (contact, avatar); empathy_avatar_unref (avatar); } else { - empathy_contact_set_avatar (contact, NULL); + contact_set_avatar (contact, NULL); } } diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h index c65e0871f..e9b1c8697 100644 --- a/libempathy/empathy-contact.h +++ b/libempathy/empathy-contact.h @@ -73,8 +73,6 @@ typedef enum { GType empathy_contact_get_type (void) G_GNUC_CONST; EmpathyContact * empathy_contact_from_tpl_contact (TpAccount *account, TplEntity *tpl_contact); -EmpathyContact * empathy_contact_new_for_log (TpAccount *account, - const gchar *id, const gchar *alias, gboolean is_user); TpContact * empathy_contact_get_tp_contact (EmpathyContact *contact); const gchar * empathy_contact_get_id (EmpathyContact *contact); void empathy_contact_set_id (EmpathyContact *contact, const gchar *id); @@ -83,8 +81,6 @@ void empathy_contact_set_alias (EmpathyContact *contact, const gchar *alias); void empathy_contact_change_group (EmpathyContact *contact, const gchar *group, gboolean is_member); EmpathyAvatar * empathy_contact_get_avatar (EmpathyContact *contact); -void empathy_contact_set_avatar (EmpathyContact *contact, - EmpathyAvatar *avatar); TpAccount * empathy_contact_get_account (EmpathyContact *contact); FolksPersona * empathy_contact_get_persona (EmpathyContact *contact); void empathy_contact_set_persona (EmpathyContact *contact, @@ -111,8 +107,6 @@ gboolean empathy_contact_can_voip_audio (EmpathyContact *contact); gboolean empathy_contact_can_voip_video (EmpathyContact *contact); gboolean empathy_contact_can_send_files (EmpathyContact *contact); gboolean empathy_contact_can_use_rfb_stream_tube (EmpathyContact *contact); -gboolean empathy_contact_load_avatar_cache (EmpathyContact *contact, - const gchar *token); #define EMPATHY_TYPE_AVATAR (empathy_avatar_get_type ()) @@ -120,7 +114,6 @@ GType empathy_avatar_get_type (void) G_GNUC_CONST; EmpathyAvatar * empathy_avatar_new (guchar *data, gsize len, gchar *format, - gchar *token, gchar *filename); EmpathyAvatar * empathy_avatar_ref (EmpathyAvatar *avatar); void empathy_avatar_unref (EmpathyAvatar *avatar); diff --git a/libempathy/empathy-dispatcher.h b/libempathy/empathy-dispatcher.h index bf6e169b7..cd54fa5d1 100644 --- a/libempathy/empathy-dispatcher.h +++ b/libempathy/empathy-dispatcher.h @@ -38,9 +38,6 @@ G_BEGIN_DECLS #define EMPATHY_IS_DISPATCHER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_DISPATCHER)) #define EMPATHY_DISPATCHER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_DISPATCHER, EmpathyDispatcherClass)) -#define EMPATHY_DISPATCHER_NON_USER_ACTION (G_GINT64_CONSTANT (0)) -#define EMPATHY_DISPATCHER_CURRENT_TIME G_MAXINT64 - typedef struct _EmpathyDispatcher EmpathyDispatcher; typedef struct _EmpathyDispatcherClass EmpathyDispatcherClass; diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c index 13568cef9..f18278a71 100644 --- a/libempathy/empathy-ft-handler.c +++ b/libempathy/empathy-ft-handler.c @@ -761,7 +761,7 @@ ft_handler_push_to_dispatcher (EmpathyFTHandler *handler) account = empathy_contact_get_account (priv->contact); req = tp_account_channel_request_new (account, priv->request, - EMPATHY_DISPATCHER_NON_USER_ACTION); + TP_USER_ACTION_TIME_NOT_USER_ACTION); tp_account_channel_request_create_and_handle_channel_async (req, NULL, ft_handler_create_channel_cb, handler); diff --git a/libempathy/empathy-gsettings.h b/libempathy/empathy-gsettings.h index 126936e11..21d08ed5d 100644 --- a/libempathy/empathy-gsettings.h +++ b/libempathy/empathy-gsettings.h @@ -89,6 +89,9 @@ G_BEGIN_DECLS #define EMPATHY_PREFS_ACCOUNTS_SCHEMA EMPATHY_PREFS_SCHEMA ".accounts" +#define EMPATHY_PREFS_LOGGER_SCHEMA "org.freedesktop.Telepathy.Logger" +#define EMPATHY_PREFS_LOGGER_ENABLED "enabled" + G_END_DECLS #endif /* __EMPATHY_GSETTINGS_H__ */ diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c index 3fbaab408..4d3eabb22 100644 --- a/libempathy/empathy-individual-manager.c +++ b/libempathy/empathy-individual-manager.c @@ -568,3 +568,37 @@ empathy_individual_manager_link_personas (EmpathyIndividualManager *self, folks_individual_aggregator_link_personas (priv->aggregator, personas, (GAsyncReadyCallback) link_personas_cb, NULL); } + +static void +unlink_individual_cb (FolksIndividualAggregator *aggregator, + GAsyncResult *async_result, + gpointer user_data) +{ + GError *error = NULL; + + folks_individual_aggregator_unlink_individual_finish (aggregator, + async_result, &error); + + if (error != NULL) + { + g_warning ("Failed to unlink individual: %s", error->message); + g_clear_error (&error); + } +} + +void +empathy_individual_manager_unlink_individual (EmpathyIndividualManager *self, + FolksIndividual *individual) +{ + EmpathyIndividualManagerPriv *priv; + + g_return_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (self)); + g_return_if_fail (FOLKS_IS_INDIVIDUAL (individual)); + + priv = GET_PRIV (self); + + DEBUG ("Unlinking individual '%s'", folks_individual_get_id (individual)); + + folks_individual_aggregator_unlink_individual (priv->aggregator, individual, + (GAsyncReadyCallback) unlink_individual_cb, NULL); +} diff --git a/libempathy/empathy-individual-manager.h b/libempathy/empathy-individual-manager.h index 0fe639d0c..72104fc40 100644 --- a/libempathy/empathy-individual-manager.h +++ b/libempathy/empathy-individual-manager.h @@ -90,5 +90,9 @@ empathy_individual_manager_get_flags_for_connection ( void empathy_individual_manager_link_personas (EmpathyIndividualManager *self, GList *personas); +void empathy_individual_manager_unlink_individual ( + EmpathyIndividualManager *self, + FolksIndividual *individual); + G_END_DECLS #endif /* __EMPATHY_INDIVIDUAL_MANAGER_H__ */ diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index 2fd6fc506..6f4874fc8 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -167,7 +167,7 @@ tp_chat_add (EmpathyContactList *list, NULL); req = tp_account_channel_request_new (priv->account, props, - EMPATHY_DISPATCHER_NON_USER_ACTION); + TP_USER_ACTION_TIME_NOT_USER_ACTION); /* Although this is a MUC, it's anonymous, so CreateChannel is * valid. */ |