Fri, 28 Sep 2007 20:29:06 +0000
propagate from branch 'im.pidgin.rlaager.merging.2_2_1_conflicts' (head 2c886553edaf187292439e8fea5eb6cace270126)
to branch 'im.pidgin.pidgin' (head 4d669acf2042a39fd9aa77ed011c492aab5e3c1b)
| 5872 | 1 | /** |
| 2 | * @file log.h Logging API | |
| 3 | * @ingroup core | |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
6 | /* purple |
| 5872 | 7 | * |
| 15884 | 8 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
| 7440 | 11 | * |
| 5872 | 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation; either version 2 of the License, or | |
| 15 | * (at your option) any later version. | |
| 16 | * | |
| 17 | * This program is distributed in the hope that it will be useful, | |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | * GNU General Public License for more details. | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License | |
| 23 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18412
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
18412
6873322c380f
Add links to the signal documents in the API documents.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16743
diff
changeset
|
25 | * |
|
6873322c380f
Add links to the signal documents in the API documents.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16743
diff
changeset
|
26 | * @see @ref log-signals |
| 5872 | 27 | */ |
| 15884 | 28 | #ifndef _PURPLE_LOG_H_ |
| 29 | #define _PURPLE_LOG_H_ | |
| 5872 | 30 | |
| 7431 | 31 | #include <stdio.h> |
| 5872 | 32 | |
| 33 | ||
| 7431 | 34 | /******************************************************** |
| 35 | * DATA STRUCTURES ************************************** | |
| 36 | ********************************************************/ | |
| 37 | ||
| 15884 | 38 | typedef struct _PurpleLog PurpleLog; |
| 39 | typedef struct _PurpleLogLogger PurpleLogLogger; | |
| 40 | typedef struct _PurpleLogCommonLoggerData PurpleLogCommonLoggerData; | |
| 41 | typedef struct _PurpleLogSet PurpleLogSet; | |
| 7431 | 42 | |
| 43 | typedef enum { | |
| 15884 | 44 | PURPLE_LOG_IM, |
| 45 | PURPLE_LOG_CHAT, | |
| 46 | PURPLE_LOG_SYSTEM | |
| 47 | } PurpleLogType; | |
| 7431 | 48 | |
| 49 | typedef enum { | |
| 15884 | 50 | PURPLE_LOG_READ_NO_NEWLINE = 1 |
| 51 | } PurpleLogReadFlags; | |
| 7431 | 52 | |
| 53 | #include "account.h" | |
| 54 | #include "conversation.h" | |
| 55 | ||
| 15884 | 56 | typedef void (*PurpleLogSetCallback) (GHashTable *sets, PurpleLogSet *set); |
|
11177
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
57 | |
| 7431 | 58 | /** |
| 59 | * A log logger. | |
| 60 | * | |
| 15884 | 61 | * This struct gets filled out and is included in the PurpleLog. It contains everything |
| 7431 | 62 | * needed to write and read from logs. |
| 63 | */ | |
| 15884 | 64 | struct _PurpleLogLogger { |
| 7431 | 65 | char *name; /**< The logger's name */ |
| 66 | char *id; /**< an identifier to refer to this logger */ | |
| 7440 | 67 | |
| 68 | /** This gets called when the log is first created. | |
| 7431 | 69 | I don't think this is actually needed. */ |
| 15884 | 70 | void (*create)(PurpleLog *log); |
| 7440 | 71 | |
| 7431 | 72 | /** This is used to write to the log file */ |
| 15884 | 73 | gsize (*write)(PurpleLog *log, |
| 74 | PurpleMessageFlags type, | |
| 7431 | 75 | const char *from, |
| 76 | time_t time, | |
| 77 | const char *message); | |
| 78 | ||
| 79 | /** Called when the log is destroyed */ | |
| 15884 | 80 | void (*finalize)(PurpleLog *log); |
| 7440 | 81 | |
| 15884 | 82 | /** This function returns a sorted GList of available PurpleLogs */ |
| 83 | GList *(*list)(PurpleLogType type, const char *name, PurpleAccount *account); | |
| 7440 | 84 | |
| 85 | /** Given one of the logs returned by the logger's list function, | |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
86 | * this returns the contents of the log in GtkIMHtml markup */ |
| 15884 | 87 | char *(*read)(PurpleLog *log, PurpleLogReadFlags *flags); |
|
10231
047177cee39f
[gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents:
10171
diff
changeset
|
88 | |
| 7556 | 89 | /** Given one of the logs returned by the logger's list function, |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
90 | * this returns the size of the log in bytes */ |
| 15884 | 91 | int (*size)(PurpleLog *log); |
| 8096 | 92 | |
| 93 | /** Returns the total size of all the logs. If this is undefined a default | |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
94 | * implementation is used */ |
| 15884 | 95 | int (*total_size)(PurpleLogType type, const char *name, PurpleAccount *account); |
| 8573 | 96 | |
| 15884 | 97 | /** This function returns a sorted GList of available system PurpleLogs */ |
| 98 | GList *(*list_syslog)(PurpleAccount *account); | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
99 | |
| 15884 | 100 | /** Adds PurpleLogSets to a GHashTable. By passing the data in the PurpleLogSets |
| 101 | * to list, the caller can get every available PurpleLog from the logger. | |
| 102 | * Loggers using purple_log_common_writer() (or otherwise storing their | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
103 | * logs in the same directory structure as the stock loggers) do not |
|
11177
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
104 | * need to implement this function. |
|
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
105 | * |
| 15884 | 106 | * Loggers which implement this function must create a PurpleLogSet, |
| 107 | * then call @a cb with @a sets and the newly created PurpleLogSet. */ | |
| 108 | void (*get_log_sets)(PurpleLogSetCallback cb, GHashTable *sets); | |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
109 | |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
110 | /* Attempts to delete the specified log, indicating success or failure */ |
|
16116
bccaa68c86ad
"delete" is a reserved word in C++, rename the "delete" member of
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
111 | gboolean (*remove)(PurpleLog *log); |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
112 | |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
113 | /* Tests whether a log is deletable */ |
| 15884 | 114 | gboolean (*is_deletable)(PurpleLog *log); |
|
16743
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
16116
diff
changeset
|
115 | |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
16116
diff
changeset
|
116 | void (*_purple_reserved1)(void); |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
16116
diff
changeset
|
117 | void (*_purple_reserved2)(void); |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
16116
diff
changeset
|
118 | void (*_purple_reserved3)(void); |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
16116
diff
changeset
|
119 | void (*_purple_reserved4)(void); |
| 5872 | 120 | }; |
| 121 | ||
| 7431 | 122 | /** |
| 123 | * A log. Not the wooden type. | |
| 124 | */ | |
| 15884 | 125 | struct _PurpleLog { |
| 126 | PurpleLogType type; /**< The type of log this is */ | |
| 7431 | 127 | char *name; /**< The name of this log */ |
| 15884 | 128 | PurpleAccount *account; /**< The account this log is taking |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13059
diff
changeset
|
129 | place on */ |
| 15884 | 130 | PurpleConversation *conv; /**< The conversation being logged */ |
| 7440 | 131 | time_t time; /**< The time this conversation |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13059
diff
changeset
|
132 | started, converted to the local timezone */ |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13059
diff
changeset
|
133 | |
| 15884 | 134 | PurpleLogLogger *logger; /**< The logging mechanism this log |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13059
diff
changeset
|
135 | is to use */ |
| 7431 | 136 | void *logger_data; /**< Data used by the log logger */ |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13059
diff
changeset
|
137 | struct tm *tm; /**< The time this conversation |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13059
diff
changeset
|
138 | started, saved with original |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13059
diff
changeset
|
139 | timezone data, if available and |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13059
diff
changeset
|
140 | if struct tm has the BSD |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13059
diff
changeset
|
141 | timezone fields, else @c NULL. |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13059
diff
changeset
|
142 | Do NOT modify anything in this struct.*/ |
|
13624
c6577def4e2a
[gaim-migrate @ 16009]
Richard Laager <rlaager@pidgin.im>
parents:
13389
diff
changeset
|
143 | |
|
c6577def4e2a
[gaim-migrate @ 16009]
Richard Laager <rlaager@pidgin.im>
parents:
13389
diff
changeset
|
144 | /* IMPORTANT: Some code in log.c allocates these without zeroing them. |
|
c6577def4e2a
[gaim-migrate @ 16009]
Richard Laager <rlaager@pidgin.im>
parents:
13389
diff
changeset
|
145 | * IMPORTANT: Update that code if you add members here. */ |
| 5872 | 146 | }; |
| 147 | ||
| 10822 | 148 | /** |
| 149 | * A common logger_data struct containing a file handle and path, as well | |
| 150 | * as a pointer to something else for additional data. | |
| 151 | */ | |
| 15884 | 152 | struct _PurpleLogCommonLoggerData { |
| 10822 | 153 | char *path; |
| 154 | FILE *file; | |
| 155 | void *extra_data; | |
| 156 | }; | |
| 7431 | 157 | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
158 | /** |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
159 | * Describes available logs. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
160 | * |
| 15884 | 161 | * By passing the elements of this struct to purple_log_get_logs(), the caller |
| 162 | * can get all available PurpleLogs. | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
163 | */ |
| 15884 | 164 | struct _PurpleLogSet { |
| 165 | PurpleLogType type; /**< The type of logs available */ | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
166 | char *name; /**< The name of the logs available */ |
| 15884 | 167 | PurpleAccount *account; /**< The account the available logs |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
168 | took place on. This will be |
|
11503
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
169 | @c NULL if the account no longer |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
170 | exists. (Depending on a |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
171 | logger's implementation of |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
172 | list, it may not be possible |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
173 | to load such logs.) */ |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
174 | gboolean buddy; /**< Is this (account, name) a buddy |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
175 | on the buddy list? */ |
|
11177
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
176 | char *normalized_name; /**< The normalized version of |
|
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
177 | @a name. It must be set, and |
|
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
178 | may be set to the same pointer |
|
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
179 | value as @a name. */ |
|
13624
c6577def4e2a
[gaim-migrate @ 16009]
Richard Laager <rlaager@pidgin.im>
parents:
13389
diff
changeset
|
180 | |
|
c6577def4e2a
[gaim-migrate @ 16009]
Richard Laager <rlaager@pidgin.im>
parents:
13389
diff
changeset
|
181 | /* IMPORTANT: Some code in log.c allocates these without zeroing them. |
|
c6577def4e2a
[gaim-migrate @ 16009]
Richard Laager <rlaager@pidgin.im>
parents:
13389
diff
changeset
|
182 | * IMPORTANT: Update that code if you add members here. */ |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
183 | }; |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
184 | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
185 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
186 | extern "C" { |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
187 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
188 | |
| 10566 | 189 | /***************************************/ |
| 190 | /** @name Log Functions */ | |
| 191 | /***************************************/ | |
| 192 | /*@{*/ | |
| 7440 | 193 | |
| 10566 | 194 | /** |
| 195 | * Creates a new log | |
| 196 | * | |
| 197 | * @param type The type of log this is. | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
198 | * @param name The name of this conversation (screenname, chat name, |
| 10566 | 199 | * etc.) |
| 200 | * @param account The account the conversation is occurring on | |
|
11292
13068c68def6
[gaim-migrate @ 13492]
Richard Laager <rlaager@pidgin.im>
parents:
11177
diff
changeset
|
201 | * @param conv The conversation being logged |
| 10566 | 202 | * @param time The time this conversation started |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13059
diff
changeset
|
203 | * @param tm The time this conversation started, with timezone data, |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13059
diff
changeset
|
204 | * if available and if struct tm has the BSD timezone fields. |
| 10566 | 205 | * @return The new log |
| 206 | */ | |
| 15884 | 207 | PurpleLog *purple_log_new(PurpleLogType type, const char *name, PurpleAccount *account, |
| 208 | PurpleConversation *conv, time_t time, const struct tm *tm); | |
| 7431 | 209 | |
| 10566 | 210 | /** |
| 211 | * Frees a log | |
| 212 | * | |
| 213 | * @param log The log to destroy | |
| 214 | */ | |
| 15884 | 215 | void purple_log_free(PurpleLog *log); |
| 7440 | 216 | |
| 10566 | 217 | /** |
| 218 | * Writes to a log file. Assumes you have checked preferences already. | |
| 219 | * | |
| 220 | * @param log The log to write to | |
| 221 | * @param type The type of message being logged | |
|
11503
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
222 | * @param from Whom this message is coming from, or @c NULL for |
| 10566 | 223 | * system messages |
| 224 | * @param time A timestamp in UNIX time | |
| 225 | * @param message The message to log | |
| 226 | */ | |
| 15884 | 227 | void purple_log_write(PurpleLog *log, |
| 228 | PurpleMessageFlags type, | |
| 10566 | 229 | const char *from, |
| 230 | time_t time, | |
| 231 | const char *message); | |
| 7431 | 232 | |
| 10566 | 233 | /** |
| 234 | * Reads from a log | |
| 235 | * | |
| 236 | * @param log The log to read from | |
| 237 | * @param flags The returned logging flags. | |
| 238 | * | |
| 15884 | 239 | * @return The contents of this log in Purple Markup. |
| 10566 | 240 | */ |
| 15884 | 241 | char *purple_log_read(PurpleLog *log, PurpleLogReadFlags *flags); |
| 7431 | 242 | |
| 10566 | 243 | /** |
| 244 | * Returns a list of all available logs | |
| 245 | * | |
| 246 | * @param type The type of the log | |
| 247 | * @param name The name of the log | |
| 248 | * @param account The account | |
| 15884 | 249 | * @return A sorted list of PurpleLogs |
| 10566 | 250 | */ |
| 15884 | 251 | GList *purple_log_get_logs(PurpleLogType type, const char *name, PurpleAccount *account); |
| 7440 | 252 | |
| 10566 | 253 | /** |
| 15884 | 254 | * Returns a GHashTable of PurpleLogSets. |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
255 | * |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
256 | * A "log set" here means the information necessary to gather the |
| 15884 | 257 | * PurpleLogs for a given buddy/chat. This information would be passed |
| 258 | * to purple_log_list to get a list of PurpleLogs. | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
259 | * |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
260 | * 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
|
261 | * user has ever talked to (assuming he or she uses logging). |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
262 | * |
|
11177
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
263 | * The GHashTable that's returned will free all log sets in it when |
| 15884 | 264 | * destroyed. If a PurpleLogSet is removed from the GHashTable, it |
| 265 | * must be freed with purple_log_set_free(). | |
|
11177
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
266 | * |
| 15884 | 267 | * @return A GHashTable of all available unique PurpleLogSets |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
268 | */ |
| 15884 | 269 | GHashTable *purple_log_get_log_sets(void); |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
270 | |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
271 | /** |
| 10566 | 272 | * Returns a list of all available system logs |
| 273 | * | |
| 274 | * @param account The account | |
| 15884 | 275 | * @return A sorted list of PurpleLogs |
| 10566 | 276 | */ |
| 15884 | 277 | GList *purple_log_get_system_logs(PurpleAccount *account); |
| 8573 | 278 | |
| 10566 | 279 | /** |
| 10822 | 280 | * Returns the size of a log |
| 10566 | 281 | * |
| 282 | * @param log The log | |
| 283 | * @return The size of the log, in bytes | |
| 284 | */ | |
| 15884 | 285 | int purple_log_get_size(PurpleLog *log); |
| 5872 | 286 | |
| 10566 | 287 | /** |
| 288 | * Returns the size, in bytes, of all available logs in this conversation | |
| 289 | * | |
| 290 | * @param type The type of the log | |
| 291 | * @param name The name of the log | |
| 292 | * @param account The account | |
| 293 | * @return The size in bytes | |
| 294 | */ | |
| 15884 | 295 | int purple_log_get_total_size(PurpleLogType type, const char *name, PurpleAccount *account); |
| 8573 | 296 | |
| 10566 | 297 | /** |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
298 | * Tests whether a log is deletable |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
299 | * |
| 15884 | 300 | * A return value of @c FALSE indicates that purple_log_delete() will fail on this |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
301 | * log, unless something changes between the two calls. A return value of @c TRUE, |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
302 | * however, does not guarantee the log can be deleted. |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
303 | * |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
304 | * @param log The log |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
305 | * @return A boolean indicating if the log is deletable |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
306 | */ |
| 15884 | 307 | gboolean purple_log_is_deletable(PurpleLog *log); |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
308 | |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
309 | /** |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
310 | * Deletes a log |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
311 | * |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
312 | * @param log The log |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
313 | * @return A boolean indicating success or failure |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
314 | */ |
| 15884 | 315 | gboolean purple_log_delete(PurpleLog *log); |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
316 | |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
317 | /** |
| 15884 | 318 | * Returns the default logger directory Purple uses for a given account |
| 319 | * and username. This would be where Purple stores logs created by | |
| 10822 | 320 | * the built-in text or HTML loggers. |
| 321 | * | |
| 322 | * @param type The type of the log. | |
| 323 | * @param name The name of the log. | |
| 324 | * @param account The account. | |
| 15884 | 325 | * @return The default logger directory for Purple. |
| 10822 | 326 | */ |
| 15884 | 327 | char *purple_log_get_log_dir(PurpleLogType type, const char *name, PurpleAccount *account); |
| 10822 | 328 | |
| 329 | /** | |
| 15884 | 330 | * Implements GCompareFunc for PurpleLogs |
| 10566 | 331 | * |
| 15884 | 332 | * @param y A PurpleLog |
| 333 | * @param z Another PurpleLog | |
|
11177
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
334 | * @return A value as specified by GCompareFunc |
| 10566 | 335 | */ |
| 15884 | 336 | gint purple_log_compare(gconstpointer y, gconstpointer z); |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
337 | |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
338 | /** |
| 15884 | 339 | * Implements GCompareFunc for PurpleLogSets |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
340 | * |
| 15884 | 341 | * @param y A PurpleLogSet |
| 342 | * @param z Another PurpleLogSet | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
343 | * @return A value as specified by GCompareFunc |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
344 | */ |
| 15884 | 345 | gint purple_log_set_compare(gconstpointer y, gconstpointer z); |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
346 | |
|
11177
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
347 | /** |
|
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
348 | * Frees a log set |
|
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
349 | * |
|
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
350 | * @param set The log set to destroy |
|
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
351 | */ |
| 15884 | 352 | void purple_log_set_free(PurpleLogSet *set); |
|
11177
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
353 | |
| 10566 | 354 | /*@}*/ |
| 8573 | 355 | |
| 10566 | 356 | /******************************************/ |
| 10822 | 357 | /** @name Common Logger Functions */ |
| 358 | /******************************************/ | |
| 359 | /*@{*/ | |
| 360 | ||
| 361 | /** | |
| 15884 | 362 | * Opens a new log file in the standard Purple log location |
| 10822 | 363 | * with the given file extension, named for the current time, |
| 364 | * for writing. If a log file is already open, the existing | |
| 365 | * file handle is retained. The log's logger_data value is | |
| 15884 | 366 | * set to a PurpleLogCommonLoggerData struct containing the log |
| 10822 | 367 | * file handle and log path. |
| 368 | * | |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
369 | * This function is intended to be used as a "common" |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
370 | * implementation of a logger's @c write function. |
| 15884 | 371 | * It should only be passed to purple_log_logger_new() and never |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
372 | * called directly. |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
373 | * |
| 10822 | 374 | * @param log The log to write to. |
| 375 | * @param ext The file extension to give to this log file. | |
| 376 | */ | |
| 15884 | 377 | void purple_log_common_writer(PurpleLog *log, const char *ext); |
| 10822 | 378 | |
| 379 | /** | |
| 15884 | 380 | * Returns a sorted GList of PurpleLogs of the requested type. |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
381 | * |
| 10822 | 382 | * This function should only be used with logs that are written |
| 15884 | 383 | * with purple_log_common_writer(). It's intended to be used as |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
384 | * a "common" implementation of a logger's @c list function. |
| 15884 | 385 | * It should only be passed to purple_log_logger_new() and never |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
386 | * called directly. |
| 10822 | 387 | * |
| 388 | * @param type The type of the logs being listed. | |
| 389 | * @param name The name of the log. | |
| 390 | * @param account The account of the log. | |
| 391 | * @param ext The file extension this log format uses. | |
| 392 | * @param logger A reference to the logger struct for this log. | |
| 393 | * | |
| 15884 | 394 | * @return A sorted GList of PurpleLogs matching the parameters. |
| 10822 | 395 | */ |
| 15884 | 396 | GList *purple_log_common_lister(PurpleLogType type, const char *name, |
| 397 | PurpleAccount *account, const char *ext, | |
| 398 | PurpleLogLogger *logger); | |
| 10822 | 399 | |
| 400 | /** | |
|
13389
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
401 | * Returns the total size of all the logs for a given user, with |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
402 | * a given extension. |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
403 | * |
|
13389
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
404 | * This function should only be used with logs that are written |
| 15884 | 405 | * with purple_log_common_writer(). It's intended to be used as |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
406 | * a "common" implementation of a logger's @c total_size function. |
| 15884 | 407 | * It should only be passed to purple_log_logger_new() and never |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
408 | * called directly. |
|
13389
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
409 | * |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
410 | * @param type The type of the logs being sized. |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
411 | * @param name The name of the logs to size |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
412 | * (e.g. the username or chat name). |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
413 | * @param account The account of the log. |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
414 | * @param ext The file extension this log format uses. |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
415 | * |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
416 | * @return The size of all the logs with the specified extension |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
417 | * for the specified user. |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
418 | */ |
| 15884 | 419 | int purple_log_common_total_sizer(PurpleLogType type, const char *name, |
| 420 | PurpleAccount *account, const char *ext); | |
|
13389
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
421 | |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
422 | /** |
| 15884 | 423 | * Returns the size of a given PurpleLog. |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
424 | * |
| 10822 | 425 | * This function should only be used with logs that are written |
| 15884 | 426 | * with purple_log_common_writer(). It's intended to be used as |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
427 | * a "common" implementation of a logger's @c size function. |
| 15884 | 428 | * It should only be passed to purple_log_logger_new() and never |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
429 | * called directly. |
| 10822 | 430 | * |
| 15884 | 431 | * @param log The PurpleLog to size. |
| 10822 | 432 | * |
| 433 | * @return An integer indicating the size of the log in bytes. | |
| 434 | */ | |
| 15884 | 435 | int purple_log_common_sizer(PurpleLog *log); |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
436 | |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
437 | /** |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
438 | * Deletes a log |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
439 | * |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
440 | * This function should only be used with logs that are written |
| 15884 | 441 | * with purple_log_common_writer(). It's intended to be used as |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
442 | * a "common" implementation of a logger's @c delete function. |
| 15884 | 443 | * It should only be passed to purple_log_logger_new() and never |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
444 | * called directly. |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
445 | * |
| 15884 | 446 | * @param log The PurpleLog to delete. |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
447 | * |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
448 | * @return A boolean indicating success or failure. |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
449 | */ |
| 15884 | 450 | gboolean purple_log_common_deleter(PurpleLog *log); |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
451 | |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
452 | /** |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
453 | * Checks to see if a log is deletable |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
454 | * |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
455 | * This function should only be used with logs that are written |
| 15884 | 456 | * with purple_log_common_writer(). It's intended to be used as |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
457 | * a "common" implementation of a logger's @c is_deletable function. |
| 15884 | 458 | * It should only be passed to purple_log_logger_new() and never |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
459 | * called directly. |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
460 | * |
| 15884 | 461 | * @param log The PurpleLog to check. |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
462 | * |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
463 | * @return A boolean indicating if the log is deletable. |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
464 | */ |
| 15884 | 465 | gboolean purple_log_common_is_deletable(PurpleLog *log); |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
466 | |
| 10822 | 467 | /*@}*/ |
| 468 | ||
| 469 | /******************************************/ | |
| 10566 | 470 | /** @name Logger Functions */ |
| 471 | /******************************************/ | |
| 472 | /*@{*/ | |
| 7440 | 473 | |
| 10566 | 474 | /** |
| 475 | * Creates a new logger | |
| 476 | * | |
|
11503
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
477 | * @param id The logger's id. |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
478 | * @param name The logger's name. |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
479 | * @param functions The number of functions being passed. The following |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
480 | * functions are currently available (in order): @c create, |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
481 | * @c write, @c finalize, @c list, @c read, @c size, |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
482 | * @c total_size, @c list_syslog, @c get_log_sets, |
|
16116
bccaa68c86ad
"delete" is a reserved word in C++, rename the "delete" member of
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
483 | * @c remove, @c is_deletable. |
| 15884 | 484 | * For details on these functions, see PurpleLogLogger. |
|
11503
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
485 | * Functions may not be skipped. For example, passing |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
486 | * @c create and @c write is acceptable (for a total of |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
487 | * two functions). Passing @c create and @c finalize, |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
488 | * however, is not. To accomplish that, the caller must |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
489 | * pass @c create, @c NULL (a placeholder for @c write), |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
490 | * and @c finalize (for a total of 3 functions). |
| 10566 | 491 | * |
| 492 | * @return The new logger | |
| 493 | */ | |
| 15884 | 494 | PurpleLogLogger *purple_log_logger_new(const char *id, const char *name, int functions, ...); |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
495 | |
| 10566 | 496 | /** |
| 497 | * Frees a logger | |
| 498 | * | |
| 499 | * @param logger The logger to free | |
| 500 | */ | |
| 15884 | 501 | void purple_log_logger_free(PurpleLogLogger *logger); |
| 7440 | 502 | |
| 10566 | 503 | /** |
| 504 | * Adds a new logger | |
| 505 | * | |
| 506 | * @param logger The new logger to add | |
| 507 | */ | |
| 15884 | 508 | void purple_log_logger_add (PurpleLogLogger *logger); |
| 7431 | 509 | |
| 10566 | 510 | /** |
| 511 | * | |
| 512 | * Removes a logger | |
| 513 | * | |
| 514 | * @param logger The logger to remove | |
| 515 | */ | |
| 15884 | 516 | void purple_log_logger_remove (PurpleLogLogger *logger); |
| 7431 | 517 | |
| 10566 | 518 | /** |
| 519 | * | |
| 520 | * Sets the current logger | |
| 521 | * | |
| 522 | * @param logger The logger to set | |
| 523 | */ | |
| 15884 | 524 | void purple_log_logger_set (PurpleLogLogger *logger); |
| 7440 | 525 | |
| 10566 | 526 | /** |
| 527 | * | |
| 528 | * Returns the current logger | |
| 529 | * | |
| 530 | * @return logger The current logger | |
| 531 | */ | |
| 15884 | 532 | PurpleLogLogger *purple_log_logger_get (void); |
| 7440 | 533 | |
| 10566 | 534 | /** |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
535 | * Returns a GList containing the IDs and names of the registered |
| 10566 | 536 | * loggers. |
| 537 | * | |
| 538 | * @return The list of IDs and names. | |
| 539 | */ | |
| 15884 | 540 | GList *purple_log_logger_get_options(void); |
| 7431 | 541 | |
|
12737
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
542 | /**************************************************************************/ |
|
12835
edc2ec6ae9f3
[gaim-migrate @ 15183]
Richard Laager <rlaager@pidgin.im>
parents:
12737
diff
changeset
|
543 | /** @name Log Subsystem */ |
|
12737
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
544 | /**************************************************************************/ |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
545 | /*@{*/ |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
546 | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
547 | /** |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
548 | * Initializes the log subsystem. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
549 | */ |
| 15884 | 550 | void purple_log_init(void); |
|
12737
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
551 | |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
552 | /** |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
553 | * Returns the log subsystem handle. |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
554 | * |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
555 | * @return The log subsystem handle. |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
556 | */ |
| 15884 | 557 | void *purple_log_get_handle(void); |
|
12737
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
558 | |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
559 | /** |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
560 | * Uninitializes the log subsystem. |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
561 | */ |
| 15884 | 562 | void purple_log_uninit(void); |
|
12737
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
563 | |
| 10566 | 564 | /*@}*/ |
| 7431 | 565 | |
| 5872 | 566 | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
567 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
568 | } |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
569 | #endif |
| 7440 | 570 | |
| 15884 | 571 | #endif /* _PURPLE_LOG_H_ */ |