aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-log-manager.h
blob: a91655a44999265d00125acd67e10938b2b19543 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
 * Copyright (C) 2003-2007 Imendio AB
 * Copyright (C) 2007-2008 Collabora Ltd.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * 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.
 *
 * Authors: Xavier Claessens <xclaesse@gmail.com>
 *          Jonny Lamb <jonny.lamb@collabora.co.uk>
 */

#ifndef __EMPATHY_LOG_MANAGER_H__
#define __EMPATHY_LOG_MANAGER_H__

#include <glib-object.h>

#include <libmissioncontrol/mc-account.h>

#include "empathy-message.h"

G_BEGIN_DECLS

#define EMPATHY_TYPE_LOG_MANAGER         (empathy_log_manager_get_type ())
#define EMPATHY_LOG_MANAGER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_LOG_MANAGER, EmpathyLogManager))
#define EMPATHY_LOG_MANAGER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_LOG_MANAGER, EmpathyLogManagerClass))
#define EMPATHY_IS_LOG_MANAGER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_LOG_MANAGER))
#define EMPATHY_IS_LOG_MANAGER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_LOG_MANAGER))
#define EMPATHY_LOG_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_LOG_MANAGER, EmpathyLogManagerClass))

typedef struct _EmpathyLogManager      EmpathyLogManager;
typedef struct _EmpathyLogManagerClass EmpathyLogManagerClass;
typedef struct _EmpathyLogSearchHit    EmpathyLogSearchHit;
typedef struct _EmpathyLogSource       EmpathyLogSource;

struct _EmpathyLogManager {
    GObject parent;
    gpointer priv;
};

struct _EmpathyLogManagerClass {
    GObjectClass parent_class;
};

struct _EmpathyLogSearchHit {
    McAccount *account;
    gchar     *chat_id;
    gboolean   is_chatroom;
    gchar     *filename;
    gchar     *date;
};

struct _EmpathyLogSource {
    gboolean (*exists) (EmpathyLogManager *manager,
                McAccount         *account,
                const gchar       *chat_id,
                gboolean           chatroom);

    void (*add_message) (EmpathyLogManager *manager,
                 const gchar       *chat_id,
                 gboolean           chatroom,
                 EmpathyMessage    *message);

    GList * (*get_dates) (EmpathyLogManager *manager,
                  McAccount         *account,
                  const gchar       *chat_id,
                  gboolean           chatroom);

    GList * (*get_messages_for_date) (EmpathyLogManager *manager,
                      McAccount         *account,
                      const gchar       *chat_id,
                      gboolean           chatroom,
                      const gchar       *date);

    GList * (*get_last_messages) (EmpathyLogManager *manager,
                      McAccount         *account,
                      const gchar       *chat_id,
                      gboolean           chatroom);

    GList * (*get_chats) (EmpathyLogManager *manager,
                  McAccount         *account);

    GList * (*search_new) (EmpathyLogManager *manager,
                   const gchar       *text);
};

GType              empathy_log_manager_get_type              (void) G_GNUC_CONST;
EmpathyLogManager *empathy_log_manager_dup_singleton         (void);
void               empathy_log_manager_add_message           (EmpathyLogManager *manager,
                                  const gchar       *chat_id,
                                  gboolean           chatroom,
                                  EmpathyMessage     *message);
gboolean           empathy_log_manager_exists                (EmpathyLogManager *manager,
                                  McAccount         *account,
                                  const gchar       *chat_id,
                                  gboolean           chatroom);
GList *            empathy_log_manager_get_dates             (EmpathyLogManager *manager,
                                  McAccount         *account,
                                  const gchar       *chat_id,
                                  gboolean           chatroom);
GList *            empathy_log_manager_get_messages_for_date (EmpathyLogManager *manager,
                                  McAccount         *account,
                                  const gchar       *chat_id,
                                  gboolean           chatroom,
                                  const gchar       *date);
GList *            empathy_log_manager_get_last_messages     (EmpathyLogManager *manager,
                                  McAccount         *account,
                                  const gchar       *chat_id,
                                  gboolean           chatroom);
GList *            empathy_log_manager_get_chats             (EmpathyLogManager *manager,
                                  McAccount         *account);
GList *            empathy_log_manager_search_new            (EmpathyLogManager *manager,
                                  const gchar       *text);
void               empathy_log_manager_search_free           (GList             *hits);
gchar *            empathy_log_manager_get_date_readable     (const gchar       *date);
void               empathy_log_manager_search_hit_free       (EmpathyLogSearchHit *hit);

G_END_DECLS

#endif /* __EMPATHY_LOG_MANAGER_H__ */