empathy r1090 - trunk/libempathy



Author: xclaesse
Date: Thu May  8 17:30:32 2008
New Revision: 1090
URL: http://svn.gnome.org/viewvc/empathy?rev=1090&view=rev

Log:
Avoid calling ListPendingMessage if it's already running.


Modified:
   trunk/libempathy/empathy-tp-chat.c
   trunk/libempathy/empathy-tp-chat.h

Modified: trunk/libempathy/empathy-tp-chat.c
==============================================================================
--- trunk/libempathy/empathy-tp-chat.c	(original)
+++ trunk/libempathy/empathy-tp-chat.c	Thu May  8 17:30:32 2008
@@ -47,7 +47,7 @@
 	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 @@
 	EmpathyTpChatPriv *priv = GET_PRIV (chat);
 	EmpathyMessage    *message;
 
-	if (!priv->had_pending_messages) {
+	if (priv->listing_pending_messages) {
 		return;
 	}
  
@@ -478,7 +478,7 @@
 	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 @@
 									       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 @@
 							       "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 @@
 }
 
 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 @@
 	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,

Modified: trunk/libempathy/empathy-tp-chat.h
==============================================================================
--- trunk/libempathy/empathy-tp-chat.h	(original)
+++ trunk/libempathy/empathy-tp-chat.h	Thu May  8 17:30:32 2008
@@ -53,8 +53,7 @@
 };
 
 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]