aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2011-02-24 18:17:15 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-02-25 01:09:23 +0800
commit67920cae23f4b8020559d7548fd1dff8de44e962 (patch)
treed9784819ef3db4a959030020e0c646902441bb39 /libempathy
parent677a6bf7fca3ce8e26cf02d36c2721fa03510a4d (diff)
downloadgsoc2013-empathy-67920cae23f4b8020559d7548fd1dff8de44e962.tar
gsoc2013-empathy-67920cae23f4b8020559d7548fd1dff8de44e962.tar.gz
gsoc2013-empathy-67920cae23f4b8020559d7548fd1dff8de44e962.tar.bz2
gsoc2013-empathy-67920cae23f4b8020559d7548fd1dff8de44e962.tar.lz
gsoc2013-empathy-67920cae23f4b8020559d7548fd1dff8de44e962.tar.xz
gsoc2013-empathy-67920cae23f4b8020559d7548fd1dff8de44e962.tar.zst
gsoc2013-empathy-67920cae23f4b8020559d7548fd1dff8de44e962.zip
Port empathy to Telepathy logger 0.2.0
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-contact.c9
-rw-r--r--libempathy/empathy-message.c30
-rw-r--r--libempathy/empathy-message.h4
3 files changed, 23 insertions, 20 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 0547ef82d..73539b406 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -1161,12 +1161,17 @@ static gboolean
contact_has_log (EmpathyContact *contact)
{
TplLogManager *manager;
+ TplEntity *entity;
gboolean have_log;
manager = tpl_log_manager_dup_singleton ();
+ entity = tpl_entity_new (empathy_contact_get_id (contact),
+ TPL_ENTITY_CONTACT, NULL, NULL);
+
have_log = tpl_log_manager_exists (manager,
- empathy_contact_get_account (contact), empathy_contact_get_id (contact),
- FALSE);
+ empathy_contact_get_account (contact), entity, TPL_EVENT_MASK_TEXT);
+
+ g_object_unref (entity);
g_object_unref (manager);
return have_log;
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c
index ca3b020ac..e194573db 100644
--- a/libempathy/empathy-message.c
+++ b/libempathy/empathy-message.c
@@ -31,8 +31,8 @@
#include <telepathy-glib/account-manager.h>
#include <telepathy-logger/entity.h>
-#include <telepathy-logger/entry.h>
-#include <telepathy-logger/entry-text.h>
+#include <telepathy-logger/event.h>
+#include <telepathy-logger/text-event.h>
#include "empathy-message.h"
#include "empathy-utils.h"
@@ -259,7 +259,7 @@ empathy_message_new (const gchar *body)
}
EmpathyMessage *
-empathy_message_from_tpl_log_entry (TplEntry *logentry)
+empathy_message_from_tpl_log_event (TplEvent *logevent)
{
EmpathyMessage *retval = NULL;
TpAccountManager *acc_man = NULL;
@@ -269,7 +269,7 @@ empathy_message_from_tpl_log_entry (TplEntry *logentry)
gchar *body= NULL;
EmpathyContact *contact;
- g_return_val_if_fail (TPL_IS_ENTRY (logentry), NULL);
+ g_return_val_if_fail (TPL_IS_EVENT (logevent), NULL);
acc_man = tp_account_manager_dup ();
/* FIXME Currently Empathy shows in the log viewer only valid accounts, so it
@@ -284,24 +284,24 @@ empathy_message_from_tpl_log_entry (TplEntry *logentry)
* needed anymore any TpAccount passing and the following call will be
* useless */
account = tp_account_manager_ensure_account (acc_man,
- tpl_entry_get_account_path (logentry));
+ tpl_event_get_account_path (logevent));
g_object_unref (acc_man);
- /* TODO Currently only TplLogEntryText exists as subclass of TplEntry, in
- * future more TplEntry will exist and EmpathyMessage should probably
- * be enhanced to support other types of log entries (ie TplLogEntryCall).
+ /* TODO Currently only TplTextEvent exists as subclass of TplEvent, in
+ * future more TplEvent will exist and EmpathyMessage should probably
+ * be enhanced to support other types of log entries (ie TplCallEvent).
*
* For now we just check (simply) that we are dealing with the only supported type,
* then there will be a if/then/else or switch handling all the supported
* cases.
*/
- if (!TPL_IS_ENTRY_TEXT (logentry))
+ if (!TPL_IS_TEXT_EVENT (logevent))
return NULL;
- body = g_strdup (tpl_entry_text_get_message (
- TPL_ENTRY_TEXT (logentry)));
- receiver = tpl_entry_get_receiver (logentry);
- sender = tpl_entry_get_sender (logentry);
+ body = g_strdup (tpl_text_event_get_message (
+ TPL_TEXT_EVENT (logevent)));
+ receiver = tpl_event_get_receiver (logevent);
+ sender = tpl_event_get_sender (logevent);
retval = empathy_message_new (body);
if (receiver != NULL) {
@@ -317,9 +317,7 @@ empathy_message_from_tpl_log_entry (TplEntry *logentry)
}
empathy_message_set_timestamp (retval,
- tpl_entry_get_timestamp (logentry));
- empathy_message_set_id (retval,
- tpl_entry_text_get_pending_msg_id (TPL_ENTRY_TEXT (logentry)));
+ tpl_event_get_timestamp (logevent));
empathy_message_set_is_backlog (retval, TRUE);
g_free (body);
diff --git a/libempathy/empathy-message.h b/libempathy/empathy-message.h
index b7a63f81e..1db0eff60 100644
--- a/libempathy/empathy-message.h
+++ b/libempathy/empathy-message.h
@@ -26,7 +26,7 @@
#define __EMPATHY_MESSAGE_H__
#include <glib-object.h>
-#include <telepathy-logger/entry.h>
+#include <telepathy-logger/event.h>
#include "empathy-contact.h"
#include "empathy-time.h"
@@ -54,7 +54,7 @@ struct _EmpathyMessageClass {
GType empathy_message_get_type (void) G_GNUC_CONST;
EmpathyMessage * empathy_message_new (const gchar *body);
-EmpathyMessage * empathy_message_from_tpl_log_entry (TplEntry *logentry);
+EmpathyMessage * empathy_message_from_tpl_log_event (TplEvent *logevent);
TpChannelTextMessageType empathy_message_get_tptype (EmpathyMessage *message);
void empathy_message_set_tptype (EmpathyMessage *message,
TpChannelTextMessageType type);