summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Alfarano <cosimo.alfarano@collabora.co.uk>2010-02-23 10:57:14 +0000
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2010-02-25 11:28:38 +1100
commit7aaf7c0092c18e902fb841a759af109f74e90b30 (patch)
tree916ba5ebb7de90a0d05739cce94d09fb0ccbf907
parent89d4e4c209f9816e695fd3e24a42be045d18504c (diff)
downloadtelepathy-logger-7aaf7c0092c18e902fb841a759af109f74e90b30.tar.gz
Fixed a bug with tpl_log_entry_set_chat_id at construct time
Now it's not a G_PROP_CONSTRUCT property anymore and tpl_log_entry_text_new does now need chat_id anymore. This way the default value for chat-id is NULL, unless differently set.
-rw-r--r--telepathy-logger/channel-text.c13
-rw-r--r--telepathy-logger/log-entry-text.c2
-rw-r--r--telepathy-logger/log-entry-text.h3
-rw-r--r--telepathy-logger/log-entry.c15
-rw-r--r--telepathy-logger/log-store-empathy.c3
-rw-r--r--tests/test-tpl-log-entry.c2
6 files changed, 11 insertions, 27 deletions
diff --git a/telepathy-logger/channel-text.c b/telepathy-logger/channel-text.c
index ce28ff6..babbac1 100644
--- a/telepathy-logger/channel-text.c
+++ b/telepathy-logger/channel-text.c
@@ -771,9 +771,10 @@ on_sent_signal_cb (TpChannel *proxy,
account_path = tp_proxy_get_object_path (
TP_PROXY (tpl_channel_get_account (TPL_CHANNEL (tpl_text))));
- log = tpl_log_entry_text_new (arg_Timestamp, account_path, chat_id,
+ log = tpl_log_entry_text_new (arg_Timestamp, account_path,
TPL_LOG_ENTRY_DIRECTION_OUT);
+ tpl_log_entry_text_set_chat_id (log, chat_id);
tpl_log_entry_text_set_timestamp (log, (time_t) arg_Timestamp);
tpl_log_entry_text_set_signal_type (log, TPL_LOG_ENTRY_TEXT_SIGNAL_SENT);
tpl_log_entry_text_set_sender (log, tpl_contact_sender);
@@ -858,7 +859,6 @@ keepon_on_receiving_signal (TplLogEntryText *log)
TplContact *tpl_contact_receiver;
TpContact *remote;
TpContact *local;
- const gchar *chat_id;
g_return_if_fail (TPL_IS_LOG_ENTRY_TEXT (log));
@@ -882,11 +882,12 @@ keepon_on_receiving_signal (TplLogEntryText *log)
/* Initialise LogStore and store the message */
if (!tpl_channel_text_is_chatroom (tpl_text))
- chat_id = tpl_contact_get_identifier (tpl_contact_sender);
+ tpl_log_entry_text_set_chat_id (log, tpl_contact_get_identifier (
+ tpl_contact_sender));
else
- chat_id = tpl_channel_text_get_chatroom_id (tpl_text);
+ tpl_log_entry_text_set_chat_id (log, tpl_channel_text_get_chatroom_id (
+ tpl_text));
- tpl_log_entry_text_set_chat_id (log, chat_id);
tpl_log_entry_text_set_chatroom (log,
tpl_channel_text_is_chatroom (tpl_text));
@@ -935,7 +936,7 @@ on_received_signal_cb (TpChannel *proxy,
}
/* Initialize TplLogEntryText (part 1) - chat_id still unknown */
- log = tpl_log_entry_text_new (arg_ID, account_path, NULL,
+ log = tpl_log_entry_text_new (arg_ID, account_path,
TPL_LOG_ENTRY_DIRECTION_IN);
tpl_log_entry_text_set_tpl_channel_text (log, tpl_text);
diff --git a/telepathy-logger/log-entry-text.c b/telepathy-logger/log-entry-text.c
index d9d50f1..830ea94 100644
--- a/telepathy-logger/log-entry-text.c
+++ b/telepathy-logger/log-entry-text.c
@@ -179,13 +179,11 @@ tpl_log_entry_text_init (TplLogEntryText * self)
TplLogEntryText *
tpl_log_entry_text_new (guint log_id,
const gchar *account_path,
- const gchar *chat_id,
TplLogEntryDirection direction)
{
return g_object_new (TPL_TYPE_LOG_ENTRY_TEXT,
"log-id", log_id,
"account-path", account_path,
- "chat-id", chat_id,
"direction", direction,
NULL);
}
diff --git a/telepathy-logger/log-entry-text.h b/telepathy-logger/log-entry-text.h
index c0f474c..fe56a37 100644
--- a/telepathy-logger/log-entry-text.h
+++ b/telepathy-logger/log-entry-text.h
@@ -65,8 +65,7 @@ typedef struct
GType tpl_log_entry_text_get_type (void);
TplLogEntryText *tpl_log_entry_text_new (guint log_id,
- const gchar *account_path, const gchar *chat_id,
- TplLogEntryDirection direction);
+ const gchar *account_path, TplLogEntryDirection direction);
TpChannelTextMessageType tpl_log_entry_text_message_type_from_str (
const gchar *type_str);
diff --git a/telepathy-logger/log-entry.c b/telepathy-logger/log-entry.c
index ff96b89..88caee0 100644
--- a/telepathy-logger/log-entry.c
+++ b/telepathy-logger/log-entry.c
@@ -256,7 +256,7 @@ tpl_log_entry_class_init (TplLogEntryClass *klass)
"ChatId",
"The chat identifier to which the log entry is related.",
NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_CHAT_ID, param_spec);
param_spec = g_param_spec_string ("account-path",
@@ -291,19 +291,6 @@ tpl_log_entry_init (TplLogEntry *self)
}
-TplLogEntry *
-tpl_log_entry_new (guint log_id,
- const gchar *chat_id,
- TplLogEntryDirection direction)
-{
- return g_object_new (TPL_TYPE_LOG_ENTRY,
- "log-id", log_id,
- "chat-id", chat_id,
- "direction", direction,
- NULL);
-}
-
-
gint64
tpl_log_entry_get_timestamp (TplLogEntry *self)
{
diff --git a/telepathy-logger/log-store-empathy.c b/telepathy-logger/log-store-empathy.c
index 74ecfe1..14ce05f 100644
--- a/telepathy-logger/log-store-empathy.c
+++ b/telepathy-logger/log-store-empathy.c
@@ -842,8 +842,7 @@ log_store_empathy_get_messages_for_file (TplLogStore *self,
tpl_contact_set_avatar_token (sender, sender_avatar_token);
message = tpl_log_entry_text_new (cm_id,
- tp_proxy_get_object_path (account), NULL,
- TPL_LOG_ENTRY_DIRECTION_NONE);
+ tp_proxy_get_object_path (account), TPL_LOG_ENTRY_DIRECTION_NONE);
tpl_log_entry_set_sender (TPL_LOG_ENTRY (message), sender);
tpl_log_entry_set_timestamp (TPL_LOG_ENTRY (message), t);
tpl_log_entry_text_set_message (message, body);
diff --git a/tests/test-tpl-log-entry.c b/tests/test-tpl-log-entry.c
index 68d5357..355dd34 100644
--- a/tests/test-tpl-log-entry.c
+++ b/tests/test-tpl-log-entry.c
@@ -13,7 +13,7 @@ int main (int argc, char **argv)
g_type_init ();
- log = tpl_log_entry_text_new (LOG_ID, ACCOUNT_PATH, CHAT_ID, DIRECTION);
+ log = tpl_log_entry_text_new (LOG_ID, ACCOUNT_PATH, DIRECTION);
return 0;