aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy-gtk/empathy-chat-view.c19
-rw-r--r--libempathy-gtk/empathy-chat-window.c1
-rw-r--r--libempathy-gtk/empathy-chat.c2
-rw-r--r--libempathy-gtk/empathy-contact-dialogs.c2
-rw-r--r--libempathy-gtk/empathy-contact-list-store.c14
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c4
-rw-r--r--libempathy-gtk/empathy-contact-widget.c8
-rw-r--r--libempathy-gtk/empathy-main-window.c6
-rw-r--r--libempathy-gtk/empathy-private-chat.c4
-rw-r--r--libempathy-gtk/empathy-status-icon.c13
-rw-r--r--libempathy-gtk/empathy-theme-boxes.c2
-rw-r--r--libempathy/empathy-debug.c4
-rw-r--r--libempathy/empathy-tp-call.c27
-rw-r--r--libempathy/empathy-tp-chatroom.c116
-rw-r--r--libempathy/empathy-tp-contact-factory.c2
-rw-r--r--libempathy/empathy-tp-contact-list.c4
-rw-r--r--libempathy/empathy-utils.c4
17 files changed, 108 insertions, 124 deletions
diff --git a/libempathy-gtk/empathy-chat-view.c b/libempathy-gtk/empathy-chat-view.c
index f4ad7f316..af523180d 100644
--- a/libempathy-gtk/empathy-chat-view.c
+++ b/libempathy-gtk/empathy-chat-view.c
@@ -715,31 +715,19 @@ chat_view_avatar_cache_data_free (gpointer ptr)
GdkPixbuf *
empathy_chat_view_get_avatar_pixbuf_with_cache (EmpathyContact *contact)
{
- static GHashTable *avatar_cache = NULL;
AvatarData *data;
EmpathyAvatar *avatar;
GdkPixbuf *tmp_pixbuf;
GdkPixbuf *pixbuf = NULL;
- /* Init avatar cache */
- if (!avatar_cache) {
- avatar_cache = g_hash_table_new_full (empathy_contact_hash,
- empathy_contact_equal,
- g_object_unref,
- chat_view_avatar_cache_data_free);
- }
-
/* Check if avatar is in cache and if it's up to date */
avatar = empathy_contact_get_avatar (contact);
- data = g_hash_table_lookup (avatar_cache, contact);
+ data = g_object_get_data (G_OBJECT (contact), "chat-view-avatar-cache");
if (data) {
if (avatar && !tp_strdiff (avatar->token, data->token)) {
/* We have the avatar in cache */
return data->pixbuf;
}
-
- /* The cache is outdate */
- g_hash_table_remove (avatar_cache, contact);
}
/* Avatar not in cache, create pixbuf */
@@ -757,9 +745,8 @@ empathy_chat_view_get_avatar_pixbuf_with_cache (EmpathyContact *contact)
data->token = g_strdup (avatar->token);
data->pixbuf = pixbuf;
- g_hash_table_insert (avatar_cache,
- g_object_ref (contact),
- data);
+ g_object_set_data_full (G_OBJECT (contact), "chat-view-avatar-cache",
+ data, chat_view_avatar_cache_data_free);
return data->pixbuf;
}
diff --git a/libempathy-gtk/empathy-chat-window.c b/libempathy-gtk/empathy-chat-window.c
index 5c3946e98..bbf66fbcf 100644
--- a/libempathy-gtk/empathy-chat-window.c
+++ b/libempathy-gtk/empathy-chat-window.c
@@ -37,7 +37,6 @@
#include <libmissioncontrol/mission-control.h>
#include <libempathy/empathy-contact-factory.h>
-#include <libempathy/empathy-contact-list.h>
#include <libempathy/empathy-log-manager.h>
#include <libempathy/empathy-chatroom-manager.h>
#include <libempathy/empathy-contact.h>
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 3494b02fd..1b2fcccb2 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -1211,7 +1211,7 @@ chat_state_changed_cb (EmpathyTpChat *tp_chat,
/* Find the contact in the list. After that l is the list elem or NULL */
for (l = priv->compositors; l; l = l->next) {
- if (empathy_contact_equal (contact, l->data)) {
+ if (contact == l->data) {
break;
}
}
diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c
index e0785c3ce..1805213a6 100644
--- a/libempathy-gtk/empathy-contact-dialogs.c
+++ b/libempathy-gtk/empathy-contact-dialogs.c
@@ -53,7 +53,7 @@ contact_dialogs_find (GtkDialog *dialog,
contact_widget = g_object_get_data (G_OBJECT (dialog), "contact_widget");
this_contact = empathy_contact_widget_get_contact (contact_widget);
- return !empathy_contact_equal (contact, this_contact);
+ return contact != this_contact;
}
/*
diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c
index 46fa99474..84c7223ff 100644
--- a/libempathy-gtk/empathy-contact-list-store.c
+++ b/libempathy-gtk/empathy-contact-list-store.c
@@ -880,7 +880,8 @@ contact_list_store_add_contact (EmpathyContactListStore *store,
priv = GET_PRIV (store);
- if (!priv->show_offline && !empathy_contact_is_online (contact)) {
+ if (!(empathy_contact_get_ready (contact) & EMPATHY_CONTACT_READY_ID) ||
+ (!priv->show_offline && !empathy_contact_is_online (contact))) {
return;
}
@@ -1488,15 +1489,14 @@ contact_list_store_find_contact_foreach (GtkTreeModel *model,
EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, &contact,
-1);
- if (!contact) {
- return FALSE;
- }
-
- if (empathy_contact_equal (contact, fc->contact)) {
+ if (contact == fc->contact) {
fc->found = TRUE;
fc->iters = g_list_append (fc->iters, gtk_tree_iter_copy (iter));
}
- g_object_unref (contact);
+
+ if (contact) {
+ g_object_unref (contact);
+ }
return FALSE;
}
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index b12387419..24174c8b7 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -774,6 +774,10 @@ contact_list_view_drag_data_received (GtkWidget *widget,
return;
}
+ empathy_contact_run_until_ready (contact,
+ EMPATHY_CONTACT_READY_HANDLE,
+ NULL);
+
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
/* Get source group information. */
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 0c3f40dc1..c0b4596de 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -306,9 +306,7 @@ static void
contact_widget_set_contact (EmpathyContactWidget *information,
EmpathyContact *contact)
{
- if (contact == information->contact ||
- (contact && information->contact &&
- empathy_contact_equal (contact, information->contact))) {
+ if (contact == information->contact) {
return;
}
@@ -512,6 +510,10 @@ contact_widget_change_contact (EmpathyContactWidget *information)
}
if (contact) {
+ empathy_contact_run_until_ready (contact,
+ EMPATHY_CONTACT_READY_HANDLE |
+ EMPATHY_CONTACT_READY_ID,
+ NULL);
contact_widget_set_contact (information, contact);
g_object_unref (contact);
}
diff --git a/libempathy-gtk/empathy-main-window.c b/libempathy-gtk/empathy-main-window.c
index ca8a16abf..c447c473d 100644
--- a/libempathy-gtk/empathy-main-window.c
+++ b/libempathy-gtk/empathy-main-window.c
@@ -669,9 +669,15 @@ main_window_edit_personal_information_cb (GtkWidget *widget,
account = accounts->data;
factory = empathy_contact_factory_new ();
contact = empathy_contact_factory_get_user (factory, account);
+ empathy_contact_run_until_ready (contact,
+ EMPATHY_CONTACT_READY_HANDLE |
+ EMPATHY_CONTACT_READY_ID,
+ NULL);
+
empathy_contact_information_dialog_show (contact,
GTK_WINDOW (window->window),
TRUE, TRUE);
+
g_slist_foreach (accounts, (GFunc) g_object_unref, NULL);
g_slist_free (accounts);
g_object_unref (factory);
diff --git a/libempathy-gtk/empathy-private-chat.c b/libempathy-gtk/empathy-private-chat.c
index 4ee02e467..a8b2941aa 100644
--- a/libempathy-gtk/empathy-private-chat.c
+++ b/libempathy-gtk/empathy-private-chat.c
@@ -105,6 +105,10 @@ private_chat_constructor (GType type,
priv->contact = empathy_contact_factory_get_from_handle (priv->factory,
account,
tp_chan->handle);
+ empathy_contact_run_until_ready (priv->contact,
+ EMPATHY_CONTACT_READY_ID |
+ EMPATHY_CONTACT_READY_NAME,
+ NULL);
priv->name = g_strdup (empathy_contact_get_name (priv->contact));
diff --git a/libempathy-gtk/empathy-status-icon.c b/libempathy-gtk/empathy-status-icon.c
index 9f10bd37e..241a2841f 100644
--- a/libempathy-gtk/empathy-status-icon.c
+++ b/libempathy-gtk/empathy-status-icon.c
@@ -418,6 +418,10 @@ status_icon_call_local_pending_cb (EmpathyTpGroup *group,
/* We are local pending, it's an incoming call, we need to ask
* the user if he wants to accept the call. */
+ empathy_contact_run_until_ready (member,
+ EMPATHY_CONTACT_READY_NAME,
+ NULL);
+
empathy_debug (DEBUG_DOMAIN, "INCOMING call, add event");
msg = g_strdup_printf (_("Incoming call from %s:\n%s"),
@@ -708,7 +712,6 @@ status_icon_pendings_changed_cb (EmpathyContactManager *manager,
EmpathyStatusIconPriv *priv;
StatusIconEvent *event;
GString *str;
- GList *l;
priv = GET_PRIV (icon);
@@ -717,11 +720,9 @@ status_icon_pendings_changed_cb (EmpathyContactManager *manager,
return;
}
- for (l = priv->events; l; l = l->next) {
- if (empathy_contact_equal (contact, ((StatusIconEvent*)l->data)->user_data)) {
- return;
- }
- }
+ empathy_contact_run_until_ready (contact,
+ EMPATHY_CONTACT_READY_NAME,
+ NULL);
str = g_string_new (NULL);
g_string_printf (str, _("Subscription requested by %s"),
diff --git a/libempathy-gtk/empathy-theme-boxes.c b/libempathy-gtk/empathy-theme-boxes.c
index 7285a9e9e..4e6a272c0 100644
--- a/libempathy-gtk/empathy-theme-boxes.c
+++ b/libempathy-gtk/empathy-theme-boxes.c
@@ -573,7 +573,7 @@ theme_boxes_maybe_append_header (EmpathyTheme *theme,
}
else if (!from_self &&
(!empathy_chat_view_get_last_contact (view) ||
- !empathy_contact_equal (contact, empathy_chat_view_get_last_contact (view)))) {
+ !(contact == empathy_chat_view_get_last_contact (view)))) {
header = TRUE;
}
diff --git a/libempathy/empathy-debug.c b/libempathy/empathy-debug.c
index f39573025..d81e6dca7 100644
--- a/libempathy/empathy-debug.c
+++ b/libempathy/empathy-debug.c
@@ -54,9 +54,11 @@ debug_init (void)
const gchar *env;
gint i;
- env = g_getenv ("EMPATHY_DEBUG");
+ env = g_getenv ("TELEPATHY_GLIB_DEBUG");
tp_debug_set_flags (env);
+ env = g_getenv ("EMPATHY_DEBUG");
+
if (env) {
debug_strv = g_strsplit_set (env, ":, ", 0);
} else {
diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-call.c
index afc6ff657..d218fd8ef 100644
--- a/libempathy/empathy-tp-call.c
+++ b/libempathy/empathy-tp-call.c
@@ -392,7 +392,6 @@ static void
tp_call_is_ready (EmpathyTpCall *call)
{
EmpathyTpCallPriv *priv = GET_PRIV (call);
- EmpathyContact *self_contact;
GList *members;
GList *local_pendings;
GList *remote_pendings;
@@ -404,13 +403,11 @@ tp_call_is_ready (EmpathyTpCall *call)
if (!members)
return;
- self_contact = empathy_tp_group_get_self_contact (priv->group);
local_pendings = empathy_tp_group_get_local_pendings (priv->group);
remote_pendings = empathy_tp_group_get_remote_pendings (priv->group);
if (local_pendings &&
- empathy_contact_equal (EMPATHY_CONTACT (((EmpathyPendingInfo *)
- local_pendings->data)->member), self_contact))
+ empathy_contact_is_user (((EmpathyPendingInfo *) local_pendings->data)->member))
{
empathy_debug (DEBUG_DOMAIN,
"Incoming call is ready - %p",
@@ -418,8 +415,7 @@ tp_call_is_ready (EmpathyTpCall *call)
priv->is_incoming = TRUE;
priv->contact = g_object_ref (members->data);
}
- else if (remote_pendings &&
- empathy_contact_equal (EMPATHY_CONTACT (members->data), self_contact))
+ else if (remote_pendings && empathy_contact_is_user (members->data))
{
empathy_debug (DEBUG_DOMAIN,
"Outgoing call is ready - %p", remote_pendings->data);
@@ -428,7 +424,6 @@ tp_call_is_ready (EmpathyTpCall *call)
tp_call_request_streams (call);
}
- g_object_unref (self_contact);
g_list_foreach (members, (GFunc) g_object_unref, NULL);
g_list_free (members);
g_list_foreach (local_pendings, (GFunc) empathy_pending_info_free, NULL);
@@ -458,10 +453,8 @@ tp_call_member_added_cb (EmpathyTpGroup *group,
if (priv->status == EMPATHY_TP_CALL_STATUS_PENDING)
{
- if ((priv->is_incoming &&
- !empathy_contact_equal (contact, priv->contact))
- || (!priv->is_incoming &&
- empathy_contact_equal (contact, priv->contact)))
+ if ((priv->is_incoming && contact != priv->contact) ||
+ (!priv->is_incoming && contact == priv->contact))
{
priv->status = EMPATHY_TP_CALL_STATUS_ACCEPTED;
g_signal_emit (call, signals[STATUS_CHANGED_SIGNAL], 0);
@@ -831,17 +824,13 @@ void
empathy_tp_call_accept_incoming_call (EmpathyTpCall *call)
{
EmpathyTpCallPriv *priv = GET_PRIV (call);
- GList *local_pendings;
+ EmpathyContact *self_contact;
empathy_debug (DEBUG_DOMAIN, "Accepting incoming call");
- local_pendings = empathy_tp_group_get_local_pendings (priv->group);
-
- empathy_tp_group_add_member (priv->group, EMPATHY_CONTACT
- (((EmpathyPendingInfo *) local_pendings->data)->member), NULL);
-
- g_list_foreach (local_pendings, (GFunc) empathy_pending_info_free, NULL);
- g_list_free (local_pendings);
+ self_contact = empathy_tp_group_get_self_contact (priv->group);
+ empathy_tp_group_add_member (priv->group, self_contact, NULL);
+ g_object_unref (self_contact);
}
void
diff --git a/libempathy/empathy-tp-chatroom.c b/libempathy/empathy-tp-chatroom.c
index a00aa581b..b66b38d2c 100644
--- a/libempathy/empathy-tp-chatroom.c
+++ b/libempathy/empathy-tp-chatroom.c
@@ -46,18 +46,6 @@ static void empathy_tp_chatroom_class_init (EmpathyTpChatroomClass *
static void tp_chatroom_iface_init (EmpathyContactListIface *iface);
static void empathy_tp_chatroom_init (EmpathyTpChatroom *chatroom);
static void tp_chatroom_finalize (GObject *object);
-static void tp_chatroom_member_added_cb (EmpathyTpGroup *group,
- EmpathyContact *contact,
- EmpathyContact *actor,
- guint reason,
- const gchar *message,
- EmpathyTpChatroom *chatroom);
-static void tp_chatroom_member_removed_cb (EmpathyTpGroup *group,
- EmpathyContact *contact,
- EmpathyContact *actor,
- guint reason,
- const gchar *message,
- EmpathyTpChatroom *chatroom);
static void tp_chatroom_add (EmpathyContactList *list,
EmpathyContact *contact,
const gchar *message);
@@ -114,14 +102,59 @@ tp_chatroom_finalize (GObject *object)
G_OBJECT_CLASS (empathy_tp_chatroom_parent_class)->finalize (object);
}
+static void
+tp_chatroom_member_added_cb (EmpathyTpGroup *group,
+ EmpathyContact *contact,
+ EmpathyContact *actor,
+ guint reason,
+ const gchar *message,
+ EmpathyTpChatroom *chatroom)
+{
+ g_signal_emit_by_name (chatroom, "members-changed",
+ contact, actor, reason, message,
+ TRUE);
+}
+
+static void
+tp_chatroom_member_removed_cb (EmpathyTpGroup *group,
+ EmpathyContact *contact,
+ EmpathyContact *actor,
+ guint reason,
+ const gchar *message,
+ EmpathyTpChatroom *chatroom)
+{
+ g_signal_emit_by_name (chatroom, "members-changed",
+ contact, actor, reason, message,
+ FALSE);
+}
+static void
+tp_chatroom_local_pending_cb (EmpathyTpGroup *group,
+ EmpathyContact *contact,
+ EmpathyContact *actor,
+ guint reason,
+ const gchar *message,
+ EmpathyTpChatroom *chatroom)
+{
+ EmpathyTpChatroomPriv *priv = GET_PRIV (chatroom);
+
+ if (empathy_contact_is_user (contact)) {
+ priv->invitor = g_object_ref (actor);
+ priv->invit_message = g_strdup (message);
+ priv->is_invited = TRUE;
+
+ empathy_debug (DEBUG_DOMAIN, "We are invited to join by %s (%d): %s",
+ empathy_contact_get_id (priv->invitor),
+ empathy_contact_get_handle (priv->invitor),
+ priv->invit_message);
+ }
+}
+
EmpathyTpChatroom *
empathy_tp_chatroom_new (McAccount *account,
TpChan *tp_chan)
{
EmpathyTpChatroomPriv *priv;
EmpathyTpChatroom *chatroom;
- GList *members, *l;
- EmpathyContact *user;
g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
g_return_val_if_fail (TELEPATHY_IS_CHAN (tp_chan), NULL);
@@ -142,32 +175,9 @@ empathy_tp_chatroom_new (McAccount *account,
g_signal_connect (priv->group, "member-removed",
G_CALLBACK (tp_chatroom_member_removed_cb),
chatroom);
-
- /* Check if we are invited to join the chat */
- user = empathy_tp_group_get_self_contact (priv->group);
- members = empathy_tp_group_get_local_pendings (priv->group);
- for (l = members; l; l = l->next) {
- EmpathyPendingInfo *info;
-
- info = l->data;
-
- if (!empathy_contact_equal (user, info->member)) {
- continue;
- }
-
- priv->invitor = g_object_ref (info->actor);
- priv->invit_message = g_strdup (info->message);
- priv->is_invited = TRUE;
-
- empathy_debug (DEBUG_DOMAIN, "We are invited to join by %s (%d): %s",
- empathy_contact_get_id (priv->invitor),
- empathy_contact_get_handle (priv->invitor),
- priv->invit_message);
- }
-
- g_list_foreach (members, (GFunc) empathy_pending_info_free, NULL);
- g_list_free (members);
- g_object_unref (user);
+ g_signal_connect (priv->group, "local-pending",
+ G_CALLBACK (tp_chatroom_local_pending_cb),
+ chatroom);
return chatroom;
}
@@ -230,32 +240,6 @@ empathy_tp_chatroom_set_topic (EmpathyTpChatroom *chatroom,
}
static void
-tp_chatroom_member_added_cb (EmpathyTpGroup *group,
- EmpathyContact *contact,
- EmpathyContact *actor,
- guint reason,
- const gchar *message,
- EmpathyTpChatroom *chatroom)
-{
- g_signal_emit_by_name (chatroom, "members-changed",
- contact, actor, reason, message,
- TRUE);
-}
-
-static void
-tp_chatroom_member_removed_cb (EmpathyTpGroup *group,
- EmpathyContact *contact,
- EmpathyContact *actor,
- guint reason,
- const gchar *message,
- EmpathyTpChatroom *chatroom)
-{
- g_signal_emit_by_name (chatroom, "members-changed",
- contact, actor, reason, message,
- FALSE);
-}
-
-static void
tp_chatroom_add (EmpathyContactList *list,
EmpathyContact *contact,
const gchar *message)
diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c
index 8773207e0..bbb17394b 100644
--- a/libempathy/empathy-tp-contact-factory.c
+++ b/libempathy/empathy-tp-contact-factory.c
@@ -731,6 +731,8 @@ tp_contact_factory_got_self_handle_cb (TpConnection *proxy,
return;
}
+ empathy_debug (DEBUG_DOMAIN, "Connection ready");
+
empathy_contact_set_handle (priv->user, handle);
priv->ready = TRUE;
diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c
index b89384487..779aa6132 100644
--- a/libempathy/empathy-tp-contact-list.c
+++ b/libempathy/empathy-tp-contact-list.c
@@ -710,8 +710,8 @@ empathy_tp_contact_list_new (McAccount *account)
priv->tp_conn = tp_conn;
priv->account = g_object_ref (account);
priv->mc = mc;
- priv->contacts_groups = g_hash_table_new_full (empathy_contact_hash,
- empathy_contact_equal,
+ priv->contacts_groups = g_hash_table_new_full (g_direct_hash,
+ g_direct_equal,
(GDestroyNotify) g_object_unref,
(GDestroyNotify) tp_contact_list_group_list_free);
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index f54f4193f..c24927b36 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -452,6 +452,10 @@ empathy_call_with_contact (EmpathyContact *contact)
group = empathy_tp_group_new (account, new_chan);
factory = empathy_contact_factory_new ();
self_contact = empathy_contact_factory_get_user (factory, account);
+ empathy_contact_run_until_ready (self_contact,
+ EMPATHY_CONTACT_READY_HANDLE,
+ NULL);
+
empathy_tp_group_add_member (group, contact, "");
empathy_tp_group_add_member (group, self_contact, "");