aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2009-03-06 19:51:21 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-03-06 19:51:21 +0800
commitd78ab99f9c8eb7952f502cfb81a9bb0274b210df (patch)
treeb4b658beade4c547e19199b2837b5921e315843d
parent51b836484f5eef122ffb1b364caec38cb3973fde (diff)
downloadgsoc2013-empathy-d78ab99f9c8eb7952f502cfb81a9bb0274b210df.tar
gsoc2013-empathy-d78ab99f9c8eb7952f502cfb81a9bb0274b210df.tar.gz
gsoc2013-empathy-d78ab99f9c8eb7952f502cfb81a9bb0274b210df.tar.bz2
gsoc2013-empathy-d78ab99f9c8eb7952f502cfb81a9bb0274b210df.tar.lz
gsoc2013-empathy-d78ab99f9c8eb7952f502cfb81a9bb0274b210df.tar.xz
gsoc2013-empathy-d78ab99f9c8eb7952f502cfb81a9bb0274b210df.tar.zst
gsoc2013-empathy-d78ab99f9c8eb7952f502cfb81a9bb0274b210df.zip
Made get_last_messages source independent. (Jonny Lamb)
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk> svn path=/trunk/; revision=2579
-rw-r--r--libempathy/empathy-log-manager.c26
-rw-r--r--libempathy/empathy-log-source-empathy.c28
2 files changed, 11 insertions, 43 deletions
diff --git a/libempathy/empathy-log-manager.c b/libempathy/empathy-log-manager.c
index 371100e13..f734a184d 100644
--- a/libempathy/empathy-log-manager.c
+++ b/libempathy/empathy-log-manager.c
@@ -246,29 +246,25 @@ empathy_log_manager_get_last_messages (EmpathyLogManager *manager,
const gchar *chat_id,
gboolean chatroom)
{
- GList *l, *out = NULL;
- EmpathyLogManagerPriv *priv;
+ GList *messages = NULL;
+ GList *dates;
+ GList *l;
g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
g_return_val_if_fail (chat_id != NULL, NULL);
- priv = GET_PRIV (manager);
+ dates = empathy_log_manager_get_dates (manager, account, chat_id, chatroom);
- for (l = priv->sources; l; l = l->next)
- {
- EmpathyLogSource *source = (EmpathyLogSource *) l->data;
+ l = g_list_last (dates);
+ if (l)
+ messages = empathy_log_manager_get_messages_for_date (manager, account,
+ chat_id, chatroom, l->data);
- if (!source->get_last_messages)
- continue;
-
- if (!out)
- out = source->get_last_messages (manager, account, chat_id, chatroom);
- else
- out = g_list_concat (out, source->get_last_messages (manager, account, chat_id, chatroom));
- }
+ g_list_foreach (dates, (GFunc) g_free, NULL);
+ g_list_free (dates);
- return out;
+ return messages;
}
GList *
diff --git a/libempathy/empathy-log-source-empathy.c b/libempathy/empathy-log-source-empathy.c
index 678ac423a..d6804683c 100644
--- a/libempathy/empathy-log-source-empathy.c
+++ b/libempathy/empathy-log-source-empathy.c
@@ -624,33 +624,6 @@ log_source_empathy_get_messages_for_date (EmpathyLogManager *manager,
}
static GList *
-log_source_empathy_get_last_messages (EmpathyLogManager *manager,
- McAccount *account,
- const gchar *chat_id,
- gboolean chatroom)
-{
- GList *messages = NULL;
- GList *dates;
- GList *l;
-
- g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
- g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
- g_return_val_if_fail (chat_id != NULL, NULL);
-
- dates = log_source_empathy_get_dates (manager, account, chat_id, chatroom);
-
- l = g_list_last (dates);
- if (l)
- messages = log_source_empathy_get_messages_for_date (manager, account,
- chat_id, chatroom, l->data);
-
- g_list_foreach (dates, (GFunc) g_free, NULL);
- g_list_free (dates);
-
- return messages;
-}
-
-static GList *
log_source_empathy_get_chats (EmpathyLogManager *manager,
McAccount *account)
{
@@ -679,7 +652,6 @@ empathy_log_source_empathy_get_source (void)
source->exists = log_source_empathy_exists;
source->add_message = log_source_empathy_add_message;
source->get_dates = log_source_empathy_get_dates;
- source->get_last_messages = log_source_empathy_get_last_messages;
source->get_messages_for_date = log_source_empathy_get_messages_for_date;
source->get_chats = log_source_empathy_get_chats;
source->search_new = log_source_empathy_search_new;