-%t format variable: path+filename of the finished ttyrec, in postcommands
-
< kerio> paxed: it would also be cool to have %g and %s work within a game definition too
-watching menu will hilight the first matching username... what if we have
more than one game installed, and someone's playing more than one at the
same time? Should also save game#, not just the username.
--allow admin to disabling the 'm' mail key in ttyplay.
+-allow admin to disable the 'm' mail key in ttyplay.
-update README
--maybe allow something like changed_menu="[Updated %d]" config option and
- $CHANGED in the menu banner.
- the $CHANGED will be replaced with the changed_menu value.
- the %d in changed_menu will be replaced with the banner file
- change time.
-whenever config file has a dir, check that it ends with "/"
-in domailuser(), we need find_curr_player_game(username)
-for menu definitions, allow "default" commands (when user presses a
-allow the admin to config the watching menu:
-top banner
-bottom banner
- -remove and reorder the columns:
- watch_title = " Name Game Size Start date & time Idle"
- this doesn't allow hiliting the sorted title, though...
- watch_columns = "0) 1 2 3 4 5 6"
- where the numbers correspond to the columns, everything else
- is passed through. the columns have default widths.
- col 0=selectletter, 1=playername, 2=gamenum, 3=termsize, 4=startdate,
- 5=starttime, 6=idletime
-set default sort method
-selectorchars:
watch_selectorchars = "abcdefghijklmn" (a-zA-Z, minus qQ)
-BUG: cannot quit watching until caught up with the stream.
-allow configuring the watching, new user registration,
email/passwd change, etc. screens.
--make default_fmode configurable, and add config
- file command "chmod file mode"
--allow setting the new rcfile access rights.
+-add config file command "chmod file mode"
-allow configuring the ttyrec dir location & file format.
--maybe allow changing the watching-screen &c layouts too?
-add commandline parameters to dgamelaunch:
dgamelaunch --chpasswd "nick" "newpass"
-some games (robotfindskitten?) are not worth saving into ttyrecs,
make it configurable. if no ttyrecs, then can't watch the game, which is
a pity. maybe rather just save the latest ttyrec, which ties into
having configurable ttyrec filenames...
--save the game name into ttyrec filename, so we can find what game it was.
-allow configuring ttyplay.c; some games may use different clear-screen
commands. (see for example crawl)
-allow configuring the gfx stripping. (number of chars, types of stripping,
*sortmode = old_sortmode;
}
+char *
+get_timediff(time_t ctime, long seconds)
+{
+ static char data[32];
+ long secs, mins, hours;
+
+ secs = (ctime - seconds);
+
+ if (showplayers) {
+ snprintf(data, 10, "%ld", secs);
+ return data;
+ }
+
+ hours = (secs / 3600);
+ secs -= (hours * 3600);
+ mins = (secs / 60) % 60;
+ secs -= (mins*60);
+ if (hours)
+ snprintf(data, 10, "%ldh %ldm", hours, mins);
+ else if (mins)
+ snprintf(data, 10, "%ldm %lds", mins, secs);
+ else if (secs > 4)
+ snprintf(data, 10, "%lds", secs);
+ else
+ snprintf(data, 10, " ");
+ return data;
+}
+
static
void
game_get_column_data(struct dg_game *game,
game->time);
break;
- case SORTMODE_IDLETIME:
- {
- long secs, mins, hours;
-
- secs = (ctime - game->idle_time);
-
- if (showplayers) {
- snprintf(data, 10, "%ld", secs);
- break;
+ case SORTMODE_DURATION:
+ {
+ /* TODO: populate_games() should put st_ctime into game struct */
+ struct tm timetm;
+ char tmptimebuf[32];
+ snprintf(tmptimebuf, 30, "%s %s", game->date, game->time);
+ tmptimebuf[31] = '\0';
+ strptime(tmptimebuf, "%Y-%m-%d %H:%M:%S", &timetm);
+ snprintf(data, 10, get_timediff(ctime, mktime(&timetm)));
}
+ break;
- hours = (secs / 3600);
- secs -= (hours * 3600);
- mins = (secs / 60) % 60;
- secs -= (mins*60);
- if (hours)
- snprintf(data, 10, "%ldh %ldm", hours, mins);
- else if (mins)
- snprintf(data, 10, "%ldm %lds", mins, secs);
- else if (secs > 4)
- snprintf(data, 10, "%lds", secs);
- else
- snprintf(data, 10, " ");
+ case SORTMODE_IDLETIME:
+ snprintf(data, 10, get_timediff(ctime, game->idle_time));
break;
- }
case SORTMODE_EXTRA_INFO:
if (game->extra_info)
SORTMODE_GAMENUM,
SORTMODE_WINDOWSIZE,
SORTMODE_STARTTIME,
+ SORTMODE_DURATION,
SORTMODE_IDLETIME,
SORTMODE_EXTRA_INFO,
#ifdef USE_SHMEM
"Game",
"Windowsize",
"Starttime",
+ "Duration",
"Idletime",
"Extrainfo",
#ifdef USE_SHMEM
(void) time(&sort_ctime);
qsort(games, len, sizeof(struct dg_game *), sort_game_idletime);
break;
+ case SORTMODE_DURATION:
case SORTMODE_STARTTIME: qsort(games, len, sizeof(struct dg_game *), sort_game_starttime); break;
case SORTMODE_EXTRA_INFO:
# [ "<display title>", "<sortname>", <Screen column>, "<printf format>" ]
#
# <sortname> may be "unsorted", "username", "game", "windowsize", "starttime",
-# "idletime", or (if shmem is enabled) "watchers".
+# "duration", "idletime", or (if shmem is enabled) "watchers".
#
# watch_columns = [ ["", "", 1, "%s)"],
# ["User", "username", 4, "%-15s"],