Mercurial > pidgin
comparison libpurple/log.h @ 15822:32c366eeeb99
sed -ie 's/gaim/purple/g'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 19 Mar 2007 07:01:17 +0000 |
parents | f61ad08739fc |
children | 4f286fc9cdff |
comparison
equal
deleted
inserted
replaced
15821:84b0f9b23ede | 15822:32c366eeeb99 |
---|---|
1 /** | 1 /** |
2 * @file log.h Logging API | 2 * @file log.h Logging API |
3 * @ingroup core | 3 * @ingroup core |
4 * | 4 * |
5 * gaim | 5 * purple |
6 * | 6 * |
7 * Gaim is the legal property of its developers, whose names are too numerous | 7 * Purple 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 | 8 * to list here. Please refer to the COPYRIGHT file distributed with this |
9 * source distribution. | 9 * source distribution. |
10 * | 10 * |
11 * This program is free software; you can redistribute it and/or modify | 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 | 12 * it under the terms of the GNU General Public License as published by |
20 * | 20 * |
21 * You should have received a copy of the GNU General Public License | 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 | 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 | 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 */ | 24 */ |
25 #ifndef _GAIM_LOG_H_ | 25 #ifndef _PURPLE_LOG_H_ |
26 #define _GAIM_LOG_H_ | 26 #define _PURPLE_LOG_H_ |
27 | 27 |
28 #include <stdio.h> | 28 #include <stdio.h> |
29 | 29 |
30 | 30 |
31 /******************************************************** | 31 /******************************************************** |
32 * DATA STRUCTURES ************************************** | 32 * DATA STRUCTURES ************************************** |
33 ********************************************************/ | 33 ********************************************************/ |
34 | 34 |
35 typedef struct _GaimLog GaimLog; | 35 typedef struct _PurpleLog PurpleLog; |
36 typedef struct _GaimLogLogger GaimLogLogger; | 36 typedef struct _PurpleLogLogger PurpleLogLogger; |
37 typedef struct _GaimLogCommonLoggerData GaimLogCommonLoggerData; | 37 typedef struct _PurpleLogCommonLoggerData PurpleLogCommonLoggerData; |
38 typedef struct _GaimLogSet GaimLogSet; | 38 typedef struct _PurpleLogSet PurpleLogSet; |
39 | 39 |
40 typedef enum { | 40 typedef enum { |
41 GAIM_LOG_IM, | 41 PURPLE_LOG_IM, |
42 GAIM_LOG_CHAT, | 42 PURPLE_LOG_CHAT, |
43 GAIM_LOG_SYSTEM | 43 PURPLE_LOG_SYSTEM |
44 } GaimLogType; | 44 } PurpleLogType; |
45 | 45 |
46 typedef enum { | 46 typedef enum { |
47 GAIM_LOG_READ_NO_NEWLINE = 1 | 47 PURPLE_LOG_READ_NO_NEWLINE = 1 |
48 } GaimLogReadFlags; | 48 } PurpleLogReadFlags; |
49 | 49 |
50 #include "account.h" | 50 #include "account.h" |
51 #include "conversation.h" | 51 #include "conversation.h" |
52 | 52 |
53 typedef void (*GaimLogSetCallback) (GHashTable *sets, GaimLogSet *set); | 53 typedef void (*PurpleLogSetCallback) (GHashTable *sets, PurpleLogSet *set); |
54 | 54 |
55 /** | 55 /** |
56 * A log logger. | 56 * A log logger. |
57 * | 57 * |
58 * This struct gets filled out and is included in the GaimLog. It contains everything | 58 * This struct gets filled out and is included in the PurpleLog. It contains everything |
59 * needed to write and read from logs. | 59 * needed to write and read from logs. |
60 */ | 60 */ |
61 struct _GaimLogLogger { | 61 struct _PurpleLogLogger { |
62 char *name; /**< The logger's name */ | 62 char *name; /**< The logger's name */ |
63 char *id; /**< an identifier to refer to this logger */ | 63 char *id; /**< an identifier to refer to this logger */ |
64 | 64 |
65 /** This gets called when the log is first created. | 65 /** This gets called when the log is first created. |
66 I don't think this is actually needed. */ | 66 I don't think this is actually needed. */ |
67 void (*create)(GaimLog *log); | 67 void (*create)(PurpleLog *log); |
68 | 68 |
69 /** This is used to write to the log file */ | 69 /** This is used to write to the log file */ |
70 gsize (*write)(GaimLog *log, | 70 gsize (*write)(PurpleLog *log, |
71 GaimMessageFlags type, | 71 PurpleMessageFlags type, |
72 const char *from, | 72 const char *from, |
73 time_t time, | 73 time_t time, |
74 const char *message); | 74 const char *message); |
75 | 75 |
76 /** Called when the log is destroyed */ | 76 /** Called when the log is destroyed */ |
77 void (*finalize)(GaimLog *log); | 77 void (*finalize)(PurpleLog *log); |
78 | 78 |
79 /** This function returns a sorted GList of available GaimLogs */ | 79 /** This function returns a sorted GList of available PurpleLogs */ |
80 GList *(*list)(GaimLogType type, const char *name, GaimAccount *account); | 80 GList *(*list)(PurpleLogType type, const char *name, PurpleAccount *account); |
81 | 81 |
82 /** Given one of the logs returned by the logger's list function, | 82 /** Given one of the logs returned by the logger's list function, |
83 * this returns the contents of the log in GtkIMHtml markup */ | 83 * this returns the contents of the log in GtkIMHtml markup */ |
84 char *(*read)(GaimLog *log, GaimLogReadFlags *flags); | 84 char *(*read)(PurpleLog *log, PurpleLogReadFlags *flags); |
85 | 85 |
86 /** Given one of the logs returned by the logger's list function, | 86 /** Given one of the logs returned by the logger's list function, |
87 * this returns the size of the log in bytes */ | 87 * this returns the size of the log in bytes */ |
88 int (*size)(GaimLog *log); | 88 int (*size)(PurpleLog *log); |
89 | 89 |
90 /** Returns the total size of all the logs. If this is undefined a default | 90 /** Returns the total size of all the logs. If this is undefined a default |
91 * implementation is used */ | 91 * implementation is used */ |
92 int (*total_size)(GaimLogType type, const char *name, GaimAccount *account); | 92 int (*total_size)(PurpleLogType type, const char *name, PurpleAccount *account); |
93 | 93 |
94 /** This function returns a sorted GList of available system GaimLogs */ | 94 /** This function returns a sorted GList of available system PurpleLogs */ |
95 GList *(*list_syslog)(GaimAccount *account); | 95 GList *(*list_syslog)(PurpleAccount *account); |
96 | 96 |
97 /** Adds GaimLogSets to a GHashTable. By passing the data in the GaimLogSets | 97 /** Adds PurpleLogSets to a GHashTable. By passing the data in the PurpleLogSets |
98 * to list, the caller can get every available GaimLog from the logger. | 98 * to list, the caller can get every available PurpleLog from the logger. |
99 * Loggers using gaim_log_common_writer() (or otherwise storing their | 99 * Loggers using purple_log_common_writer() (or otherwise storing their |
100 * logs in the same directory structure as the stock loggers) do not | 100 * logs in the same directory structure as the stock loggers) do not |
101 * need to implement this function. | 101 * need to implement this function. |
102 * | 102 * |
103 * Loggers which implement this function must create a GaimLogSet, | 103 * Loggers which implement this function must create a PurpleLogSet, |
104 * then call @a cb with @a sets and the newly created GaimLogSet. */ | 104 * then call @a cb with @a sets and the newly created PurpleLogSet. */ |
105 void (*get_log_sets)(GaimLogSetCallback cb, GHashTable *sets); | 105 void (*get_log_sets)(PurpleLogSetCallback cb, GHashTable *sets); |
106 | 106 |
107 /* Attempts to delete the specified log, indicating success or failure */ | 107 /* Attempts to delete the specified log, indicating success or failure */ |
108 gboolean (*delete)(GaimLog *log); | 108 gboolean (*delete)(PurpleLog *log); |
109 | 109 |
110 /* Tests whether a log is deletable */ | 110 /* Tests whether a log is deletable */ |
111 gboolean (*is_deletable)(GaimLog *log); | 111 gboolean (*is_deletable)(PurpleLog *log); |
112 }; | 112 }; |
113 | 113 |
114 /** | 114 /** |
115 * A log. Not the wooden type. | 115 * A log. Not the wooden type. |
116 */ | 116 */ |
117 struct _GaimLog { | 117 struct _PurpleLog { |
118 GaimLogType type; /**< The type of log this is */ | 118 PurpleLogType type; /**< The type of log this is */ |
119 char *name; /**< The name of this log */ | 119 char *name; /**< The name of this log */ |
120 GaimAccount *account; /**< The account this log is taking | 120 PurpleAccount *account; /**< The account this log is taking |
121 place on */ | 121 place on */ |
122 GaimConversation *conv; /**< The conversation being logged */ | 122 PurpleConversation *conv; /**< The conversation being logged */ |
123 time_t time; /**< The time this conversation | 123 time_t time; /**< The time this conversation |
124 started, converted to the local timezone */ | 124 started, converted to the local timezone */ |
125 | 125 |
126 GaimLogLogger *logger; /**< The logging mechanism this log | 126 PurpleLogLogger *logger; /**< The logging mechanism this log |
127 is to use */ | 127 is to use */ |
128 void *logger_data; /**< Data used by the log logger */ | 128 void *logger_data; /**< Data used by the log logger */ |
129 struct tm *tm; /**< The time this conversation | 129 struct tm *tm; /**< The time this conversation |
130 started, saved with original | 130 started, saved with original |
131 timezone data, if available and | 131 timezone data, if available and |
139 | 139 |
140 /** | 140 /** |
141 * A common logger_data struct containing a file handle and path, as well | 141 * A common logger_data struct containing a file handle and path, as well |
142 * as a pointer to something else for additional data. | 142 * as a pointer to something else for additional data. |
143 */ | 143 */ |
144 struct _GaimLogCommonLoggerData { | 144 struct _PurpleLogCommonLoggerData { |
145 char *path; | 145 char *path; |
146 FILE *file; | 146 FILE *file; |
147 void *extra_data; | 147 void *extra_data; |
148 }; | 148 }; |
149 | 149 |
150 /** | 150 /** |
151 * Describes available logs. | 151 * Describes available logs. |
152 * | 152 * |
153 * By passing the elements of this struct to gaim_log_get_logs(), the caller | 153 * By passing the elements of this struct to purple_log_get_logs(), the caller |
154 * can get all available GaimLogs. | 154 * can get all available PurpleLogs. |
155 */ | 155 */ |
156 struct _GaimLogSet { | 156 struct _PurpleLogSet { |
157 GaimLogType type; /**< The type of logs available */ | 157 PurpleLogType type; /**< The type of logs available */ |
158 char *name; /**< The name of the logs available */ | 158 char *name; /**< The name of the logs available */ |
159 GaimAccount *account; /**< The account the available logs | 159 PurpleAccount *account; /**< The account the available logs |
160 took place on. This will be | 160 took place on. This will be |
161 @c NULL if the account no longer | 161 @c NULL if the account no longer |
162 exists. (Depending on a | 162 exists. (Depending on a |
163 logger's implementation of | 163 logger's implementation of |
164 list, it may not be possible | 164 list, it may not be possible |
194 * @param time The time this conversation started | 194 * @param time The time this conversation started |
195 * @param tm The time this conversation started, with timezone data, | 195 * @param tm The time this conversation started, with timezone data, |
196 * if available and if struct tm has the BSD timezone fields. | 196 * if available and if struct tm has the BSD timezone fields. |
197 * @return The new log | 197 * @return The new log |
198 */ | 198 */ |
199 GaimLog *gaim_log_new(GaimLogType type, const char *name, GaimAccount *account, | 199 PurpleLog *purple_log_new(PurpleLogType type, const char *name, PurpleAccount *account, |
200 GaimConversation *conv, time_t time, const struct tm *tm); | 200 PurpleConversation *conv, time_t time, const struct tm *tm); |
201 | 201 |
202 /** | 202 /** |
203 * Frees a log | 203 * Frees a log |
204 * | 204 * |
205 * @param log The log to destroy | 205 * @param log The log to destroy |
206 */ | 206 */ |
207 void gaim_log_free(GaimLog *log); | 207 void purple_log_free(PurpleLog *log); |
208 | 208 |
209 /** | 209 /** |
210 * Writes to a log file. Assumes you have checked preferences already. | 210 * Writes to a log file. Assumes you have checked preferences already. |
211 * | 211 * |
212 * @param log The log to write to | 212 * @param log The log to write to |
214 * @param from Whom this message is coming from, or @c NULL for | 214 * @param from Whom this message is coming from, or @c NULL for |
215 * system messages | 215 * system messages |
216 * @param time A timestamp in UNIX time | 216 * @param time A timestamp in UNIX time |
217 * @param message The message to log | 217 * @param message The message to log |
218 */ | 218 */ |
219 void gaim_log_write(GaimLog *log, | 219 void purple_log_write(PurpleLog *log, |
220 GaimMessageFlags type, | 220 PurpleMessageFlags type, |
221 const char *from, | 221 const char *from, |
222 time_t time, | 222 time_t time, |
223 const char *message); | 223 const char *message); |
224 | 224 |
225 /** | 225 /** |
226 * Reads from a log | 226 * Reads from a log |
227 * | 227 * |
228 * @param log The log to read from | 228 * @param log The log to read from |
229 * @param flags The returned logging flags. | 229 * @param flags The returned logging flags. |
230 * | 230 * |
231 * @return The contents of this log in Gaim Markup. | 231 * @return The contents of this log in Purple Markup. |
232 */ | 232 */ |
233 char *gaim_log_read(GaimLog *log, GaimLogReadFlags *flags); | 233 char *purple_log_read(PurpleLog *log, PurpleLogReadFlags *flags); |
234 | 234 |
235 /** | 235 /** |
236 * Returns a list of all available logs | 236 * Returns a list of all available logs |
237 * | 237 * |
238 * @param type The type of the log | 238 * @param type The type of the log |
239 * @param name The name of the log | 239 * @param name The name of the log |
240 * @param account The account | 240 * @param account The account |
241 * @return A sorted list of GaimLogs | 241 * @return A sorted list of PurpleLogs |
242 */ | 242 */ |
243 GList *gaim_log_get_logs(GaimLogType type, const char *name, GaimAccount *account); | 243 GList *purple_log_get_logs(PurpleLogType type, const char *name, PurpleAccount *account); |
244 | 244 |
245 /** | 245 /** |
246 * Returns a GHashTable of GaimLogSets. | 246 * Returns a GHashTable of PurpleLogSets. |
247 * | 247 * |
248 * A "log set" here means the information necessary to gather the | 248 * A "log set" here means the information necessary to gather the |
249 * GaimLogs for a given buddy/chat. This information would be passed | 249 * PurpleLogs for a given buddy/chat. This information would be passed |
250 * to gaim_log_list to get a list of GaimLogs. | 250 * to purple_log_list to get a list of PurpleLogs. |
251 * | 251 * |
252 * The primary use of this function is to get a list of everyone the | 252 * The primary use of this function is to get a list of everyone the |
253 * user has ever talked to (assuming he or she uses logging). | 253 * user has ever talked to (assuming he or she uses logging). |
254 * | 254 * |
255 * The GHashTable that's returned will free all log sets in it when | 255 * The GHashTable that's returned will free all log sets in it when |
256 * destroyed. If a GaimLogSet is removed from the GHashTable, it | 256 * destroyed. If a PurpleLogSet is removed from the GHashTable, it |
257 * must be freed with gaim_log_set_free(). | 257 * must be freed with purple_log_set_free(). |
258 * | 258 * |
259 * @return A GHashTable of all available unique GaimLogSets | 259 * @return A GHashTable of all available unique PurpleLogSets |
260 */ | 260 */ |
261 GHashTable *gaim_log_get_log_sets(void); | 261 GHashTable *purple_log_get_log_sets(void); |
262 | 262 |
263 /** | 263 /** |
264 * Returns a list of all available system logs | 264 * Returns a list of all available system logs |
265 * | 265 * |
266 * @param account The account | 266 * @param account The account |
267 * @return A sorted list of GaimLogs | 267 * @return A sorted list of PurpleLogs |
268 */ | 268 */ |
269 GList *gaim_log_get_system_logs(GaimAccount *account); | 269 GList *purple_log_get_system_logs(PurpleAccount *account); |
270 | 270 |
271 /** | 271 /** |
272 * Returns the size of a log | 272 * Returns the size of a log |
273 * | 273 * |
274 * @param log The log | 274 * @param log The log |
275 * @return The size of the log, in bytes | 275 * @return The size of the log, in bytes |
276 */ | 276 */ |
277 int gaim_log_get_size(GaimLog *log); | 277 int purple_log_get_size(PurpleLog *log); |
278 | 278 |
279 /** | 279 /** |
280 * Returns the size, in bytes, of all available logs in this conversation | 280 * Returns the size, in bytes, of all available logs in this conversation |
281 * | 281 * |
282 * @param type The type of the log | 282 * @param type The type of the log |
283 * @param name The name of the log | 283 * @param name The name of the log |
284 * @param account The account | 284 * @param account The account |
285 * @return The size in bytes | 285 * @return The size in bytes |
286 */ | 286 */ |
287 int gaim_log_get_total_size(GaimLogType type, const char *name, GaimAccount *account); | 287 int purple_log_get_total_size(PurpleLogType type, const char *name, PurpleAccount *account); |
288 | 288 |
289 /** | 289 /** |
290 * Tests whether a log is deletable | 290 * Tests whether a log is deletable |
291 * | 291 * |
292 * A return value of @c FALSE indicates that gaim_log_delete() will fail on this | 292 * A return value of @c FALSE indicates that purple_log_delete() will fail on this |
293 * log, unless something changes between the two calls. A return value of @c TRUE, | 293 * log, unless something changes between the two calls. A return value of @c TRUE, |
294 * however, does not guarantee the log can be deleted. | 294 * however, does not guarantee the log can be deleted. |
295 * | 295 * |
296 * @param log The log | 296 * @param log The log |
297 * @return A boolean indicating if the log is deletable | 297 * @return A boolean indicating if the log is deletable |
298 */ | 298 */ |
299 gboolean gaim_log_is_deletable(GaimLog *log); | 299 gboolean purple_log_is_deletable(PurpleLog *log); |
300 | 300 |
301 /** | 301 /** |
302 * Deletes a log | 302 * Deletes a log |
303 * | 303 * |
304 * @param log The log | 304 * @param log The log |
305 * @return A boolean indicating success or failure | 305 * @return A boolean indicating success or failure |
306 */ | 306 */ |
307 gboolean gaim_log_delete(GaimLog *log); | 307 gboolean purple_log_delete(PurpleLog *log); |
308 | 308 |
309 /** | 309 /** |
310 * Returns the default logger directory Gaim uses for a given account | 310 * Returns the default logger directory Purple uses for a given account |
311 * and username. This would be where Gaim stores logs created by | 311 * and username. This would be where Purple stores logs created by |
312 * the built-in text or HTML loggers. | 312 * the built-in text or HTML loggers. |
313 * | 313 * |
314 * @param type The type of the log. | 314 * @param type The type of the log. |
315 * @param name The name of the log. | 315 * @param name The name of the log. |
316 * @param account The account. | 316 * @param account The account. |
317 * @return The default logger directory for Gaim. | 317 * @return The default logger directory for Purple. |
318 */ | 318 */ |
319 char *gaim_log_get_log_dir(GaimLogType type, const char *name, GaimAccount *account); | 319 char *purple_log_get_log_dir(PurpleLogType type, const char *name, PurpleAccount *account); |
320 | 320 |
321 /** | 321 /** |
322 * Implements GCompareFunc for GaimLogs | 322 * Implements GCompareFunc for PurpleLogs |
323 * | 323 * |
324 * @param y A GaimLog | 324 * @param y A PurpleLog |
325 * @param z Another GaimLog | 325 * @param z Another PurpleLog |
326 * @return A value as specified by GCompareFunc | 326 * @return A value as specified by GCompareFunc |
327 */ | 327 */ |
328 gint gaim_log_compare(gconstpointer y, gconstpointer z); | 328 gint purple_log_compare(gconstpointer y, gconstpointer z); |
329 | 329 |
330 /** | 330 /** |
331 * Implements GCompareFunc for GaimLogSets | 331 * Implements GCompareFunc for PurpleLogSets |
332 * | 332 * |
333 * @param y A GaimLogSet | 333 * @param y A PurpleLogSet |
334 * @param z Another GaimLogSet | 334 * @param z Another PurpleLogSet |
335 * @return A value as specified by GCompareFunc | 335 * @return A value as specified by GCompareFunc |
336 */ | 336 */ |
337 gint gaim_log_set_compare(gconstpointer y, gconstpointer z); | 337 gint purple_log_set_compare(gconstpointer y, gconstpointer z); |
338 | 338 |
339 /** | 339 /** |
340 * Frees a log set | 340 * Frees a log set |
341 * | 341 * |
342 * @param set The log set to destroy | 342 * @param set The log set to destroy |
343 */ | 343 */ |
344 void gaim_log_set_free(GaimLogSet *set); | 344 void purple_log_set_free(PurpleLogSet *set); |
345 | 345 |
346 /*@}*/ | 346 /*@}*/ |
347 | 347 |
348 /******************************************/ | 348 /******************************************/ |
349 /** @name Common Logger Functions */ | 349 /** @name Common Logger Functions */ |
350 /******************************************/ | 350 /******************************************/ |
351 /*@{*/ | 351 /*@{*/ |
352 | 352 |
353 /** | 353 /** |
354 * Opens a new log file in the standard Gaim log location | 354 * Opens a new log file in the standard Purple log location |
355 * with the given file extension, named for the current time, | 355 * with the given file extension, named for the current time, |
356 * for writing. If a log file is already open, the existing | 356 * for writing. If a log file is already open, the existing |
357 * file handle is retained. The log's logger_data value is | 357 * file handle is retained. The log's logger_data value is |
358 * set to a GaimLogCommonLoggerData struct containing the log | 358 * set to a PurpleLogCommonLoggerData struct containing the log |
359 * file handle and log path. | 359 * file handle and log path. |
360 * | 360 * |
361 * This function is intended to be used as a "common" | 361 * This function is intended to be used as a "common" |
362 * implementation of a logger's @c write function. | 362 * implementation of a logger's @c write function. |
363 * It should only be passed to gaim_log_logger_new() and never | 363 * It should only be passed to purple_log_logger_new() and never |
364 * called directly. | 364 * called directly. |
365 * | 365 * |
366 * @param log The log to write to. | 366 * @param log The log to write to. |
367 * @param ext The file extension to give to this log file. | 367 * @param ext The file extension to give to this log file. |
368 */ | 368 */ |
369 void gaim_log_common_writer(GaimLog *log, const char *ext); | 369 void purple_log_common_writer(PurpleLog *log, const char *ext); |
370 | 370 |
371 /** | 371 /** |
372 * Returns a sorted GList of GaimLogs of the requested type. | 372 * Returns a sorted GList of PurpleLogs of the requested type. |
373 * | 373 * |
374 * This function should only be used with logs that are written | 374 * This function should only be used with logs that are written |
375 * with gaim_log_common_writer(). It's intended to be used as | 375 * with purple_log_common_writer(). It's intended to be used as |
376 * a "common" implementation of a logger's @c list function. | 376 * a "common" implementation of a logger's @c list function. |
377 * It should only be passed to gaim_log_logger_new() and never | 377 * It should only be passed to purple_log_logger_new() and never |
378 * called directly. | 378 * called directly. |
379 * | 379 * |
380 * @param type The type of the logs being listed. | 380 * @param type The type of the logs being listed. |
381 * @param name The name of the log. | 381 * @param name The name of the log. |
382 * @param account The account of the log. | 382 * @param account The account of the log. |
383 * @param ext The file extension this log format uses. | 383 * @param ext The file extension this log format uses. |
384 * @param logger A reference to the logger struct for this log. | 384 * @param logger A reference to the logger struct for this log. |
385 * | 385 * |
386 * @return A sorted GList of GaimLogs matching the parameters. | 386 * @return A sorted GList of PurpleLogs matching the parameters. |
387 */ | 387 */ |
388 GList *gaim_log_common_lister(GaimLogType type, const char *name, | 388 GList *purple_log_common_lister(PurpleLogType type, const char *name, |
389 GaimAccount *account, const char *ext, | 389 PurpleAccount *account, const char *ext, |
390 GaimLogLogger *logger); | 390 PurpleLogLogger *logger); |
391 | 391 |
392 /** | 392 /** |
393 * Returns the total size of all the logs for a given user, with | 393 * Returns the total size of all the logs for a given user, with |
394 * a given extension. | 394 * a given extension. |
395 * | 395 * |
396 * This function should only be used with logs that are written | 396 * This function should only be used with logs that are written |
397 * with gaim_log_common_writer(). It's intended to be used as | 397 * with purple_log_common_writer(). It's intended to be used as |
398 * a "common" implementation of a logger's @c total_size function. | 398 * a "common" implementation of a logger's @c total_size function. |
399 * It should only be passed to gaim_log_logger_new() and never | 399 * It should only be passed to purple_log_logger_new() and never |
400 * called directly. | 400 * called directly. |
401 * | 401 * |
402 * @param type The type of the logs being sized. | 402 * @param type The type of the logs being sized. |
403 * @param name The name of the logs to size | 403 * @param name The name of the logs to size |
404 * (e.g. the username or chat name). | 404 * (e.g. the username or chat name). |
406 * @param ext The file extension this log format uses. | 406 * @param ext The file extension this log format uses. |
407 * | 407 * |
408 * @return The size of all the logs with the specified extension | 408 * @return The size of all the logs with the specified extension |
409 * for the specified user. | 409 * for the specified user. |
410 */ | 410 */ |
411 int gaim_log_common_total_sizer(GaimLogType type, const char *name, | 411 int purple_log_common_total_sizer(PurpleLogType type, const char *name, |
412 GaimAccount *account, const char *ext); | 412 PurpleAccount *account, const char *ext); |
413 | 413 |
414 /** | 414 /** |
415 * Returns the size of a given GaimLog. | 415 * Returns the size of a given PurpleLog. |
416 * | 416 * |
417 * This function should only be used with logs that are written | 417 * This function should only be used with logs that are written |
418 * with gaim_log_common_writer(). It's intended to be used as | 418 * with purple_log_common_writer(). It's intended to be used as |
419 * a "common" implementation of a logger's @c size function. | 419 * a "common" implementation of a logger's @c size function. |
420 * It should only be passed to gaim_log_logger_new() and never | 420 * It should only be passed to purple_log_logger_new() and never |
421 * called directly. | 421 * called directly. |
422 * | 422 * |
423 * @param log The GaimLog to size. | 423 * @param log The PurpleLog to size. |
424 * | 424 * |
425 * @return An integer indicating the size of the log in bytes. | 425 * @return An integer indicating the size of the log in bytes. |
426 */ | 426 */ |
427 int gaim_log_common_sizer(GaimLog *log); | 427 int purple_log_common_sizer(PurpleLog *log); |
428 | 428 |
429 /** | 429 /** |
430 * Deletes a log | 430 * Deletes a log |
431 * | 431 * |
432 * This function should only be used with logs that are written | 432 * This function should only be used with logs that are written |
433 * with gaim_log_common_writer(). It's intended to be used as | 433 * with purple_log_common_writer(). It's intended to be used as |
434 * a "common" implementation of a logger's @c delete function. | 434 * a "common" implementation of a logger's @c delete function. |
435 * It should only be passed to gaim_log_logger_new() and never | 435 * It should only be passed to purple_log_logger_new() and never |
436 * called directly. | 436 * called directly. |
437 * | 437 * |
438 * @param log The GaimLog to delete. | 438 * @param log The PurpleLog to delete. |
439 * | 439 * |
440 * @return A boolean indicating success or failure. | 440 * @return A boolean indicating success or failure. |
441 */ | 441 */ |
442 gboolean gaim_log_common_deleter(GaimLog *log); | 442 gboolean purple_log_common_deleter(PurpleLog *log); |
443 | 443 |
444 /** | 444 /** |
445 * Checks to see if a log is deletable | 445 * Checks to see if a log is deletable |
446 * | 446 * |
447 * This function should only be used with logs that are written | 447 * This function should only be used with logs that are written |
448 * with gaim_log_common_writer(). It's intended to be used as | 448 * with purple_log_common_writer(). It's intended to be used as |
449 * a "common" implementation of a logger's @c is_deletable function. | 449 * a "common" implementation of a logger's @c is_deletable function. |
450 * It should only be passed to gaim_log_logger_new() and never | 450 * It should only be passed to purple_log_logger_new() and never |
451 * called directly. | 451 * called directly. |
452 * | 452 * |
453 * @param log The GaimLog to check. | 453 * @param log The PurpleLog to check. |
454 * | 454 * |
455 * @return A boolean indicating if the log is deletable. | 455 * @return A boolean indicating if the log is deletable. |
456 */ | 456 */ |
457 gboolean gaim_log_common_is_deletable(GaimLog *log); | 457 gboolean purple_log_common_is_deletable(PurpleLog *log); |
458 | 458 |
459 /*@}*/ | 459 /*@}*/ |
460 | 460 |
461 /******************************************/ | 461 /******************************************/ |
462 /** @name Logger Functions */ | 462 /** @name Logger Functions */ |
471 * @param functions The number of functions being passed. The following | 471 * @param functions The number of functions being passed. The following |
472 * functions are currently available (in order): @c create, | 472 * functions are currently available (in order): @c create, |
473 * @c write, @c finalize, @c list, @c read, @c size, | 473 * @c write, @c finalize, @c list, @c read, @c size, |
474 * @c total_size, @c list_syslog, @c get_log_sets, | 474 * @c total_size, @c list_syslog, @c get_log_sets, |
475 * @c delete, @c is_deletable. | 475 * @c delete, @c is_deletable. |
476 * For details on these functions, see GaimLogLogger. | 476 * For details on these functions, see PurpleLogLogger. |
477 * Functions may not be skipped. For example, passing | 477 * Functions may not be skipped. For example, passing |
478 * @c create and @c write is acceptable (for a total of | 478 * @c create and @c write is acceptable (for a total of |
479 * two functions). Passing @c create and @c finalize, | 479 * two functions). Passing @c create and @c finalize, |
480 * however, is not. To accomplish that, the caller must | 480 * however, is not. To accomplish that, the caller must |
481 * pass @c create, @c NULL (a placeholder for @c write), | 481 * pass @c create, @c NULL (a placeholder for @c write), |
482 * and @c finalize (for a total of 3 functions). | 482 * and @c finalize (for a total of 3 functions). |
483 * | 483 * |
484 * @return The new logger | 484 * @return The new logger |
485 */ | 485 */ |
486 GaimLogLogger *gaim_log_logger_new(const char *id, const char *name, int functions, ...); | 486 PurpleLogLogger *purple_log_logger_new(const char *id, const char *name, int functions, ...); |
487 | 487 |
488 /** | 488 /** |
489 * Frees a logger | 489 * Frees a logger |
490 * | 490 * |
491 * @param logger The logger to free | 491 * @param logger The logger to free |
492 */ | 492 */ |
493 void gaim_log_logger_free(GaimLogLogger *logger); | 493 void purple_log_logger_free(PurpleLogLogger *logger); |
494 | 494 |
495 /** | 495 /** |
496 * Adds a new logger | 496 * Adds a new logger |
497 * | 497 * |
498 * @param logger The new logger to add | 498 * @param logger The new logger to add |
499 */ | 499 */ |
500 void gaim_log_logger_add (GaimLogLogger *logger); | 500 void purple_log_logger_add (PurpleLogLogger *logger); |
501 | 501 |
502 /** | 502 /** |
503 * | 503 * |
504 * Removes a logger | 504 * Removes a logger |
505 * | 505 * |
506 * @param logger The logger to remove | 506 * @param logger The logger to remove |
507 */ | 507 */ |
508 void gaim_log_logger_remove (GaimLogLogger *logger); | 508 void purple_log_logger_remove (PurpleLogLogger *logger); |
509 | 509 |
510 /** | 510 /** |
511 * | 511 * |
512 * Sets the current logger | 512 * Sets the current logger |
513 * | 513 * |
514 * @param logger The logger to set | 514 * @param logger The logger to set |
515 */ | 515 */ |
516 void gaim_log_logger_set (GaimLogLogger *logger); | 516 void purple_log_logger_set (PurpleLogLogger *logger); |
517 | 517 |
518 /** | 518 /** |
519 * | 519 * |
520 * Returns the current logger | 520 * Returns the current logger |
521 * | 521 * |
522 * @return logger The current logger | 522 * @return logger The current logger |
523 */ | 523 */ |
524 GaimLogLogger *gaim_log_logger_get (void); | 524 PurpleLogLogger *purple_log_logger_get (void); |
525 | 525 |
526 /** | 526 /** |
527 * Returns a GList containing the IDs and names of the registered | 527 * Returns a GList containing the IDs and names of the registered |
528 * loggers. | 528 * loggers. |
529 * | 529 * |
530 * @return The list of IDs and names. | 530 * @return The list of IDs and names. |
531 */ | 531 */ |
532 GList *gaim_log_logger_get_options(void); | 532 GList *purple_log_logger_get_options(void); |
533 | 533 |
534 /**************************************************************************/ | 534 /**************************************************************************/ |
535 /** @name Log Subsystem */ | 535 /** @name Log Subsystem */ |
536 /**************************************************************************/ | 536 /**************************************************************************/ |
537 /*@{*/ | 537 /*@{*/ |
538 | 538 |
539 /** | 539 /** |
540 * Initializes the log subsystem. | 540 * Initializes the log subsystem. |
541 */ | 541 */ |
542 void gaim_log_init(void); | 542 void purple_log_init(void); |
543 | 543 |
544 /** | 544 /** |
545 * Returns the log subsystem handle. | 545 * Returns the log subsystem handle. |
546 * | 546 * |
547 * @return The log subsystem handle. | 547 * @return The log subsystem handle. |
548 */ | 548 */ |
549 void *gaim_log_get_handle(void); | 549 void *purple_log_get_handle(void); |
550 | 550 |
551 /** | 551 /** |
552 * Uninitializes the log subsystem. | 552 * Uninitializes the log subsystem. |
553 */ | 553 */ |
554 void gaim_log_uninit(void); | 554 void purple_log_uninit(void); |
555 | 555 |
556 /*@}*/ | 556 /*@}*/ |
557 | 557 |
558 | 558 |
559 #ifdef __cplusplus | 559 #ifdef __cplusplus |
560 } | 560 } |
561 #endif | 561 #endif |
562 | 562 |
563 #endif /* _GAIM_LOG_H_ */ | 563 #endif /* _PURPLE_LOG_H_ */ |