Thu, 07 Jul 2005 15:43:48 +0000
[gaim-migrate @ 13048]
Modified configure.ac so that it rejects dbus builds with the dbus
library older than 0.34
Added a simple object registration system to the dbus implementation
so that it is possible to query object properties remotely (eg. give
me property "name" of buddy with id = 5).
| 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; |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
38 | typedef struct _GaimLogSet GaimLogSet; |
| 7431 | 39 | |
| 40 | typedef enum { | |
| 41 | GAIM_LOG_IM, | |
| 42 | GAIM_LOG_CHAT, | |
|
10348
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10231
diff
changeset
|
43 | GAIM_LOG_SYSTEM |
| 7431 | 44 | } GaimLogType; |
| 45 | ||
| 46 | typedef enum { | |
|
10348
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10231
diff
changeset
|
47 | GAIM_LOG_READ_NO_NEWLINE = 1 |
| 7431 | 48 | } GaimLogReadFlags; |
| 49 | ||
| 50 | #include "account.h" | |
| 51 | #include "conversation.h" | |
| 52 | ||
| 53 | /** | |
| 54 | * A log logger. | |
| 55 | * | |
| 56 | * This struct gets filled out and is included in the GaimLog. It contains everything | |
| 57 | * needed to write and read from logs. | |
| 58 | */ | |
| 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
25c595cbffe8
[gaim-migrate @ 12465]
Richard Laager <rlaager@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
25c595cbffe8
[gaim-migrate @ 12465]
Richard Laager <rlaager@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
85f5615bc27e
[gaim-migrate @ 9667]
Mark Doliner <markdoliner@pidgin.im>
parents:
8735
diff
changeset
|
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
047177cee39f
[gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents:
10171
diff
changeset
|
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
85f5615bc27e
[gaim-migrate @ 9667]
Mark Doliner <markdoliner@pidgin.im>
parents:
8735
diff
changeset
|
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); | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
94 | |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
95 | /** Returns a list of GaimLogSets. By passing the data in the GaimLogSets |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
96 | * to list, the caller can get every available GaimLog from the logger. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
97 | * Loggers using gaim_log_common_writer() (or otherwise storing their |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
98 | * logs in the same directory structure as the stock loggers) do not |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
99 | * need to implement this function. */ |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
100 | GList *(*get_log_sets)(void); |
| 5872 | 101 | }; |
| 102 | ||
| 7431 | 103 | /** |
| 104 | * A log. Not the wooden type. | |
| 105 | */ | |
| 106 | struct _GaimLog { | |
| 107 | GaimLogType type; /**< The type of log this is */ | |
| 108 | char *name; /**< The name of this log */ | |
| 7440 | 109 | GaimAccount *account; /**< The account this log is taking |
| 110 | place on */ | |
| 111 | time_t time; /**< The time this conversation | |
| 112 | started */ | |
| 113 | GaimLogLogger *logger; /**< The logging mechanism this log | |
| 114 | is to use */ | |
| 7431 | 115 | void *logger_data; /**< Data used by the log logger */ |
| 5872 | 116 | }; |
| 117 | ||
| 10822 | 118 | /** |
| 119 | * A common logger_data struct containing a file handle and path, as well | |
| 120 | * as a pointer to something else for additional data. | |
| 121 | */ | |
| 122 | struct _GaimLogCommonLoggerData { | |
| 123 | char *path; | |
| 124 | FILE *file; | |
| 125 | void *extra_data; | |
| 126 | }; | |
| 7431 | 127 | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
128 | /** |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
129 | * Describes available logs. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
130 | * |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
131 | * By passing the elements of this struct to gaim_log_get_logs(), the caller |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
132 | * can get all available GaimLogs. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
133 | */ |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
134 | struct _GaimLogSet { |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
135 | GaimLogType type; /**< The type of logs available */ |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
136 | char *name; /**< The name of the logs available */ |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
137 | GaimAccount *account; /**< The account the available logs |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
138 | took place on. This will be |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
139 | NULL if the account no longer |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
140 | exists. (Depending on a |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
141 | logger's implementation of |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
142 | list, it may not be possible |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
143 | to load such logs.) */ |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
144 | gboolean buddy; /**< Is this (account, name) a buddy |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
145 | on the buddy list? */ |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
146 | }; |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
147 | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
148 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
149 | extern "C" { |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
150 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
151 | |
| 10566 | 152 | /***************************************/ |
| 153 | /** @name Log Functions */ | |
| 154 | /***************************************/ | |
| 155 | /*@{*/ | |
| 7440 | 156 | |
| 10566 | 157 | /** |
| 158 | * Creates a new log | |
| 159 | * | |
| 160 | * @param type The type of log this is. | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
161 | * @param name The name of this conversation (screenname, chat name, |
| 10566 | 162 | * etc.) |
| 163 | * @param account The account the conversation is occurring on | |
| 164 | * @param time The time this conversation started | |
| 165 | * @return The new log | |
| 166 | */ | |
| 167 | GaimLog *gaim_log_new(GaimLogType type, const char *name, | |
| 168 | GaimAccount *account, time_t time); | |
| 7431 | 169 | |
| 10566 | 170 | /** |
| 171 | * Frees a log | |
| 172 | * | |
| 173 | * @param log The log to destroy | |
| 174 | */ | |
| 175 | void gaim_log_free(GaimLog *log); | |
| 7440 | 176 | |
| 10566 | 177 | /** |
| 178 | * Writes to a log file. Assumes you have checked preferences already. | |
| 179 | * | |
| 180 | * @param log The log to write to | |
| 181 | * @param type The type of message being logged | |
| 182 | * @param from Whom this message is coming from, or NULL for | |
| 183 | * system messages | |
| 184 | * @param time A timestamp in UNIX time | |
| 185 | * @param message The message to log | |
| 186 | */ | |
| 187 | void gaim_log_write(GaimLog *log, | |
| 188 | GaimMessageFlags type, | |
| 189 | const char *from, | |
| 190 | time_t time, | |
| 191 | const char *message); | |
| 7431 | 192 | |
| 10566 | 193 | /** |
| 194 | * Reads from a log | |
| 195 | * | |
| 196 | * @param log The log to read from | |
| 197 | * @param flags The returned logging flags. | |
| 198 | * | |
| 199 | * @return The contents of this log in Gaim Markup. | |
| 200 | */ | |
| 201 | char *gaim_log_read(GaimLog *log, GaimLogReadFlags *flags); | |
| 7431 | 202 | |
| 10566 | 203 | /** |
| 204 | * Returns a list of all available logs | |
| 205 | * | |
| 206 | * @param type The type of the log | |
| 207 | * @param name The name of the log | |
| 208 | * @param account The account | |
| 209 | * @return A sorted list of GaimLogs | |
| 210 | */ | |
| 211 | GList *gaim_log_get_logs(GaimLogType type, const char *name, GaimAccount *account); | |
| 7440 | 212 | |
| 10566 | 213 | /** |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
214 | * Returns a list of GaimLogSets. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
215 | * |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
216 | * A "log set" here means the information necessary to gather the |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
217 | * GaimLogs for a given buddy/chat. This information would be passed |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
218 | * to gaim_log_list to get a list of GaimLogs. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
219 | * |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
220 | * The primary use of this function is to get a list of everyone the |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
221 | * user has ever talked to (assuming he or she uses logging). |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
222 | * |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
223 | * @return A sorted list of all available unique GaimLogSets |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
224 | */ |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
225 | GList *gaim_log_get_log_sets(void); |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
226 | |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
227 | /** |
| 10566 | 228 | * Returns a list of all available system logs |
| 229 | * | |
| 230 | * @param account The account | |
| 231 | * @return A sorted list of GaimLogs | |
| 232 | */ | |
| 233 | GList *gaim_log_get_system_logs(GaimAccount *account); | |
| 8573 | 234 | |
| 10566 | 235 | /** |
| 10822 | 236 | * Returns the size of a log |
| 10566 | 237 | * |
| 238 | * @param log The log | |
| 239 | * @return The size of the log, in bytes | |
| 240 | */ | |
| 241 | int gaim_log_get_size(GaimLog *log); | |
| 5872 | 242 | |
| 10566 | 243 | /** |
| 244 | * Returns the size, in bytes, of all available logs in this conversation | |
| 245 | * | |
| 246 | * @param type The type of the log | |
| 247 | * @param name The name of the log | |
| 248 | * @param account The account | |
| 249 | * @return The size in bytes | |
| 250 | */ | |
| 251 | int gaim_log_get_total_size(GaimLogType type, const char *name, GaimAccount *account); | |
| 8573 | 252 | |
| 10566 | 253 | /** |
| 10822 | 254 | * Returns the default logger directory Gaim uses for a given account |
| 255 | * and username. This would be where Gaim stores logs created by | |
| 256 | * the built-in text or HTML loggers. | |
| 257 | * | |
| 258 | * @param type The type of the log. | |
| 259 | * @param name The name of the log. | |
| 260 | * @param account The account. | |
| 261 | * @return The default logger directory for Gaim. | |
| 262 | */ | |
| 263 | char *gaim_log_get_log_dir(GaimLogType type, const char *name, GaimAccount *account); | |
| 264 | ||
| 265 | /** | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
266 | * Implements GCompareFunc for GaimLogs |
| 10566 | 267 | * |
| 268 | * @param y A GaimLog | |
| 269 | * @param z Another GaimLog | |
| 270 | * @return A value as specified by GCompareFunc | |
| 271 | */ | |
| 272 | gint gaim_log_compare(gconstpointer y, gconstpointer z); | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
273 | |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
274 | /** |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
275 | * Implements GCompareFunc for GaimLogSets |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
276 | * |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
277 | * @param y A GaimLogSet |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
278 | * @param z Another GaimLogSet |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
279 | * @return A value as specified by GCompareFunc |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
280 | */ |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
281 | gint gaim_log_set_compare(gconstpointer y, gconstpointer z); |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
282 | |
| 10566 | 283 | /*@}*/ |
| 8573 | 284 | |
| 10566 | 285 | /******************************************/ |
| 10822 | 286 | /** @name Common Logger Functions */ |
| 287 | /******************************************/ | |
| 288 | /*@{*/ | |
| 289 | ||
| 290 | /** | |
| 291 | * Opens a new log file in the standard Gaim log location | |
| 292 | * with the given file extension, named for the current time, | |
| 293 | * for writing. If a log file is already open, the existing | |
| 294 | * file handle is retained. The log's logger_data value is | |
| 295 | * set to a GaimLogCommonLoggerData struct containing the log | |
| 296 | * file handle and log path. | |
| 297 | * | |
| 298 | * @param log The log to write to. | |
| 299 | * @param time The time of the item being logged. | |
| 300 | * @param ext The file extension to give to this log file. | |
| 301 | */ | |
| 302 | void gaim_log_common_writer(GaimLog *log, time_t time, const char *ext); | |
| 303 | ||
| 304 | /** | |
| 305 | * Returns a sorted GList of GaimLogs of the requested type. | |
| 306 | * This function should only be used with logs that are written | |
| 307 | * with gaim_log_common_writer(). | |
| 308 | * | |
| 309 | * @param type The type of the logs being listed. | |
| 310 | * @param name The name of the log. | |
| 311 | * @param account The account of the log. | |
| 312 | * @param ext The file extension this log format uses. | |
| 313 | * @param logger A reference to the logger struct for this log. | |
| 314 | * | |
| 315 | * @return A sorted GList of GaimLogs matching the parameters. | |
| 316 | */ | |
| 317 | GList *gaim_log_common_lister(GaimLogType type, const char *name, | |
| 318 | GaimAccount *account, const char *ext, | |
| 319 | GaimLogLogger *logger); | |
| 320 | ||
| 321 | /** | |
| 322 | * Returns the size of a given GaimLog. | |
| 323 | * This function should only be used with logs that are written | |
| 324 | * with gaim_log_common_writer(). | |
| 325 | * | |
| 326 | * @param log The GaimLog to size. | |
| 327 | * | |
| 328 | * @return An integer indicating the size of the log in bytes. | |
| 329 | */ | |
| 330 | int gaim_log_common_sizer(GaimLog *log); | |
| 331 | /*@}*/ | |
| 332 | ||
| 333 | /******************************************/ | |
| 10566 | 334 | /** @name Logger Functions */ |
| 335 | /******************************************/ | |
| 336 | /*@{*/ | |
| 7440 | 337 | |
| 10566 | 338 | /** |
| 339 | * Creates a new logger | |
| 340 | * | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
341 | * @param create The logger's new function. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
342 | * @param write The logger's write function. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
343 | * @param finalize The logger's finalize function. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
344 | * @param list The logger's list function. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
345 | * @param read The logger's read function. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
346 | * @param size The logger's size function. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
347 | * @param total_size The logger's total_size function. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
348 | * @param list_syslog The logger's list_syslog function. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
349 | * @param get_log_sets The logger's get_log_sets function. |
| 10566 | 350 | * |
| 351 | * @return The new logger | |
| 352 | */ | |
| 353 | GaimLogLogger *gaim_log_logger_new( | |
| 354 | void(*create)(GaimLog *), | |
| 355 | void(*write)(GaimLog *, GaimMessageFlags, const char *, time_t, const char *), | |
| 356 | void(*finalize)(GaimLog *), | |
| 357 | GList*(*list)(GaimLogType type, const char*, GaimAccount*), | |
| 358 | char*(*read)(GaimLog*, GaimLogReadFlags*), | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
359 | int(*size)(GaimLog*), |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
360 | int(*total_size)(GaimLogType type, const char *name, GaimAccount *account), |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
361 | GList*(*list_syslog)(GaimAccount *account), |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
362 | GList*(*get_log_sets)(void)); |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
363 | |
| 10566 | 364 | /** |
| 365 | * Frees a logger | |
| 366 | * | |
| 367 | * @param logger The logger to free | |
| 368 | */ | |
| 369 | void gaim_log_logger_free(GaimLogLogger *logger); | |
| 7440 | 370 | |
| 10566 | 371 | /** |
| 372 | * Adds a new logger | |
| 373 | * | |
| 374 | * @param logger The new logger to add | |
| 375 | */ | |
| 376 | void gaim_log_logger_add (GaimLogLogger *logger); | |
| 7431 | 377 | |
| 10566 | 378 | /** |
| 379 | * | |
| 380 | * Removes a logger | |
| 381 | * | |
| 382 | * @param logger The logger to remove | |
| 383 | */ | |
| 384 | void gaim_log_logger_remove (GaimLogLogger *logger); | |
| 7431 | 385 | |
| 10566 | 386 | /** |
| 387 | * | |
| 388 | * Sets the current logger | |
| 389 | * | |
| 390 | * @param logger The logger to set | |
| 391 | */ | |
| 392 | void gaim_log_logger_set (GaimLogLogger *logger); | |
| 7440 | 393 | |
| 10566 | 394 | /** |
| 395 | * | |
| 396 | * Returns the current logger | |
| 397 | * | |
| 398 | * @return logger The current logger | |
| 399 | */ | |
| 400 | GaimLogLogger *gaim_log_logger_get (void); | |
| 7440 | 401 | |
| 10566 | 402 | /** |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
403 | * Returns a GList containing the IDs and names of the registered |
| 10566 | 404 | * loggers. |
| 405 | * | |
| 406 | * @return The list of IDs and names. | |
| 407 | */ | |
| 408 | GList *gaim_log_logger_get_options(void); | |
| 7431 | 409 | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
410 | /** |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
411 | * Initializes the log subsystem. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
412 | */ |
| 10566 | 413 | void gaim_log_init(void); |
| 414 | /*@}*/ | |
| 7431 | 415 | |
| 5872 | 416 | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
417 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
418 | } |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
419 | #endif |
| 7440 | 420 | |
| 7431 | 421 | #endif /* _GAIM_LOG_H_ */ |