]> skyeroc.xyz Git - dgamelaunch/commitdiff
Output some identifying info to the first frame of the ttyrec.
authorPasi Kallinen <paxed@alt.org>
Wed, 5 May 2010 13:37:40 +0000 (13:37 +0000)
committerPasi Kallinen <paxed@alt.org>
Wed, 5 May 2010 13:37:40 +0000 (13:37 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@553 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

TODO
ttyrec.c

diff --git a/TODO b/TODO
index 22849bf3e3f4f086600d67747731763a8ba359a5..8cfc36675ebe5fbbe2ed915ae4cf46c84f2fc00b 100644 (file)
--- 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
index 318e2d77404b719c0f11a09ea19a10fc22e7596a..9eca9b1d6d43601fb8dab0deb5f1d7c15b1564f0 100644 (file)
--- 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