libpurple/log.h

changeset 15884
4de1981757fc
parent 15584
f4d9ac6f94b8
child 16116
bccaa68c86ad
--- a/libpurple/log.h	Mon Mar 19 06:11:46 2007 +0000
+++ b/libpurple/log.h	Mon Mar 19 07:01:17 2007 +0000
@@ -2,9 +2,9 @@
  * @file log.h Logging API
  * @ingroup core
  *
- * gaim
+ * purple
  *
- * Gaim is the legal property of its developers, whose names are too numerous
+ * Purple is the legal property of its developers, whose names are too numerous
  * to list here.  Please refer to the COPYRIGHT file distributed with this
  * source distribution.
  *
@@ -22,8 +22,8 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifndef _GAIM_LOG_H_
-#define _GAIM_LOG_H_
+#ifndef _PURPLE_LOG_H_
+#define _PURPLE_LOG_H_
 
 #include <stdio.h>
 
@@ -32,98 +32,98 @@
  * DATA STRUCTURES **************************************
  ********************************************************/
 
-typedef struct _GaimLog GaimLog;
-typedef struct _GaimLogLogger GaimLogLogger;
-typedef struct _GaimLogCommonLoggerData GaimLogCommonLoggerData;
-typedef struct _GaimLogSet GaimLogSet;
+typedef struct _PurpleLog PurpleLog;
+typedef struct _PurpleLogLogger PurpleLogLogger;
+typedef struct _PurpleLogCommonLoggerData PurpleLogCommonLoggerData;
+typedef struct _PurpleLogSet PurpleLogSet;
 
 typedef enum {
-	GAIM_LOG_IM,
-	GAIM_LOG_CHAT,
-	GAIM_LOG_SYSTEM
-} GaimLogType;
+	PURPLE_LOG_IM,
+	PURPLE_LOG_CHAT,
+	PURPLE_LOG_SYSTEM
+} PurpleLogType;
 
 typedef enum {
-	GAIM_LOG_READ_NO_NEWLINE = 1
-} GaimLogReadFlags;
+	PURPLE_LOG_READ_NO_NEWLINE = 1
+} PurpleLogReadFlags;
 
 #include "account.h"
 #include "conversation.h"
 
-typedef void (*GaimLogSetCallback) (GHashTable *sets, GaimLogSet *set);
+typedef void (*PurpleLogSetCallback) (GHashTable *sets, PurpleLogSet *set);
 
 /**
  * A log logger.
  *
- * This struct gets filled out and is included in the GaimLog.  It contains everything
+ * This struct gets filled out and is included in the PurpleLog.  It contains everything
  * needed to write and read from logs.
  */
