Mercurial > pidgin.yaz
diff plugins/timestamp_format.c @ 13987:f94309c7c480
[gaim-migrate @ 16559]
Change the log-timestamp and conversation-timestamp signals to pass around a time_t instead of a struct tm. Most of this changeset is Ethan's work.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 24 Jul 2006 05:08:30 +0000 |
parents | c73c7dd0721f |
children |
line wrap: on
line diff
--- a/plugins/timestamp_format.c Mon Jul 24 04:27:42 2006 +0000 +++ b/plugins/timestamp_format.c Mon Jul 24 05:08:30 2006 +0000 @@ -52,18 +52,18 @@ } static char *timestamp_cb_common(GaimConversation *conv, - const struct tm *tm, + time_t t, gboolean force, const char *dates) { + struct tm *tm = localtime(&t); g_return_val_if_fail(conv != NULL, NULL); - g_return_val_if_fail(tm != NULL, NULL); g_return_val_if_fail(dates != NULL, NULL); if (!strcmp(dates, "always") || (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT && !strcmp(dates, "chats")) || - (time(NULL) > (mktime((struct tm *)tm) + 20*60))) + (time(NULL) > (mktime(tm) + 20*60))) { if (force) return g_strdup(gaim_utf8_strftime("%Y-%m-%d %H:%M:%S", tm)); @@ -78,7 +78,7 @@ } static char *conversation_timestamp_cb(GaimConversation *conv, - const struct tm *tm, gpointer data) + time_t t, gpointer data) { gboolean force = gaim_prefs_get_bool( "/plugins/gtk/timestamp_format/force_24hr"); @@ -86,13 +86,11 @@ "/plugins/gtk/timestamp_format/use_dates/conversation"); g_return_val_if_fail(conv != NULL, NULL); - g_return_val_if_fail(tm != NULL, NULL); - return timestamp_cb_common(conv, tm, force, dates); + return timestamp_cb_common(conv, t, force, dates); } -static char *log_timestamp_cb(GaimLog *log, - const struct tm *tm, gpointer data) +static char *log_timestamp_cb(GaimLog *log, time_t t, gpointer data) { gboolean force = gaim_prefs_get_bool( "/plugins/gtk/timestamp_format/force_24hr"); @@ -100,17 +98,18 @@ "/plugins/gtk/timestamp_format/use_dates/log"); g_return_val_if_fail(log != NULL, NULL); - g_return_val_if_fail(tm != NULL, NULL); if (log->type == GAIM_LOG_SYSTEM) { - if (force) + if (force) { + struct tm *tm = localtime(&t); return g_strdup(gaim_utf8_strftime("%Y-%m-%d %H:%M:%S", tm)); - else + } else { return NULL; + } } - return timestamp_cb_common(log->conv, tm, force, dates); + return timestamp_cb_common(log->conv, t, force, dates); } static gboolean