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