[srvx-commits] CVS: services/src helpserv.c,1.84,1.85
Brought to you by:
entrope
From: Entrope <en...@us...> - 2003-11-06 14:41:42
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv22877/src Modified Files: helpserv.c Log Message: clarify HelpServ stats output for variable week-start Index: helpserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/helpserv.c,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -r1.84 -r1.85 *** helpserv.c 5 Nov 2003 13:52:23 -0000 1.84 --- helpserv.c 6 Nov 2003 14:41:37 -0000 1.85 *************** *** 1851,1871 **** struct helpfile_table tbl; int i; ! char weekstr[32]; /* "September 10" should be the longest, but with other locales, who knows */ ! char intervalstr[32]; /* Should be at least 1 more than enough */ ! char buf[12]; ! struct tm *week_tm; ! if (!from_opserv) { ! hs_user = GetHSUser(hs, user->handle_info); ! } else { ! hs_user = NULL; ! } if (argc > 1) { ! if (!from_opserv) { ! if (hs_user->level < HlManager) { ! helpserv_notice(user, HSMSG_NEED_MANAGER); ! return 0; ! } } --- 1851,1862 ---- struct helpfile_table tbl; int i; ! char intervalstr[INTERVALLEN], buf[16]; ! hs_user = from_opserv ? NULL :GetHSUser(hs, user->handle_info); if (argc > 1) { ! if (!from_opserv && (hs_user->level < HlManager)) { ! helpserv_notice(user, HSMSG_NEED_MANAGER); ! return 0; } *************** *** 1893,1927 **** tbl.contents = alloca(tbl.length * sizeof(*tbl.contents)); tbl.contents[0] = alloca(tbl.width * sizeof(**tbl.contents)); ! tbl.contents[0][0] = "Week of"; tbl.contents[0][1] = "Recorded time"; - week_tm = localtime(&last_stats_update); - week_tm->tm_mday -= week_tm->tm_wday; /* Ensure it'll start on Sunday */ for (i=0; i < 5; i++) { unsigned int week_time = target->time_per_week[i]; tbl.contents[i+1] = alloca(tbl.width * sizeof(**tbl.contents)); - if (i == 4) { - tbl.contents[i+1][0] = strdup("Total"); - } else { - mktime(week_tm); /* To fix up other stuff after messing with tm_mday */ - if (!strftime(weekstr, 32, "%B %d", week_tm)) { - tbl.contents[i+1][0] = strdup("(Error)"); - } else { - tbl.contents[i+1][0] = strdup(weekstr); - } - } if ((i == 0 || i == 4) && target->join_time) week_time += now - target->join_time; helpserv_interval(intervalstr, week_time); tbl.contents[i+1][1] = strdup(intervalstr); - week_tm->tm_mday -= 7; } helpserv_notice(user, HSMSG_STATS_TIME, hs->helpchan->name); table_send((from_opserv ? opserv : hs->helpserv), user->nick, 0, NULL, tbl); ! for (i=1; i <= 5; i++) { ! free((char *)tbl.contents[i][0]); free((char *)tbl.contents[i][1]); - } tbl.length = 5; --- 1884,1908 ---- tbl.contents = alloca(tbl.length * sizeof(*tbl.contents)); tbl.contents[0] = alloca(tbl.width * sizeof(**tbl.contents)); ! tbl.contents[0][0] = ""; tbl.contents[0][1] = "Recorded time"; for (i=0; i < 5; i++) { unsigned int week_time = target->time_per_week[i]; tbl.contents[i+1] = alloca(tbl.width * sizeof(**tbl.contents)); if ((i == 0 || i == 4) && target->join_time) week_time += now - target->join_time; helpserv_interval(intervalstr, week_time); tbl.contents[i+1][1] = strdup(intervalstr); } + tbl.contents[1][0] = "This week"; + tbl.contents[2][0] = "Last week"; + tbl.contents[3][0] = "2 weeks ago"; + tbl.contents[4][0] = "3 weeks ago"; + tbl.contents[5][0] = "Total"; helpserv_notice(user, HSMSG_STATS_TIME, hs->helpchan->name); table_send((from_opserv ? opserv : hs->helpserv), user->nick, 0, NULL, tbl); ! for (i=1; i <= 5; i++) free((char *)tbl.contents[i][1]); tbl.length = 5; |