src/log.h

changeset 10566
b681d2b3dec5
parent 10348
0ab5eb1a828e
child 10812
25c595cbffe8
equal deleted inserted replaced
10565:50678b6fdedb 10566:b681d2b3dec5
110 110
111 #ifdef __cplusplus 111 #ifdef __cplusplus
112 extern "C" { 112 extern "C" {
113 #endif 113 #endif
114 114
115 /***************************************/ 115 /***************************************/
116 /** @name Log Functions */ 116 /** @name Log Functions */
117 /***************************************/ 117 /***************************************/
118 /*@{*/ 118 /*@{*/
119 119
120 /** 120 /**
121 * Creates a new log 121 * Creates a new log
122 * 122 *
123 * @param type The type of log this is. 123 * @param type The type of log this is.
124 * @param name The name of this conversation (Screenname, chat name, 124 * @param name The name of this conversation (Screenname, chat name,
125 * etc.) 125 * etc.)
126 * @param account The account the conversation is occurring on 126 * @param account The account the conversation is occurring on
127 * @param time The time this conversation started 127 * @param time The time this conversation started
128 * @return The new log 128 * @return The new log
129 */ 129 */
130 GaimLog *gaim_log_new(GaimLogType type, const char *name, 130 GaimLog *gaim_log_new(GaimLogType type, const char *name,
131 GaimAccount *account, time_t time); 131 GaimAccount *account, time_t time);
132 132
133 /** 133 /**
134 * Frees a log 134 * Frees a log
135 * 135 *
136 * @param log The log to destroy 136 * @param log The log to destroy
137 */ 137 */
138 void gaim_log_free(GaimLog *log); 138 void gaim_log_free(GaimLog *log);
139 139
140 /** 140 /**
141 * Writes to a log file. Assumes you have checked preferences already. 141 * Writes to a log file. Assumes you have checked preferences already.
142 * 142 *
143 * @param log The log to write to 143 * @param log The log to write to
144 * @param type The type of message being logged 144 * @param type The type of message being logged
145 * @param from Whom this message is coming from, or NULL for 145 * @param from Whom this message is coming from, or NULL for
146 * system messages 146 * system messages
147 * @param time A timestamp in UNIX time 147 * @param time A timestamp in UNIX time
148 * @param message The message to log 148 * @param message The message to log
149 */ 149 */
150 void gaim_log_write(GaimLog *log, 150 void gaim_log_write(GaimLog *log,
151 GaimMessageFlags type, 151 GaimMessageFlags type,
152 const char *from, 152 const char *from,
153 time_t time, 153 time_t time,
154 const char *message); 154 const char *message);
155 155
156 /** 156 /**
157 * Reads from a log 157 * Reads from a log
158 * 158 *
159 * @param log The log to read from 159 * @param log The log to read from
160 * @param flags The returned logging flags. 160 * @param flags The returned logging flags.
161 * 161 *
162 * @return The contents of this log in Gaim Markup. 162 * @return The contents of this log in Gaim Markup.
163 */ 163 */
164 char *gaim_log_read(GaimLog *log, GaimLogReadFlags *flags); 164 char *gaim_log_read(GaimLog *log, GaimLogReadFlags *flags);
165 165
166 /** 166 /**
167 * Returns a list of all available logs 167 * Returns a list of all available logs
168 * 168 *
169 * @param type The type of the log 169 * @param type The type of the log
170 * @param name The name of the log 170 * @param name The name of the log
171 * @param account The account 171 * @param account The account
172 * @return A sorted list of GaimLogs 172 * @return A sorted list of GaimLogs
173 */ 173 */
174 GList *gaim_log_get_logs(GaimLogType type, const char *name, GaimAccount *account); 174 GList *gaim_log_get_logs(GaimLogType type, const char *name, GaimAccount *account);
175 175
176 /** 176 /**
177 * Returns a list of all available system logs 177 * Returns a list of all available system logs
178 * 178 *
179 * @param account The account 179 * @param account The account
180 * @return A sorted list of GaimLogs 180 * @return A sorted list of GaimLogs
181 */ 181 */
182 GList *gaim_log_get_system_logs(GaimAccount *account); 182 GList *gaim_log_get_system_logs(GaimAccount *account);
183 183
184 /** 184 /**
185 * Returns the size of a log 185 * Returns the size of a log
186 * 186 *
187 * @param log The log 187 * @param log The log
188 * @return The size of the log, in bytes 188 * @return The size of the log, in bytes
189 */ 189 */
190 int gaim_log_get_size(GaimLog *log); 190 int gaim_log_get_size(GaimLog *log);
191 191
192 /** 192 /**
193 * Returns the size, in bytes, of all available logs in this conversation 193 * Returns the size, in bytes, of all available logs in this conversation
194 * 194 *
195 * @param type The type of the log 195 * @param type The type of the log
196 * @param name The name of the log 196 * @param name The name of the log
197 * @param account The account 197 * @param account The account
198 * @return The size in bytes 198 * @return The size in bytes
199 */ 199 */
200 int gaim_log_get_total_size(GaimLogType type, const char *name, GaimAccount *account); 200 int gaim_log_get_total_size(GaimLogType type, const char *name, GaimAccount *account);
201 201
202 /** 202 /**
203 * Implements GCompareFunc 203 * Implements GCompareFunc
204 * 204 *
205 * @param y A GaimLog 205 * @param y A GaimLog
206 * @param z Another GaimLog 206 * @param z Another GaimLog
207 * @return A value as specified by GCompareFunc 207 * @return A value as specified by GCompareFunc
208 */ 208 */
209 gint gaim_log_compare(gconstpointer y, gconstpointer z); 209 gint gaim_log_compare(gconstpointer y, gconstpointer z);
210 /*@}*/ 210 /*@}*/
211 211
212 /******************************************/ 212 /******************************************/
213 /** @name Logger Functions */ 213 /** @name Logger Functions */
214 /******************************************/ 214 /******************************************/
215 /*@{*/ 215 /*@{*/
216 216
217 /** 217 /**
218 * Creates a new logger 218 * Creates a new logger
219 * 219 *
220 * @param create The logger's new function. 220 * @param create The logger's new function.
221 * @param write The logger's write function. 221 * @param write The logger's write function.
222 * @param finalize The logger's finalize function. 222 * @param finalize The logger's finalize function.
223 * @param list The logger's list function. 223 * @param list The logger's list function.
224 * @param read The logger's read function. 224 * @param read The logger's read function.
225 * @param size The logger's size function. 225 * @param size The logger's size function.
226 * 226 *
227 * @return The new logger 227 * @return The new logger
228 */ 228 */
229 GaimLogLogger *gaim_log_logger_new( 229 GaimLogLogger *gaim_log_logger_new(
230 void(*create)(GaimLog *), 230 void(*create)(GaimLog *),
231 void(*write)(GaimLog *, GaimMessageFlags, const char *, time_t, const char *), 231 void(*write)(GaimLog *, GaimMessageFlags, const char *, time_t, const char *),
232 void(*finalize)(GaimLog *), 232 void(*finalize)(GaimLog *),
233 GList*(*list)(GaimLogType type, const char*, GaimAccount*), 233 GList*(*list)(GaimLogType type, const char*, GaimAccount*),
234 char*(*read)(GaimLog*, GaimLogReadFlags*), 234 char*(*read)(GaimLog*, GaimLogReadFlags*),
235 int(*size)(GaimLog*)); 235 int(*size)(GaimLog*));
236 /** 236 /**
237 * Frees a logger 237 * Frees a logger
238 * 238 *
239 * @param logger The logger to free 239 * @param logger The logger to free
240 */ 240 */
241 void gaim_log_logger_free(GaimLogLogger *logger); 241 void gaim_log_logger_free(GaimLogLogger *logger);
242 242
243 /** 243 /**
244 * Adds a new logger 244 * Adds a new logger
245 * 245 *
246 * @param logger The new logger to add 246 * @param logger The new logger to add
247 */ 247 */
248 void gaim_log_logger_add (GaimLogLogger *logger); 248 void gaim_log_logger_add (GaimLogLogger *logger);
249 249
250 /** 250 /**
251 * 251 *
252 * Removes a logger 252 * Removes a logger
253 * 253 *
254 * @param logger The logger to remove 254 * @param logger The logger to remove
255 */ 255 */
256 void gaim_log_logger_remove (GaimLogLogger *logger); 256 void gaim_log_logger_remove (GaimLogLogger *logger);
257 257
258 /** 258 /**
259 * 259 *
260 * Sets the current logger 260 * Sets the current logger
261 * 261 *
262 * @param logger The logger to set 262 * @param logger The logger to set
263 */ 263 */
264 void gaim_log_logger_set (GaimLogLogger *logger); 264 void gaim_log_logger_set (GaimLogLogger *logger);
265 265
266 /** 266 /**
267 * 267 *
268 * Returns the current logger 268 * Returns the current logger
269 * 269 *
270 * @return logger The current logger 270 * @return logger The current logger
271 */ 271 */
272 GaimLogLogger *gaim_log_logger_get (void); 272 GaimLogLogger *gaim_log_logger_get (void);
273 273
274 /** 274 /**
275 * Returns a GList containing the IDs and Names of the registered log 275 * Returns a GList containing the IDs and Names of the registered log
276 * loggers. 276 * loggers.
277 * 277 *
278 * @return The list of IDs and names. 278 * @return The list of IDs and names.
279 */ 279 */
280 GList *gaim_log_logger_get_options(void); 280 GList *gaim_log_logger_get_options(void);
281 281
282 void gaim_log_init(void); 282 void gaim_log_init(void);
283 /*@}*/ 283 /*@}*/
284 284
285 285
286 #ifdef __cplusplus 286 #ifdef __cplusplus
287 } 287 }
288 #endif 288 #endif

mercurial