summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDafydd Harries <dafydd.harries@collabora.co.uk>2007-09-27 15:03:28 +0000
committerDafydd Harries <dafydd.harries@collabora.co.uk>2007-09-27 15:03:28 +0000
commit3a4df2954becfbc195fadfc325a5c6f3d2eefbcf (patch)
tree9344084796de1a42bbb0cb914a8122cffd8f15be /tests
parent22083c7a6f9dbf64c6d405310cf2ba130921f90a (diff)
use MessageTypeNormal for offline messages without type attribute that Google server sends
Diffstat (limited to 'tests')
-rw-r--r--tests/test-parse-message.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/test-parse-message.c b/tests/test-parse-message.c
index e3d0545e6..48da1623b 100644
--- a/tests/test-parse-message.c
+++ b/tests/test-parse-message.c
@@ -126,6 +126,43 @@ test_error (void)
return TRUE;
}
+static gboolean
+test_google_offline (void)
+{
+ LmMessage *msg;
+ gboolean ret;
+ const gchar *from;
+ time_t stamp;
+ TpChannelTextMessageType type;
+ TpChannelTextSendError send_error;
+ const gchar *body;
+ gint state;
+
+ msg = lm_message_build (NULL, LM_MESSAGE_TYPE_MESSAGE,
+ '@', "from", "foo@bar.com",
+ '(', "body", "hello", ')',
+ '(', "x", "",
+ '@', "xmlns", "jabber:x:delay",
+ '@', "stamp", "20070927T13:24:14",
+ ')',
+ '(', "time", "",
+ '@', "xmlns", "google:timestamp",
+ '@', "ms", "1190899454656",
+ ')',
+ NULL);
+ ret = gabble_text_mixin_parse_incoming_message (
+ msg, &from, &stamp, &type, &body, &state, &send_error);
+ g_assert (ret == TRUE);
+ g_assert (0 == strcmp (from, "foo@bar.com"));
+ g_assert (stamp == 1190899454);
+ g_assert (type == TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL);
+ g_assert (0 == strcmp(body, "hello"));
+ g_assert (state == -1);
+ g_assert (send_error == GABBLE_TEXT_CHANNEL_SEND_NO_ERROR);
+ lm_message_unref (msg);
+ return TRUE;
+}
+
int
main (void)
{
@@ -133,6 +170,7 @@ main (void)
g_assert (test2 ());
g_assert (test3 ());
g_assert (test_error ());
+ g_assert (test_google_offline ());
return 0;
}