diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.co.uk> | 2011-02-24 18:17:15 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-02-25 01:09:23 +0800 |
commit | 67920cae23f4b8020559d7548fd1dff8de44e962 (patch) | |
tree | d9784819ef3db4a959030020e0c646902441bb39 | |
parent | 677a6bf7fca3ce8e26cf02d36c2721fa03510a4d (diff) | |
download | gsoc2013-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
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 37 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-menu.c | 11 | ||||
-rw-r--r-- | libempathy-gtk/empathy-log-window.c | 197 | ||||
-rw-r--r-- | libempathy/empathy-contact.c | 9 | ||||
-rw-r--r-- | libempathy/empathy-message.c | 30 | ||||
-rw-r--r-- | libempathy/empathy-message.h | 4 |
7 files changed, 144 insertions, 146 deletions
diff --git a/configure.ac b/configure.ac index 5ed244683..50c0ccce2 100644 --- a/configure.ac +++ b/configure.ac @@ -41,7 +41,7 @@ LIBCANBERRA_GTK_REQUIRED=0.25 LIBNOTIFY_REQUIRED=0.7.0 TELEPATHY_FARSIGHT_REQUIRED=0.0.14 TELEPATHY_GLIB_REQUIRED=0.13.14 -TELEPATHY_LOGGER=0.1.5 +TELEPATHY_LOGGER=0.2.0 # Optional deps CLUTTER_GTK_REQUIRED=0.90.3 diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index cb9ceb31f..77eac12fe 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -2040,7 +2040,7 @@ chat_input_populate_popup_cb (GtkTextView *view, static gboolean -chat_log_filter (TplEntry *log, +chat_log_filter (TplEvent *log, gpointer user_data) { EmpathyChat *chat = user_data; @@ -2048,11 +2048,11 @@ chat_log_filter (TplEntry *log, EmpathyChatPriv *priv = GET_PRIV (chat); const GList *pending; - g_return_val_if_fail (TPL_IS_ENTRY (log), FALSE); + g_return_val_if_fail (TPL_IS_EVENT (log), FALSE); g_return_val_if_fail (EMPATHY_IS_CHAT (chat), FALSE); pending = empathy_tp_chat_get_pending_messages (priv->tp_chat); - message = empathy_message_from_tpl_log_entry (log); + message = empathy_message_from_tpl_log_event (log); for (; pending; pending = g_list_next (pending)) { if (empathy_message_equal (message, pending->data)) { @@ -2099,7 +2099,7 @@ got_filtered_messages_cb (GObject *manager, EmpathyChatPriv *priv = GET_PRIV (chat); GError *error = NULL; - if (!tpl_log_manager_get_filtered_messages_finish (TPL_LOG_MANAGER (manager), + if (!tpl_log_manager_get_filtered_events_finish (TPL_LOG_MANAGER (manager), result, &messages, &error)) { DEBUG ("%s. Aborting.", error->message); empathy_chat_view_append_event (chat->view, @@ -2110,9 +2110,9 @@ got_filtered_messages_cb (GObject *manager, for (l = messages; l; l = g_list_next (l)) { EmpathyMessage *message; - g_assert (TPL_IS_ENTRY (l->data)); + g_assert (TPL_IS_EVENT (l->data)); - message = empathy_message_from_tpl_log_entry (l->data); + message = empathy_message_from_tpl_log_event (l->data); g_object_unref (l->data); empathy_chat_view_append_message (chat->view, message); @@ -2138,7 +2138,7 @@ static void chat_add_logs (EmpathyChat *chat) { EmpathyChatPriv *priv = GET_PRIV (chat); - gboolean is_chatroom; + TplEntity *target; if (!priv->id) { return; @@ -2148,18 +2148,21 @@ chat_add_logs (EmpathyChat *chat) empathy_chat_view_scroll (chat->view, FALSE); /* Add messages from last conversation */ - is_chatroom = priv->handle_type == TP_HANDLE_TYPE_ROOM; + if (priv->handle_type == TP_HANDLE_TYPE_ROOM) + target = tpl_entity_new_from_room_id (priv->id); + else + target = tpl_entity_new (priv->id, TPL_ENTITY_CONTACT, NULL, NULL); priv->retrieving_backlogs = TRUE; - tpl_log_manager_get_filtered_messages_async (priv->log_manager, - priv->account, - priv->id, - is_chatroom, - 5, - chat_log_filter, - chat, - got_filtered_messages_cb, - (gpointer) chat); + tpl_log_manager_get_filtered_events_async (priv->log_manager, + priv->account, + target, + TPL_EVENT_MASK_TEXT, + 5, + chat_log_filter, + chat, + got_filtered_messages_cb, + (gpointer) chat); } static gint diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c index cff1bf4e5..3bf415746 100644 --- a/libempathy-gtk/empathy-contact-menu.c +++ b/libempathy-gtk/empathy-contact-menu.c @@ -317,6 +317,7 @@ GtkWidget * empathy_contact_log_menu_item_new (EmpathyContact *contact) { TplLogManager *manager; + TplEntity *entity; gboolean have_log; GtkWidget *item; GtkWidget *image; @@ -324,11 +325,15 @@ empathy_contact_log_menu_item_new (EmpathyContact *contact) g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); manager = tpl_log_manager_dup_singleton (); + entity = tpl_entity_new_from_tp_contact (empathy_contact_get_tp_contact (contact), + TPL_ENTITY_CONTACT); + 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); item = gtk_image_menu_item_new_with_mnemonic (_("_Previous Conversations")); diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index d3f566777..0ee1e8e59 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -107,8 +107,7 @@ static void log_window_chats_accounts_changed_cb (GtkWidget *co static void log_window_chats_set_selected (EmpathyLogWindow *window); static gboolean log_window_chats_get_selected (EmpathyLogWindow *window, TpAccount **account, - gchar **chat_id, - gboolean *is_chatroom); + TplEntity **target); static void log_window_chats_get_messages (EmpathyLogWindow *window, GDate *date_to_show); static void log_window_calendar_chats_day_selected_cb (GtkWidget *calendar, @@ -125,8 +124,7 @@ enum { COL_FIND_ACCOUNT_NAME, COL_FIND_ACCOUNT, COL_FIND_CHAT_NAME, - COL_FIND_CHAT_ID, - COL_FIND_IS_CHATROOM, + COL_FIND_TARGET, COL_FIND_DATE, COL_FIND_DATE_READABLE, COL_FIND_COUNT @@ -136,8 +134,7 @@ enum { COL_CHAT_ICON, COL_CHAT_NAME, COL_CHAT_ACCOUNT, - COL_CHAT_ID, - COL_CHAT_IS_CHATROOM, + COL_CHAT_TARGET, COL_CHAT_COUNT }; @@ -371,7 +368,7 @@ log_window_entry_find_changed_cb (GtkWidget *entry, } static void -got_messages_for_date_cb (GObject *manager, +got_events_for_date_cb (GObject *manager, GAsyncResult *result, gpointer user_data) { @@ -385,7 +382,7 @@ got_messages_for_date_cb (GObject *manager, if (log_window == NULL) return; - if (!tpl_log_manager_get_messages_for_date_finish (TPL_LOG_MANAGER (manager), + if (!tpl_log_manager_get_events_for_date_finish (TPL_LOG_MANAGER (manager), result, &messages, &error)) { DEBUG ("Unable to retrieve messages for the selected date: %s. Aborting", error->message); @@ -398,9 +395,9 @@ got_messages_for_date_cb (GObject *manager, for (l = messages; l; l = l->next) { EmpathyMessage *message; - g_assert (TPL_IS_ENTRY (l->data)); + g_assert (TPL_IS_EVENT (l->data)); - message = empathy_message_from_tpl_log_entry (l->data); + message = empathy_message_from_tpl_log_event (l->data); g_object_unref (l->data); empathy_chat_view_append_message (window->chatview_find, message); g_object_unref (message); @@ -455,8 +452,7 @@ log_window_find_changed_cb (GtkTreeSelection *selection, GtkTreeModel *model; GtkTreeIter iter; TpAccount *account; - gchar *chat_id; - gboolean is_chatroom; + TplEntity *target; gchar *date; GDate *gdate; @@ -478,8 +474,7 @@ log_window_find_changed_cb (GtkTreeSelection *selection, gtk_tree_model_get (model, &iter, COL_FIND_ACCOUNT, &account, - COL_FIND_CHAT_ID, &chat_id, - COL_FIND_IS_CHATROOM, &is_chatroom, + COL_FIND_TARGET, &target, COL_FIND_DATE, &date, -1); @@ -493,20 +488,20 @@ log_window_find_changed_cb (GtkTreeSelection *selection, gdate = gdate_from_str (date); if (gdate != NULL) { - tpl_log_manager_get_messages_for_date_async (window->log_manager, - account, - chat_id, - is_chatroom, - gdate, - got_messages_for_date_cb, - window); + tpl_log_manager_get_events_for_date_async (window->log_manager, + account, + target, + TPL_EVENT_MASK_TEXT, + gdate, + got_events_for_date_cb, + window); g_date_free (gdate); } g_object_unref (account); + g_object_unref (target); g_free (date); - g_free (chat_id); } @@ -541,7 +536,7 @@ log_manager_searched_new_cb (GObject *manager, hit = l->data; /* Protect against invalid data (corrupt or old log files. */ - if (hit->account == NULL || hit->chat_id == NULL) { + if (hit->account == NULL || hit->target == NULL) { continue; } @@ -559,15 +554,14 @@ log_manager_searched_new_cb (GObject *manager, COL_FIND_ACCOUNT_ICON, account_icon, COL_FIND_ACCOUNT_NAME, account_name, COL_FIND_ACCOUNT, hit->account, - COL_FIND_CHAT_NAME, hit->chat_id, /* FIXME */ - COL_FIND_CHAT_ID, hit->chat_id, - COL_FIND_IS_CHATROOM, hit->is_chatroom, + COL_FIND_CHAT_NAME, tpl_entity_get_alias (hit->target), + COL_FIND_TARGET, hit->target, COL_FIND_DATE, tmp, COL_FIND_DATE_READABLE, date_readable, -1); /* FIXME: Update COL_FIND_CHAT_NAME */ - if (hit->is_chatroom) { + if (tpl_entity_get_entity_type (hit->target) == TPL_ENTITY_ROOM) { } else { } } @@ -600,7 +594,8 @@ log_window_find_populate (EmpathyLogWindow *window, return; } - tpl_log_manager_search_async (window->log_manager, search_criteria, + tpl_log_manager_search_async (window->log_manager, + search_criteria, TPL_EVENT_MASK_TEXT, log_manager_searched_new_cb, (gpointer) store); } @@ -625,8 +620,7 @@ log_window_find_setup (EmpathyLogWindow *window) G_TYPE_STRING, /* account name */ TP_TYPE_ACCOUNT, /* account */ G_TYPE_STRING, /* chat name */ - G_TYPE_STRING, /* chat id */ - G_TYPE_BOOLEAN, /* is chatroom */ + TPL_TYPE_ENTITY, /* target */ G_TYPE_STRING, /* date */ G_TYPE_STRING); /* date_readable */ @@ -788,12 +782,14 @@ log_window_chats_changed_cb (GtkTreeSelection *selection, } static void -log_manager_got_chats_cb (GObject *manager, - GAsyncResult *result, - gpointer user_data) +log_manager_got_entities_cb (GObject *manager, + GAsyncResult *result, + gpointer user_data) { EmpathyLogWindow *window = user_data; - GList *chats; + EmpathyAccountChooser *account_chooser; + TpAccount *account; + GList *entities; GList *l; GtkTreeView *view; GtkTreeModel *model; @@ -803,11 +799,16 @@ log_manager_got_chats_cb (GObject *manager, GError *error = NULL; gboolean select_account = FALSE; + account_chooser = EMPATHY_ACCOUNT_CHOOSER (window->account_chooser_chats); + account = empathy_account_chooser_dup_account (account_chooser); + + view = GTK_TREE_VIEW (window->treeview_chats); + if (log_window == NULL) return; - if (!tpl_log_manager_get_chats_finish (TPL_LOG_MANAGER (manager), - result, &chats, &error)) { + if (!tpl_log_manager_get_entities_finish (TPL_LOG_MANAGER (manager), + result, &entities, &error)) { DEBUG ("%s. Aborting", error->message); g_error_free (error); return; @@ -818,34 +819,32 @@ log_manager_got_chats_cb (GObject *manager, selection = gtk_tree_view_get_selection (view); store = GTK_LIST_STORE (model); - for (l = chats; l; l = l->next) { - TplLogSearchHit *hit; - - hit = l->data; + for (l = entities; l; l = l->next) { + TplEntity *entity; - if (hit->account == NULL) - continue; + entity = TPL_ENTITY (l->data); gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, COL_CHAT_ICON, "empathy-available", /* FIXME */ - COL_CHAT_NAME, hit->chat_id, - COL_CHAT_ACCOUNT, hit->account, - COL_CHAT_ID, hit->chat_id, - COL_CHAT_IS_CHATROOM, hit->is_chatroom, + COL_CHAT_NAME, tpl_entity_get_alias (entity), + COL_CHAT_ACCOUNT, account, + COL_CHAT_TARGET, entity, -1); if (window->selected_account != NULL && - !tp_strdiff (tp_proxy_get_object_path (hit->account), + !tp_strdiff (tp_proxy_get_object_path (account), tp_proxy_get_object_path (window->selected_account))) select_account = TRUE; /* FIXME: Update COL_CHAT_ICON/NAME */ - if (hit->is_chatroom) { + if (tpl_entity_get_entity_type (entity) == TPL_ENTITY_ROOM) { } else { } + + g_object_unref (entity); } - tpl_log_manager_search_free (chats); + g_list_free (entities); /* Unblock signals */ g_signal_handlers_unblock_by_func (selection, @@ -889,8 +888,8 @@ log_window_chats_populate (EmpathyLogWindow *window) gtk_list_store_clear (store); - tpl_log_manager_get_chats_async (window->log_manager, account, - log_manager_got_chats_cb, (gpointer) window); + tpl_log_manager_get_entities_async (window->log_manager, account, + log_manager_got_entities_cb, (gpointer) window); } static void @@ -912,8 +911,7 @@ log_window_chats_setup (EmpathyLogWindow *window) G_TYPE_STRING, /* icon */ G_TYPE_STRING, /* name */ TP_TYPE_ACCOUNT, /* account */ - G_TYPE_STRING, /* id */ - G_TYPE_BOOLEAN); /* is chatroom */ + TPL_TYPE_ENTITY); /* target */ model = GTK_TREE_MODEL (store); sortable = GTK_TREE_SORTABLE (store); @@ -981,16 +979,19 @@ log_window_chats_set_selected (EmpathyLogWindow *window) } for (ok = TRUE; ok; ok = gtk_tree_model_iter_next (model, &iter)) { - TpAccount *this_account; - gchar *this_chat_id; - gboolean this_is_chatroom; + TpAccount *this_account; + TplEntity *this_target; + const gchar *this_chat_id; + gboolean this_is_chatroom; gtk_tree_model_get (model, &iter, COL_CHAT_ACCOUNT, &this_account, - COL_CHAT_ID, &this_chat_id, - COL_CHAT_IS_CHATROOM, &this_is_chatroom, + COL_CHAT_TARGET, &this_target, -1); + this_chat_id = tpl_entity_get_identifier (this_target); + this_is_chatroom = tpl_entity_get_entity_type (this_target) == TPL_ENTITY_ROOM; + if (this_account == window->selected_account && !tp_strdiff (this_chat_id, window->selected_chat_id) && this_is_chatroom == window->selected_is_chatroom) { @@ -999,12 +1000,12 @@ log_window_chats_set_selected (EmpathyLogWindow *window) gtk_tree_view_scroll_to_cell (view, path, NULL, TRUE, 0.5, 0.0); gtk_tree_path_free (path); g_object_unref (this_account); - g_free (this_chat_id); + g_object_unref (this_target); break; } g_object_unref (this_account); - g_free (this_chat_id); + g_object_unref (this_target); } tp_clear_object (&window->selected_account); @@ -1014,16 +1015,14 @@ log_window_chats_set_selected (EmpathyLogWindow *window) static gboolean log_window_chats_get_selected (EmpathyLogWindow *window, TpAccount **account, - gchar **chat_id, - gboolean *is_chatroom) + TplEntity **target) { GtkTreeView *view; GtkTreeModel *model; GtkTreeSelection *selection; GtkTreeIter iter; - gchar *id = NULL; + TplEntity *targ; TpAccount *acc = NULL; - gboolean room = FALSE; view = GTK_TREE_VIEW (window->treeview_chats); model = gtk_tree_view_get_model (view); @@ -1035,24 +1034,20 @@ log_window_chats_get_selected (EmpathyLogWindow *window, gtk_tree_model_get (model, &iter, COL_CHAT_ACCOUNT, &acc, - COL_CHAT_ID, &id, - COL_CHAT_IS_CHATROOM, &room, + COL_CHAT_TARGET, &targ, -1); - if (chat_id != NULL) { - *chat_id = id; - } else { - g_free (id); - } if (account != NULL) { - *account = acc; - } else { - g_object_unref (acc); + *account = g_object_ref (acc); } - if (is_chatroom) { - *is_chatroom = room; + + if (target != NULL) { + *target = g_object_ref (targ); } + g_object_unref (acc); + g_object_unref (targ); + return TRUE; } @@ -1062,15 +1057,15 @@ log_window_got_messages_for_date_cb (GObject *manager, gpointer user_data) { EmpathyLogWindow *window = user_data; - GList *messages; + GList *events; GList *l; GError *error = NULL; if (log_window == NULL) return; - if (!tpl_log_manager_get_messages_for_date_finish (TPL_LOG_MANAGER (manager), - result, &messages, &error)) { + if (!tpl_log_manager_get_events_for_date_finish (TPL_LOG_MANAGER (manager), + result, &events, &error)) { DEBUG ("Unable to retrieve messages for the selected date: %s. Aborting", error->message); empathy_chat_view_append_event (window->chatview_find, @@ -1079,14 +1074,14 @@ log_window_got_messages_for_date_cb (GObject *manager, return; } - for (l = messages; l; l = l->next) { - EmpathyMessage *message = empathy_message_from_tpl_log_entry (l->data); + for (l = events; l; l = l->next) { + EmpathyMessage *message = empathy_message_from_tpl_log_event (l->data); g_object_unref (l->data); empathy_chat_view_append_message (window->chatview_chats, message); g_object_unref (message); } - g_list_free (messages); + g_list_free (events); /* Turn back on scrolling */ empathy_chat_view_scroll (window->chatview_find, TRUE); @@ -1101,11 +1096,9 @@ log_window_get_messages_for_date (EmpathyLogWindow *window, GDate *date) { TpAccount *account; - gchar *chat_id; - gboolean is_chatroom; + TplEntity *target; - if (!log_window_chats_get_selected (window, &account, - &chat_id, &is_chatroom)) { + if (!log_window_chats_get_selected (window, &account, &target)) { return; } @@ -1115,16 +1108,15 @@ log_window_get_messages_for_date (EmpathyLogWindow *window, /* Turn off scrolling temporarily */ empathy_chat_view_scroll (window->chatview_find, FALSE); - /* Get messages */ - tpl_log_manager_get_messages_for_date_async (window->log_manager, - account, chat_id, - is_chatroom, + /* Get events */ + tpl_log_manager_get_events_for_date_async (window->log_manager, + account, target, TPL_EVENT_MASK_TEXT, date, log_window_got_messages_for_date_cb, (gpointer) window); - g_free (chat_id); g_object_unref (account); + g_object_unref (target); } static void @@ -1212,15 +1204,13 @@ log_window_chats_get_messages (EmpathyLogWindow *window, GDate *date) { TpAccount *account; - gchar *chat_id; - gboolean is_chatroom; + TplEntity *target; guint year_selected; guint month_selected; guint day; - if (!log_window_chats_get_selected (window, &account, - &chat_id, &is_chatroom)) { + if (!log_window_chats_get_selected (window, &account, &target)) { return; } @@ -1232,8 +1222,7 @@ log_window_chats_get_messages (EmpathyLogWindow *window, if (date == NULL) { /* Get a list of dates and show them on the calendar */ tpl_log_manager_get_dates_async (window->log_manager, - account, chat_id, - is_chatroom, + account, target, TPL_EVENT_MASK_TEXT, log_manager_got_dates_cb, (gpointer) window); /* signal unblocked at the end of the CB flow */ } else { @@ -1263,7 +1252,7 @@ log_window_chats_get_messages (EmpathyLogWindow *window, } g_object_unref (account); - g_free (chat_id); + g_object_unref (target); } static void @@ -1348,25 +1337,23 @@ log_window_calendar_chats_month_changed_cb (GtkWidget *calendar, EmpathyLogWindow *window) { TpAccount *account; - gchar *chat_id; - gboolean is_chatroom; + TplEntity *target; gtk_calendar_clear_marks (GTK_CALENDAR (calendar)); - if (!log_window_chats_get_selected (window, &account, - &chat_id, &is_chatroom)) { + if (!log_window_chats_get_selected (window, &account, &target)) { DEBUG ("No chat selected to get dates for..."); return; } /* Get the log object for this contact */ - tpl_log_manager_get_dates_async (window->log_manager, account, - chat_id, is_chatroom, + tpl_log_manager_get_dates_async (window->log_manager, account, target, + TPL_EVENT_MASK_TEXT, log_window_updating_calendar_month_cb, (gpointer) window); g_object_unref (account); - g_free (chat_id); + g_object_unref (target); } static void 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); |