Mercurial > pidgin
annotate src/log.h @ 10895:ffb30c2e82cb
[gaim-migrate @ 12609]
sf patch #1193187, from Rainer Blessing
Fix an infinite loop. Infinity is a long time.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 03 May 2005 01:37:30 +0000 |
parents | 5c5120837bab |
children | 8d2007d738d5 |
rev | line source |
---|---|
5872 | 1 /** |
2 * @file log.h Logging API | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
7440 | 10 * |
5872 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
25 #ifndef _GAIM_LOG_H_ | |
26 #define _GAIM_LOG_H_ | |
27 | |
7431 | 28 #include <stdio.h> |
5872 | 29 |
30 | |
7431 | 31 /******************************************************** |
32 * DATA STRUCTURES ************************************** | |
33 ********************************************************/ | |
34 | |
35 typedef struct _GaimLog GaimLog; | |
36 typedef struct _GaimLogLogger GaimLogLogger; | |
10822 | 37 typedef struct _GaimLogCommonLoggerData GaimLogCommonLoggerData; |
7431 | 38 |
39 typedef enum { | |
40 GAIM_LOG_IM, | |
41 GAIM_LOG_CHAT, | |
10348 | 42 GAIM_LOG_SYSTEM |
7431 | 43 } GaimLogType; |
44 | |
45 typedef enum { | |
10348 | 46 GAIM_LOG_READ_NO_NEWLINE = 1 |
7431 | 47 } GaimLogReadFlags; |
48 | |
49 #include "account.h" | |
50 #include "conversation.h" | |
51 | |
52 /** | |
53 * A log logger. | |
54 * | |
55 * This struct gets filled out and is included in the GaimLog. It contains everything | |
56 * needed to write and read from logs. | |
57 */ | |
9000 | 58 /*@{*/ |
7431 | 59 struct _GaimLogLogger { |
60 char *name; /**< The logger's name */ | |
61 char *id; /**< an identifier to refer to this logger */ | |
7440 | 62 |
63 /** This gets called when the log is first created. | |
7431 | 64 I don't think this is actually needed. */ |
10812
d087e928ffd1
[gaim-migrate @ 12465]
Luke Schierer <lschiere@pidgin.im>
parents:
10566
diff
changeset
|
65 void (*create)(GaimLog *log); |
7440 | 66 |
7431 | 67 /** This is used to write to the log file */ |
10812
d087e928ffd1
[gaim-migrate @ 12465]
Luke Schierer <lschiere@pidgin.im>
parents:
10566
diff
changeset
|
68 void (*write)(GaimLog *log, |
7440 | 69 GaimMessageFlags type, |
7431 | 70 const char *from, |
71 time_t time, | |
72 const char *message); | |
73 | |
74 /** Called when the log is destroyed */ | |
75 void (*finalize)(GaimLog *log); | |
7440 | 76 |
7431 | 77 /** This function returns a sorted GList of available GaimLogs */ |
8898 | 78 GList *(*list)(GaimLogType type, const char *name, GaimAccount *account); |
7440 | 79 |
80 /** Given one of the logs returned by the logger's list function, | |
81 * this returns the contents of the log in GtkIMHtml markup */ | |
7431 | 82 char *(*read)(GaimLog *log, GaimLogReadFlags *flags); |
10231 | 83 |
7556 | 84 /** Given one of the logs returned by the logger's list function, |
85 * this returns the size of the log in bytes */ | |
86 int (*size)(GaimLog *log); | |
8096 | 87 |
88 /** Returns the total size of all the logs. If this is undefined a default | |
89 * implementation is used */ | |
8898 | 90 int (*total_size)(GaimLogType type, const char *name, GaimAccount *account); |
8573 | 91 |
92 /** This function returns a sorted GList of available system GaimLogs */ | |
93 GList *(*list_syslog)(GaimAccount *account); | |
5872 | 94 }; |
95 | |
7431 | 96 /** |
97 * A log. Not the wooden type. | |
98 */ | |
99 struct _GaimLog { | |
100 GaimLogType type; /**< The type of log this is */ | |
101 char *name; /**< The name of this log */ | |
7440 | 102 GaimAccount *account; /**< The account this log is taking |
103 place on */ | |
104 time_t time; /**< The time this conversation | |
105 started */ | |
106 GaimLogLogger *logger; /**< The logging mechanism this log | |
107 is to use */ | |
7431 | 108 void *logger_data; /**< Data used by the log logger */ |
5872 | 109 }; |
110 | |
10822 | 111 /** |
112 * A common logger_data struct containing a file handle and path, as well | |
113 * as a pointer to something else for additional data. | |
114 */ | |
115 struct _GaimLogCommonLoggerData { | |
116 char *path; | |
117 FILE *file; | |
118 void *extra_data; | |
119 }; | |
7431 | 120 |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
121 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
122 extern "C" { |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
123 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
124 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
125 /***************************************/ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
126 /** @name Log Functions */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
127 /***************************************/ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
128 /*@{*/ |
7440 | 129 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
130 /** |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
131 * Creates a new log |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
132 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
133 * @param type The type of log this is. |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
134 * @param name The name of this conversation (Screenname, chat name, |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
135 * etc.) |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
136 * @param account The account the conversation is occurring on |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
137 * @param time The time this conversation started |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
138 * @return The new log |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
139 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
140 GaimLog *gaim_log_new(GaimLogType type, const char *name, |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
141 GaimAccount *account, time_t time); |
7431 | 142 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
143 /** |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
144 * Frees a log |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
145 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
146 * @param log The log to destroy |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
147 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
148 void gaim_log_free(GaimLog *log); |
7440 | 149 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
150 /** |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
151 * Writes to a log file. Assumes you have checked preferences already. |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
152 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
153 * @param log The log to write to |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
154 * @param type The type of message being logged |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
155 * @param from Whom this message is coming from, or NULL for |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
156 * system messages |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
157 * @param time A timestamp in UNIX time |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
158 * @param message The message to log |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
159 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
160 void gaim_log_write(GaimLog *log, |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
161 GaimMessageFlags type, |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
162 const char *from, |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
163 time_t time, |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
164 const char *message); |
7431 | 165 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
166 /** |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
167 * Reads from a log |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
168 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
169 * @param log The log to read from |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
170 * @param flags The returned logging flags. |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
171 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
172 * @return The contents of this log in Gaim Markup. |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
173 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
174 char *gaim_log_read(GaimLog *log, GaimLogReadFlags *flags); |
7431 | 175 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
176 /** |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
177 * Returns a list of all available logs |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
178 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
179 * @param type The type of the log |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
180 * @param name The name of the log |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
181 * @param account The account |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
182 * @return A sorted list of GaimLogs |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
183 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
184 GList *gaim_log_get_logs(GaimLogType type, const char *name, GaimAccount *account); |
7440 | 185 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
186 /** |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
187 * Returns a list of all available system logs |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
188 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
189 * @param account The account |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
190 * @return A sorted list of GaimLogs |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
191 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
192 GList *gaim_log_get_system_logs(GaimAccount *account); |
8573 | 193 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
194 /** |
10822 | 195 * Returns the size of a log |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
196 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
197 * @param log The log |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
198 * @return The size of the log, in bytes |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
199 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
200 int gaim_log_get_size(GaimLog *log); |
5872 | 201 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
202 /** |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
203 * Returns the size, in bytes, of all available logs in this conversation |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
204 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
205 * @param type The type of the log |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
206 * @param name The name of the log |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
207 * @param account The account |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
208 * @return The size in bytes |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
209 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
210 int gaim_log_get_total_size(GaimLogType type, const char *name, GaimAccount *account); |
8573 | 211 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
212 /** |
10822 | 213 * Returns the default logger directory Gaim uses for a given account |
214 * and username. This would be where Gaim stores logs created by | |
215 * the built-in text or HTML loggers. | |
216 * | |
217 * @param type The type of the log. | |
218 * @param name The name of the log. | |
219 * @param account The account. | |
220 * @return The default logger directory for Gaim. | |
221 */ | |
222 char *gaim_log_get_log_dir(GaimLogType type, const char *name, GaimAccount *account); | |
223 | |
224 /** | |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
225 * Implements GCompareFunc |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
226 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
227 * @param y A GaimLog |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
228 * @param z Another GaimLog |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
229 * @return A value as specified by GCompareFunc |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
230 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
231 gint gaim_log_compare(gconstpointer y, gconstpointer z); |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
232 /*@}*/ |
8573 | 233 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
234 /******************************************/ |
10822 | 235 /** @name Common Logger Functions */ |
236 /******************************************/ | |
237 /*@{*/ | |
238 | |
239 /** | |
240 * Opens a new log file in the standard Gaim log location | |
241 * with the given file extension, named for the current time, | |
242 * for writing. If a log file is already open, the existing | |
243 * file handle is retained. The log's logger_data value is | |
244 * set to a GaimLogCommonLoggerData struct containing the log | |
245 * file handle and log path. | |
246 * | |
247 * @param log The log to write to. | |
248 * @param time The time of the item being logged. | |
249 * @param ext The file extension to give to this log file. | |
250 */ | |
251 void gaim_log_common_writer(GaimLog *log, time_t time, const char *ext); | |
252 | |
253 /** | |
254 * Returns a sorted GList of GaimLogs of the requested type. | |
255 * This function should only be used with logs that are written | |
256 * with gaim_log_common_writer(). | |
257 * | |
258 * @param type The type of the logs being listed. | |
259 * @param name The name of the log. | |
260 * @param account The account of the log. | |
261 * @param ext The file extension this log format uses. | |
262 * @param logger A reference to the logger struct for this log. | |
263 * | |
264 * @return A sorted GList of GaimLogs matching the parameters. | |
265 */ | |
266 GList *gaim_log_common_lister(GaimLogType type, const char *name, | |
267 GaimAccount *account, const char *ext, | |
268 GaimLogLogger *logger); | |
269 | |
270 /** | |
271 * Returns the size of a given GaimLog. | |
272 * This function should only be used with logs that are written | |
273 * with gaim_log_common_writer(). | |
274 * | |
275 * @param log The GaimLog to size. | |
276 * | |
277 * @return An integer indicating the size of the log in bytes. | |
278 */ | |
279 int gaim_log_common_sizer(GaimLog *log); | |
280 /*@}*/ | |
281 | |
282 /******************************************/ | |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
283 /** @name Logger Functions */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
284 /******************************************/ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
285 /*@{*/ |
7440 | 286 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
287 /** |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
288 * Creates a new logger |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
289 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
290 * @param create The logger's new function. |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
291 * @param write The logger's write function. |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
292 * @param finalize The logger's finalize function. |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
293 * @param list The logger's list function. |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
294 * @param read The logger's read function. |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
295 * @param size The logger's size function. |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
296 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
297 * @return The new logger |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
298 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
299 GaimLogLogger *gaim_log_logger_new( |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
300 void(*create)(GaimLog *), |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
301 void(*write)(GaimLog *, GaimMessageFlags, const char *, time_t, const char *), |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
302 void(*finalize)(GaimLog *), |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
303 GList*(*list)(GaimLogType type, const char*, GaimAccount*), |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
304 char*(*read)(GaimLog*, GaimLogReadFlags*), |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
305 int(*size)(GaimLog*)); |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
306 /** |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
307 * Frees a logger |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
308 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
309 * @param logger The logger to free |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
310 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
311 void gaim_log_logger_free(GaimLogLogger *logger); |
7440 | 312 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
313 /** |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
314 * Adds a new logger |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
315 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
316 * @param logger The new logger to add |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
317 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
318 void gaim_log_logger_add (GaimLogLogger *logger); |
7431 | 319 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
320 /** |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
321 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
322 * Removes a logger |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
323 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
324 * @param logger The logger to remove |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
325 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
326 void gaim_log_logger_remove (GaimLogLogger *logger); |
7431 | 327 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
328 /** |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
329 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
330 * Sets the current logger |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
331 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
332 * @param logger The logger to set |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
333 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
334 void gaim_log_logger_set (GaimLogLogger *logger); |
7440 | 335 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
336 /** |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
337 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
338 * Returns the current logger |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
339 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
340 * @return logger The current logger |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
341 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
342 GaimLogLogger *gaim_log_logger_get (void); |
7440 | 343 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
344 /** |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
345 * Returns a GList containing the IDs and Names of the registered log |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
346 * loggers. |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
347 * |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
348 * @return The list of IDs and names. |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
349 */ |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
350 GList *gaim_log_logger_get_options(void); |
7431 | 351 |
10566
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
352 void gaim_log_init(void); |
62fc579810f4
[gaim-migrate @ 11949]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10348
diff
changeset
|
353 /*@}*/ |
7431 | 354 |
5872 | 355 |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
356 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
357 } |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
358 #endif |
7440 | 359 |
7431 | 360 #endif /* _GAIM_LOG_H_ */ |