log.h
Go to the documentation of this file.
1 
7 /* purple
8  *
9  * Purple is the legal property of its developers, whose names are too numerous
10  * to list here. Please refer to the COPYRIGHT file distributed with this
11  * source distribution.
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26  */
27 #ifndef _PURPLE_LOG_H_
28 #define _PURPLE_LOG_H_
29 
30 #include <stdio.h>
31 
32 
33 /********************************************************
34  * DATA STRUCTURES **************************************
35  ********************************************************/
36 
37 typedef struct _PurpleLog PurpleLog;
38 typedef struct _PurpleLogLogger PurpleLogLogger;
40 typedef struct _PurpleLogSet PurpleLogSet;
41 
42 typedef enum {
43  PURPLE_LOG_IM,
44  PURPLE_LOG_CHAT,
45  PURPLE_LOG_SYSTEM
46 } PurpleLogType;
47 
48 typedef enum {
49  PURPLE_LOG_READ_NO_NEWLINE = 1
50 } PurpleLogReadFlags;
51 
52 #include "account.h"
53 #include "conversation.h"
54 
55 typedef void (*PurpleLogSetCallback) (GHashTable *sets, PurpleLogSet *set);
56 
64  char *name;
65  char *id;
69  void (*create)(PurpleLog *log);
70 
72  gsize (*write)(PurpleLog *log,
73  PurpleMessageFlags type,
74  const char *from,
75  time_t time,
76  const char *message);
77 
79  void (*finalize)(PurpleLog *log);
80 
82  GList *(*list)(PurpleLogType type, const char *name, PurpleAccount *account);
83 
86  char *(*read)(PurpleLog *log, PurpleLogReadFlags *flags);
87 
90  int (*size)(PurpleLog *log);
91 
94  int (*total_size)(PurpleLogType type, const char *name, PurpleAccount *account);
95 
97  GList *(*list_syslog)(PurpleAccount *account);
98 
107  void (*get_log_sets)(PurpleLogSetCallback cb, GHashTable *sets);
108 
109  /* Attempts to delete the specified log, indicating success or failure */
110  gboolean (*remove)(PurpleLog *log);
111 
112  /* Tests whether a log is deletable */
113  gboolean (*is_deletable)(PurpleLog *log);
114 
115  void (*_purple_reserved1)(void);
116  void (*_purple_reserved2)(void);
117  void (*_purple_reserved3)(void);
118  void (*_purple_reserved4)(void);
119 };
120 
124 struct _PurpleLog {
125  PurpleLogType type;
126  char *name;
130  time_t time;
135  void *logger_data;
136  struct tm *tm;
143  /* IMPORTANT: Some code in log.c allocates these without zeroing them.
144  * IMPORTANT: Update that code if you add members here. */
145 };
146 
152  char *path;
153  FILE *file;
154  void *extra_data;
155 };
156 
164  PurpleLogType type;
165  char *name;
173  gboolean buddy;
180  /* IMPORTANT: Some code in log.c allocates these without zeroing them.
181  * IMPORTANT: Update that code if you add members here. */
182 };
183 
184 #ifdef __cplusplus
185 extern "C" {
186 #endif
187 
188 /***************************************/
190 /***************************************/
206 PurpleLog *purple_log_new(PurpleLogType type, const char *name, PurpleAccount *account,
207  PurpleConversation *conv, time_t time, const struct tm *tm);
208 
214 void purple_log_free(PurpleLog *log);
215 
226 void purple_log_write(PurpleLog *log,
227  PurpleMessageFlags type,
228  const char *from,
229  time_t time,
230  const char *message);
231 
240 char *purple_log_read(PurpleLog *log, PurpleLogReadFlags *flags);
241 
250 GList *purple_log_get_logs(PurpleLogType type, const char *name, PurpleAccount *account);
251 
268 GHashTable *purple_log_get_log_sets(void);
269 
277 
285 
294 int purple_log_get_total_size(PurpleLogType type, const char *name, PurpleAccount *account);
295 
307 int purple_log_get_activity_score(PurpleLogType type, const char *name, PurpleAccount *account);
308 
319 gboolean purple_log_is_deletable(PurpleLog *log);
320 
327 gboolean purple_log_delete(PurpleLog *log);
328 
339 char *purple_log_get_log_dir(PurpleLogType type, const char *name, PurpleAccount *account);
340 
348 gint purple_log_compare(gconstpointer y, gconstpointer z);
349 
357 gint purple_log_set_compare(gconstpointer y, gconstpointer z);
358 
365 
368 /******************************************/
370 /******************************************/
389 void purple_log_common_writer(PurpleLog *log, const char *ext);
390 
408 GList *purple_log_common_lister(PurpleLogType type, const char *name,
409  PurpleAccount *account, const char *ext,
410  PurpleLogLogger *logger);
411 
431 int purple_log_common_total_sizer(PurpleLogType type, const char *name,
432  PurpleAccount *account, const char *ext);
433 
448 
462 gboolean purple_log_common_deleter(PurpleLog *log);
463 
478 
481 /******************************************/
483 /******************************************/
506 PurpleLogLogger *purple_log_logger_new(const char *id, const char *name, int functions, ...);
507 
514 
521 
529 
537 
545 
552 GList *purple_log_logger_get_options(void);
553 
554 /**************************************************************************/
556 /**************************************************************************/
562 void purple_log_init(void);
563 
569 void *purple_log_get_handle(void);
570 
574 void purple_log_uninit(void);
575 
579 #ifdef __cplusplus
580 }
581 #endif
582 
583 #endif /* _PURPLE_LOG_H_ */
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!