cpw.nader.asynclogging-3: 09900a6e: Removed a number of the unnecessary purp...
morshed.nader at gmail.com
morshed.nader at gmail.com
Mon May 30 02:15:54 EDT 2011
----------------------------------------------------------------------
Revision: 09900a6ec8f3a5946d48fbdaca1b7566ce5a5b60
Parent: 34c3d21a9d7787508d1d963dd3fccc734b30a4e4
Author: morshed.nader at gmail.com
Date: 05/30/11 02:10:33
Branch: im.pidgin.cpw.nader.asynclogging-3
URL: http://d.pidgin.im/viewmtn/revision/info/09900a6ec8f3a5946d48fbdaca1b7566ce5a5b60
Changelog:
Removed a number of the unnecessary purple_*_log_new functions as they cluttered the code and were not useful, use purple_log_new instead for creating logs
Added documentation to commonlog.h
Fixed small issues with writing whitespace in txtlog.c
Changes against parent 34c3d21a9d7787508d1d963dd3fccc734b30a4e4
patched libpurple/commonlog.c
patched libpurple/commonlog.h
patched libpurple/htmllog.c
patched libpurple/htmllog.h
patched libpurple/log.h
patched libpurple/oldlog.c
patched libpurple/oldlog.h
patched libpurple/txtlog.c
patched libpurple/txtlog.h
-------------- next part --------------
============================================================
--- libpurple/log.h 0e50e86f6cde6fba595b05c623e510bdae0bfb39
+++ libpurple/log.h 456afd18e26ddbce407f92f980245830fb29a0cf
@@ -51,11 +51,11 @@ G_BEGIN_DECLS
#define PURPLE_IS_LOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), PURPLE_TYPE_LOG))
#define PURPLE_LOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), PURPLE_TYPE_LOG, PurpleLogClass))
-// Would rather have this generated by glib-mkenums
+/* XXX: Would rather have this generated by glib-mkenums */
#define PURPLE_TYPE_LOG_CHAT_TYPE (purple_log_chat_type_get_type())
GType purple_log_chat_type_get_type(void);
-// To be used until PurpleLog changes to using a GDateTime
+/* XXX: To be used until PurpleLog changes to using a GDateTime */
#define PURPLE_TYPE_STRUCT_TM (purple_struct_tm_get_type())
GType purple_struct_tm_get_type(void);
@@ -272,7 +272,7 @@ struct _PurpleLogClass {
void (*_purple_reserved4)(void);
};
-//GObjectify this?
+/* XXX: GObjectify this? */
/**
* Describes available logs.
*
============================================================
--- libpurple/htmllog.c 1f14a0da492abe94e4839454b02c02c2628b547b
+++ libpurple/htmllog.c 1fbac63c0f554d97bebf54aeac75b35db3ed65ed
@@ -66,15 +66,6 @@ purple_html_log_init(PurpleHtmlLog *html
{
}
-PurpleLog *
-purple_html_log_new(PurpleLogChatType type, const gchar *name,
- PurpleAccount *account, PurpleConversation *conv, time_t time,
- const struct tm *tm)
-{
- return purple_common_log_new(PURPLE_TYPE_HTML_LOG, type, name, account,
- conv, time, tm);
-}
-
static gboolean
purple_html_log_create(PurpleLog *log, GCancellable *cancellable,
GError **error)
============================================================
--- libpurple/htmllog.h 23547a5079e241a1d05fb256516bca65b2f57932
+++ libpurple/htmllog.h 36e36ec777c4de014baccedbdc6c0c2e122f31fa
@@ -59,10 +59,6 @@ GType purple_html_log_get_type(void);
GType purple_html_log_get_type(void);
-PurpleLog *purple_html_log_new(PurpleLogChatType chat_type, const gchar *name,
- PurpleAccount *account, PurpleConversation *conv, time_t time,
- const struct tm *tm);
-
void purple_html_log_system_init(void);
void purple_html_log_system_uninit(void);
============================================================
--- libpurple/oldlog.c 81c5ce3da6157d4ac806dff2ea825b999e1c8cef
+++ libpurple/oldlog.c 1a6f067668c9f88e2ca0808b3bd7c7fdc4b07d5d
@@ -63,15 +63,6 @@ purple_old_log_init(PurpleOldLog *old_lo
{
}
-PurpleLog *
-purple_old_log_new(PurpleLogChatType type, const gchar *name,
- PurpleAccount *account, PurpleConversation *conv, time_t time,
- const struct tm *tm)
-{
- return purple_common_log_new(PURPLE_TYPE_OLD_LOG, type, name, account, conv,
- time, tm);
-}
-
/* XXX: Needs testing!!! */
static GList *
purple_old_log_list(PurpleLog *log, PurpleLogChatType chat_type,
@@ -173,7 +164,7 @@ purple_old_log_list(PurpleLog *log, Purp
{
PurpleLog *log;
- log = purple_old_log_new(PURPLE_LOG_IM,
+ log = purple_log_new(PURPLE_TYPE_OLD_LOG, PURPLE_LOG_IM,
sn, account, NULL, idx_time, NULL);
purple_common_log_set_file(PURPLE_COMMON_LOG(log), file);
============================================================
--- libpurple/oldlog.h e5f8c4503b340d6c2ee2bf53f6960f5d419235e1
+++ libpurple/oldlog.h 0707dad69972f2f10e4fe4371ab32978ddeffb43
@@ -59,10 +59,6 @@ GType purple_old_log_get_type(void);
GType purple_old_log_get_type(void);
-PurpleLog *purple_old_log_new(PurpleLogChatType chat_type, const gchar *name,
- PurpleAccount *account, PurpleConversation *conv, time_t time,
- const struct tm *tm);
-
void purple_old_log_system_init(void);
void purple_old_log_system_uninit(void);
============================================================
--- libpurple/txtlog.c f4aebbe439e03d22587938810780d44e6fbaac5a
+++ libpurple/txtlog.c b183991bb8e128dd52281a97c75076e613f77119
@@ -61,15 +61,6 @@ purple_txt_log_init(PurpleTxtLog *txt_lo
{
}
-PurpleLog *
-purple_txt_log_new(PurpleLogChatType type, const gchar *name,
- PurpleAccount *account, PurpleConversation *conv, time_t time,
- const struct tm *tm)
-{
- return purple_common_log_new(PURPLE_TYPE_TXT_LOG, type, name, account, conv,
- time, tm);
-}
-
static gboolean
purple_txt_log_create(PurpleLog *log, GCancellable *cancellable, GError **error)
{
@@ -190,10 +181,10 @@ purple_txt_log_write(PurpleLog *log, Pur
type & PURPLE_MESSAGE_RAW)
line = g_strdup_printf("(%s) %s\n", date, stripped);
else if (type & PURPLE_MESSAGE_WHISPER)
- line = g_strdup_printf("(%s) *%s* %s", date, from, stripped);
+ line = g_strdup_printf("(%s) *%s* %s\n", date, from, stripped);
else
- line = g_strdup_printf("(%s) %s%s %s\n", date, from ? from : "",
- from ? ":" : "", stripped);
+ line = g_strdup_printf("(%s) %s%s%s\n", date, from ? from : "",
+ from ? ": " : "", stripped);
}
success = g_output_stream_write_all(out_stream, line, strlen(line),
============================================================
--- libpurple/txtlog.h 361d125532b2df3906360de9d94dcfaa0bd71465
+++ libpurple/txtlog.h d808d3d4f4e7b2a46ad2272d6b2c99cd9676b068
@@ -59,10 +59,6 @@ GType purple_txt_log_get_type(void);
GType purple_txt_log_get_type(void);
-PurpleLog *purple_txt_log_new(PurpleLogChatType chat_type, const gchar *name,
- PurpleAccount *account, PurpleConversation *conv, time_t time,
- const struct tm *tm);
-
void purple_txt_log_system_init(void);
void purple_txt_log_system_uninit(void);
============================================================
--- libpurple/commonlog.c 3d79b910d1de7e94aa0936b575a4f27dadf379bd
+++ libpurple/commonlog.c e3887f90da7510c2534f7f48f7beb510876fbd1f
@@ -133,14 +133,6 @@ purple_common_log_init(PurpleCommonLog *
priv->length = -1;
}
-PurpleLog *
-purple_common_log_new(GType log_type, PurpleLogChatType type, const gchar *name,
- PurpleAccount *account, PurpleConversation *conv, time_t time,
- const struct tm *tm)
-{
- return purple_log_new(log_type, type, name, account, conv, time, tm);
-}
-
static void
purple_common_log_set_property(GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
============================================================
--- libpurple/commonlog.h 41be5fcdcd16dc0a1f1bd5662858e4fcc2ef20ad
+++ libpurple/commonlog.h fca243affd56e937745880cde7bfd22e73a56917
@@ -57,32 +57,66 @@ struct _PurpleCommonLogClass {
void (*_purple_reserved4)(void);
};
-//
-GType purple_common_log_get_type(void);
-//
-PurpleLog *purple_common_log_new(GType log_type, PurpleLogChatType chat_type,
- const gchar *name, PurpleAccount *account, PurpleConversation *conv,
- time_t time, const struct tm *tm);
+GType purple_common_log_get_type(void);
-
/******************************************/
/** @name Common Logger Functions */
/******************************************/
/*@{*/
-//
+/**
+ * Sets a log's file location
+ *
+ * @param common_log The log
+ * @param file The log's file
+ */
void purple_common_log_set_file(PurpleCommonLog *common_log, GFile *file);
-//
+
+/**
+ * Sets a log's offset, useful for storing multiple logs in one file.
+ *
+ * @param common_log The log
+ * @param offset The log's offset
+ */
void purple_common_log_set_offset(PurpleCommonLog *common_log, gssize offset);
-//
+
+/**
+ * Sets a log's size (Not necessary its file size), useful for storing multiple
+ * logs in one file.
+ *
+ * @param common_log The log
+ * @param length The log's size
+ */
void purple_common_log_set_length(PurpleCommonLog *common_log, gssize length);
-//
+
+/**
+ * Gets the log's file which contains its path and can be used for I/O
+ * interaction, depending on its location
+ *
+ * @param commmon_log The log
+ *
+ * @return The log's file
+ */
GFile *purple_common_log_get_file(PurpleCommonLog *common_log);
-//
+
+/**
+ * Gets the log's offset within its file, if available
+ *
+ * @param common_log The log
+ *
+ * @return The log's offset
+ */
gssize purple_common_log_get_offset(PurpleCommonLog *common_log);
-//
+
+/**
+ * Gets the log's size (Not necessary its file size)
+ *
+ * @param common_log The log
+ *
+ * @return The log's size
+ */
gssize purple_common_log_get_length(PurpleCommonLog *common_log);
/**
More information about the Commits
mailing list