summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2010-02-16 14:11:16 +1100
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2010-02-16 14:11:16 +1100
commitd4888a59a2abcea30c043bd17068dcb799b25a2f (patch)
treee199cc0bd8c6cd80a6a4c2441bbf407dcc347005
parentc06e7c7633386534324cf1f75a3a82a44ad3f095 (diff)
downloadtelepathy-logger-d4888a59a2abcea30c043bd17068dcb799b25a2f.tar.gz
Update spec for int64 timestamps, correct dbus-service types
Also plug a leak due to incorrect usage of tp_value_array_build
-rw-r--r--extensions/Logger.xml10
-rw-r--r--extensions/all.xml2
-rw-r--r--telepathy-logger/dbus-service.c22
3 files changed, 19 insertions, 15 deletions
diff --git a/extensions/Logger.xml b/extensions/Logger.xml
index 5abe60f..1695690 100644
--- a/extensions/Logger.xml
+++ b/extensions/Logger.xml
@@ -39,7 +39,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</
</tp:docstring>
</tp:member>
- <tp:member type="u" name="Timestamp">
+ <tp:member type="x" name="Timestamp" tp:type="Unix_Timestamp64">
<tp:docstring xmlns="http://www.w3.org/1999/xhtml">
Unix timestamp for the log entry
</tp:docstring>
@@ -69,7 +69,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</
<arg direction="in" name="Is_Chatroom" type="b">
<tp:docstring>
- Whether the conversation is a chatroom (i.e., XMMP's MUC) or not
+ Whether the conversation is a chatroom (i.e., XMPP MUC) or not
</tp:docstring>
</arg>
@@ -77,12 +77,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</
<tp:docstring>
how many entries will be returned.
- NOTE: to retreive information that would generate hight traffic, use
- the library API approach instead of DBbus.
+ NOTE: to retreive information that would generate high traffic, use
+ the library API approach instead of DBus.
</tp:docstring>
</arg>
- <arg direction="out" name="Messages" type="a(ssu)"
+ <arg direction="out" name="Messages" type="a(ssx)"
tp:type="Chat_Message[]" />
<tp:docstring>
diff --git a/extensions/all.xml b/extensions/all.xml
index 6c7af8e..cff8af8 100644
--- a/extensions/all.xml
+++ b/extensions/all.xml
@@ -25,6 +25,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</p>
<tp:generic-types>
<tp:external-type name="Account" type="o"
from="Telepathy specification"/>
+ <tp:external-type name="Unix_Timestamp64" type="x"
+ from="Telepathy specification"/>
</tp:generic-types>
<xi:include href="Logger.xml"/>
diff --git a/telepathy-logger/dbus-service.c b/telepathy-logger/dbus-service.c
index 1a7023d..e3d2c7e 100644
--- a/telepathy-logger/dbus-service.c
+++ b/telepathy-logger/dbus-service.c
@@ -77,7 +77,7 @@ tpl_dbus_service_new (void)
static GPtrArray *
-tpl_assu_marshal (GList *data)
+tpl_chat_message_marshal (GList *data)
{
guint idx;
GList *data_ptr;
@@ -85,18 +85,18 @@ tpl_assu_marshal (GList *data)
retval = g_ptr_array_new_with_free_func ((GDestroyNotify) g_value_array_free);
- DEBUG ("Marshalled a(ssu) data:");
+ DEBUG ("Marshalled a(ssx) data:");
+
for (idx = 0, data_ptr = data;
data_ptr != NULL;
data_ptr = g_list_next (data_ptr), ++idx)
{
TplLogEntry *log = data_ptr->data;
-
- gchar *message = g_strdup (tpl_log_entry_text_get_message (
- TPL_LOG_ENTRY_TEXT (log)));
- gchar *sender = g_strdup (tpl_contact_get_identifier (
- tpl_log_entry_text_get_sender (TPL_LOG_ENTRY_TEXT (log))));
- guint timestamp = tpl_log_entry_get_timestamp (log);
+ const gchar *message = tpl_log_entry_text_get_message (
+ TPL_LOG_ENTRY_TEXT (log));
+ const gchar *sender = tpl_contact_get_identifier (
+ tpl_log_entry_text_get_sender (TPL_LOG_ENTRY_TEXT (log)));
+ gint64 timestamp = tpl_log_entry_get_timestamp (log);
g_ptr_array_add (retval, tp_value_array_build (3,
G_TYPE_STRING, sender,
@@ -104,8 +104,10 @@ tpl_assu_marshal (GList *data)
G_TYPE_INT64, timestamp,
G_TYPE_INVALID));
- DEBUG ("%d = %s / %s / %d", idx, sender, message, timestamp);
+ DEBUG ("%d = %s / %s / %" G_GINT64_FORMAT,
+ idx, sender, message, timestamp);
}
+
return retval;
}
@@ -185,7 +187,7 @@ tpl_dbus_service_get_recent_messages (TplSvcLogger *self,
g_list_foreach (dates, (GFunc) g_free, NULL);
g_list_free (dates);
- packed = tpl_assu_marshal (ret);
+ packed = tpl_chat_message_marshal (ret);
g_list_foreach (ret, (GFunc) g_object_unref, NULL);
g_list_free (ret);