]> git.0d.be Git - empathy.git/blob - libempathy/empathy-log-store.c
empathy-tp-tube: remove initiator and type member variables as they are not used
[empathy.git] / libempathy / empathy-log-store.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2008 Collabora Ltd.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Authors: Jonny Lamb <jonny.lamb@collabora.co.uk>
21  */
22
23 #include "empathy-log-store.h"
24
25 GType
26 empathy_log_store_get_type (void)
27 {
28   static GType type = 0;
29   if (type == 0) {
30     static const GTypeInfo info = {
31       sizeof (EmpathyLogStoreInterface),
32       NULL,   /* base_init */
33       NULL,   /* base_finalize */
34       NULL,   /* class_init */
35       NULL,   /* class_finalize */
36       NULL,   /* class_data */
37       0,
38       0,      /* n_preallocs */
39       NULL    /* instance_init */
40     };
41     type = g_type_register_static (G_TYPE_INTERFACE, "EmpathyLogStore",
42         &info, 0);
43   }
44   return type;
45 }
46
47 const gchar *
48 empathy_log_store_get_name (EmpathyLogStore *self)
49 {
50   if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_name)
51     return NULL;
52
53   return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_name (self);
54 }
55
56 gboolean
57 empathy_log_store_exists (EmpathyLogStore *self,
58                           McAccount *account,
59                           const gchar *chat_id,
60                           gboolean chatroom)
61 {
62   if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->exists)
63     return FALSE;
64
65   return EMPATHY_LOG_STORE_GET_INTERFACE (self)->exists (
66       self, account, chat_id, chatroom);
67 }
68
69
70
71 gboolean
72 empathy_log_store_add_message (EmpathyLogStore *self,
73                                const gchar *chat_id,
74                                gboolean chatroom,
75                                EmpathyMessage *message,
76                                GError **error)
77 {
78   if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->add_message)
79     return FALSE;
80
81   return EMPATHY_LOG_STORE_GET_INTERFACE (self)->add_message (
82       self, chat_id, chatroom, message, error);
83 }
84
85 GList *
86 empathy_log_store_get_dates (EmpathyLogStore *self,
87                              McAccount *account,
88                              const gchar *chat_id,
89                              gboolean chatroom)
90 {
91   if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_dates)
92     return NULL;
93
94   return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_dates (
95       self, account, chat_id, chatroom);
96 }
97
98 GList *
99 empathy_log_store_get_messages_for_date (EmpathyLogStore *self,
100                                          McAccount *account,
101                                          const gchar *chat_id,
102                                          gboolean chatroom,
103                                          const gchar *date)
104 {
105   if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_messages_for_date)
106     return NULL;
107
108   return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_messages_for_date (
109       self, account, chat_id, chatroom, date);
110 }
111
112 GList *
113 empathy_log_store_get_last_messages (EmpathyLogStore *self,
114                                      McAccount *account,
115                                      const gchar *chat_id,
116                                      gboolean chatroom)
117 {
118   if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_last_messages)
119     return NULL;
120
121   return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_last_messages (
122       self, account, chat_id, chatroom);
123 }
124
125 GList *
126 empathy_log_store_get_chats (EmpathyLogStore *self,
127                              McAccount *account)
128 {
129   if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_chats)
130     return NULL;
131
132   return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_chats (self, account);
133 }
134
135 GList *
136 empathy_log_store_search_new (EmpathyLogStore *self,
137                               const gchar *text)
138 {
139   if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->search_new)
140     return NULL;
141
142   return EMPATHY_LOG_STORE_GET_INTERFACE (self)->search_new (self, text);
143 }
144
145 void
146 empathy_log_store_ack_message (EmpathyLogStore *self,
147                                const gchar *chat_id,
148                                gboolean chatroom,
149                                EmpathyMessage *message)
150 {
151   if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->ack_message)
152     return;
153
154   EMPATHY_LOG_STORE_GET_INTERFACE (self)->ack_message (
155       self, chat_id, chatroom, message);
156 }
157
158 GList *
159 empathy_log_store_get_filtered_messages (EmpathyLogStore *self,
160                                          McAccount *account,
161                                          const gchar *chat_id,
162                                          gboolean chatroom,
163                                          guint num_messages,
164                                          EmpathyLogMessageFilter filter,
165                                          gpointer user_data)
166
167 {
168   if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_filtered_messages)
169     return NULL;
170
171   return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_filtered_messages (
172       self, account, chat_id, chatroom, num_messages, filter, user_data);
173 }