summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-05-25 12:50:01 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-05-25 12:50:01 +0200
commit2743dd452844fb234155e82efb106a839f9e8e6e (patch)
tree3ac29134418fad5a6456e67797169d17e9d827b7
parent0845f60ad48dc43f586da31cfeec01ddacb0c042 (diff)
ignore messages until GetPendingMessages() has returned
-rw-r--r--examples/client/text-handler.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/client/text-handler.c b/examples/client/text-handler.c
index a878491e..a35433b8 100644
--- a/examples/client/text-handler.c
+++ b/examples/client/text-handler.c
@@ -14,6 +14,8 @@
#include <telepathy-glib/telepathy-glib.h>
+gboolean got_pending_msg = FALSE;
+
static void
echo_message (TpChannel *channel,
const gchar *text)
@@ -42,6 +44,10 @@ message_received_cb (TpChannel *channel,
{
GArray *arr;
+ /* Ignore messages if we didn't fetch pending messages yet */
+ if (!got_pending_msg)
+ return;
+
g_print ("received: %s\n", text);
echo_message (channel, text);
@@ -65,6 +71,8 @@ got_pending_messages_cb (TpChannel *channel,
guint i;
GArray *ids;
+ got_pending_msg = TRUE;
+
if (error != NULL)
return;