-struct _GaimLogLogger {
+struct _PurpleLogLogger {
 	char *name;               /**< The logger's name */
 	char *id;                 /**< an identifier to refer to this logger */
 
 	/** This gets called when the log is first created.
 	    I don't think this is actually needed. */
-	void (*create)(GaimLog *log);
+	void (*create)(PurpleLog *log);
 
 	/** This is used to write to the log file */
-	gsize (*write)(GaimLog *log,
-		     GaimMessageFlags type,
+	gsize (*write)(PurpleLog *log,
+		     PurpleMessageFlags type,
 		     const char *from,
 		     time_t time,
 		     const char *message);
 
 	/** Called when the log is destroyed */
-	void (*finalize)(GaimLog *log);
+	void (*finalize)(PurpleLog *log);
 
-	/** This function returns a sorted GList of available GaimLogs */
-	GList *(*list)(GaimLogType type, const char *name, GaimAccount *account);
+	/** This function returns a sorted GList of available PurpleLogs */
+	GList *(*list)(PurpleLogType type, const char *name, PurpleAccount *account);
 
 	/** Given one of the logs returned by the logger's list function,
 	 *  this returns the contents of the log in GtkIMHtml markup */
-	char *(*read)(GaimLog *log, GaimLogReadFlags *flags);
+	char *(*read)(PurpleLog *log, PurpleLogReadFlags *flags);
 
 	/** Given one of the logs returned by the logger's list function,
 	 *  this returns the size of the log in bytes */
-	int (*size)(GaimLog *log);
+	int (*size)(PurpleLog *log);
 
 	/** Returns the total size of all the logs. If this is undefined a default
 	 *  implementation is used */
-	int (*total_size)(GaimLogType type, const char *name, GaimAccount *account);
+	int (*total_size)(PurpleLogType type, const char *name, PurpleAccount *account);
 
-	/** This function returns a sorted GList of available system GaimLogs */
-	GList *(*list_syslog)(GaimAccount *account);
+	/** This function returns a sorted GList of available system PurpleLogs */
+	GList *(*list_syslog)(PurpleAccount *account);
 
-	/** Adds GaimLogSets to a GHashTable. By passing the data in the GaimLogSets
-	 *  to list, the caller can get every available GaimLog from the logger.
-	 *  Loggers using gaim_log_common_writer() (or otherwise storing their
+	/** Adds PurpleLogSets to a GHashTable. By passing the data in the PurpleLogSets
+	 *  to list, the caller can get every available PurpleLog from the logger.
+	 *  Loggers using purple_log_common_writer() (or otherwise storing their
 	 *  logs in the same directory structure as the stock loggers) do not
 	 *  need to implement this function.
 	 *
-	 *  Loggers which implement this function must create a GaimLogSet,
-	 *  then call @a cb with @a sets and the newly created GaimLogSet. */
-	void (*get_log_sets)(GaimLogSetCallback cb, GHashTable *sets);
+	 *  Loggers which implement this function must create a PurpleLogSet,
+	 *  then call @a cb with @a sets and the newly created PurpleLogSet. */
+	void (*get_log_sets)(PurpleLogSetCallback cb, GHashTable *sets);
 
 	/* Attempts to delete the specified log, indicating success or failure */
-	gboolean (*delete)(GaimLog *log);
+	gboolean (*delete)(PurpleLog *log);
 
 	/* Tests whether a log is deletable */
-	gboolean (*is_deletable)(GaimLog *log);
+	gboolean (*is_deletable)(PurpleLog *log);
 };
 
 /**
  * A log.  Not the wooden type.
  */
-struct _GaimLog {
-	GaimLogType type;                     /**< The type of log this is */
+struct _PurpleLog {
+	PurpleLogType type;                     /**< The type of log this is */
 	char *name;                           /**< The name of this log */
-	GaimAccount *account;                 /**< The account this log is taking
+	PurpleAccount *account;                 /**< The account this log is taking
 	                                           place on */
-	GaimConversation *conv;               /**< The conversation being logged */
+	PurpleConversation *conv;               /**< The conversation being logged */
 	time_t time;                          /**< The time this conversation
 	                                           started, converted to the local timezone */
 
-	GaimLogLogger *logger;                /**< The logging mechanism this log
+	PurpleLogLogger *logger;                /**< The logging mechanism this log
 	                                           is to use */
 	void *logger_data;                    /**< Data used by the log logger */
 	struct tm *tm;                        /**< The time this conversation
@@ -141,7 +141,7 @@
  * A common logger_data struct containing a file handle and path, as well
  * as a pointer to something else for additional data.
  */
-struct _GaimLogCommonLoggerData {
+struct _PurpleLogCommonLoggerData {
 	char *path;
 	FILE *file;
 	void *extra_data;
@@ -150,13 +150,13 @@
 /**
  * Describes available logs.
  *
- * By passing the elements of this struct to gaim_log_get_logs(), the caller
- * can get all available GaimLogs.
+ * By passing the elements of this struct to purple_log_get_logs(), the caller
+ * can get all available PurpleLogs.
  */
-struct _GaimLogSet {
-	GaimLogType type;                     /**< The type of logs available */
+struct _PurpleLogSet {
+	PurpleLogType type;                     /**< The type of logs available */
 	char *name;                           /**< The name of the logs available */
-	GaimAccount *account;                 /**< The account the available logs
+	PurpleAccount *account;                 /**< The account the available logs
 	                                           took place on. This will be
 	                                           @c NULL if the account no longer
 	                                           exists. (Depending on a
@@ -196,15 +196,15 @@
  *                    if available and if struct tm has the BSD timezone fields.
  * @return            The new log
  */
-GaimLog *gaim_log_new(GaimLogType type, const char *name, GaimAccount *account,
-                      GaimConversation *conv, time_t time, const struct tm *tm);
+PurpleLog *purple_log_new(PurpleLogType type, const char *name, PurpleAccount *account,
+                      PurpleConversation *conv, time_t time, const struct tm *tm);
 
 /**
  * Frees a log
  *
  * @param log         The log to destroy
  */
-void gaim_log_free(GaimLog *log);
+void purple_log_free(PurpleLog *log);
 
 /**
  * Writes to a log file. Assumes you have checked preferences already.
@@ -216,8 +216,8 @@
  * @param time         A timestamp in UNIX time
  * @param message      The message to log
  */
-void gaim_log_write(GaimLog *log,
-		    GaimMessageFlags type,
+void purple_log_write(PurpleLog *log,
+		    PurpleMessageFlags type,
 		    const char *from,
 		    time_t time,
 		    const char *message);
@@ -228,9 +228,9 @@
  * @param log   The log to read from
  * @param flags The returned logging flags.
  *
- * @return The contents of this log in Gaim Markup.
+ * @return The contents of this log in Purple Markup.
  */
-char *gaim_log_read(GaimLog *log, GaimLogReadFlags *flags);
+char *purple_log_read(PurpleLog *log, PurpleLogReadFlags *flags);
 
 /**
  * Returns a list of all available logs
@@ -238,35 +238,35 @@
  * @param type                The type of the log
  * @param name                The name of the log
  * @param account             The account
- * @return                    A sorted list of GaimLogs
+ * @return                    A sorted list of PurpleLogs
  */
-GList *gaim_log_get_logs(GaimLogType type, const char *name, GaimAccount *account);
+GList *purple_log_get_logs(PurpleLogType type, const char *name, PurpleAccount *account);
 
 /**
- * Returns a GHashTable of GaimLogSets.
+ * Returns a GHashTable of PurpleLogSets.
  *
  * A "log set" here means the information necessary to gather the
- * GaimLogs for a given buddy/chat. This information would be passed
- * to gaim_log_list to get a list of GaimLogs.
+ * PurpleLogs for a given buddy/chat. This information would be passed
+ * to purple_log_list to get a list of PurpleLogs.
  *
  * The primary use of this function is to get a list of everyone the
  * user has ever talked to (assuming he or she uses logging).
  *
  * The GHashTable that's returned will free all log sets in it when
- * destroyed. If a GaimLogSet is removed from the GHashTable, it
- * must be freed with gaim_log_set_free().
+ * destroyed. If a PurpleLogSet is removed from the GHashTable, it
+ * must be freed with purple_log_set_free().
  *
- * @return A GHashTable of all available unique GaimLogSets
+ * @return A GHashTable of all available unique PurpleLogSets
  */
-GHashTable *gaim_log_get_log_sets(void);
+GHashTable *purple_log_get_log_sets(void);
 
 /**
  * Returns a list of all available system logs
  *
  * @param account The account
- * @return        A sorted list of GaimLogs
+ * @return        A sorted list of PurpleLogs
  */
-GList *gaim_log_get_system_logs(GaimAccount *account);
+GList *purple_log_get_system_logs(PurpleAccount *account);
 
 /**
  * Returns the size of a log
@@ -274,7 +274,7 @@
  * @param log                 The log
  * @return                    The size of the log, in bytes
  */
-int gaim_log_get_size(GaimLog *log);
+int purple_log_get_size(PurpleLog *log);
 
 /**
  * Returns the size, in bytes, of all available logs in this conversation
@@ -284,19 +284,19 @@
  * @param account             The account
  * @return                    The size in bytes
  */
-int gaim_log_get_total_size(GaimLogType type, const char *name, GaimAccount *account);
+int purple_log_get_total_size(PurpleLogType type, const char *name, PurpleAccount *account);
 
 /**
  * Tests whether a log is deletable
  *
- * A return value of @c FALSE indicates that gaim_log_delete() will fail on this
+ * A return value of @c FALSE indicates that purple_log_delete() will fail on this
  * log, unless something changes between the two calls.  A return value of @c TRUE,
  * however, does not guarantee the log can be deleted.
  *
  * @param log                 The log
  * @return                    A boolean indicating if the log is deletable
  */
-gboolean gaim_log_is_deletable(GaimLog *log);
+gboolean purple_log_is_deletable(PurpleLog *log);
 
 /**
  * Deletes a log
@@ -304,44 +304,44 @@
  * @param log                 The log
  * @return                    A boolean indicating success or failure
  */
-gboolean gaim_log_delete(GaimLog *log);
+gboolean purple_log_delete(PurpleLog *log);
 
 /**
- * Returns the default logger directory Gaim uses for a given account
- * and username.  This would be where Gaim stores logs created by
+ * Returns the default logger directory Purple uses for a given account
+ * and username.  This would be where Purple stores logs created by
  * the built-in text or HTML loggers.
  *
  * @param type                The type of the log.
  * @param name                The name of the log.
  * @param account             The account.
- * @return                    The default logger directory for Gaim.
+ * @return                    The default logger directory for Purple.
  */
-char *gaim_log_get_log_dir(GaimLogType type, const char *name, GaimAccount *account);
+char *purple_log_get_log_dir(PurpleLogType type, const char *name, PurpleAccount *account);
 
 /**
- * Implements GCompareFunc for GaimLogs
+ * Implements GCompareFunc for PurpleLogs
  *
- * @param y                   A GaimLog
- * @param z                   Another GaimLog
+ * @param y                   A PurpleLog
+ * @param z                   Another PurpleLog
  * @return                    A value as specified by GCompareFunc
  */
-gint gaim_log_compare(gconstpointer y, gconstpointer z);
+gint purple_log_compare(gconstpointer y, gconstpointer z);
 
 /**
- * Implements GCompareFunc for GaimLogSets
+ * Implements GCompareFunc for PurpleLogSets
  *
- * @param y                   A GaimLogSet
- * @param z                   Another GaimLogSet
+ * @param y                   A PurpleLogSet
+ * @param z                   Another PurpleLogSet
  * @return                    A value as specified by GCompareFunc
  */
-gint gaim_log_set_compare(gconstpointer y, gconstpointer z);
+gint purple_log_set_compare(gconstpointer y, gconstpointer z);
 
 /**
  * Frees a log set
  *
  * @param set         The log set to destroy
  */
-void gaim_log_set_free(GaimLogSet *set);
+void purple_log_set_free(PurpleLogSet *set);
 
 /*@}*/
 
@@ -351,30 +351,30 @@
 /*@{*/
 
 /**
- * Opens a new log file in the standard Gaim log location
+ * Opens a new log file in the standard Purple log location
  * with the given file extension, named for the current time,
  * for writing.  If a log file is already open, the existing
  * file handle is retained.  The log's logger_data value is
- * set to a GaimLogCommonLoggerData struct containing the log
+ * set to a PurpleLogCommonLoggerData struct containing the log
  * file handle and log path.
  *
  * This function is intended to be used as a "common"
  * implementation of a logger's @c write function.
- * It should only be passed to gaim_log_logger_new() and never
+ * It should only be passed to purple_log_logger_new() and never
  * called directly.
  *
  * @param log   The log to write to.
  * @param ext   The file extension to give to this log file.
  */
-void gaim_log_common_writer(GaimLog *log, const char *ext);
+void purple_log_common_writer(PurpleLog *log, const char *ext);
 
 /**
- * Returns a sorted GList of GaimLogs of the requested type.
+ * Returns a sorted GList of PurpleLogs of the requested type.
  *
  * This function should only be used with logs that are written
- * with gaim_log_common_writer().  It's intended to be used as
+ * with purple_log_common_writer().  It's intended to be used as
  * a "common" implementation of a logger's @c list function.
- * It should only be passed to gaim_log_logger_new() and never
+ * It should only be passed to purple_log_logger_new() and never
  * called directly.
  *
  * @param type     The type of the logs being listed.
@@ -383,20 +383,20 @@
  * @param ext      The file extension this log format uses.
  * @param logger   A reference to the logger struct for this log.
  *
- * @return A sorted GList of GaimLogs matching the parameters.
+ * @return A sorted GList of PurpleLogs matching the parameters.
  */
-GList *gaim_log_common_lister(GaimLogType type, const char *name,
-							  GaimAccount *account, const char *ext,
-							  GaimLogLogger *logger);
+GList *purple_log_common_lister(PurpleLogType type, const char *name,
+							  PurpleAccount *account, const char *ext,
+							  PurpleLogLogger *logger);
 
 /**
  * Returns the total size of all the logs for a given user, with
  * a given extension.
  *
  * This function should only be used with logs that are written
- * with gaim_log_common_writer().  It's intended to be used as
+ * with purple_log_common_writer().  It's intended to be used as
  * a "common" implementation of a logger's @c total_size function.
- * It should only be passed to gaim_log_logger_new() and never
+ * It should only be passed to purple_log_logger_new() and never
  * called directly.
  *
  * @param type     The type of the logs being sized.
@@ -408,53 +408,53 @@
  * @return The size of all the logs with the specified extension
  *         for the specified user.
  */
-int gaim_log_common_total_sizer(GaimLogType type, const char *name,
-								GaimAccount *account, const char *ext);
+int purple_log_common_total_sizer(PurpleLogType type, const char *name,
+								PurpleAccount *account, const char *ext);
 
 /**
- * Returns the size of a given GaimLog.
+ * Returns the size of a given PurpleLog.
  *
  * This function should only be used with logs that are written
- * with gaim_log_common_writer().  It's intended to be used as
+ * with purple_log_common_writer().  It's intended to be used as
  * a "common" implementation of a logger's @c size function.
- * It should only be passed to gaim_log_logger_new() and never
+ * It should only be passed to purple_log_logger_new() and never
  * called directly.
  *
- * @param log      The GaimLog to size.
+ * @param log      The PurpleLog to size.
  *
  * @return An integer indicating the size of the log in bytes.
  */
-int gaim_log_common_sizer(GaimLog *log);
+int purple_log_common_sizer(PurpleLog *log);
 
 /**
  * Deletes a log
  *
  * This function should only be used with logs that are written
- * with gaim_log_common_writer().  It's intended to be used as
+ * with purple_log_common_writer().  It's intended to be used as
  * a "common" implementation of a logger's @c delete function.
- * It should only be passed to gaim_log_logger_new() and never
+ * It should only be passed to purple_log_logger_new() and never
  * called directly.
  *
- * @param log      The GaimLog to delete.
+ * @param log      The PurpleLog to delete.
  *
  * @return A boolean indicating success or failure.
  */
-gboolean gaim_log_common_deleter(GaimLog *log);
+gboolean purple_log_common_deleter(PurpleLog *log);
 
 /**
  * Checks to see if a log is deletable
  *
  * This function should only be used with logs that are written
- * with gaim_log_common_writer().  It's intended to be used as
+ * with purple_log_common_writer().  It's intended to be used as
  * a "common" implementation of a logger's @c is_deletable function.
- * It should only be passed to gaim_log_logger_new() and never
+ * It should only be passed to purple_log_logger_new() and never
  * called directly.
  *
- * @param log      The GaimLog to check.
+ * @param log      The PurpleLog to check.
  *
  * @return A boolean indicating if the log is deletable.
  */
-gboolean gaim_log_common_is_deletable(GaimLog *log);
+gboolean purple_log_common_is_deletable(PurpleLog *log);
 
 /*@}*/
 
@@ -473,7 +473,7 @@
  *                     @c write, @c finalize, @c list, @c read, @c size,
  *                     @c total_size, @c list_syslog, @c get_log_sets,
  *                     @c delete, @c is_deletable.
- *                     For details on these functions, see GaimLogLogger.
+ *                     For details on these functions, see PurpleLogLogger.
  *                     Functions may not be skipped. For example, passing
  *                     @c create and @c write is acceptable (for a total of
  *                     two functions). Passing @c create and @c finalize,
@@ -483,21 +483,21 @@
  *
  * @return The new logger
  */
-GaimLogLogger *gaim_log_logger_new(const char *id, const char *name, int functions, ...);
+PurpleLogLogger *purple_log_logger_new(const char *id, const char *name, int functions, ...);
 
 /**
  * Frees a logger
  *
  * @param logger       The logger to free
  */
-void gaim_log_logger_free(GaimLogLogger *logger);
+void purple_log_logger_free(PurpleLogLogger *logger);
 
 /**
  * Adds a new logger
  *
  * @param logger       The new logger to add
  */
-void gaim_log_logger_add (GaimLogLogger *logger);
+void purple_log_logger_add (PurpleLogLogger *logger);
 
 /**
  *
@@ -505,7 +505,7 @@
  *
  * @param logger       The logger to remove
  */
-void gaim_log_logger_remove (GaimLogLogger *logger);
+void purple_log_logger_remove (PurpleLogLogger *logger);
 
 /**
  *
@@ -513,7 +513,7 @@
  *
  * @param logger       The logger to set
  */
-void gaim_log_logger_set (GaimLogLogger *logger);
+void purple_log_logger_set (PurpleLogLogger *logger);
 
 /**
  *
@@ -521,7 +521,7 @@
  *
  * @return logger      The current logger
  */
-GaimLogLogger *gaim_log_logger_get (void);
+PurpleLogLogger *purple_log_logger_get (void);
 
 /**
  * Returns a GList containing the IDs and names of the registered
@@ -529,7 +529,7 @@
  *
  * @return The list of IDs and names.
  */
-GList *gaim_log_logger_get_options(void);
+GList *purple_log_logger_get_options(void);
 
 /**************************************************************************/
 /** @name Log Subsystem                                                   */
@@ -539,19 +539,19 @@
 /**
  * Initializes the log subsystem.
  */
-void gaim_log_init(void);
+void purple_log_init(void);
 
 /**
  * Returns the log subsystem handle.
  *
  * @return The log subsystem handle.
  */
-void *gaim_log_get_handle(void);
+void *purple_log_get_handle(void);
 
 /**
  * Uninitializes the log subsystem.
  */
-void gaim_log_uninit(void);
+void purple_log_uninit(void);
 
 /*@}*/
 
@@ -560,4 +560,4 @@
 }
 #endif
 
-#endif /* _GAIM_LOG_H_ */
+#endif /* _PURPLE_LOG_H_ */

mercurial