aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-message.c
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-05-18 10:51:43 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-06-12 14:56:34 +0800
commit29ab54db065d7753aebd5501680fb91049011fce (patch)
tree692ae3548096bb453489e6a9e204dc460369874c /libempathy/empathy-message.c
parentcdcd685e0ced11bc3bcae0a641d656be052bd343 (diff)
downloadgsoc2013-empathy-29ab54db065d7753aebd5501680fb91049011fce.tar
gsoc2013-empathy-29ab54db065d7753aebd5501680fb91049011fce.tar.gz
gsoc2013-empathy-29ab54db065d7753aebd5501680fb91049011fce.tar.bz2
gsoc2013-empathy-29ab54db065d7753aebd5501680fb91049011fce.tar.lz
gsoc2013-empathy-29ab54db065d7753aebd5501680fb91049011fce.tar.xz
gsoc2013-empathy-29ab54db065d7753aebd5501680fb91049011fce.tar.zst
gsoc2013-empathy-29ab54db065d7753aebd5501680fb91049011fce.zip
Add 'token' property to EmpathyMessage
This allows us to pass the 'message-token' from the TpMessage through to the chat-view.
Diffstat (limited to 'libempathy/empathy-message.c')
-rw-r--r--libempathy/empathy-message.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c
index d30ce3645..79625dd61 100644
--- a/libempathy/empathy-message.c
+++ b/libempathy/empathy-message.c
@@ -49,6 +49,7 @@ typedef struct {
TpChannelTextMessageType type;
EmpathyContact *sender;
EmpathyContact *receiver;
+ gchar *token;
gchar *body;
gint64 timestamp;
gboolean is_backlog;
@@ -74,6 +75,7 @@ enum {
PROP_TYPE,
PROP_SENDER,
PROP_RECEIVER,
+ PROP_TOKEN,
PROP_BODY,
PROP_TIMESTAMP,
PROP_IS_BACKLOG,
@@ -117,6 +119,13 @@ empathy_message_class_init (EmpathyMessageClass *class)
EMPATHY_TYPE_CONTACT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
+ PROP_TOKEN,
+ g_param_spec_string ("token",
+ "Message Token",
+ "The message-token",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (object_class,
PROP_BODY,
g_param_spec_string ("body",
"Message Body",
@@ -201,6 +210,7 @@ empathy_message_finalize (GObject *object)
g_object_unref (priv->tp_message);
}
+ g_free (priv->token);
g_free (priv->body);
G_OBJECT_CLASS (empathy_message_parent_class)->finalize (object);
@@ -226,6 +236,9 @@ message_get_property (GObject *object,
case PROP_RECEIVER:
g_value_set_object (value, priv->receiver);
break;
+ case PROP_TOKEN:
+ g_value_set_string (value, priv->token);
+ break;
case PROP_BODY:
g_value_set_string (value, priv->body);
break;
@@ -272,6 +285,10 @@ message_set_property (GObject *object,
empathy_message_set_receiver (EMPATHY_MESSAGE (object),
EMPATHY_CONTACT (g_value_get_object (value)));
break;
+ case PROP_TOKEN:
+ g_assert (priv->token == NULL); /* construct only */
+ priv->token = g_value_dup_string (value);
+ break;
case PROP_BODY:
g_assert (priv->body == NULL); /* construct only */
priv->body = g_value_dup_string (value);
@@ -473,6 +490,18 @@ empathy_message_set_receiver (EmpathyMessage *message, EmpathyContact *contact)
}
const gchar *
+empathy_message_get_token (EmpathyMessage *message)
+{
+ EmpathyMessagePriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), NULL);
+
+ priv = GET_PRIV (message);
+
+ return priv->token;
+}
+
+const gchar *
empathy_message_get_body (EmpathyMessage *message)
{
EmpathyMessagePriv *priv;
@@ -668,6 +697,7 @@ empathy_message_new_from_tp_message (TpMessage *tp_msg,
message = g_object_new (EMPATHY_TYPE_MESSAGE,
"body", body,
+ "token", tp_message_get_token (tp_msg),
"type", tp_message_get_message_type (tp_msg),
"timestamp", tp_message_get_received_timestamp (tp_msg),
"flags", flags,