comparison libpurple/protocols/jabber/buddy.c @ 25659:481e07d69a10

Format the time as "localtimeformat [+-]HHMM". Iterative development is fun. This shows up, for me, as "Local Time: 10:50:15 PM -0800". Marcus, I figure this bypasses the need to localize 'GMT'. Are there any locales where either the tz offset is always printed (my reading is that this would show up in the conversation window, so I doubt it) or where a tz offset is printed before the time?
author Paul Aurich <paul@darkrain42.org>
date Mon, 09 Feb 2009 07:13:44 +0000
parents b73c79f7490c
children 751df82b78e7
comparison
equal deleted inserted replaced
25658:b73c79f7490c 25659:481e07d69a10
804 } 804 }
805 if (jbr && jbr->tz_off != PURPLE_NO_TZ_OFF) { 805 if (jbr && jbr->tz_off != PURPLE_NO_TZ_OFF) {
806 time_t now_t; 806 time_t now_t;
807 struct tm *now; 807 struct tm *now;
808 char *timestamp; 808 char *timestamp;
809 char *timezone;
810 time(&now_t); 809 time(&now_t);
811 now_t += jbr->tz_off; 810 now_t += jbr->tz_off;
812 now = gmtime(&now_t); 811 now = gmtime(&now_t);
813 812
814 if (jbr->tz_off) 813 timestamp = g_strdup_printf("%s %c%02d%02d", purple_time_format(now),
815 timezone = g_strdup_printf("%02d:%02d", (int)(jbr->tz_off / (60*60)), 814 jbr->tz_off < 0 ? '-' : '+',
816 abs((jbr->tz_off % (60*60)) / 60)); 815 abs(jbr->tz_off / (60*60)),
817 else 816 abs((jbr->tz_off % (60*60)) / 60));
818 timezone = NULL;
819 timestamp = g_strdup_printf("%s GMT%s", purple_time_format(now),
820 timezone ? timezone : "");
821 purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); 817 purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp);
822 g_free(timestamp); 818 g_free(timestamp);
823 g_free(timezone);
824 } 819 }
825 if(jbir) { 820 if(jbir) {
826 if(jbir->idle_seconds > 0) { 821 if(jbir->idle_seconds > 0) {
827 char *idle = purple_str_seconds_to_string(jbir->idle_seconds); 822 char *idle = purple_str_seconds_to_string(jbir->idle_seconds);
828 purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle); 823 purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle);
994 989
995 if (jbr->tz_off != PURPLE_NO_TZ_OFF) { 990 if (jbr->tz_off != PURPLE_NO_TZ_OFF) {
996 time_t now_t; 991 time_t now_t;
997 struct tm *now; 992 struct tm *now;
998 char *timestamp; 993 char *timestamp;
999 char *timezone;
1000 time(&now_t); 994 time(&now_t);
1001 now_t += jbr->tz_off; 995 now_t += jbr->tz_off;
1002 now = gmtime(&now_t); 996 now = gmtime(&now_t);
1003 997
1004 if (jbr->tz_off) 998 timestamp = g_strdup_printf("%s %c%02d%02d", purple_time_format(now),
1005 timezone = g_strdup_printf("%02d:%02d", (int)(jbr->tz_off / (60*60)), 999 jbr->tz_off < 0 ? '-' : '+',
1006 abs((jbr->tz_off % (60*60)) / 60)); 1000 abs(jbr->tz_off / (60*60)),
1007 else 1001 abs((jbr->tz_off % (60*60)) / 60));
1008 timezone = NULL;
1009 timestamp = g_strdup_printf("%s GMT%s", purple_time_format(now),
1010 timezone ? timezone : "");
1011 purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); 1002 purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp);
1012 g_free(timestamp); 1003 g_free(timestamp);
1013 g_free(timezone);
1014 } 1004 }
1015 1005
1016 if(jbr->name && (jbir = g_hash_table_lookup(jbi->resources, jbr->name))) { 1006 if(jbr->name && (jbir = g_hash_table_lookup(jbi->resources, jbr->name))) {
1017 if(jbir->idle_seconds > 0) { 1007 if(jbir->idle_seconds > 0) {
1018 char *idle = purple_str_seconds_to_string(jbir->idle_seconds); 1008 char *idle = purple_str_seconds_to_string(jbir->idle_seconds);