Mercurial > pidgin.yaz
comparison src/log.h @ 11025:8d2007d738d5
[gaim-migrate @ 12899]
sf patch #1180490, from Richard Laager (who else?)
A pretty peach of a patch that allows you to auto-complete screen names
based on log file names.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 23 Jun 2005 03:04:52 +0000 |
parents | 5c5120837bab |
children | 11e465b55fe6 |
comparison
equal
deleted
inserted
replaced
11024:1d58cc6c4552 | 11025:8d2007d738d5 |
---|---|
33 ********************************************************/ | 33 ********************************************************/ |
34 | 34 |
35 typedef struct _GaimLog GaimLog; | 35 typedef struct _GaimLog GaimLog; |
36 typedef struct _GaimLogLogger GaimLogLogger; | 36 typedef struct _GaimLogLogger GaimLogLogger; |
37 typedef struct _GaimLogCommonLoggerData GaimLogCommonLoggerData; | 37 typedef struct _GaimLogCommonLoggerData GaimLogCommonLoggerData; |
38 typedef struct _GaimLogSet GaimLogSet; | |
38 | 39 |
39 typedef enum { | 40 typedef enum { |
40 GAIM_LOG_IM, | 41 GAIM_LOG_IM, |
41 GAIM_LOG_CHAT, | 42 GAIM_LOG_CHAT, |
42 GAIM_LOG_SYSTEM | 43 GAIM_LOG_SYSTEM |
89 * implementation is used */ | 90 * implementation is used */ |
90 int (*total_size)(GaimLogType type, const char *name, GaimAccount *account); | 91 int (*total_size)(GaimLogType type, const char *name, GaimAccount *account); |
91 | 92 |
92 /** This function returns a sorted GList of available system GaimLogs */ | 93 /** This function returns a sorted GList of available system GaimLogs */ |
93 GList *(*list_syslog)(GaimAccount *account); | 94 GList *(*list_syslog)(GaimAccount *account); |
95 | |
96 /** Returns a list of GaimLogSets. By passing the data in the GaimLogSets | |
97 * to list, the caller can get every available GaimLog from the logger. | |
98 * Loggers using gaim_log_common_writer() (or otherwise storing their | |
99 * logs in the same directory structure as the stock loggers) do not | |
100 * need to implement this function. */ | |
101 GList *(*get_log_sets)(void); | |
94 }; | 102 }; |
95 | 103 |
96 /** | 104 /** |
97 * A log. Not the wooden type. | 105 * A log. Not the wooden type. |
98 */ | 106 */ |
116 char *path; | 124 char *path; |
117 FILE *file; | 125 FILE *file; |
118 void *extra_data; | 126 void *extra_data; |
119 }; | 127 }; |
120 | 128 |
129 /** | |
130 * Describes available logs. | |
131 * | |
132 * By passing the elements of this struct to gaim_log_get_logs(), the caller | |
133 * can get all available GaimLogs. | |
134 */ | |
135 struct _GaimLogSet { | |
136 GaimLogType type; /**< The type of logs available */ | |
137 char *name; /**< The name of the logs available */ | |
138 GaimAccount *account; /**< The account the available logs | |
139 took place on. This will be | |
140 NULL if the account no longer | |
141 exists. (Depending on a | |
142 logger's implementation of | |
143 list, it may not be possible | |
144 to load such logs.) */ | |
145 gboolean buddy; /**< Is this (account, name) a buddy | |
146 on the buddy list? */ | |
147 }; | |
148 | |
121 #ifdef __cplusplus | 149 #ifdef __cplusplus |
122 extern "C" { | 150 extern "C" { |
123 #endif | 151 #endif |
124 | 152 |
125 /***************************************/ | 153 /***************************************/ |
129 | 157 |
130 /** | 158 /** |
131 * Creates a new log | 159 * Creates a new log |
132 * | 160 * |
133 * @param type The type of log this is. | 161 * @param type The type of log this is. |
134 * @param name The name of this conversation (Screenname, chat name, | 162 * @param name The name of this conversation (screenname, chat name, |
135 * etc.) | 163 * etc.) |
136 * @param account The account the conversation is occurring on | 164 * @param account The account the conversation is occurring on |
137 * @param time The time this conversation started | 165 * @param time The time this conversation started |
138 * @return The new log | 166 * @return The new log |
139 */ | 167 */ |
182 * @return A sorted list of GaimLogs | 210 * @return A sorted list of GaimLogs |
183 */ | 211 */ |
184 GList *gaim_log_get_logs(GaimLogType type, const char *name, GaimAccount *account); | 212 GList *gaim_log_get_logs(GaimLogType type, const char *name, GaimAccount *account); |
185 | 213 |
186 /** | 214 /** |
215 * Returns a list of GaimLogSets. | |
216 * | |
217 * A "log set" here means the information necessary to gather the | |
218 * GaimLogs for a given buddy/chat. This information would be passed | |
219 * to gaim_log_list to get a list of GaimLogs. | |
220 * | |
221 * The primary use of this function is to get a list of everyone the | |
222 * user has ever talked to (assuming he or she uses logging). | |
223 * | |
224 * @return A sorted list of all available unique GaimLogSets | |
225 */ | |
226 GList *gaim_log_get_log_sets(void); | |
227 | |
228 /** | |
187 * Returns a list of all available system logs | 229 * Returns a list of all available system logs |
188 * | 230 * |
189 * @param account The account | 231 * @param account The account |
190 * @return A sorted list of GaimLogs | 232 * @return A sorted list of GaimLogs |
191 */ | 233 */ |
220 * @return The default logger directory for Gaim. | 262 * @return The default logger directory for Gaim. |
221 */ | 263 */ |
222 char *gaim_log_get_log_dir(GaimLogType type, const char *name, GaimAccount *account); | 264 char *gaim_log_get_log_dir(GaimLogType type, const char *name, GaimAccount *account); |
223 | 265 |
224 /** | 266 /** |
225 * Implements GCompareFunc | 267 * Implements GCompareFunc for GaimLogs |
226 * | 268 * |
227 * @param y A GaimLog | 269 * @param y A GaimLog |
228 * @param z Another GaimLog | 270 * @param z Another GaimLog |
229 * @return A value as specified by GCompareFunc | 271 * @return A value as specified by GCompareFunc |
230 */ | 272 */ |
231 gint gaim_log_compare(gconstpointer y, gconstpointer z); | 273 gint gaim_log_compare(gconstpointer y, gconstpointer z); |
274 | |
275 /** | |
276 * Implements GCompareFunc for GaimLogSets | |
277 * | |
278 * @param y A GaimLogSet | |
279 * @param z Another GaimLogSet | |
280 * @return A value as specified by GCompareFunc | |
281 */ | |
282 gint gaim_log_set_compare(gconstpointer y, gconstpointer z); | |
283 | |
232 /*@}*/ | 284 /*@}*/ |
233 | 285 |
234 /******************************************/ | 286 /******************************************/ |
235 /** @name Common Logger Functions */ | 287 /** @name Common Logger Functions */ |
236 /******************************************/ | 288 /******************************************/ |
285 /*@{*/ | 337 /*@{*/ |
286 | 338 |
287 /** | 339 /** |
288 * Creates a new logger | 340 * Creates a new logger |
289 * | 341 * |
290 * @param create The logger's new function. | 342 * @param create The logger's new function. |
291 * @param write The logger's write function. | 343 * @param write The logger's write function. |
292 * @param finalize The logger's finalize function. | 344 * @param finalize The logger's finalize function. |
293 * @param list The logger's list function. | 345 * @param list The logger's list function. |
294 * @param read The logger's read function. | 346 * @param read The logger's read function. |
295 * @param size The logger's size function. | 347 * @param size The logger's size function. |
348 * @param total_size The logger's total_size function. | |
349 * @param list_syslog The logger's list_syslog function. | |
350 * @param get_log_sets The logger's get_log_sets function. | |
296 * | 351 * |
297 * @return The new logger | 352 * @return The new logger |
298 */ | 353 */ |
299 GaimLogLogger *gaim_log_logger_new( | 354 GaimLogLogger *gaim_log_logger_new( |
300 void(*create)(GaimLog *), | 355 void(*create)(GaimLog *), |
301 void(*write)(GaimLog *, GaimMessageFlags, const char *, time_t, const char *), | 356 void(*write)(GaimLog *, GaimMessageFlags, const char *, time_t, const char *), |
302 void(*finalize)(GaimLog *), | 357 void(*finalize)(GaimLog *), |
303 GList*(*list)(GaimLogType type, const char*, GaimAccount*), | 358 GList*(*list)(GaimLogType type, const char*, GaimAccount*), |
304 char*(*read)(GaimLog*, GaimLogReadFlags*), | 359 char*(*read)(GaimLog*, GaimLogReadFlags*), |
305 int(*size)(GaimLog*)); | 360 int(*size)(GaimLog*), |
361 int(*total_size)(GaimLogType type, const char *name, GaimAccount *account), | |
362 GList*(*list_syslog)(GaimAccount *account), | |
363 GList*(*get_log_sets)(void)); | |
364 | |
306 /** | 365 /** |
307 * Frees a logger | 366 * Frees a logger |
308 * | 367 * |
309 * @param logger The logger to free | 368 * @param logger The logger to free |
310 */ | 369 */ |
340 * @return logger The current logger | 399 * @return logger The current logger |
341 */ | 400 */ |
342 GaimLogLogger *gaim_log_logger_get (void); | 401 GaimLogLogger *gaim_log_logger_get (void); |
343 | 402 |
344 /** | 403 /** |
345 * Returns a GList containing the IDs and Names of the registered log | 404 * Returns a GList containing the IDs and names of the registered |
346 * loggers. | 405 * loggers. |
347 * | 406 * |
348 * @return The list of IDs and names. | 407 * @return The list of IDs and names. |
349 */ | 408 */ |
350 GList *gaim_log_logger_get_options(void); | 409 GList *gaim_log_logger_get_options(void); |
351 | 410 |
411 /** | |
412 * Initializes the log subsystem. | |
413 */ | |
352 void gaim_log_init(void); | 414 void gaim_log_init(void); |
353 /*@}*/ | 415 /*@}*/ |
354 | 416 |
355 | 417 |
356 #ifdef __cplusplus | 418 #ifdef __cplusplus |