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