/soc/2012/sanket/statscollector-2.x.y: ed0fb2431b17: Use purple_...

Sanket Agarwal sanket at soc.pidgin.im
Mon Aug 20 05:26:52 EDT 2012


Changeset: ed0fb2431b17d2fc6dcb055ae4509d5f72763d43
Author:	 Sanket Agarwal <sanket at soc.pidgin.im>
Date:	 2012-08-20 02:26 +0530
Branch:	 soc.2012.statscollector
URL: http://hg.pidgin.im/soc/2012/sanket/statscollector-2.x.y/rev/ed0fb2431b17

Description:

Use purple_date_format_long for displaying date/time

diffstat:

 libpurple/plugins/statscollector.c |  16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diffs (41 lines):

diff --git a/libpurple/plugins/statscollector.c b/libpurple/plugins/statscollector.c
--- a/libpurple/plugins/statscollector.c
+++ b/libpurple/plugins/statscollector.c
@@ -82,15 +82,6 @@ static gboolean plugin_unload(PurplePlug
 static gboolean refresh_trusted_cache(gpointer data);
 static xmlnode *init_stats();
 
-static char *
-epoch_to_str(time_t epoch){
-  struct tm  ts;
-  char  *buf= g_new0(char, 80);
-  ts = *localtime(&epoch); // Best effort estimation.
-  strftime(buf, 80, "%a %Y-%m-%d %H:%M:%S %Z", &ts);
-  return buf;
-}
-
 static void
 confirm_allow(){
 
@@ -1298,6 +1289,8 @@ get_plugin_pref_frame(PurplePlugin *plug
 	PurplePluginPrefFrame *frame;
 	PurplePluginPref *pref, *ts;
     char *ts_str;
+    struct tm  *_ts;
+    time_t epoch;
 
 	frame = purple_plugin_pref_frame_new();
 
@@ -1312,9 +1305,10 @@ get_plugin_pref_frame(PurplePlugin *plug
 	purple_plugin_pref_frame_add(frame, pref);
 
     /* Last updated time of sending stats */
+    epoch= purple_prefs_get_int("/plugins/core/statscollector/last-sent");
+    _ts = localtime(&epoch); // Best effort estimation.
     ts_str = g_strdup_printf("Last time of stats update: %s",\
-      epoch_to_str(purple_prefs_get_int\
-        ("/plugins/core/statscollector/last-sent")));
+        purple_date_format_long(_ts));
     ts = purple_plugin_pref_new_with_label(ts_str);
     purple_plugin_pref_set_type(ts, PURPLE_PLUGIN_PREF_INFO);
     purple_plugin_pref_frame_add(frame, ts);



More information about the Commits mailing list