| 751 |
751 |
| 752 static char *log_get_timestamp(PurpleLog *log, time_t when) |
752 static char *log_get_timestamp(PurpleLog *log, time_t when) |
| 753 { |
753 { |
| 754 gboolean show_date; |
754 gboolean show_date; |
| 755 char *date; |
755 char *date; |
| 756 struct tm tm; |
756 struct tm *tm; |
| 757 |
757 |
| 758 show_date = (log->type == PURPLE_LOG_SYSTEM) || (time(NULL) > when + 20*60); |
758 show_date = (log->type == PURPLE_LOG_SYSTEM) || (time(NULL) > when + 20*60); |
| 759 |
759 |
| 760 date = purple_signal_emit_return_1(purple_log_get_handle(), |
760 date = purple_signal_emit_return_1(purple_log_get_handle(), |
| 761 "log-timestamp", |
761 "log-timestamp", |
| 762 log, when, show_date); |
762 log, when, show_date); |
| 763 if (date != NULL) |
763 if (date != NULL) |
| 764 return date; |
764 return date; |
| 765 |
765 |
| 766 tm = *(localtime(&when)); |
766 tm = localtime(&when); |
| 767 if (show_date) |
767 if (show_date) |
| 768 return g_strdup(purple_date_format_long(&tm)); |
768 return g_strdup(purple_date_format_long(tm)); |
| 769 else |
769 else |
| 770 return g_strdup(purple_time_format(&tm)); |
770 return g_strdup(purple_time_format(tm)); |
| 771 } |
771 } |
| 772 |
772 |
| 773 /* NOTE: This can return msg (which you may or may not want to g_free()) |
773 /* NOTE: This can return msg (which you may or may not want to g_free()) |
| 774 * NOTE: or a newly allocated string which you MUST g_free(). */ |
774 * NOTE: or a newly allocated string which you MUST g_free(). */ |
| 775 static char * |
775 static char * |