From: Pasi Kallinen Date: Wed, 5 May 2010 13:37:40 +0000 (+0000) Subject: Output some identifying info to the first frame of the ttyrec. X-Git-Tag: v1.6.1-roc-dev~157 X-Git-Url: https://skyeroc.xyz/gitweb/?a=commitdiff_plain;h=ce1dd29060b933830db41ad1e8cf653277e07596;p=dgamelaunch Output some identifying info to the first frame of the ttyrec. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@553 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- diff --git a/TODO b/TODO index 22849bf..8cfc366 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,4 @@ --dgl menu file inclusion command: $INCLUDE(filename) or $INSERT(filename) - would insert the file at that position of the menu file. - would make easier to maintain banners, &c +-$MTIME(filename) < Napkin> I'd suggest the default of DGL_MAILMSGLEN to be less < Napkin> there are 4 digits in front of the prompt, paxed. having diff --git a/ttyrec.c b/ttyrec.c index 318e2d7..9eca9b1 100644 --- a/ttyrec.c +++ b/ttyrec.c @@ -85,6 +85,45 @@ struct termios tt; struct winsize win; int uflg; +void +ttyrec_id(int game, char *username, char *ttyrec_filename) +{ + int i; + time_t tstamp; + Header h; + char *buf = (char *)malloc(1024); + char tmpbuf[256]; + if (!buf) return; + + tstamp = time(NULL); + +#define dCLRSCR "\033[2J" +#define dCRLF "\r\n" + snprintf(buf, 1024, + dCLRSCR "\033[1;1H" dCRLF + "Player: %s" dCRLF + "Game: %s" dCRLF + "Server: %s" dCRLF + "Filename: %s" dCRLF + "Time: (%lu) %s" dCRLF + dCLRSCR, + username, + myconfig[game]->game_name, + globalconfig.server_id, + ttyrec_filename, + tstamp, ctime(&tstamp) + ); +#undef dCLRSCR +#undef dCRLF + h.len = strlen(buf); + gettimeofday (&h.tv, NULL); + + (void) write_header(fscript, &h); + (void) fwrite(buf, 1, h.len, fscript); + + free(buf); +} + int ttyrec_main (int game, char *username, char *ttyrec_path, char* ttyrec_filename) { @@ -143,6 +182,7 @@ ttyrec_main (int game, char *username, char *ttyrec_path, char* ttyrec_filename) { close (slave); ipfile = gen_inprogress_lock (game, child, ttyrec_filename); + ttyrec_id(game, username, ttyrec_filename); dooutput (myconfig[game]->max_idle_time); } else