aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-05-09 01:30:32 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-05-09 01:30:32 +0800
commitaa2be89aed362db3656d7b8938f78e3a9c64f142 (patch)
treea54f90011f0c6745c0e9a5215cbcd28ab64d5d09
parent083daa833fba469d53c4089fdbceac0a704e432b (diff)
downloadgsoc2013-empathy-aa2be89aed362db3656d7b8938f78e3a9c64f142.tar
gsoc2013-empathy-aa2be89aed362db3656d7b8938f78e3a9c64f142.tar.gz
gsoc2013-empathy-aa2be89aed362db3656d7b8938f78e3a9c64f142.tar.bz2
gsoc2013-empathy-aa2be89aed362db3656d7b8938f78e3a9c64f142.tar.lz
gsoc2013-empathy-aa2be89aed362db3656d7b8938f78e3a9c64f142.tar.xz
gsoc2013-empathy-aa2be89aed362db3656d7b8938f78e3a9c64f142.tar.zst
gsoc2013-empathy-aa2be89aed362db3656d7b8938f78e3a9c64f142.zip
Avoid calling ListPendingMessage if it's already running.
svn path=/trunk/; revision=1090
-rw-r--r--libempathy/empathy-tp-chat.c19
-rw-r--r--libempathy/empathy-tp-chat.h3
2 files changed, 12 insertions, 10 deletions
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index d4eedf492..f0d7820a9 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -47,7 +47,7 @@ typedef struct {
TpChannel *channel;
gchar *id;
gboolean acknowledge;
- gboolean had_pending_messages;
+ gboolean listing_pending_messages;
GSList *message_queue;
gboolean had_properties_list;
GPtrArray *properties;
@@ -370,7 +370,7 @@ tp_chat_received_cb (TpChannel *channel,
EmpathyTpChatPriv *priv = GET_PRIV (chat);
EmpathyMessage *message;
- if (!priv->had_pending_messages) {
+ if (priv->listing_pending_messages) {
return;
}
@@ -478,7 +478,7 @@ tp_chat_list_pending_messages_cb (TpChannel *channel,
guint i;
GArray *message_ids = NULL;
- priv->had_pending_messages = TRUE;
+ priv->listing_pending_messages = FALSE;
if (error) {
DEBUG ("Error listing pending messages: %s", error->message);
@@ -796,6 +796,7 @@ tp_chat_channel_ready_cb (EmpathyTpChat *chat)
G_OBJECT (chat), NULL);
}
+ priv->listing_pending_messages = TRUE;
tp_cli_channel_type_text_call_list_pending_messages (priv->channel, -1,
FALSE,
tp_chat_list_pending_messages_cb,
@@ -981,8 +982,7 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass)
"acknowledge messages",
"Wheter or not received messages should be acknowledged",
FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
+ G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_REMOTE_CONTACT,
@@ -1071,12 +1071,10 @@ tp_chat_iface_init (EmpathyContactListIface *iface)
}
EmpathyTpChat *
-empathy_tp_chat_new (TpChannel *channel,
- gboolean acknowledge)
+empathy_tp_chat_new (TpChannel *channel)
{
return g_object_new (EMPATHY_TYPE_TP_CHAT,
"channel", channel,
- "acknowledge", acknowledge,
NULL);
}
@@ -1161,6 +1159,11 @@ empathy_tp_chat_emit_pendings (EmpathyTpChat *chat)
g_return_if_fail (EMPATHY_IS_TP_CHAT (chat));
g_return_if_fail (priv->ready);
+ if (priv->listing_pending_messages) {
+ return;
+ }
+
+ priv->listing_pending_messages = TRUE;
tp_cli_channel_type_text_call_list_pending_messages (priv->channel, -1,
FALSE,
tp_chat_list_pending_messages_cb,
diff --git a/libempathy/empathy-tp-chat.h b/libempathy/empathy-tp-chat.h
index 0d5b4f94d..4aae240b8 100644
--- a/libempathy/empathy-tp-chat.h
+++ b/libempathy/empathy-tp-chat.h
@@ -53,8 +53,7 @@ struct _EmpathyTpChatClass {
};
GType empathy_tp_chat_get_type (void) G_GNUC_CONST;
-EmpathyTpChat *empathy_tp_chat_new (TpChannel *channel,
- gboolean acknowledge);
+EmpathyTpChat *empathy_tp_chat_new (TpChannel *channel);
const gchar * empathy_tp_chat_get_id (EmpathyTpChat *chat);
EmpathyContact*empathy_tp_chat_get_remote_contact (EmpathyTpChat *chat);
McAccount * empathy_tp_chat_get_account (EmpathyTpChat *chat);