summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--telepathy-logger/channel-text.c10
-rw-r--r--telepathy-logger/entry-text-internal.h2
-rw-r--r--telepathy-logger/entry-text.c4
-rw-r--r--telepathy-logger/entry.c51
-rw-r--r--telepathy-logger/entry.h2
-rw-r--r--telepathy-logger/log-store-xml.c3
6 files changed, 28 insertions, 44 deletions
diff --git a/telepathy-logger/channel-text.c b/telepathy-logger/channel-text.c
index a41b4d1..46afad9 100644
--- a/telepathy-logger/channel-text.c
+++ b/telepathy-logger/channel-text.c
@@ -1120,7 +1120,7 @@ on_sent_signal_cb (TpChannel *proxy,
TplEntry *log;
TplLogManager *logmanager;
const gchar *chat_id;
- const gchar *account_path;
+ TpAccount *account;
const gchar *channel_path;
gchar *log_id;
@@ -1169,10 +1169,9 @@ on_sent_signal_cb (TpChannel *proxy,
else
chat_id = _tpl_channel_text_get_chatroom_id (tpl_text);
- account_path = tp_proxy_get_object_path (
- TP_PROXY (_tpl_channel_get_account (TPL_CHANNEL (tpl_text))));
+ account = _tpl_channel_get_account (TPL_CHANNEL (tpl_text));
- text_log = _tpl_entry_text_new (log_id, account_path,
+ text_log = _tpl_entry_text_new (log_id, account,
TPL_ENTRY_DIRECTION_OUT);
log = TPL_ENTRY (text_log);
@@ -1341,7 +1340,6 @@ on_received_signal_cb (TpChannel *proxy,
TplEntry *log;
TpAccount *account = _tpl_channel_get_account (TPL_CHANNEL (tpl_text));
TplLogStore *index = _tpl_log_store_sqlite_dup ();
- const gchar *account_path = tp_proxy_get_object_path (TP_PROXY (account));
const gchar *channel_path = tp_proxy_get_object_path (TP_PROXY (tpl_text));
gchar *log_id = _tpl_create_message_token (channel_path, arg_Timestamp, arg_ID);
@@ -1380,7 +1378,7 @@ on_received_signal_cb (TpChannel *proxy,
}
/* Initialize TplEntryText (part 1) - chat_id still unknown */
- text_log = _tpl_entry_text_new (log_id, account_path,
+ text_log = _tpl_entry_text_new (log_id, account,
TPL_ENTRY_DIRECTION_IN);
log = TPL_ENTRY (text_log);
diff --git a/telepathy-logger/entry-text-internal.h b/telepathy-logger/entry-text-internal.h
index 6e74477..08d53ba 100644
--- a/telepathy-logger/entry-text-internal.h
+++ b/telepathy-logger/entry-text-internal.h
@@ -53,7 +53,7 @@ struct _TplEntryTextClass
};
TplEntryText * _tpl_entry_text_new (const gchar* log_id,
- const gchar *account_path,
+ TpAccount *account,
TplEntryDirection direction);
TpChannelTextMessageType _tpl_entry_text_message_type_from_str (
diff --git a/telepathy-logger/entry-text.c b/telepathy-logger/entry-text.c
index b0e4a5a..69d2503 100644
--- a/telepathy-logger/entry-text.c
+++ b/telepathy-logger/entry-text.c
@@ -220,12 +220,12 @@ tpl_entry_text_init (TplEntryText *self)
TplEntryText *
_tpl_entry_text_new (const gchar *log_id,
- const gchar *account_path,
+ TpAccount *account,
TplEntryDirection direction)
{
return g_object_new (TPL_TYPE_ENTRY_TEXT,
"log-id", log_id,
- "account-path", account_path,
+ "account", account,
"direction", direction,
NULL);
}
diff --git a/telepathy-logger/entry.c b/telepathy-logger/entry.c
index 2152307..040f0af 100644
--- a/telepathy-logger/entry.c
+++ b/telepathy-logger/entry.c
@@ -23,7 +23,6 @@
#include "entry-internal.h"
#include <glib.h>
-#include <telepathy-glib/util.h>
#define DEBUG_FLAG TPL_DEBUG_ENTRY
#include <telepathy-logger/debug-internal.h>
@@ -76,8 +75,6 @@
G_DEFINE_ABSTRACT_TYPE (TplEntry, tpl_entry, G_TYPE_OBJECT)
static void tpl_entry_set_log_id (TplEntry *self, const gchar *data);
-static void tpl_entry_set_account_path (TplEntry *self,
- const gchar *data);
struct _TplEntryPriv
{
@@ -85,7 +82,7 @@ struct _TplEntryPriv
gint64 timestamp;
TplEntrySignalType signal_type;
gchar *chat_id;
- gchar *account_path;
+ TpAccount *account;
gchar *channel_path;
/* incoming/outgoing */
@@ -102,7 +99,7 @@ enum {
PROP_LOG_ID,
PROP_DIRECTION,
PROP_CHAT_ID,
- PROP_ACCOUNT_PATH,
+ PROP_ACCOUNT,
PROP_CHANNEL_PATH,
PROP_SENDER,
PROP_RECEIVER
@@ -117,8 +114,8 @@ tpl_entry_finalize (GObject *obj)
g_free (priv->chat_id);
priv->chat_id = NULL;
- g_free (priv->account_path);
- priv->account_path = NULL;
+
+ tp_clear_object (&priv->account);
G_OBJECT_CLASS (tpl_entry_parent_class)->finalize (obj);
}
@@ -168,8 +165,8 @@ tpl_entry_get_property (GObject *object,
case PROP_CHAT_ID:
g_value_set_string (value, priv->chat_id);
break;
- case PROP_ACCOUNT_PATH:
- g_value_set_string (value, priv->account_path);
+ case PROP_ACCOUNT:
+ g_value_set_object (value, priv->account);
break;
case PROP_CHANNEL_PATH:
g_value_set_string (value, priv->channel_path);
@@ -208,8 +205,8 @@ tpl_entry_set_property (GObject *object,
case PROP_CHAT_ID:
_tpl_entry_set_chat_id (self, g_value_get_string (value));
break;
- case PROP_ACCOUNT_PATH:
- tpl_entry_set_account_path (self, g_value_get_string (value));
+ case PROP_ACCOUNT:
+ self->priv->account = g_value_dup_object (value);
break;
case PROP_CHANNEL_PATH:
_tpl_entry_set_channel_path (self, g_value_get_string (value));
@@ -276,12 +273,12 @@ tpl_entry_class_init (TplEntryClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_CHAT_ID, param_spec);
- param_spec = g_param_spec_string ("account-path",
- "AccountPath",
- "The account path of the TpAccount to which the log entry is related",
- NULL,
+ param_spec = g_param_spec_object ("account",
+ "TpAccount",
+ "The TpAccount to which the log entry is related",
+ TP_TYPE_ACCOUNT,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (object_class, PROP_ACCOUNT_PATH, param_spec);
+ g_object_class_install_property (object_class, PROP_ACCOUNT, param_spec);
param_spec = g_param_spec_string ("channel-path",
"ChannelPath",
@@ -396,17 +393,19 @@ _tpl_entry_get_chat_id (TplEntry *self)
/**
- * tpl_entry_get_account_path
+ * tpl_entry_get_account
* @self: a #TplEntry
*
- * Returns: the same path as the #TplEntry:account-path property
+ * <!-- no more to say -->
+ *
+ * Returns: the path as the #TplEntry:account property
*/
const gchar *
tpl_entry_get_account_path (TplEntry *self)
{
g_return_val_if_fail (TPL_IS_ENTRY (self), NULL);
- return self->priv->account_path;
+ return tp_proxy_get_object_path (self->priv->account);
}
@@ -523,20 +522,6 @@ _tpl_entry_set_chat_id (TplEntry *self,
g_object_notify (G_OBJECT (self), "chat-id");
}
-
-static void
-tpl_entry_set_account_path (TplEntry *self,
- const gchar *data)
-{
- g_return_if_fail (TPL_IS_ENTRY (self));
- g_return_if_fail (!TPL_STR_EMPTY (data));
- g_return_if_fail (self->priv->account_path == NULL);
-
- self->priv->account_path = g_strdup (data);
- g_object_notify (G_OBJECT (self), "account-path");
-}
-
-
void
_tpl_entry_set_channel_path (TplEntry *self,
const gchar *data)
diff --git a/telepathy-logger/entry.h b/telepathy-logger/entry.h
index 87667eb..188866f 100644
--- a/telepathy-logger/entry.h
+++ b/telepathy-logger/entry.h
@@ -24,6 +24,8 @@
#include <glib-object.h>
+#include <telepathy-glib/telepathy-glib.h>
+
#include <telepathy-logger/entity.h>
G_BEGIN_DECLS
diff --git a/telepathy-logger/log-store-xml.c b/telepathy-logger/log-store-xml.c
index aec2a0a..cbe5cf2 100644
--- a/telepathy-logger/log-store-xml.c
+++ b/telepathy-logger/log-store-xml.c
@@ -879,8 +879,7 @@ log_store_xml_get_messages_for_file (TplLogStoreXml *self,
g_free (instead_of_channel_path);
}
- message = _tpl_entry_text_new (log_id,
- tp_proxy_get_object_path (account), TPL_ENTRY_DIRECTION_NONE);
+ message = _tpl_entry_text_new (log_id, account, TPL_ENTRY_DIRECTION_NONE);
_tpl_entry_text_set_pending_msg_id (TPL_ENTRY_TEXT (message),
pending_id);