comparison src/log.h @ 7440:8c0527c91a92

[gaim-migrate @ 8045] this is all more better, but i forget what it all is. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 05 Nov 2003 23:43:53 +0000
parents 643cbc9a6035
children 702fbd2460d7
comparison
equal deleted inserted replaced
7439:3a51b301a805 7440:8c0527c91a92
3 * @ingroup core 3 * @ingroup core
4 * 4 *
5 * gaim 5 * gaim
6 * 6 *
7 * Copyright (C) 2003 Douglas E. Egan 7 * Copyright (C) 2003 Douglas E. Egan
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version. 12 * (at your option) any later version.
13 * 13 *
54 * needed to write and read from logs. 54 * needed to write and read from logs.
55 */ 55 */
56 struct _GaimLogLogger { 56 struct _GaimLogLogger {
57 char *name; /**< The logger's name */ 57 char *name; /**< The logger's name */
58 char *id; /**< an identifier to refer to this logger */ 58 char *id; /**< an identifier to refer to this logger */
59 59
60 /** This gets called when the log is first created. 60 /** This gets called when the log is first created.
61 I don't think this is actually needed. */ 61 I don't think this is actually needed. */
62 void(*new)(GaimLog *log); 62 void(*create)(GaimLog *log);
63 63
64 /** This is used to write to the log file */ 64 /** This is used to write to the log file */
65 void(*write)(GaimLog *log, 65 void(*write)(GaimLog *log,
66 GaimMessageFlags type, 66 GaimMessageFlags type,
67 const char *from, 67 const char *from,
68 time_t time, 68 time_t time,
69 const char *message); 69 const char *message);
70 70
71 /** Called when the log is destroyed */ 71 /** Called when the log is destroyed */
72 void (*finalize)(GaimLog *log); 72 void (*finalize)(GaimLog *log);
73 73
74 /** This function returns a sorted GList of available GaimLogs */ 74 /** This function returns a sorted GList of available GaimLogs */
75 GList *(*list)(const char *name, GaimAccount *account); 75 GList *(*list)(const char *name, GaimAccount *account);
76 76
77 /** Given one of the logs returned by the logger's list function, this returns 77 /** Given one of the logs returned by the logger's list function,
78 * the contents of the log in GtkIMHtml markup */ 78 * this returns the contents of the log in GtkIMHtml markup */
79 char *(*read)(GaimLog *log, GaimLogReadFlags *flags); 79 char *(*read)(GaimLog *log, GaimLogReadFlags *flags);
80 }; 80 };
81 81
82 /** 82 /**
83 * A log. Not the wooden type. 83 * A log. Not the wooden type.
84 */ 84 */
85 struct _GaimLog { 85 struct _GaimLog {
86 GaimLogType type; /**< The type of log this is */ 86 GaimLogType type; /**< The type of log this is */
87
88 char *name; /**< The name of this log */ 87 char *name; /**< The name of this log */
89 GaimAccount *account; /**< The account this log is taking place on */ 88 GaimAccount *account; /**< The account this log is taking
90 time_t time; /**< The time this conversation started */ 89 place on */
91 90 time_t time; /**< The time this conversation
92 GaimLogLogger *logger; /**< The logging mechanism this log is to use */ 91 started */
92 GaimLogLogger *logger; /**< The logging mechanism this log
93 is to use */
93 void *logger_data; /**< Data used by the log logger */ 94 void *logger_data; /**< Data used by the log logger */
94 }; 95 };
95 96
96 97
97 #ifdef __cplusplus 98 #ifdef __cplusplus
99 #endif 100 #endif
100 101
101 /*************************************** 102 /***************************************
102 ** LOG FUNCTIONS ********************** 103 ** LOG FUNCTIONS **********************
103 ***************************************/ 104 ***************************************/
104 105
105 /** 106 /**
106 * Creates a new log 107 * Creates a new log
107 * 108 *
108 * @param type The type of log this is. 109 * @param type The type of log this is.
109 * @param name The name of this conversation (Screenname, chat name, etc.) 110 * @param name The name of this conversation (Screenname, chat name,
111 * etc.)
110 * @param account The account the conversation is occuring on 112 * @param account The account the conversation is occuring on
111 * @param time The time this conversation started 113 * @param time The time this conversation started
112 * @return The new log 114 * @return The new log
113 */ 115 */
114 GaimLog *gaim_log_new(GaimLogType type, const char *name, GaimAccount *account, time_t time); 116 GaimLog *gaim_log_new(GaimLogType type, const char *name,
117 GaimAccount *account, time_t time);
115 118
116 /** 119 /**
117 * Frees a log 120 * Frees a log
118 * 121 *
119 * @param log The log to destroy 122 * @param log The log to destroy
120 */ 123 */
121 void gaim_log_free(GaimLog *log); 124 void gaim_log_free(GaimLog *log);
122 125
123 /** 126 /**
124 * Writes to a log file 127 * Writes to a log file
125 * 128 *
126 * @param log The log to write to 129 * @param log The log to write to
127 * @param type The type of message being logged 130 * @param type The type of message being logged
128 * @param from Whom this message is coming from, or NULL for system messages 131 * @param from Whom this message is coming from, or NULL for
132 * system messages
129 * @param time A timestamp in UNIX time 133 * @param time A timestamp in UNIX time
130 * @param message The message to log 134 * @param message The message to log
131 */ 135 */
132 void gaim_log_write(GaimLog *log, 136 void gaim_log_write(GaimLog *log,
133 GaimMessageFlags type, 137 GaimMessageFlags type,
134 const char *from, 138 const char *from,
135 time_t time, 139 time_t time,
136 const char *message); 140 const char *message);
137 141
138 /** 142 /**
139 * Reads from a log 143 * Reads from a log
140 * 144 *
149 * @param name The name of the log 153 * @param name The name of the log
150 * @param account The account 154 * @param account The account
151 * @return A sorted list of GaimLogs 155 * @return A sorted list of GaimLogs
152 */ 156 */
153 GList *gaim_log_get_logs(const char *name, GaimAccount *account); 157 GList *gaim_log_get_logs(const char *name, GaimAccount *account);
154 158
155 159
156 /****************************************** 160 /******************************************
157 ** LOGGER FUNCTIONS ********************** 161 ** LOGGER FUNCTIONS **********************
158 ******************************************/ 162 ******************************************/
159 163
160 /** 164 /**
161 * Creates a new logger 165 * Creates a new logger
162 * 166 *
163 * @param new The logger's new function 167 * @param new The logger's new function
164 * @param write The logger's write function 168 * @param write The logger's write function
165 * @return The new logger 169 * @return The new logger
166 */ 170 */
167 GaimLogLogger *gaim_log_logger_new(void(*new)(GaimLog *), 171 GaimLogLogger *gaim_log_logger_new(void(*create)(GaimLog *),
168 void(*write)(GaimLog *, GaimMessageFlags, 172 void(*write)(GaimLog *, GaimMessageFlags,
169 const char *, time_t, const char *), 173 const char *, time_t, const char *),
170 void(*finalize)(GaimLog *), GList*(*list)(const char*, GaimAccount*), 174 void(*finalize)(GaimLog *),
175 GList*(*list)(const char*, GaimAccount*),
171 char*(*read)(GaimLog*, GaimLogReadFlags*)); 176 char*(*read)(GaimLog*, GaimLogReadFlags*));
172 /** 177 /**
173 * Frees a logger 178 * Frees a logger
174 * 179 *
175 * @param logger The logger to free 180 * @param logger The logger to free
176 */ 181 */
177 void gaim_log_logger_free(GaimLogLogger *logger); 182 void gaim_log_logger_free(GaimLogLogger *logger);
178 183
179 /** 184 /**
180 * Adds a new logger 185 * Adds a new logger
181 * 186 *
182 * @param logger The new logger to add 187 * @param logger The new logger to add
183 */ 188 */
196 * Sets the current logger 201 * Sets the current logger
197 * 202 *
198 * @param logger The logger to set 203 * @param logger The logger to set
199 */ 204 */
200 void gaim_log_logger_set (GaimLogLogger *logger); 205 void gaim_log_logger_set (GaimLogLogger *logger);
201 206
202 /** 207 /**
203 * 208 *
204 * Returns the current logger 209 * Returns the current logger
205 * 210 *
206 * @return logger The current logger 211 * @return logger The current logger
207 */ 212 */
208 GaimLogLogger *gaim_log_logger_get (void); 213 GaimLogLogger *gaim_log_logger_get (void);
209 214
210 /** 215 /**
211 * Returns a GList containing the IDs and Names of the registered log loggers. 216 * Returns a GList containing the IDs and Names of the registered log
217 * loggers.
212 * 218 *
213 * @return The list of IDs and names. 219 * @return The list of IDs and names.
214 */ 220 */
215 GList *gaim_log_logger_get_options(void); 221 GList *gaim_log_logger_get_options(void);
216 222
219 225
220 226
221 #ifdef __cplusplus 227 #ifdef __cplusplus
222 } 228 }
223 #endif 229 #endif
224 230
225 #endif /* _GAIM_LOG_H_ */ 231 #endif /* _GAIM_LOG_H_ */
226 232