[empathy: 1/19] Add 'token' property to EmpathyMessage
- From: Danielle Madeley <daniellem src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy: 1/19] Add 'token' property to EmpathyMessage
- Date: Mon, 20 Jun 2011 10:08:00 +0000 (UTC)
commit 29ab54db065d7753aebd5501680fb91049011fce
Author: Danielle Madeley <danielle madeley collabora co uk>
Date: Wed May 18 12:51:43 2011 +1000
Add 'token' property to EmpathyMessage
This allows us to pass the 'message-token' from the TpMessage through to the
chat-view.
libempathy/empathy-message.c | 30 ++++++++++++++++++++++++++++++
libempathy/empathy-message.h | 1 +
2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c
index d30ce36..79625dd 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,
diff --git a/libempathy/empathy-message.h b/libempathy/empathy-message.h
index b20ceca..f6c57ed 100644
--- a/libempathy/empathy-message.h
+++ b/libempathy/empathy-message.h
@@ -69,6 +69,7 @@ EmpathyContact * empathy_message_get_receiver (EmpathyMessage
void empathy_message_set_receiver (EmpathyMessage *message,
EmpathyContact *contact);
const gchar * empathy_message_get_body (EmpathyMessage *message);
+const gchar * empathy_message_get_token (EmpathyMessage *message);
gint64 empathy_message_get_timestamp (EmpathyMessage *message);
gboolean empathy_message_is_backlog (EmpathyMessage *message);
gboolean empathy_message_is_incoming (EmpathyMessage *message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]