# HG changeset patch # User Richard Laager # Date 1136269980 0 # Node ID 4da7062a06c27f3da585973072cd342d2944b80f # Parent 4e1d44bad3c430218b60688def313753a02a37fc [gaim-migrate @ 15035] SF Patch #1277888 from Douglas Thrift I modified this a bit, but the end result is: This patch adds a logging preference that defaults to off. When enabled, the date is included in messages' timestamps in logs (in addition to the time). This can be useful if you leave conversations open for days (for me, that's chats). The original patch had this affect timestamps in the conversation window as well, but I didn't like that. I figured it probably wasn't necessary, and I was dreading adding another conversation pref. I welcome feedback on this issue. committer: Tailor Script diff -r 4e1d44bad3c4 -r 4da7062a06c2 src/gtkprefs.c --- a/src/gtkprefs.c Tue Jan 03 05:56:22 2006 +0000 +++ b/src/gtkprefs.c Tue Jan 03 06:33:00 2006 +0000 @@ -1296,6 +1296,9 @@ gaim_gtk_prefs_checkbox(_("Log all _status changes to system log"), "/core/logging/log_system", vbox); + gaim_gtk_prefs_checkbox(_("Include _date in timestamps"), + "/core/logging/include_date_timestamps", vbox); + gtk_widget_show_all(ret); return ret; diff -r 4e1d44bad3c4 -r 4da7062a06c2 src/log.c --- a/src/log.c Tue Jan 03 05:56:22 2006 +0000 +++ b/src/log.c Tue Jan 03 06:33:00 2006 +0000 @@ -493,6 +493,7 @@ gaim_prefs_add_bool("/core/logging/log_system", FALSE); gaim_prefs_add_string("/core/logging/format", "txt"); + gaim_prefs_add_bool("/core/logging/include_date_timestamps", FALSE); html_logger = gaim_log_logger_new("html", _("HTML"), 8, NULL, @@ -803,7 +804,11 @@ if(!data->file) return; - strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); + if (gaim_prefs_get_bool("/core/logging/include_date_timestamps")) + strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&time)); + else + strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); + gaim_markup_html_to_xhtml(message, &xhtml, NULL); if (from) fprintf(log->logger_data, "%s\n", @@ -893,7 +898,11 @@ strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&time)); fprintf(data->file, "---- %s @ %s ----
\n", msg_fixed, date); } else { - strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); + if (gaim_prefs_get_bool("/core/logging/include_date_timestamps")) + strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&time)); + else + strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); + if (type & GAIM_MESSAGE_SYSTEM) fprintf(data->file, "(%s) %s
\n", date, msg_fixed); else if (type & GAIM_MESSAGE_WHISPER) @@ -1012,7 +1021,11 @@ strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&time)); fprintf(data->file, "---- %s @ %s ----\n", stripped, date); } else { - strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); + if (gaim_prefs_get_bool("/core/logging/include_date_timestamps")) + strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&time)); + else + strftime(date, sizeof(date), "%H:%M:%S", localtime(&time)); + if (type & GAIM_MESSAGE_SEND || type & GAIM_MESSAGE_RECV) { if (type & GAIM_MESSAGE_AUTO_RESP) {