empathy r857 - trunk/libempathy



Author: xclaesse
Date: Wed Apr  2 10:42:25 2008
New Revision: 857
URL: http://svn.gnome.org/viewvc/empathy?rev=857&view=rev

Log:
Do not ack pending messages until they are displayed


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

Modified: trunk/libempathy/empathy-tp-chat.c
==============================================================================
--- trunk/libempathy/empathy-tp-chat.c	(original)
+++ trunk/libempathy/empathy-tp-chat.c	Wed Apr  2 10:42:25 2008
@@ -355,7 +355,7 @@
 									    -1,
 									    message_ids,
 									    tp_chat_async_cb,
-									    "acknowledging pending messages",
+									    "acknowledging received message",
 									    NULL,
 									    chat);
 		g_array_free (message_ids, TRUE);
@@ -439,6 +439,7 @@
 {
 	EmpathyTpChatPriv *priv = GET_PRIV (chat);
 	guint              i;
+	GArray            *message_ids = NULL;
 
 	priv->had_pending_messages = TRUE;
 
@@ -448,6 +449,11 @@
 		return;
 	}
 
+	if (priv->acknowledge) {
+		message_ids = g_array_sized_new (FALSE, FALSE, sizeof (guint),
+						 messages_list->len);
+	}
+
 	for (i = 0; i < messages_list->len; i++) {
 		EmpathyMessage *message;
 		GValueArray    *message_struct;
@@ -469,6 +475,10 @@
 
 		empathy_debug (DEBUG_DOMAIN, "Message pending: %s", message_body);
 
+		if (message_ids) {
+			g_array_append_val (message_ids, message_id);
+		}
+
 		message = tp_chat_build_message (EMPATHY_TP_CHAT (chat),
 						 message_type,
 						 timestamp,
@@ -478,6 +488,17 @@
 		tp_chat_emit_or_queue_message (EMPATHY_TP_CHAT (chat), message);
 		g_object_unref (message);
 	}
+
+	if (message_ids) {
+		tp_cli_channel_type_text_call_acknowledge_pending_messages (priv->channel,
+									    -1,
+									    message_ids,
+									    tp_chat_async_cb,
+									    "acknowledging pending messages",
+									    NULL,
+									    chat);
+		g_array_free (message_ids, TRUE);
+	}
 }
 
 static void



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