annotate src/log.h @ 10550:522cd02f235f

[gaim-migrate @ 11924] This should fix the annoying problem of the docked buddy list stealing screen real estate when it is hidden. Turns out it was actually using the section of the screen, you just couldn't see it. I think this is the last of the bugs that I introduced into the docking stuff. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 28 Jan 2005 05:01:24 +0000
parents 64bc206c7473
children 62fc579810f4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file log.h Logging API
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 * @ingroup core
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7586
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7586
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7586
diff changeset
9 * source distribution.
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
10 *
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * (at your option) any later version.
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 *
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * GNU General Public License for more details.
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 *
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 */
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #ifndef _GAIM_LOG_H_
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 #define _GAIM_LOG_H_
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
28 #include <stdio.h>
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
31 /********************************************************
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
32 * DATA STRUCTURES **************************************
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
33 ********************************************************/
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
34
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
35 typedef struct _GaimLog GaimLog;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
36 typedef struct _GaimLogLogger GaimLogLogger;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
37
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
38 typedef enum {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
39 GAIM_LOG_IM,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
40 GAIM_LOG_CHAT,
10348
64bc206c7473 [gaim-migrate @ 11562]
Mark Doliner <mark@kingant.net>
parents: 10231
diff changeset
41 GAIM_LOG_SYSTEM
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
42 } GaimLogType;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
43
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
44 typedef enum {
10348
64bc206c7473 [gaim-migrate @ 11562]
Mark Doliner <mark@kingant.net>
parents: 10231
diff changeset
45 GAIM_LOG_READ_NO_NEWLINE = 1
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
46 } GaimLogReadFlags;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
47
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
48 #include "account.h"
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
49 #include "conversation.h"
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
50
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
51 /**
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
52 * A log logger.
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
53 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
54 * This struct gets filled out and is included in the GaimLog. It contains everything
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
55 * needed to write and read from logs.
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
56 */
9000
b540c735a6ad [gaim-migrate @ 9775]
Luke Schierer <lschiere@pidgin.im>
parents: 8898
diff changeset
57 /*@{*/
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
58 struct _GaimLogLogger {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
59 char *name; /**< The logger's name */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
60 char *id; /**< an identifier to refer to this logger */
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
61
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
62 /** This gets called when the log is first created.
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
63 I don't think this is actually needed. */
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
64 void(*create)(GaimLog *log);
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
65
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
66 /** This is used to write to the log file */
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
67 void(*write)(GaimLog *log,
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
68 GaimMessageFlags type,
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
69 const char *from,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
70 time_t time,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
71 const char *message);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
72
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
73 /** Called when the log is destroyed */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
74 void (*finalize)(GaimLog *log);
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
75
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
76 /** This function returns a sorted GList of available GaimLogs */
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8735
diff changeset
77 GList *(*list)(GaimLogType type, const char *name, GaimAccount *account);
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
78
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
79 /** Given one of the logs returned by the logger's list function,
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
80 * this returns the contents of the log in GtkIMHtml markup */
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
81 char *(*read)(GaimLog *log, GaimLogReadFlags *flags);
10231
84cf3fc8a2cb [gaim-migrate @ 11366]
Mark Doliner <mark@kingant.net>
parents: 10171
diff changeset
82
7556
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
83 /** Given one of the logs returned by the logger's list function,
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
84 * this returns the size of the log in bytes */
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
85 int (*size)(GaimLog *log);
8096
81079e3eda47 [gaim-migrate @ 8795]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
86
81079e3eda47 [gaim-migrate @ 8795]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
87 /** Returns the total size of all the logs. If this is undefined a default
81079e3eda47 [gaim-migrate @ 8795]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
88 * implementation is used */
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8735
diff changeset
89 int (*total_size)(GaimLogType type, const char *name, GaimAccount *account);
8573
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
90
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
91 /** This function returns a sorted GList of available system GaimLogs */
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
92 GList *(*list_syslog)(GaimAccount *account);
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 };
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
95 /**
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
96 * A log. Not the wooden type.
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
97 */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
98 struct _GaimLog {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
99 GaimLogType type; /**< The type of log this is */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
100 char *name; /**< The name of this log */
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
101 GaimAccount *account; /**< The account this log is taking
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
102 place on */
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
103 time_t time; /**< The time this conversation
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
104 started */
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
105 GaimLogLogger *logger; /**< The logging mechanism this log
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
106 is to use */
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
107 void *logger_data; /**< Data used by the log logger */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 };
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
110
5944
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5934
diff changeset
111 #ifdef __cplusplus
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5934
diff changeset
112 extern "C" {
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5934
diff changeset
113 #endif
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5934
diff changeset
114
10231
84cf3fc8a2cb [gaim-migrate @ 11366]
Mark Doliner <mark@kingant.net>
parents: 10171
diff changeset
115 /***************************************/
84cf3fc8a2cb [gaim-migrate @ 11366]
Mark Doliner <mark@kingant.net>
parents: 10171
diff changeset
116 /** @name Log Functions */
84cf3fc8a2cb [gaim-migrate @ 11366]
Mark Doliner <mark@kingant.net>
parents: 10171
diff changeset
117 /***************************************/
84cf3fc8a2cb [gaim-migrate @ 11366]
Mark Doliner <mark@kingant.net>
parents: 10171
diff changeset
118 /*@{*/
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
119
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
120 /**
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
121 * Creates a new log
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
122 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
123 * @param type The type of log this is.
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
124 * @param name The name of this conversation (Screenname, chat name,
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
125 * etc.)
8735
92cbf9713795 [gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents: 8573
diff changeset
126 * @param account The account the conversation is occurring on
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
127 * @param time The time this conversation started
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
128 * @return The new log
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
129 */
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
130 GaimLog *gaim_log_new(GaimLogType type, const char *name,
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
131 GaimAccount *account, time_t time);
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
132
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
133 /**
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
134 * Frees a log
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
135 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
136 * @param log The log to destroy
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
137 */
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
138 void gaim_log_free(GaimLog *log);
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
139
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
140 /**
10171
829a569993e0 [gaim-migrate @ 11263]
Luke Schierer <lschiere@pidgin.im>
parents: 9713
diff changeset
141 * Writes to a log file. Assumes you have checked preferences already.
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
142 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
143 * @param log The log to write to
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
144 * @param type The type of message being logged
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
145 * @param from Whom this message is coming from, or NULL for
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
146 * system messages
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
147 * @param time A timestamp in UNIX time
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
148 * @param message The message to log
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
149 */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
150 void gaim_log_write(GaimLog *log,
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
151 GaimMessageFlags type,
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
152 const char *from,
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
153 time_t time,
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
154 const char *message);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
155
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
156 /**
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
157 * Reads from a log
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
158 *
7456
702fbd2460d7 [gaim-migrate @ 8069]
Christian Hammond <chipx86@chipx86.com>
parents: 7440
diff changeset
159 * @param log The log to read from
702fbd2460d7 [gaim-migrate @ 8069]
Christian Hammond <chipx86@chipx86.com>
parents: 7440
diff changeset
160 * @param flags The returned logging flags.
702fbd2460d7 [gaim-migrate @ 8069]
Christian Hammond <chipx86@chipx86.com>
parents: 7440
diff changeset
161 *
702fbd2460d7 [gaim-migrate @ 8069]
Christian Hammond <chipx86@chipx86.com>
parents: 7440
diff changeset
162 * @return The contents of this log in Gaim Markup.
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
163 */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
164 char *gaim_log_read(GaimLog *log, GaimLogReadFlags *flags);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
165
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
166 /**
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
167 * Returns a list of all available logs
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
168 *
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8735
diff changeset
169 * @param type The type of the log
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
170 * @param name The name of the log
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
171 * @param account The account
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
172 * @return A sorted list of GaimLogs
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
173 */
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8735
diff changeset
174 GList *gaim_log_get_logs(GaimLogType type, const char *name, GaimAccount *account);
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
175
7556
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
176 /**
8573
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
177 * Returns a list of all available system logs
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
178 *
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
179 * @param account The account
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
180 * @return A sorted list of GaimLogs
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
181 */
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
182 GList *gaim_log_get_system_logs(GaimAccount *account);
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
183
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
184 /**
7556
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
185 * Returns the size of a log
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
186 *
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
187 * @param log The log
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
188 * @return The size of the log, in bytes
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
189 */
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
190 int gaim_log_get_size(GaimLog *log);
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191
7556
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
192 /**
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
193 * Returns the size, in bytes, of all available logs in this conversation
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
194 *
9000
b540c735a6ad [gaim-migrate @ 9775]
Luke Schierer <lschiere@pidgin.im>
parents: 8898
diff changeset
195 * @param type The type of the log
7556
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
196 * @param name The name of the log
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
197 * @param account The account
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
198 * @return The size in bytes
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
199 */
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8735
diff changeset
200 int gaim_log_get_total_size(GaimLogType type, const char *name, GaimAccount *account);
8573
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
201
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
202 /**
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
203 * Implements GCompareFunc
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
204 *
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
205 * @param y A GaimLog
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
206 * @param z Another GaimLog
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
207 * @return A value as specified by GCompareFunc
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
208 */
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
209 gint gaim_log_compare(gconstpointer y, gconstpointer z);
10231
84cf3fc8a2cb [gaim-migrate @ 11366]
Mark Doliner <mark@kingant.net>
parents: 10171
diff changeset
210 /*@}*/
8573
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8096
diff changeset
211
10231
84cf3fc8a2cb [gaim-migrate @ 11366]
Mark Doliner <mark@kingant.net>
parents: 10171
diff changeset
212 /******************************************/
84cf3fc8a2cb [gaim-migrate @ 11366]
Mark Doliner <mark@kingant.net>
parents: 10171
diff changeset
213 /** @name Logger Functions */
84cf3fc8a2cb [gaim-migrate @ 11366]
Mark Doliner <mark@kingant.net>
parents: 10171
diff changeset
214 /******************************************/
84cf3fc8a2cb [gaim-migrate @ 11366]
Mark Doliner <mark@kingant.net>
parents: 10171
diff changeset
215 /*@{*/
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
216
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
217 /**
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
218 * Creates a new logger
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
219 *
7456
702fbd2460d7 [gaim-migrate @ 8069]
Christian Hammond <chipx86@chipx86.com>
parents: 7440
diff changeset
220 * @param create The logger's new function.
702fbd2460d7 [gaim-migrate @ 8069]
Christian Hammond <chipx86@chipx86.com>
parents: 7440
diff changeset
221 * @param write The logger's write function.
702fbd2460d7 [gaim-migrate @ 8069]
Christian Hammond <chipx86@chipx86.com>
parents: 7440
diff changeset
222 * @param finalize The logger's finalize function.
702fbd2460d7 [gaim-migrate @ 8069]
Christian Hammond <chipx86@chipx86.com>
parents: 7440
diff changeset
223 * @param list The logger's list function.
702fbd2460d7 [gaim-migrate @ 8069]
Christian Hammond <chipx86@chipx86.com>
parents: 7440
diff changeset
224 * @param read The logger's read function.
7556
219903d29401 [gaim-migrate @ 8170]
Sean Egan <seanegan@gmail.com>
parents: 7456
diff changeset
225 * @param size The logger's size function.
7456
702fbd2460d7 [gaim-migrate @ 8069]
Christian Hammond <chipx86@chipx86.com>
parents: 7440
diff changeset
226 *
702fbd2460d7 [gaim-migrate @ 8069]
Christian Hammond <chipx86@chipx86.com>
parents: 7440
diff changeset
227 * @return The new logger
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
228 */
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8735
diff changeset
229 GaimLogLogger *gaim_log_logger_new(
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8735
diff changeset
230 void(*create)(GaimLog *),
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8735
diff changeset
231 void(*write)(GaimLog *, GaimMessageFlags, const char *, time_t, const char *),
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8735
diff changeset
232 void(*finalize)(GaimLog *),
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8735
diff changeset
233 GList*(*list)(GaimLogType type, const char*, GaimAccount*),
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8735
diff changeset
234 char*(*read)(GaimLog*, GaimLogReadFlags*),
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8735
diff changeset
235 int(*size)(GaimLog*));
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
236 /**
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
237 * Frees a logger
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
238 *
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
239 * @param logger The logger to free
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
240 */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
241 void gaim_log_logger_free(GaimLogLogger *logger);
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
242
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
243 /**
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
244 * Adds a new logger
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
245 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
246 * @param logger The new logger to add
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
247 */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
248 void gaim_log_logger_add (GaimLogLogger *logger);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
249
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
250 /**
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
251 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
252 * Removes a logger
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
253 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
254 * @param logger The logger to remove
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
255 */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
256 void gaim_log_logger_remove (GaimLogLogger *logger);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
257
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
258 /**
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
259 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
260 * Sets the current logger
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
261 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
262 * @param logger The logger to set
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
263 */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
264 void gaim_log_logger_set (GaimLogLogger *logger);
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
265
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
266 /**
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
267 *
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
268 * Returns the current logger
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
269 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
270 * @return logger The current logger
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
271 */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
272 GaimLogLogger *gaim_log_logger_get (void);
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
273
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
274 /**
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
275 * Returns a GList containing the IDs and Names of the registered log
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
276 * loggers.
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
277 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
278 * @return The list of IDs and names.
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
279 */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
280 GList *gaim_log_logger_get_options(void);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
281
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
282 void gaim_log_init(void);
10231
84cf3fc8a2cb [gaim-migrate @ 11366]
Mark Doliner <mark@kingant.net>
parents: 10171
diff changeset
283 /*@}*/
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
284
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
285
5944
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5934
diff changeset
286 #ifdef __cplusplus
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5934
diff changeset
287 }
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5934
diff changeset
288 #endif
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
289
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 6695
diff changeset
290 #endif /* _GAIM_LOG_H_ */