]> git.0d.be Git - empathy.git/blob - libempathy/empathy-log-manager.h
Started splitting empathy log code from the log manager to make logging more pluggabl...
[empathy.git] / libempathy / empathy-log-manager.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2003-2007 Imendio AB
4  * Copyright (C) 2007-2008 Collabora Ltd.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public
17  * License along with this program; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  * Authors: Xavier Claessens <xclaesse@gmail.com>
22  *          Jonny Lamb <jonny.lamb@collabora.co.uk>
23  */
24
25 #ifndef __EMPATHY_LOG_MANAGER_H__
26 #define __EMPATHY_LOG_MANAGER_H__
27
28 #include <glib-object.h>
29
30 #include <libmissioncontrol/mc-account.h>
31
32 #include "empathy-message.h"
33
34 G_BEGIN_DECLS
35
36 #define EMPATHY_TYPE_LOG_MANAGER         (empathy_log_manager_get_type ())
37 #define EMPATHY_LOG_MANAGER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_LOG_MANAGER, EmpathyLogManager))
38 #define EMPATHY_LOG_MANAGER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_LOG_MANAGER, EmpathyLogManagerClass))
39 #define EMPATHY_IS_LOG_MANAGER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_LOG_MANAGER))
40 #define EMPATHY_IS_LOG_MANAGER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_LOG_MANAGER))
41 #define EMPATHY_LOG_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_LOG_MANAGER, EmpathyLogManagerClass))
42
43 typedef struct _EmpathyLogManager      EmpathyLogManager;
44 typedef struct _EmpathyLogManagerClass EmpathyLogManagerClass;
45 typedef struct _EmpathyLogSearchHit    EmpathyLogSearchHit;
46 typedef struct _EmpathyLogSource       EmpathyLogSource;
47
48 struct _EmpathyLogManager {
49         GObject parent;
50         gpointer priv;
51 };
52
53 struct _EmpathyLogManagerClass {
54         GObjectClass parent_class;
55 };
56
57 struct _EmpathyLogSearchHit {
58         McAccount *account;
59         gchar     *chat_id;
60         gboolean   is_chatroom;
61         gchar     *filename;
62         gchar     *date;
63 };
64
65 struct _EmpathyLogSource {
66         gboolean (*exists) (EmpathyLogManager *manager,
67                             McAccount         *account,
68                             const gchar       *chat_id,
69                             gboolean           chatroom);
70
71         void (*add_message) (EmpathyLogManager *manager,
72                              const gchar       *chat_id,
73                              gboolean           chatroom,
74                              EmpathyMessage    *message);
75
76         GList * (*get_dates) (EmpathyLogManager *manager,
77                               McAccount         *account,
78                               const gchar       *chat_id,
79                               gboolean           chatroom);
80
81         GList * (*get_messages_for_date) (EmpathyLogManager *manager,
82                                           McAccount         *account,
83                                           const gchar       *chat_id,
84                                           gboolean           chatroom,
85                                           const gchar       *date);
86
87         GList * (*get_last_messages) (EmpathyLogManager *manager,
88                                       McAccount         *account,
89                                       const gchar       *chat_id,
90                                       gboolean           chatroom);
91
92         GList * (*get_chats) (EmpathyLogManager *manager,
93                               McAccount         *account);
94
95         GList * (*search_new) (EmpathyLogManager *manager,
96                                const gchar       *text);
97 };
98
99 GType              empathy_log_manager_get_type              (void) G_GNUC_CONST;
100 EmpathyLogManager *empathy_log_manager_dup_singleton         (void);
101 void               empathy_log_manager_add_message           (EmpathyLogManager *manager,
102                                                               const gchar       *chat_id,
103                                                               gboolean           chatroom,
104                                                               EmpathyMessage     *message);
105 gboolean           empathy_log_manager_exists                (EmpathyLogManager *manager,
106                                                               McAccount         *account,
107                                                               const gchar       *chat_id,
108                                                               gboolean           chatroom);
109 GList *            empathy_log_manager_get_dates             (EmpathyLogManager *manager,
110                                                               McAccount         *account,
111                                                               const gchar       *chat_id,
112                                                               gboolean           chatroom);
113 GList *            empathy_log_manager_get_messages_for_date (EmpathyLogManager *manager,
114                                                               McAccount         *account,
115                                                               const gchar       *chat_id,
116                                                               gboolean           chatroom,
117                                                               const gchar       *date);
118 GList *            empathy_log_manager_get_last_messages     (EmpathyLogManager *manager,
119                                                               McAccount         *account,
120                                                               const gchar       *chat_id,
121                                                               gboolean           chatroom);
122 GList *            empathy_log_manager_get_chats             (EmpathyLogManager *manager,
123                                                               McAccount         *account);
124 GList *            empathy_log_manager_search_new            (EmpathyLogManager *manager,
125                                                               const gchar       *text);
126 void               empathy_log_manager_search_free           (GList             *hits);
127 gchar *            empathy_log_manager_get_date_readable     (const gchar       *date);
128 void               empathy_log_manager_search_hit_free       (EmpathyLogSearchHit *hit);
129
130 G_END_DECLS
131
132 #endif /* __EMPATHY_LOG_MANAGER_H__ */