Mercurial > pidgin.yaz
changeset 12692:4da7062a06c2
[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 <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 03 Jan 2006 06:33:00 +0000 |
parents | 4e1d44bad3c4 |
children | 07d6cc1b5a98 |
files | src/gtkprefs.c src/log.c |
diffstat | 2 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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, "<message %s %s from='%s' time='%s'>%s</message>\n", @@ -893,7 +898,11 @@ strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&time)); fprintf(data->file, "---- %s @ %s ----<br/>\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, "<font size=\"2\">(%s)</font><b> %s</b><br/>\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) {