| 119 void (*_purple_reserved3)(void); |
121 void (*_purple_reserved3)(void); |
| 120 void (*_purple_reserved4)(void); |
122 void (*_purple_reserved4)(void); |
| 121 }; |
123 }; |
| 122 |
124 |
| 123 /** |
125 /** |
| |
126 * PurpleLog: |
| |
127 * @type: The type of log this is |
| |
128 * @name: The name of this log |
| |
129 * @account: The account this log is taking place on |
| |
130 * @conv: The conversation being logged |
| |
131 * @time: The time this conversation started, converted to the local |
| |
132 * timezone |
| |
133 * @logger: The logging mechanism this log is to use |
| |
134 * @logger_data: Data used by the log logger |
| |
135 * @tm: The time this conversation started, saved with original |
| |
136 * timezone data, if available and if struct tm has the BSD |
| |
137 * timezone fields, else %NULL. Do NOT modify anything in this |
| |
138 * struct. |
| |
139 * |
| 124 * A log. Not the wooden type. |
140 * A log. Not the wooden type. |
| 125 */ |
141 */ |
| 126 struct _PurpleLog { |
142 struct _PurpleLog { |
| 127 PurpleLogType type; /**< The type of log this is */ |
143 PurpleLogType type; |
| 128 char *name; /**< The name of this log */ |
144 char *name; |
| 129 PurpleAccount *account; /**< The account this log is taking |
145 PurpleAccount *account; |
| 130 place on */ |
146 PurpleConversation *conv; |
| 131 PurpleConversation *conv; /**< The conversation being logged */ |
147 time_t time; |
| 132 time_t time; /**< The time this conversation |
148 |
| 133 started, converted to the local timezone */ |
149 PurpleLogLogger *logger; |
| 134 |
150 void *logger_data; |
| 135 PurpleLogLogger *logger; /**< The logging mechanism this log |
151 struct tm *tm; |
| 136 is to use */ |
|
| 137 void *logger_data; /**< Data used by the log logger */ |
|
| 138 struct tm *tm; /**< The time this conversation |
|
| 139 started, saved with original |
|
| 140 timezone data, if available and |
|
| 141 if struct tm has the BSD |
|
| 142 timezone fields, else %NULL. |
|
| 143 Do NOT modify anything in this struct.*/ |
|
| 144 |
152 |
| 145 /* IMPORTANT: Some code in log.c allocates these without zeroing them. |
153 /* IMPORTANT: Some code in log.c allocates these without zeroing them. |
| 146 * IMPORTANT: Update that code if you add members here. */ |
154 * IMPORTANT: Update that code if you add members here. */ |
| 147 }; |
155 }; |
| 148 |
156 |
| 149 /** |
157 /** |
| |
158 * PurpleLogCommonLoggerData: |
| |
159 * |
| 150 * A common logger_data struct containing a file handle and path, as well |
160 * A common logger_data struct containing a file handle and path, as well |
| 151 * as a pointer to something else for additional data. |
161 * as a pointer to something else for additional data. |
| 152 */ |
162 */ |
| 153 struct _PurpleLogCommonLoggerData { |
163 struct _PurpleLogCommonLoggerData { |
| 154 char *path; |
164 char *path; |
| 155 FILE *file; |
165 FILE *file; |
| 156 void *extra_data; |
166 void *extra_data; |
| 157 }; |
167 }; |
| 158 |
168 |
| 159 /** |
169 /** |
| |
170 * PurpleLogSet: |
| |
171 * @type: The type of logs available |
| |
172 * @name: The name of the logs available |
| |
173 * @account: The account the available logs took place on. This will be |
| |
174 * %NULL if the account no longer exists. (Depending on a |
| |
175 * logger's implementation of list, it may not be possible to |
| |
176 * load such logs.) |
| |
177 * @buddy: Is this (account, name) a buddy on the buddy list? |
| |
178 * @normalized_name: The normalized version of @name. It must be set, and may |
| |
179 * be set to the same pointer value as @name. |
| |
180 * |
| 160 * Describes available logs. |
181 * Describes available logs. |
| 161 * |
182 * |
| 162 * By passing the elements of this struct to purple_log_get_logs(), the caller |
183 * By passing the elements of this struct to purple_log_get_logs(), the caller |
| 163 * can get all available PurpleLogs. |
184 * can get all available PurpleLogs. |
| 164 */ |
185 */ |
| 165 struct _PurpleLogSet { |
186 struct _PurpleLogSet { |
| 166 PurpleLogType type; /**< The type of logs available */ |
187 PurpleLogType type; |
| 167 char *name; /**< The name of the logs available */ |
188 char *name; |
| 168 PurpleAccount *account; /**< The account the available logs |
189 PurpleAccount *account; |
| 169 took place on. This will be |
190 gboolean buddy; |
| 170 %NULL if the account no longer |
191 char *normalized_name; |
| 171 exists. (Depending on a |
|
| 172 logger's implementation of |
|
| 173 list, it may not be possible |
|
| 174 to load such logs.) */ |
|
| 175 gboolean buddy; /**< Is this (account, name) a buddy |
|
| 176 on the buddy list? */ |
|
| 177 char *normalized_name; /**< The normalized version of |
|
| 178 @a name. It must be set, and |
|
| 179 may be set to the same pointer |
|
| 180 value as @a name. */ |
|
| 181 |
192 |
| 182 /* IMPORTANT: Some code in log.c allocates these without zeroing them. |
193 /* IMPORTANT: Some code in log.c allocates these without zeroing them. |
| 183 * IMPORTANT: Update that code if you add members here. */ |
194 * IMPORTANT: Update that code if you add members here. */ |
| 184 }; |
195 }; |
| 185 |
196 |
| 189 /** @name Log Functions */ |
200 /** @name Log Functions */ |
| 190 /***************************************/ |
201 /***************************************/ |
| 191 /*@{*/ |
202 /*@{*/ |
| 192 |
203 |
| 193 /** |
204 /** |
| |
205 * purple_log_get_type: |
| |
206 * |
| 194 * Returns the GType for the PurpleLog boxed structure. |
207 * Returns the GType for the PurpleLog boxed structure. |
| 195 * TODO Boxing of PurpleLog is a temporary solution to having a GType for |
208 * TODO Boxing of PurpleLog is a temporary solution to having a GType for |
| 196 * logs. This should rather be a GObject instead of a GBoxed. |
209 * logs. This should rather be a GObject instead of a GBoxed. |
| 197 */ |
210 */ |
| 198 GType purple_log_get_type(void); |
211 GType purple_log_get_type(void); |
| 199 |
212 |
| 200 /** |
213 /** |
| 201 * Creates a new log |
214 * purple_log_new: |
| 202 * |
|
| 203 * @type: The type of log this is. |
215 * @type: The type of log this is. |
| 204 * @name: The name of this conversation (buddy name, chat name, |
216 * @name: The name of this conversation (buddy name, chat name, |
| 205 * etc.) |
217 * etc.) |
| 206 * @account: The account the conversation is occurring on |
218 * @account: The account the conversation is occurring on |
| 207 * @conv: The conversation being logged |
219 * @conv: The conversation being logged |
| 208 * @time: The time this conversation started |
220 * @time: The time this conversation started |
| 209 * @tm: The time this conversation started, with timezone data, |
221 * @tm: The time this conversation started, with timezone data, |
| 210 * if available and if struct tm has the BSD timezone fields. |
222 * if available and if struct tm has the BSD timezone fields. |
| |
223 * |
| |
224 * Creates a new log |
| |
225 * |
| 211 * Returns: The new log |
226 * Returns: The new log |
| 212 */ |
227 */ |
| 213 PurpleLog *purple_log_new(PurpleLogType type, const char *name, PurpleAccount *account, |
228 PurpleLog *purple_log_new(PurpleLogType type, const char *name, PurpleAccount *account, |
| 214 PurpleConversation *conv, time_t time, const struct tm *tm); |
229 PurpleConversation *conv, time_t time, const struct tm *tm); |
| 215 |
230 |
| 216 /** |
231 /** |
| |
232 * purple_log_free: |
| |
233 * @log: The log to destroy |
| |
234 * |
| 217 * Frees a log |
235 * Frees a log |
| 218 * |
|
| 219 * @log: The log to destroy |
|
| 220 */ |
236 */ |
| 221 void purple_log_free(PurpleLog *log); |
237 void purple_log_free(PurpleLog *log); |
| 222 |
238 |
| 223 /** |
239 /** |
| 224 * Writes to a log file. Assumes you have checked preferences already. |
240 * purple_log_write: |
| 225 * |
|
| 226 * @log: The log to write to |
241 * @log: The log to write to |
| 227 * @type: The type of message being logged |
242 * @type: The type of message being logged |
| 228 * @from: Whom this message is coming from, or %NULL for |
243 * @from: Whom this message is coming from, or %NULL for |
| 229 * system messages |
244 * system messages |
| 230 * @time: A timestamp in UNIX time |
245 * @time: A timestamp in UNIX time |
| 231 * @message: The message to log |
246 * @message: The message to log |
| |
247 * |
| |
248 * Writes to a log file. Assumes you have checked preferences already. |
| 232 */ |
249 */ |
| 233 void purple_log_write(PurpleLog *log, |
250 void purple_log_write(PurpleLog *log, |
| 234 PurpleMessageFlags type, |
251 PurpleMessageFlags type, |
| 235 const char *from, |
252 const char *from, |
| 236 time_t time, |
253 time_t time, |
| 237 const char *message); |
254 const char *message); |
| 238 |
255 |
| 239 /** |
256 /** |
| 240 * Reads from a log |
257 * purple_log_read: |
| 241 * |
|
| 242 * @log: The log to read from |
258 * @log: The log to read from |
| 243 * @flags: The returned logging flags. |
259 * @flags: The returned logging flags. |
| 244 * |
260 * |
| |
261 * Reads from a log |
| |
262 * |
| 245 * Returns: The contents of this log in Purple Markup. |
263 * Returns: The contents of this log in Purple Markup. |
| 246 */ |
264 */ |
| 247 char *purple_log_read(PurpleLog *log, PurpleLogReadFlags *flags); |
265 char *purple_log_read(PurpleLog *log, PurpleLogReadFlags *flags); |
| 248 |
266 |
| 249 /** |
267 /** |
| 250 * Returns a list of all available logs |
268 * purple_log_get_logs: |
| 251 * |
|
| 252 * @type: The type of the log |
269 * @type: The type of the log |
| 253 * @name: The name of the log |
270 * @name: The name of the log |
| 254 * @account: The account |
271 * @account: The account |
| |
272 * |
| |
273 * Returns a list of all available logs |
| |
274 * |
| 255 * Returns: A sorted list of PurpleLogs |
275 * Returns: A sorted list of PurpleLogs |
| 256 */ |
276 */ |
| 257 GList *purple_log_get_logs(PurpleLogType type, const char *name, PurpleAccount *account); |
277 GList *purple_log_get_logs(PurpleLogType type, const char *name, PurpleAccount *account); |
| 258 |
278 |
| 259 /** |
279 /** |
| |
280 * purple_log_get_log_sets: |
| |
281 * |
| 260 * Returns a GHashTable of PurpleLogSets. |
282 * Returns a GHashTable of PurpleLogSets. |
| 261 * |
283 * |
| 262 * A "log set" here means the information necessary to gather the |
284 * A "log set" here means the information necessary to gather the |
| 263 * PurpleLogs for a given buddy/chat. This information would be passed |
285 * PurpleLogs for a given buddy/chat. This information would be passed |
| 264 * to purple_log_list to get a list of PurpleLogs. |
286 * to purple_log_list to get a list of PurpleLogs. |
| 273 * Returns: A GHashTable of all available unique PurpleLogSets |
295 * Returns: A GHashTable of all available unique PurpleLogSets |
| 274 */ |
296 */ |
| 275 GHashTable *purple_log_get_log_sets(void); |
297 GHashTable *purple_log_get_log_sets(void); |
| 276 |
298 |
| 277 /** |
299 /** |
| |
300 * purple_log_get_system_logs: |
| |
301 * @account: The account |
| |
302 * |
| 278 * Returns a list of all available system logs |
303 * Returns a list of all available system logs |
| 279 * |
304 * |
| 280 * @account: The account |
|
| 281 * Returns: A sorted list of PurpleLogs |
305 * Returns: A sorted list of PurpleLogs |
| 282 */ |
306 */ |
| 283 GList *purple_log_get_system_logs(PurpleAccount *account); |
307 GList *purple_log_get_system_logs(PurpleAccount *account); |
| 284 |
308 |
| 285 /** |
309 /** |
| |
310 * purple_log_get_size: |
| |
311 * @log: The log |
| |
312 * |
| 286 * Returns the size of a log |
313 * Returns the size of a log |
| 287 * |
314 * |
| 288 * @log: The log |
|
| 289 * Returns: The size of the log, in bytes |
315 * Returns: The size of the log, in bytes |
| 290 */ |
316 */ |
| 291 int purple_log_get_size(PurpleLog *log); |
317 int purple_log_get_size(PurpleLog *log); |
| 292 |
318 |
| 293 /** |
319 /** |
| 294 * Returns the size, in bytes, of all available logs in this conversation |
320 * purple_log_get_total_size: |
| 295 * |
|
| 296 * @type: The type of the log |
321 * @type: The type of the log |
| 297 * @name: The name of the log |
322 * @name: The name of the log |
| 298 * @account: The account |
323 * @account: The account |
| |
324 * |
| |
325 * Returns the size, in bytes, of all available logs in this conversation |
| |
326 * |
| 299 * Returns: The size in bytes |
327 * Returns: The size in bytes |
| 300 */ |
328 */ |
| 301 int purple_log_get_total_size(PurpleLogType type, const char *name, PurpleAccount *account); |
329 int purple_log_get_total_size(PurpleLogType type, const char *name, PurpleAccount *account); |
| 302 |
330 |
| 303 /** |
331 /** |
| 304 * Returns the activity score of a log, based on total size in bytes, |
332 * purple_log_get_activity_score: |
| 305 * which is then decayed based on age |
|
| 306 * |
|
| 307 * @type: The type of the log |
333 * @type: The type of the log |
| 308 * @name: The name of the log |
334 * @name: The name of the log |
| 309 * @account: The account |
335 * @account: The account |
| |
336 * |
| |
337 * Returns the activity score of a log, based on total size in bytes, |
| |
338 * which is then decayed based on age |
| |
339 * |
| 310 * Returns: The activity score |
340 * Returns: The activity score |
| 311 */ |
341 */ |
| 312 int purple_log_get_activity_score(PurpleLogType type, const char *name, PurpleAccount *account); |
342 int purple_log_get_activity_score(PurpleLogType type, const char *name, PurpleAccount *account); |
| 313 |
343 |
| 314 /** |
344 /** |
| |
345 * purple_log_is_deletable: |
| |
346 * @log: The log |
| |
347 * |
| 315 * Tests whether a log is deletable |
348 * Tests whether a log is deletable |
| 316 * |
349 * |
| 317 * A return value of %FALSE indicates that purple_log_delete() will fail on this |
350 * A return value of %FALSE indicates that purple_log_delete() will fail on this |
| 318 * log, unless something changes between the two calls. A return value of %TRUE, |
351 * log, unless something changes between the two calls. A return value of %TRUE, |
| 319 * however, does not guarantee the log can be deleted. |
352 * however, does not guarantee the log can be deleted. |
| 320 * |
353 * |
| |
354 * Returns: A boolean indicating if the log is deletable |
| |
355 */ |
| |
356 gboolean purple_log_is_deletable(PurpleLog *log); |
| |
357 |
| |
358 /** |
| |
359 * purple_log_delete: |
| 321 * @log: The log |
360 * @log: The log |
| 322 * Returns: A boolean indicating if the log is deletable |
361 * |
| 323 */ |
|
| 324 gboolean purple_log_is_deletable(PurpleLog *log); |
|
| 325 |
|
| 326 /** |
|
| 327 * Deletes a log |
362 * Deletes a log |
| 328 * |
363 * |
| 329 * @log: The log |
|
| 330 * Returns: A boolean indicating success or failure |
364 * Returns: A boolean indicating success or failure |
| 331 */ |
365 */ |
| 332 gboolean purple_log_delete(PurpleLog *log); |
366 gboolean purple_log_delete(PurpleLog *log); |
| 333 |
367 |
| 334 /** |
368 /** |
| |
369 * purple_log_get_log_dir: |
| |
370 * @type: The type of the log. |
| |
371 * @name: The name of the log. |
| |
372 * @account: The account. |
| |
373 * |
| 335 * Returns the default logger directory Purple uses for a given account |
374 * Returns the default logger directory Purple uses for a given account |
| 336 * and username. This would be where Purple stores logs created by |
375 * and username. This would be where Purple stores logs created by |
| 337 * the built-in text or HTML loggers. |
376 * the built-in text or HTML loggers. |
| 338 * |
377 * |
| 339 * @type: The type of the log. |
|
| 340 * @name: The name of the log. |
|
| 341 * @account: The account. |
|
| 342 * Returns: The default logger directory for Purple. |
378 * Returns: The default logger directory for Purple. |
| 343 */ |
379 */ |
| 344 char *purple_log_get_log_dir(PurpleLogType type, const char *name, PurpleAccount *account); |
380 char *purple_log_get_log_dir(PurpleLogType type, const char *name, PurpleAccount *account); |
| 345 |
381 |
| 346 /** |
382 /** |
| 347 * Implements GCompareFunc for PurpleLogs |
383 * purple_log_compare: |
| 348 * |
|
| 349 * @y: A PurpleLog |
384 * @y: A PurpleLog |
| 350 * @z: Another PurpleLog |
385 * @z: Another PurpleLog |
| |
386 * |
| |
387 * Implements GCompareFunc for PurpleLogs |
| |
388 * |
| 351 * Returns: A value as specified by GCompareFunc |
389 * Returns: A value as specified by GCompareFunc |
| 352 */ |
390 */ |
| 353 gint purple_log_compare(gconstpointer y, gconstpointer z); |
391 gint purple_log_compare(gconstpointer y, gconstpointer z); |
| 354 |
392 |
| 355 /** |
393 /** |
| 356 * Implements GCompareFunc for PurpleLogSets |
394 * purple_log_set_compare: |
| 357 * |
|
| 358 * @y: A PurpleLogSet |
395 * @y: A PurpleLogSet |
| 359 * @z: Another PurpleLogSet |
396 * @z: Another PurpleLogSet |
| |
397 * |
| |
398 * Implements GCompareFunc for PurpleLogSets |
| |
399 * |
| 360 * Returns: A value as specified by GCompareFunc |
400 * Returns: A value as specified by GCompareFunc |
| 361 */ |
401 */ |
| 362 gint purple_log_set_compare(gconstpointer y, gconstpointer z); |
402 gint purple_log_set_compare(gconstpointer y, gconstpointer z); |
| 363 |
403 |
| 364 /** |
404 /** |
| |
405 * purple_log_set_free: |
| |
406 * @set: The log set to destroy |
| |
407 * |
| 365 * Frees a log set |
408 * Frees a log set |
| 366 * |
|
| 367 * @set: The log set to destroy |
|
| 368 */ |
409 */ |
| 369 void purple_log_set_free(PurpleLogSet *set); |
410 void purple_log_set_free(PurpleLogSet *set); |
| 370 |
411 |
| 371 /*@}*/ |
412 /*@}*/ |
| 372 |
413 |
| 374 /** @name Common Logger Functions */ |
415 /** @name Common Logger Functions */ |
| 375 /******************************************/ |
416 /******************************************/ |
| 376 /*@{*/ |
417 /*@{*/ |
| 377 |
418 |
| 378 /** |
419 /** |
| |
420 * purple_log_common_writer: |
| |
421 * @log: The log to write to. |
| |
422 * @ext: The file extension to give to this log file. |
| |
423 * |
| 379 * Opens a new log file in the standard Purple log location |
424 * Opens a new log file in the standard Purple log location |
| 380 * with the given file extension, named for the current time, |
425 * with the given file extension, named for the current time, |
| 381 * for writing. If a log file is already open, the existing |
426 * for writing. If a log file is already open, the existing |
| 382 * file handle is retained. The log's logger_data value is |
427 * file handle is retained. The log's logger_data value is |
| 383 * set to a PurpleLogCommonLoggerData struct containing the log |
428 * set to a PurpleLogCommonLoggerData struct containing the log |
| 384 * file handle and log path. |
429 * file handle and log path. |
| 385 * |
430 * |
| 386 * This function is intended to be used as a "common" |
431 * This function is intended to be used as a "common" |
| 387 * implementation of a logger's @c write function. |
432 * implementation of a logger's <tt>write</tt> function. |
| 388 * It should only be passed to purple_log_logger_new() and never |
433 * It should only be passed to purple_log_logger_new() and never |
| 389 * called directly. |
434 * called directly. |
| 390 * |
|
| 391 * @log: The log to write to. |
|
| 392 * @ext: The file extension to give to this log file. |
|
| 393 */ |
435 */ |
| 394 void purple_log_common_writer(PurpleLog *log, const char *ext); |
436 void purple_log_common_writer(PurpleLog *log, const char *ext); |
| 395 |
437 |
| 396 /** |
438 /** |
| 397 * Returns a sorted GList of PurpleLogs of the requested type. |
439 * purple_log_common_lister: |
| 398 * |
|
| 399 * This function should only be used with logs that are written |
|
| 400 * with purple_log_common_writer(). It's intended to be used as |
|
| 401 * a "common" implementation of a logger's @c list function. |
|
| 402 * It should only be passed to purple_log_logger_new() and never |
|
| 403 * called directly. |
|
| 404 * |
|
| 405 * @type: The type of the logs being listed. |
440 * @type: The type of the logs being listed. |
| 406 * @name: The name of the log. |
441 * @name: The name of the log. |
| 407 * @account: The account of the log. |
442 * @account: The account of the log. |
| 408 * @ext: The file extension this log format uses. |
443 * @ext: The file extension this log format uses. |
| 409 * @logger: A reference to the logger struct for this log. |
444 * @logger: A reference to the logger struct for this log. |
| 410 * |
445 * |
| |
446 * Returns a sorted GList of PurpleLogs of the requested type. |
| |
447 * |
| |
448 * This function should only be used with logs that are written |
| |
449 * with purple_log_common_writer(). It's intended to be used as |
| |
450 * a "common" implementation of a logger's <tt>list</tt> function. |
| |
451 * It should only be passed to purple_log_logger_new() and never |
| |
452 * called directly. |
| |
453 * |
| 411 * Returns: A sorted GList of PurpleLogs matching the parameters. |
454 * Returns: A sorted GList of PurpleLogs matching the parameters. |
| 412 */ |
455 */ |
| 413 GList *purple_log_common_lister(PurpleLogType type, const char *name, |
456 GList *purple_log_common_lister(PurpleLogType type, const char *name, |
| 414 PurpleAccount *account, const char *ext, |
457 PurpleAccount *account, const char *ext, |
| 415 PurpleLogLogger *logger); |
458 PurpleLogLogger *logger); |
| 416 |
459 |
| 417 /** |
460 /** |
| 418 * Returns the total size of all the logs for a given user, with |
461 * purple_log_common_total_sizer: |
| 419 * a given extension. |
|
| 420 * |
|
| 421 * This function should only be used with logs that are written |
|
| 422 * with purple_log_common_writer(). It's intended to be used as |
|
| 423 * a "common" implementation of a logger's @c total_size function. |
|
| 424 * It should only be passed to purple_log_logger_new() and never |
|
| 425 * called directly. |
|
| 426 * |
|
| 427 * @type: The type of the logs being sized. |
462 * @type: The type of the logs being sized. |
| 428 * @name: The name of the logs to size |
463 * @name: The name of the logs to size |
| 429 * (e.g. the username or chat name). |
464 * (e.g. the username or chat name). |
| 430 * @account: The account of the log. |
465 * @account: The account of the log. |
| 431 * @ext: The file extension this log format uses. |
466 * @ext: The file extension this log format uses. |
| 432 * |
467 * |
| |
468 * Returns the total size of all the logs for a given user, with |
| |
469 * a given extension. |
| |
470 * |
| |
471 * This function should only be used with logs that are written |
| |
472 * with purple_log_common_writer(). It's intended to be used as |
| |
473 * a "common" implementation of a logger's <tt>total_size</tt> function. |
| |
474 * It should only be passed to purple_log_logger_new() and never |
| |
475 * called directly. |
| |
476 * |
| 433 * Returns: The size of all the logs with the specified extension |
477 * Returns: The size of all the logs with the specified extension |
| 434 * for the specified user. |
478 * for the specified user. |
| 435 */ |
479 */ |
| 436 int purple_log_common_total_sizer(PurpleLogType type, const char *name, |
480 int purple_log_common_total_sizer(PurpleLogType type, const char *name, |
| 437 PurpleAccount *account, const char *ext); |
481 PurpleAccount *account, const char *ext); |
| 438 |
482 |
| 439 /** |
483 /** |
| |
484 * purple_log_common_sizer: |
| |
485 * @log: The PurpleLog to size. |
| |
486 * |
| 440 * Returns the size of a given PurpleLog. |
487 * Returns the size of a given PurpleLog. |
| 441 * |
488 * |
| 442 * This function should only be used with logs that are written |
489 * This function should only be used with logs that are written |
| 443 * with purple_log_common_writer(). It's intended to be used as |
490 * with purple_log_common_writer(). It's intended to be used as |
| 444 * a "common" implementation of a logger's @c size function. |
491 * a "common" implementation of a logger's <tt>size</tt> function. |
| 445 * It should only be passed to purple_log_logger_new() and never |
492 * It should only be passed to purple_log_logger_new() and never |
| 446 * called directly. |
493 * called directly. |
| 447 * |
494 * |
| 448 * @log: The PurpleLog to size. |
|
| 449 * |
|
| 450 * Returns: An integer indicating the size of the log in bytes. |
495 * Returns: An integer indicating the size of the log in bytes. |
| 451 */ |
496 */ |
| 452 int purple_log_common_sizer(PurpleLog *log); |
497 int purple_log_common_sizer(PurpleLog *log); |
| 453 |
498 |
| 454 /** |
499 /** |
| |
500 * purple_log_common_deleter: |
| |
501 * @log: The PurpleLog to delete. |
| |
502 * |
| 455 * Deletes a log |
503 * Deletes a log |
| 456 * |
504 * |
| 457 * This function should only be used with logs that are written |
505 * This function should only be used with logs that are written |
| 458 * with purple_log_common_writer(). It's intended to be used as |
506 * with purple_log_common_writer(). It's intended to be used as |
| 459 * a "common" implementation of a logger's @c delete function. |
507 * a "common" implementation of a logger's <tt>delete</tt> function. |
| 460 * It should only be passed to purple_log_logger_new() and never |
508 * It should only be passed to purple_log_logger_new() and never |
| 461 * called directly. |
509 * called directly. |
| 462 * |
510 * |
| 463 * @log: The PurpleLog to delete. |
|
| 464 * |
|
| 465 * Returns: A boolean indicating success or failure. |
511 * Returns: A boolean indicating success or failure. |
| 466 */ |
512 */ |
| 467 gboolean purple_log_common_deleter(PurpleLog *log); |
513 gboolean purple_log_common_deleter(PurpleLog *log); |
| 468 |
514 |
| 469 /** |
515 /** |
| |
516 * purple_log_common_is_deletable: |
| |
517 * @log: The PurpleLog to check. |
| |
518 * |
| 470 * Checks to see if a log is deletable |
519 * Checks to see if a log is deletable |
| 471 * |
520 * |
| 472 * This function should only be used with logs that are written |
521 * This function should only be used with logs that are written |
| 473 * with purple_log_common_writer(). It's intended to be used as |
522 * with purple_log_common_writer(). It's intended to be used as |
| 474 * a "common" implementation of a logger's @c is_deletable function. |
523 * a "common" implementation of a logger's <tt>is_deletable</tt> function. |
| 475 * It should only be passed to purple_log_logger_new() and never |
524 * It should only be passed to purple_log_logger_new() and never |
| 476 * called directly. |
525 * called directly. |
| 477 * |
|
| 478 * @log: The PurpleLog to check. |
|
| 479 * |
526 * |
| 480 * Returns: A boolean indicating if the log is deletable. |
527 * Returns: A boolean indicating if the log is deletable. |
| 481 */ |
528 */ |
| 482 gboolean purple_log_common_is_deletable(PurpleLog *log); |
529 gboolean purple_log_common_is_deletable(PurpleLog *log); |
| 483 |
530 |
| 487 /** @name Logger Functions */ |
534 /** @name Logger Functions */ |
| 488 /******************************************/ |
535 /******************************************/ |
| 489 /*@{*/ |
536 /*@{*/ |
| 490 |
537 |
| 491 /** |
538 /** |
| 492 * Creates a new logger |
539 * purple_log_logger_new: |
| 493 * |
|
| 494 * @id: The logger's id. |
540 * @id: The logger's id. |
| 495 * @name: The logger's name. |
541 * @name: The logger's name. |
| 496 * @functions: The number of functions being passed. The following |
542 * @functions: The number of functions being passed. The following |
| 497 * functions are currently available (in order): @c create, |
543 * functions are currently available (in order): <tt>create</tt>, |
| 498 * @c write, @c finalize, @c list, @c read, @c size, |
544 * <tt>write</tt>, <tt>finalize</tt>, <tt>list</tt>, |
| 499 * @c total_size, @c list_syslog, @c get_log_sets, |
545 * <tt>read</tt>, <tt>size</tt>, <tt>total_size</tt>, |
| 500 * @c remove, @c is_deletable. |
546 * <tt>list_syslog</tt>, <tt>get_log_sets</tt>, <tt>remove</tt>, |
| 501 * For details on these functions, see PurpleLogLogger. |
547 * <tt>is_deletable</tt>. |
| 502 * Functions may not be skipped. For example, passing |
548 * For details on these functions, see PurpleLogLogger. |
| 503 * @c create and @c write is acceptable (for a total of |
549 * Functions may not be skipped. For example, passing |
| 504 * two functions). Passing @c create and @c finalize, |
550 * <tt>create</tt> and <tt>write</tt> is acceptable (for a total |
| 505 * however, is not. To accomplish that, the caller must |
551 * of two functions). Passing <tt>create</tt> and |
| 506 * pass @c create, %NULL (a placeholder for @c write), |
552 * <tt>finalize</tt>, however, is not. To accomplish that, the |
| 507 * and @c finalize (for a total of 3 functions). |
553 * caller must pass <tt>create</tt>, %NULL (a placeholder for |
| |
554 * <tt>write</tt>), and <tt>finalize</tt> (for a total of 3 |
| |
555 * functions). |
| |
556 * |
| |
557 * Creates a new logger |
| 508 * |
558 * |
| 509 * Returns: The new logger |
559 * Returns: The new logger |
| 510 */ |
560 */ |
| 511 PurpleLogLogger *purple_log_logger_new(const char *id, const char *name, int functions, ...); |
561 PurpleLogLogger *purple_log_logger_new(const char *id, const char *name, int functions, ...); |
| 512 |
562 |
| 513 /** |
563 /** |
| |
564 * purple_log_logger_free: |
| |
565 * @logger: The logger to free |
| |
566 * |
| 514 * Frees a logger |
567 * Frees a logger |
| 515 * |
|
| 516 * @logger: The logger to free |
|
| 517 */ |
568 */ |
| 518 void purple_log_logger_free(PurpleLogLogger *logger); |
569 void purple_log_logger_free(PurpleLogLogger *logger); |
| 519 |
570 |
| 520 /** |
571 /** |
| |
572 * purple_log_logger_add: |
| |
573 * @logger: The new logger to add |
| |
574 * |
| 521 * Adds a new logger |
575 * Adds a new logger |
| 522 * |
|
| 523 * @logger: The new logger to add |
|
| 524 */ |
576 */ |
| 525 void purple_log_logger_add (PurpleLogLogger *logger); |
577 void purple_log_logger_add (PurpleLogLogger *logger); |
| 526 |
578 |
| 527 /** |
579 /** |
| |
580 * purple_log_logger_remove: |
| |
581 * @logger: The logger to remove |
| 528 * |
582 * |
| 529 * Removes a logger |
583 * Removes a logger |
| 530 * |
|
| 531 * @logger: The logger to remove |
|
| 532 */ |
584 */ |
| 533 void purple_log_logger_remove (PurpleLogLogger *logger); |
585 void purple_log_logger_remove (PurpleLogLogger *logger); |
| 534 |
586 |
| 535 /** |
587 /** |
| |
588 * purple_log_logger_set: |
| |
589 * @logger: The logger to set |
| 536 * |
590 * |
| 537 * Sets the current logger |
591 * Sets the current logger |
| 538 * |
|
| 539 * @logger: The logger to set |
|
| 540 */ |
592 */ |
| 541 void purple_log_logger_set (PurpleLogLogger *logger); |
593 void purple_log_logger_set (PurpleLogLogger *logger); |
| 542 |
594 |
| 543 /** |
595 /** |
| |
596 * purple_log_logger_get: |
| 544 * |
597 * |
| 545 * Returns the current logger |
598 * Returns the current logger |
| 546 * |
599 * |
| 547 * Returns: logger The current logger |
600 * Returns: logger The current logger |
| 548 */ |
601 */ |
| 549 PurpleLogLogger *purple_log_logger_get (void); |
602 PurpleLogLogger *purple_log_logger_get (void); |
| 550 |
603 |
| 551 /** |
604 /** |
| |
605 * purple_log_logger_get_options: |
| |
606 * |
| 552 * Returns a GList containing the IDs and names of the registered |
607 * Returns a GList containing the IDs and names of the registered |
| 553 * loggers. |
608 * loggers. |
| 554 * |
609 * |
| 555 * Returns: The list of IDs and names. |
610 * Returns: The list of IDs and names. |
| 556 */ |
611 */ |