cpw.nader.asynclogging-3: 77bb4c8b: Got gntlog and gntconv compiling properl...
nader.morshed at pidgin.im
nader.morshed at pidgin.im
Fri Jan 14 00:32:00 EST 2011
----------------------------------------------------------------------
Revision: 77bb4c8b032403cbae267c803125da3330346a7e
Parent: ad8a3ab62472e8b65fee2dbde58c5f2981eceaf2
Author: nader.morshed at pidgin.im
Date: 01/05/11 10:26:25
Branch: im.pidgin.cpw.nader.asynclogging-3
URL: http://d.pidgin.im/viewmtn/revision/info/77bb4c8b032403cbae267c803125da3330346a7e
Changelog:
Got gntlog and gntconv compiling properly
Disabled the log_reader plugin when Makefile.am is used
Changes against parent ad8a3ab62472e8b65fee2dbde58c5f2981eceaf2
patched finch/gntconv.c
patched finch/gntlog.c
patched finch/gntlog.h
patched libpurple/plugins/Makefile.am
-------------- next part --------------
============================================================
--- finch/gntconv.c f90604cda09e9264d42bfe6701836f484d439ed1
+++ finch/gntconv.c e2728d65f5751abdc7b02b7452e2388bcb4c3165
@@ -494,7 +494,7 @@ view_log_cb(GntMenuItem *n, gpointer ggc
{
FinchConv *fc;
PurpleConversation *conv;
- PurpleLogType type;
+ PurpleLogChatType chat_type;
const char *name;
PurpleAccount *account;
GSList *buddies;
@@ -504,9 +504,9 @@ view_log_cb(GntMenuItem *n, gpointer ggc
conv = fc->active_conv;
if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
- type = PURPLE_LOG_IM;
+ chat_type = PURPLE_LOG_IM;
else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
- type = PURPLE_LOG_CHAT;
+ chat_type = PURPLE_LOG_CHAT;
else
return;
@@ -525,7 +525,7 @@ view_log_cb(GntMenuItem *n, gpointer ggc
}
g_slist_free(buddies);
- finch_log_show(type, name, account);
+ finch_log_show(chat_type, name, account);
}
static void
============================================================
--- libpurple/plugins/Makefile.am ec52e0928671d24f93561f6d9c8786ec16cc96e6
+++ libpurple/plugins/Makefile.am 625d8bc785924078a2d49c3e38b73f07930fbf6d
@@ -32,7 +32,6 @@ joinpart_la_LDFLAGS = -module -a
helloworld_la_LDFLAGS = -module -avoid-version
idle_la_LDFLAGS = -module -avoid-version
joinpart_la_LDFLAGS = -module -avoid-version
-log_reader_la_LDFLAGS = -module -avoid-version
newline_la_LDFLAGS = -module -avoid-version
notify_example_la_LDFLAGS = -module -avoid-version
offlinemsg_la_LDFLAGS = -module -avoid-version
@@ -53,7 +52,6 @@ plugin_LTLIBRARIES = \
buddynote.la \
idle.la \
joinpart.la \
- log_reader.la \
newline.la \
offlinemsg.la \
psychic.la \
============================================================
--- finch/gntlog.c 210fe522065d96c130eb4dbe22d3f9b399457bb3
+++ finch/gntlog.c 8e04b40f57a836b75c11be686f8183318695c93d
@@ -57,7 +57,7 @@ typedef struct {
GCancellable *search_cancel; /**< A GCancellable to stop any searches */
GCancellable *list_cancel; /**< A GCancellable to stop any folder listings */
- PurpleLogType type; /**< The log type of the window */
+ PurpleLogChatType chat_type; /**< The log type of the window */
} FinchLogViewerEx;
typedef struct {
@@ -72,11 +72,6 @@ typedef struct {
} _finch_log_data;
typedef struct {
- _finch_log_data *log_data;
- PurpleLog *log;
-} _finch_search_callback_data;
-
-typedef struct {
PurpleAccount *account;
PurpleContact *contact;
PurpleLogChatType chat_type;
@@ -202,10 +197,16 @@ log_get_date(PurpleLog *log)
static const gchar *
log_get_date(PurpleLog *log)
{
- if (log->tm)
- return purple_date_format_full(log->tm);
- else
- return purple_date_format_full(localtime(&log->time));
+ const struct tm *tm;
+
+ tm = purple_log_get_tm(log);
+ if (tm != NULL)
+ return purple_date_format_full(tm);
+ else {
+ time_t log_time = purple_log_get_time(log);
+
+ return purple_date_format_full(localtime(&log_time));
+ }
}
static void
@@ -240,13 +241,12 @@ finch_log_search_cb(GObject *object, GAs
static void
finch_log_search_cb(GObject *object, GAsyncResult *res, gpointer userdata)
{
- _finch_search_callback_data *callback_data = userdata;
- _finch_log_data *finch_log_data = callback_data->log_data;
- PurpleLog *log = callback_data->log;
+ _finch_log_data *finch_log_data = userdata;
+ PurpleLog *log = PURPLE_LOG(object);
GError *err = NULL;
gchar *read;
- read = purple_log_read_finish(log, res, &err);
+ read = purple_log_read_finish(log, res, NULL, &err);
finch_log_data->count--;
if (read == NULL) {
@@ -267,14 +267,11 @@ finch_log_search_cb(GObject *object, GAs
if (finch_log_data->count < 1)
finch_log_search_done_cb(finch_log_data);
-
- g_free(callback_data);
}
static void
search_cb(GntWidget *button, FinchLogViewerEx *lv_ex)
{
- _finch_search_callback_data *callback_data;
_finch_log_data *finch_log_data;
FinchLogViewer *lv = lv_ex->lv;
GCancellable *cancel;
@@ -322,19 +319,10 @@ search_cb(GntWidget *button, FinchLogVie
cancel = g_cancellable_new();
finch_log_viewer_ex_set_search_cancel(lv_ex, cancel);
- purple_debug_info("gntlog", "Searching %u logs\n", length);
+ for (logs = lv->logs; logs != NULL; logs = g_list_next(logs))
+ purple_log_read_async(logs->data, G_PRIORITY_DEFAULT_IDLE, cancel,
+ finch_log_search_cb, finch_log_data);
- for (logs = lv->logs; logs != NULL; logs = g_list_next(logs)) {
- PurpleLog *log = logs->data;
-
- callback_data = g_new0(_finch_search_callback_data, 1);
- callback_data->log_data = finch_log_data;
- callback_data->log = log;
-
- purple_log_read_async(log, NULL, G_PRIORITY_DEFAULT_IDLE, cancel,
- finch_log_search_cb, callback_data);
- }
-
g_object_unref(cancel);
}
@@ -343,7 +331,6 @@ destroy_cb(GntWidget *w, log_viewer_hash
{
FinchLogViewerEx *lv_ex = syslog_viewer;
FinchLogViewer *lv;
- GList *list;
if (ht != NULL) {
lv_ex = g_hash_table_lookup(log_viewers, ht);
@@ -357,9 +344,7 @@ destroy_cb(GntWidget *w, log_viewer_hash
lv = lv_ex->lv;
purple_request_close_with_handle(lv);
- for (list = lv->logs; list != NULL; list = g_list_next(list))
- purple_log_free(list->data);
-
+ g_list_foreach(lv->logs, (GFunc) g_object_unref, NULL);
g_list_free(lv->logs);
g_free(lv->search);
@@ -391,12 +376,13 @@ finch_log_read_cb(GObject *object, GAsyn
if (finch_log_data->is_window_open) {
PurpleLog *log = finch_log_data->log;
+ PurpleLogReadFlags flags;
FinchLogViewerEx *lv_ex = finch_log_data->log_viewer;
FinchLogViewer *lv = lv_ex->lv;
GError *err = NULL;
gchar *text, *strip;
- text = purple_log_read_finish(log, res, &err);
+ text = purple_log_read_finish(log, res, &flags, &err);
if (text == NULL) {
if (err->code == G_IO_ERROR_CANCELLED) {
@@ -409,7 +395,7 @@ finch_log_read_cb(GObject *object, GAsyn
text = err->message;
}
- if (!(lv->flags & PURPLE_LOG_READ_NO_NEWLINE)) {
+ if (!(flags & PURPLE_LOG_READ_NO_NEWLINE)) {
gchar *newline = purple_strdup_withhtml(text);
strip = purple_markup_strip_html(newline);
g_free(newline);
@@ -436,6 +422,7 @@ log_select_cb(GntWidget *w, gpointer old
_finch_log_data *finch_log_data;
FinchLogViewer *lv = lv_ex->lv;
PurpleLog *log;
+ PurpleLogChatType chat_type;
GntTree *tree = GNT_TREE(w);
GCancellable *cancel;
@@ -448,15 +435,18 @@ log_select_cb(GntWidget *w, gpointer old
if (log == NULL)
return;
- if (log->type != PURPLE_LOG_SYSTEM) {
+ chat_type = purple_log_get_chat_type(log);
+
+ if (chat_type != PURPLE_LOG_SYSTEM) {
+ const gchar *name = purple_log_get_name(log);
gchar *title;
- if (log->type == PURPLE_LOG_CHAT)
+ if (chat_type == PURPLE_LOG_CHAT)
title = g_strdup_printf(_("Conversation in %s on %s"),
- log->name, log_get_date(log));
+ name, log_get_date(log));
else
title = g_strdup_printf(_("Conversation with %s on %s"),
- log->name, log_get_date(log));
+ name, log_get_date(log));
gnt_label_set_text(GNT_LABEL(lv->label), title);
g_free(title);
@@ -472,7 +462,7 @@ log_select_cb(GntWidget *w, gpointer old
cancel = g_cancellable_new();
finch_log_viewer_ex_set_read_cancel(lv_ex, cancel);
- purple_log_read_async(log, &lv->flags, G_PRIORITY_DEFAULT, cancel,
+ purple_log_read_async(log, G_PRIORITY_DEFAULT, cancel,
finch_log_read_cb, finch_log_data);
g_object_unref(cancel);
@@ -496,9 +486,11 @@ populate_log_tree(FinchLogViewerEx *lv_e
for (logs = lv->logs; logs != NULL; logs = g_list_next(logs)) {
PurpleLog *log = logs->data;
+ const struct tm *tm = purple_log_get_tm(log);
+ time_t log_time = purple_log_get_time(log);
pmonth = purple_utf8_strftime(_("%B %Y"),
- log->tm ? log->tm : localtime(&log->time));
+ tm != NULL ? tm : localtime(&log_time));
if (strcmp(pmonth, prev_top_month) != 0) {
month = g_strdup(pmonth);
@@ -534,10 +526,10 @@ display_log_viewer_nonblocking(log_viewe
lv_ex->lv = lv;
if (ht != NULL) {
- lv_ex->type = ht->type;
+ lv_ex->chat_type = ht->chat_type;
g_hash_table_insert(log_viewers, ht, lv_ex);
} else
- lv_ex->type = PURPLE_LOG_SYSTEM;
+ lv_ex->chat_type = PURPLE_LOG_SYSTEM;
/* Window ***********/
lv->window = gnt_vwindow_new(FALSE);
@@ -623,15 +615,15 @@ finch_log_done_cb(_finch_log_data *finch
/* No logs were found. */
const gchar *log_preferences = NULL;
- if (lv_ex->type == PURPLE_LOG_SYSTEM) {
+ if (lv_ex->chat_type == PURPLE_LOG_SYSTEM) {
if (!purple_prefs_get_bool("/purple/logging/log_system"))
log_preferences = _("System events will only be logged if the \"Log all status changes to system log\""
"preference is enabled.");
- } else if (lv_ex->type == PURPLE_LOG_IM) {
+ } else if (lv_ex->chat_type == PURPLE_LOG_IM) {
if (!purple_prefs_get_bool("/purple/logging/log_ims"))
log_preferences = _("Instant messages will only be logged if the \"Log all instant messages\""
"preference is enabled.");
- } else if (lv_ex->type == PURPLE_LOG_CHAT) {
+ } else if (lv_ex->chat_type == PURPLE_LOG_CHAT) {
if (!purple_prefs_get_bool("/purple/logging/log_chats"))
log_preferences = _("Chats will only be logged if the \"Log all chats\" preference is enabled.");
}
@@ -680,7 +672,7 @@ finch_log_size_cb(GObject *object, GAsyn
GError *err = NULL;
gssize log_size;
- log_size = purple_log_get_total_size_finish(res, &err);
+ log_size = purple_logs_get_total_size_finish(res, &err);
finch_log_data->count--;
if (log_size < 0) {
@@ -719,7 +711,7 @@ finch_log_list_cb(GObject *object, GAsyn
GError *err = NULL;
GList *list;
- list = purple_log_get_logs_finish(res, &err);
+ list = purple_logs_get_logs_finish(res, &err);
finch_log_data->count--;
if (list == NULL) {
@@ -750,7 +742,7 @@ finch_log_system_list_cb(GObject *object
GError *err = NULL;
GList *list;
- list = purple_log_get_system_logs_finish(res, &err);
+ list = purple_logs_get_system_logs_finish(res, &err);
finch_log_data->count--;
if (list == NULL) {
@@ -781,7 +773,7 @@ finch_log_sets_cb(GObject *object, GAsyn
GError *err = NULL;
GHashTable *table;
- table = purple_log_get_log_sets_finish(res, &err);
+ table = purple_logs_get_log_sets_finish(res, &err);
if (table == NULL) {
if (err != NULL && err->code != G_IO_ERROR_CANCELLED)
@@ -807,9 +799,9 @@ finch_log_sets_cb(GObject *object, GAsyn
finch_log_data->count = (finch_log_data->total += 2);
- purple_log_get_logs_async(PURPLE_LOG_IM, set->name, set->account,
+ purple_logs_get_logs_async(PURPLE_LOG_IM, set->name, set->account,
G_PRIORITY_DEFAULT, lv_ex->list_cancel, finch_log_list_cb, finch_log_data);
- purple_log_get_total_size_async(PURPLE_LOG_IM, set->name, set->account,
+ purple_logs_get_total_size_async(PURPLE_LOG_IM, set->name, set->account,
G_PRIORITY_DEFAULT, lv_ex->list_cancel, finch_log_size_cb, finch_log_data);
}
}
@@ -854,7 +846,7 @@ finch_log_show(PurpleLogChatType chat_ty
return;
}
- if (type == PURPLE_LOG_CHAT) {
+ if (chat_type == PURPLE_LOG_CHAT) {
PurpleChat *chat = purple_blist_find_chat(account, username);
if (chat != NULL)
@@ -975,9 +967,9 @@ finch_log_show_contact(PurpleContact *co
name = purple_buddy_get_name(PURPLE_BUDDY(child));
account = purple_buddy_get_account(PURPLE_BUDDY(child));
- purple_log_get_logs_async(PURPLE_LOG_IM, name, account,
+ purple_logs_get_logs_async(PURPLE_LOG_IM, name, account,
G_PRIORITY_DEFAULT, cancel, finch_log_list_cb, finch_log_data);
- purple_log_get_total_size_async(PURPLE_LOG_IM, name, account,
+ purple_logs_get_total_size_async(PURPLE_LOG_IM, name, account,
G_PRIORITY_DEFAULT, cancel, finch_log_size_cb, finch_log_data);
}
@@ -1018,7 +1010,7 @@ finch_syslog_show(void)
finch_log_data->count = finch_log_data->total++;
- purple_log_get_system_logs_async(account,
+ purple_logs_get_system_logs_async(account,
G_PRIORITY_DEFAULT, cancel, finch_log_system_list_cb, finch_log_data);
}
============================================================
--- finch/gntlog.h 93c1a036b3b32630a8902d4c867abc96d2da8436
+++ finch/gntlog.h 8e28b625b4642455c76a3e114852718779abcf67
@@ -49,7 +49,6 @@ struct _FinchLogViewer {
GntWidget *entry; /**< The search entry, in which search terms
* are entered */
GntWidget *label; /**< The label widget with the title */
- PurpleLogReadFlags flags; /**< The most recently used log flags */
gchar *search; /**< The string currently being searched for */
};
More information about the Commits
mailing list