*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
*
* Authors: Xavier Claessens <xclaesse@gmail.com>
* Jonny Lamb <jonny.lamb@collabora.co.uk>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+
+/* FIXME: g_mapped_file_free has been deprecated in GLib 2.22, but the
+ * replacement symbol, g_mapped_file_unref is not available in older Glib
+ * and we're not ready to bump our version requirement just for this. When
+ * we're ready to bump our version requirement, just revert this patch. */
+#undef G_DISABLE_DEPRECATED
#include <glib/gstdio.h>
+#define G_DISABLE_DEPRECATED
#include "empathy-log-store.h"
#include "empathy-log-store-empathy.h"
#include "empathy-log-manager.h"
+#include "empathy-account-manager.h"
#include "empathy-contact.h"
#include "empathy-time.h"
#include "empathy-utils.h"
{
gchar *basedir;
gchar *name;
+ EmpathyAccountManager *account_manager;
} EmpathyLogStoreEmpathyPriv;
static void log_store_iface_init (gpointer g_iface,gpointer iface_data);
EmpathyLogStoreEmpathy *self = EMPATHY_LOG_STORE_EMPATHY (object);
EmpathyLogStoreEmpathyPriv *priv = GET_PRIV (self);
+ g_object_unref (priv->account_manager);
g_free (priv->basedir);
g_free (priv->name);
}
".gnome2", PACKAGE_NAME, "logs", NULL);
priv->name = g_strdup ("Empathy");
+ priv->account_manager = empathy_account_manager_dup_singleton ();
}
static gchar *
log_store_empathy_get_dir (EmpathyLogStore *self,
- McAccount *account,
+ EmpathyAccount *account,
const gchar *chat_id,
gboolean chatroom)
{
priv = GET_PRIV (self);
- account_id = mc_account_get_unique_name (account);
+ account_id = empathy_account_get_unique_name (account);
if (chatroom)
basedir = g_build_path (G_DIR_SEPARATOR_S, priv->basedir, account_id,
static gchar *
log_store_empathy_get_filename (EmpathyLogStore *self,
- McAccount *account,
+ EmpathyAccount *account,
const gchar *chat_id,
gboolean chatroom)
{
GError **error)
{
FILE *file;
- McAccount *account;
+ EmpathyAccount *account;
EmpathyContact *sender;
const gchar *body_str;
const gchar *str;
static gboolean
log_store_empathy_exists (EmpathyLogStore *self,
- McAccount *account,
+ EmpathyAccount *account,
const gchar *chat_id,
gboolean chatroom)
{
static GList *
log_store_empathy_get_dates (EmpathyLogStore *self,
- McAccount *account,
+ EmpathyAccount *account,
const gchar *chat_id,
gboolean chatroom)
{
const gchar *p;
g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
- g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
g_return_val_if_fail (chat_id != NULL, NULL);
directory = log_store_empathy_get_dir (self, account, chat_id, chatroom);
static gchar *
log_store_empathy_get_filename_for_date (EmpathyLogStore *self,
- McAccount *account,
+ EmpathyAccount *account,
const gchar *chat_id,
gboolean chatroom,
const gchar *date)
log_store_empathy_search_hit_new (EmpathyLogStore *self,
const gchar *filename)
{
+ EmpathyLogStoreEmpathyPriv *priv = GET_PRIV (self);
EmpathyLogSearchHit *hit;
const gchar *account_name;
const gchar *end;
else
account_name = strv[len-3];
- hit->account = mc_account_lookup (account_name);
+ hit->account = empathy_account_manager_lookup (priv->account_manager,
+ account_name);
hit->filename = g_strdup (filename);
g_strfreev (strv);
xmlNodePtr log_node;
xmlNodePtr node;
EmpathyLogSearchHit *hit;
- McAccount *account;
+ EmpathyAccount *account;
g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
g_return_val_if_fail (filename != NULL, NULL);
t = empathy_time_parse (time);
- sender = g_object_new (EMPATHY_TYPE_CONTACT,
- "account", account,
- "id", sender_id,
- "name", sender_name,
- "is-user", is_user,
- NULL);
+ sender = empathy_contact_new_for_log (account, sender_id, sender_name,
+ is_user);
+
if (!EMP_STR_EMPTY (sender_avatar_token))
empathy_contact_load_avatar_cache (sender,
sender_avatar_token);
empathy_message_set_sender (message, sender);
empathy_message_set_timestamp (message, t);
empathy_message_set_tptype (message, msg_type);
+ empathy_message_set_is_backlog (message, TRUE);
if (cm_id_str)
empathy_message_set_id (message, cm_id);
static GList *
log_store_empathy_get_messages_for_date (EmpathyLogStore *self,
- McAccount *account,
+ EmpathyAccount *account,
const gchar *chat_id,
gboolean chatroom,
const gchar *date)
GList *messages;
g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
- g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
g_return_val_if_fail (chat_id != NULL, NULL);
filename = log_store_empathy_get_filename_for_date (self, account,
static GList *
log_store_empathy_get_chats (EmpathyLogStore *self,
- McAccount *account)
+ EmpathyAccount *account)
{
gchar *dir;
GList *hits;
priv = GET_PRIV (self);
dir = g_build_filename (priv->basedir,
- mc_account_get_unique_name (account), NULL);
+ empathy_account_get_unique_name (account), NULL);
hits = log_store_empathy_get_chats_for_dir (self, dir, FALSE);
static GList *
log_store_empathy_get_filtered_messages (EmpathyLogStore *self,
- McAccount *account,
+ EmpathyAccount *account,
const gchar *chat_id,
gboolean chatroom,
guint num_messages,