Sun, 28 Apr 2013 02:26:38 +0200
keyring.c refactoring - order up function implementations
| 5872 | 1 | /** |
| 2 | * @file log.h Logging API | |
| 3 | * @ingroup core | |
|
20889
3d0ef192f98c
All the links to libpurple signal pages were in the comment containing the
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
4 | * @see @ref log-signals |
|
20147
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 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
7 | /* purple |
| 5872 | 8 | * |
| 15884 | 9 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 10 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 11 | * source distribution. | |
| 7440 | 12 | * |
| 5872 | 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License as published by | |
| 15 | * the Free Software Foundation; either version 2 of the License, or | |
| 16 | * (at your option) any later version. | |
| 17 | * | |
| 18 | * This program is distributed in the hope that it will be useful, | |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 21 | * GNU General Public License for more details. | |
| 22 | * | |
| 23 | * You should have received a copy of the GNU General Public License | |
| 24 | * along with this program; if not, write to the Free Software | |
|
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
|
25 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 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 | |
|
32787
7072f190d6ad
Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32604
diff
changeset
|
184 | G_BEGIN_DECLS |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5934
diff
changeset
|
185 | |
| 10566 | 186 | /***************************************/ |
| 187 | /** @name Log Functions */ | |
| 188 | /***************************************/ | |
| 189 | /*@{*/ | |
| 7440 | 190 | |
| 10566 | 191 | /** |
| 192 | * Creates a new log | |
| 193 | * | |
| 194 | * @param type The type of log this is. | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25883
diff
changeset
|
195 | * @param name The name of this conversation (buddy name, chat name, |
| 10566 | 196 | * etc.) |
| 197 | * @param account The account the conversation is occurring on | |
|
11292
13068c68def6
[gaim-migrate @ 13492]
Richard Laager <rlaager@pidgin.im>
parents:
11177
diff
changeset
|
198 | * @param conv The conversation being logged |
| 10566 | 199 | * @param time The time this conversation started |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13059
diff
changeset
|
200 | * @param tm The time this conversation started, with timezone data, |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13059
diff
changeset
|
201 | * if available and if struct tm has the BSD timezone fields. |
| 10566 | 202 | * @return The new log |
| 203 | */ | |
| 15884 | 204 | PurpleLog *purple_log_new(PurpleLogType type, const char *name, PurpleAccount *account, |
| 205 | PurpleConversation *conv, time_t time, const struct tm *tm); | |
| 7431 | 206 | |
| 10566 | 207 | /** |
| 208 | * Frees a log | |
| 209 | * | |
| 210 | * @param log The log to destroy | |
| 211 | */ | |
| 15884 | 212 | void purple_log_free(PurpleLog *log); |
| 7440 | 213 | |
| 10566 | 214 | /** |
| 215 | * Writes to a log file. Assumes you have checked preferences already. | |
| 216 | * | |
| 217 | * @param log The log to write to | |
| 218 | * @param type The type of message being logged | |
|
11503
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
219 | * @param from Whom this message is coming from, or @c NULL for |
| 10566 | 220 | * system messages |
| 221 | * @param time A timestamp in UNIX time | |
| 222 | * @param message The message to log | |
| 223 | */ | |
| 15884 | 224 | void purple_log_write(PurpleLog *log, |
| 225 | PurpleMessageFlags type, | |
| 10566 | 226 | const char *from, |
| 227 | time_t time, | |
| 228 | const char *message); | |
| 7431 | 229 | |
| 10566 | 230 | /** |
| 231 | * Reads from a log | |
| 232 | * | |
| 233 | * @param log The log to read from | |
| 234 | * @param flags The returned logging flags. | |
| 235 | * | |
| 15884 | 236 | * @return The contents of this log in Purple Markup. |
| 10566 | 237 | */ |
| 15884 | 238 | char *purple_log_read(PurpleLog *log, PurpleLogReadFlags *flags); |
| 7431 | 239 | |
| 10566 | 240 | /** |
| 241 | * Returns a list of all available logs | |
| 242 | * | |
| 243 | * @param type The type of the log | |
| 244 | * @param name The name of the log | |
| 245 | * @param account The account | |
| 15884 | 246 | * @return A sorted list of PurpleLogs |
| 10566 | 247 | */ |
| 15884 | 248 | GList *purple_log_get_logs(PurpleLogType type, const char *name, PurpleAccount *account); |
| 7440 | 249 | |
| 10566 | 250 | /** |
| 15884 | 251 | * Returns a GHashTable of PurpleLogSets. |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
252 | * |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
253 | * A "log set" here means the information necessary to gather the |
| 15884 | 254 | * PurpleLogs for a given buddy/chat. This information would be passed |
| 255 | * to purple_log_list to get a list of PurpleLogs. | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
256 | * |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
257 | * 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
|
258 | * user has ever talked to (assuming he or she uses logging). |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
259 | * |
|
11177
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
260 | * The GHashTable that's returned will free all log sets in it when |
| 15884 | 261 | * destroyed. If a PurpleLogSet is removed from the GHashTable, it |
| 262 | * must be freed with purple_log_set_free(). | |
|
11177
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
263 | * |
| 15884 | 264 | * @return A GHashTable of all available unique PurpleLogSets |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
265 | */ |
| 15884 | 266 | GHashTable *purple_log_get_log_sets(void); |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
267 | |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
268 | /** |
| 10566 | 269 | * Returns a list of all available system logs |
| 270 | * | |
| 271 | * @param account The account | |
| 15884 | 272 | * @return A sorted list of PurpleLogs |
| 10566 | 273 | */ |
| 15884 | 274 | GList *purple_log_get_system_logs(PurpleAccount *account); |
| 8573 | 275 | |
| 10566 | 276 | /** |
| 10822 | 277 | * Returns the size of a log |
| 10566 | 278 | * |
| 279 | * @param log The log | |
| 280 | * @return The size of the log, in bytes | |
| 281 | */ | |
| 15884 | 282 | int purple_log_get_size(PurpleLog *log); |
| 5872 | 283 | |
| 10566 | 284 | /** |
| 285 | * Returns the size, in bytes, of all available logs in this conversation | |
| 286 | * | |
| 287 | * @param type The type of the log | |
| 288 | * @param name The name of the log | |
| 289 | * @param account The account | |
| 290 | * @return The size in bytes | |
| 291 | */ | |
| 15884 | 292 | int purple_log_get_total_size(PurpleLogType type, const char *name, PurpleAccount *account); |
| 8573 | 293 | |
| 10566 | 294 | /** |
|
25883
059b74032730
A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents:
20889
diff
changeset
|
295 | * Returns the activity score of a log, based on total size in bytes, |
|
059b74032730
A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents:
20889
diff
changeset
|
296 | * which is then decayed based on age |
|
059b74032730
A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents:
20889
diff
changeset
|
297 | * |
|
059b74032730
A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents:
20889
diff
changeset
|
298 | * @param type The type of the log |
|
059b74032730
A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents:
20889
diff
changeset
|
299 | * @param name The name of the log |
|
059b74032730
A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents:
20889
diff
changeset
|
300 | * @param account The account |
|
059b74032730
A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents:
20889
diff
changeset
|
301 | * @return The activity score |
|
059b74032730
A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents:
20889
diff
changeset
|
302 | */ |
|
059b74032730
A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents:
20889
diff
changeset
|
303 | int purple_log_get_activity_score(PurpleLogType type, const char *name, PurpleAccount *account); |
|
059b74032730
A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents:
20889
diff
changeset
|
304 | |
|
059b74032730
A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents:
20889
diff
changeset
|
305 | /** |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
306 | * 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
|
307 | * |
| 15884 | 308 | * 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
|
309 | * 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
|
310 | * 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
|
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 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
|
314 | */ |
| 15884 | 315 | 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
|
316 | |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
317 | /** |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
318 | * 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
|
319 | * |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
320 | * @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
|
321 | * @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
|
322 | */ |
| 15884 | 323 | 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
|
324 | |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
325 | /** |
| 15884 | 326 | * Returns the default logger directory Purple uses for a given account |
| 327 | * and username. This would be where Purple stores logs created by | |
| 10822 | 328 | * the built-in text or HTML loggers. |
| 329 | * | |
| 330 | * @param type The type of the log. | |
| 331 | * @param name The name of the log. | |
| 332 | * @param account The account. | |
| 15884 | 333 | * @return The default logger directory for Purple. |
| 10822 | 334 | */ |
| 15884 | 335 | char *purple_log_get_log_dir(PurpleLogType type, const char *name, PurpleAccount *account); |
| 10822 | 336 | |
| 337 | /** | |
| 15884 | 338 | * Implements GCompareFunc for PurpleLogs |
| 10566 | 339 | * |
| 15884 | 340 | * @param y A PurpleLog |
| 341 | * @param z Another PurpleLog | |
|
11177
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
342 | * @return A value as specified by GCompareFunc |
| 10566 | 343 | */ |
| 15884 | 344 | gint purple_log_compare(gconstpointer y, gconstpointer z); |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
345 | |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
346 | /** |
| 15884 | 347 | * Implements GCompareFunc for PurpleLogSets |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
348 | * |
| 15884 | 349 | * @param y A PurpleLogSet |
| 350 | * @param z Another PurpleLogSet | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
351 | * @return A value as specified by GCompareFunc |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
352 | */ |
| 15884 | 353 | gint purple_log_set_compare(gconstpointer y, gconstpointer z); |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
354 | |
|
11177
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
355 | /** |
|
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
356 | * Frees a log set |
|
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
357 | * |
|
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
358 | * @param set The log set to destroy |
|
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
359 | */ |
| 15884 | 360 | void purple_log_set_free(PurpleLogSet *set); |
|
11177
534ca3ae0bfc
[gaim-migrate @ 13285]
Richard Laager <rlaager@pidgin.im>
parents:
11035
diff
changeset
|
361 | |
| 10566 | 362 | /*@}*/ |
| 8573 | 363 | |
| 10566 | 364 | /******************************************/ |
| 10822 | 365 | /** @name Common Logger Functions */ |
| 366 | /******************************************/ | |
| 367 | /*@{*/ | |
| 368 | ||
| 369 | /** | |
| 15884 | 370 | * Opens a new log file in the standard Purple log location |
| 10822 | 371 | * with the given file extension, named for the current time, |
| 372 | * for writing. If a log file is already open, the existing | |
| 373 | * file handle is retained. The log's logger_data value is | |
| 15884 | 374 | * set to a PurpleLogCommonLoggerData struct containing the log |
| 10822 | 375 | * file handle and log path. |
| 376 | * | |
|
15584
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
377 | * 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
|
378 | * implementation of a logger's @c write function. |
| 15884 | 379 | * 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
|
380 | * called directly. |
|
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 | * @param log The log to write to. |
| 383 | * @param ext The file extension to give to this log file. | |
| 384 | */ | |
| 15884 | 385 | void purple_log_common_writer(PurpleLog *log, const char *ext); |
| 10822 | 386 | |
| 387 | /** | |
| 15884 | 388 | * 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
|
389 | * |
| 10822 | 390 | * This function should only be used with logs that are written |
| 15884 | 391 | * 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
|
392 | * a "common" implementation of a logger's @c list function. |
| 15884 | 393 | * 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
|
394 | * called directly. |
| 10822 | 395 | * |
| 396 | * @param type The type of the logs being listed. | |
| 397 | * @param name The name of the log. | |
| 398 | * @param account The account of the log. | |
| 399 | * @param ext The file extension this log format uses. | |
| 400 | * @param logger A reference to the logger struct for this log. | |
| 401 | * | |
| 15884 | 402 | * @return A sorted GList of PurpleLogs matching the parameters. |
| 10822 | 403 | */ |
| 15884 | 404 | GList *purple_log_common_lister(PurpleLogType type, const char *name, |
| 405 | PurpleAccount *account, const char *ext, | |
| 406 | PurpleLogLogger *logger); | |
| 10822 | 407 | |
| 408 | /** | |
|
13389
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
409 | * 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
|
410 | * 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
|
411 | * |
|
13389
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
412 | * This function should only be used with logs that are written |
| 15884 | 413 | * 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
|
414 | * a "common" implementation of a logger's @c total_size function. |
| 15884 | 415 | * 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
|
416 | * called directly. |
|
13389
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
417 | * |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
418 | * @param type The type of the logs being sized. |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
419 | * @param name The name of the logs to size |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
420 | * (e.g. the username or chat name). |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
421 | * @param account The account of the log. |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
422 | * @param ext The file extension this log format uses. |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
423 | * |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
424 | * @return The size of all the logs with the specified extension |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
425 | * for the specified user. |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
426 | */ |
| 15884 | 427 | int purple_log_common_total_sizer(PurpleLogType type, const char *name, |
| 428 | PurpleAccount *account, const char *ext); | |
|
13389
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
429 | |
|
27cf7d84dfd1
[gaim-migrate @ 15761]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
430 | /** |
| 15884 | 431 | * 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
|
432 | * |
| 10822 | 433 | * This function should only be used with logs that are written |
| 15884 | 434 | * 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
|
435 | * a "common" implementation of a logger's @c size function. |
| 15884 | 436 | * 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
|
437 | * called directly. |
| 10822 | 438 | * |
| 15884 | 439 | * @param log The PurpleLog to size. |
| 10822 | 440 | * |
| 441 | * @return An integer indicating the size of the log in bytes. | |
| 442 | */ | |
| 15884 | 443 | 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
|
444 | |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
445 | /** |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
446 | * 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
|
447 | * |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
448 | * This function should only be used with logs that are written |
| 15884 | 449 | * 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
|
450 | * a "common" implementation of a logger's @c delete function. |
| 15884 | 451 | * 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
|
452 | * called directly. |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
453 | * |
| 15884 | 454 | * @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
|
455 | * |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
456 | * @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
|
457 | */ |
| 15884 | 458 | 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
|
459 | |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
460 | /** |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
461 | * 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
|
462 | * |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
463 | * This function should only be used with logs that are written |
| 15884 | 464 | * 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
|
465 | * a "common" implementation of a logger's @c is_deletable function. |
| 15884 | 466 | * 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
|
467 | * called directly. |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
468 | * |
| 15884 | 469 | * @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
|
470 | * |
|
f4d9ac6f94b8
This is the core code to support log deletion. It's untested.
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
471 | * @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
|
472 | */ |
| 15884 | 473 | 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
|
474 | |
| 10822 | 475 | /*@}*/ |
| 476 | ||
| 477 | /******************************************/ | |
| 10566 | 478 | /** @name Logger Functions */ |
| 479 | /******************************************/ | |
| 480 | /*@{*/ | |
| 7440 | 481 | |
| 10566 | 482 | /** |
| 483 | * Creates a new logger | |
| 484 | * | |
|
11503
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
485 | * @param id The logger's id. |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
486 | * @param name The logger's name. |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
487 | * @param functions The number of functions being passed. The following |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
488 | * functions are currently available (in order): @c create, |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
489 | * @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
|
490 | * @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
|
491 | * @c remove, @c is_deletable. |
| 15884 | 492 | * For details on these functions, see PurpleLogLogger. |
|
11503
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
493 | * Functions may not be skipped. For example, passing |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
494 | * @c create and @c write is acceptable (for a total of |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
495 | * two functions). Passing @c create and @c finalize, |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
496 | * however, is not. To accomplish that, the caller must |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
497 | * pass @c create, @c NULL (a placeholder for @c write), |
|
9f15d4c089b9
[gaim-migrate @ 13748]
Richard Laager <rlaager@pidgin.im>
parents:
11292
diff
changeset
|
498 | * and @c finalize (for a total of 3 functions). |
| 10566 | 499 | * |
| 500 | * @return The new logger | |
| 501 | */ | |
| 15884 | 502 | 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
|
503 | |
| 10566 | 504 | /** |
| 505 | * Frees a logger | |
| 506 | * | |
| 507 | * @param logger The logger to free | |
| 508 | */ | |
| 15884 | 509 | void purple_log_logger_free(PurpleLogLogger *logger); |
| 7440 | 510 | |
| 10566 | 511 | /** |
| 512 | * Adds a new logger | |
| 513 | * | |
| 514 | * @param logger The new logger to add | |
| 515 | */ | |
| 15884 | 516 | void purple_log_logger_add (PurpleLogLogger *logger); |
| 7431 | 517 | |
| 10566 | 518 | /** |
| 519 | * | |
| 520 | * Removes a logger | |
| 521 | * | |
| 522 | * @param logger The logger to remove | |
| 523 | */ | |
| 15884 | 524 | void purple_log_logger_remove (PurpleLogLogger *logger); |
| 7431 | 525 | |
| 10566 | 526 | /** |
| 527 | * | |
| 528 | * Sets the current logger | |
| 529 | * | |
| 530 | * @param logger The logger to set | |
| 531 | */ | |
| 15884 | 532 | void purple_log_logger_set (PurpleLogLogger *logger); |
| 7440 | 533 | |
| 10566 | 534 | /** |
| 535 | * | |
| 536 | * Returns the current logger | |
| 537 | * | |
| 538 | * @return logger The current logger | |
| 539 | */ | |
| 15884 | 540 | PurpleLogLogger *purple_log_logger_get (void); |
| 7440 | 541 | |
| 10566 | 542 | /** |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
543 | * Returns a GList containing the IDs and names of the registered |
| 10566 | 544 | * loggers. |
| 545 | * | |
| 546 | * @return The list of IDs and names. | |
| 547 | */ | |
| 15884 | 548 | GList *purple_log_logger_get_options(void); |
| 7431 | 549 | |
|
12737
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
550 | /**************************************************************************/ |
|
12835
edc2ec6ae9f3
[gaim-migrate @ 15183]
Richard Laager <rlaager@pidgin.im>
parents:
12737
diff
changeset
|
551 | /** @name Log Subsystem */ |
|
12737
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 | /*@{*/ |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
554 | |
|
11025
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
555 | /** |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
556 | * Initializes the log subsystem. |
|
41b6449f7dff
[gaim-migrate @ 12899]
Richard Laager <rlaager@pidgin.im>
parents:
10822
diff
changeset
|
557 | */ |
| 15884 | 558 | void purple_log_init(void); |
|
12737
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 | /** |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
561 | * Returns the log subsystem handle. |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
562 | * |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
563 | * @return The log subsystem handle. |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
564 | */ |
| 15884 | 565 | void *purple_log_get_handle(void); |
|
12737
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
566 | |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
567 | /** |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
568 | * Uninitializes the log subsystem. |
|
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
569 | */ |
| 15884 | 570 | void purple_log_uninit(void); |
|
12737
e1300804318e
[gaim-migrate @ 15082]
Richard Laager <rlaager@pidgin.im>
parents:
11503
diff
changeset
|
571 | |
| 10566 | 572 | /*@}*/ |
| 7431 | 573 | |
| 5872 | 574 | |
|
32787
7072f190d6ad
Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32604
diff
changeset
|
575 | G_END_DECLS |
| 7440 | 576 | |
| 15884 | 577 | #endif /* _PURPLE_LOG_H_ */ |