changeset 230:b64500bb7fbe

Some yet-unused backbuffer related code.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 20 Feb 2011 20:45:58 +0200
parents 08d4355d6fc9
children 01c86ec9a3d8
files nnchat.c
diffstat 1 files changed, 27 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/nnchat.c	Sun Feb 20 20:45:23 2011 +0200
+++ b/nnchat.c	Sun Feb 20 20:45:58 2011 +0200
@@ -32,7 +32,14 @@
 #define SET_DELAY          (5)
 #endif
 
-#define SET_MIN_BACKBUF (1024)      /* Backbuffer size (in lines) */
+/* Define the weak "encryption" key used for locally stored passwords.
+ * This has no other purpose than to obfuscate keys in configuration
+ * file(s) from casual observers. In NO WAY this can be seen as a
+ * true security measure!
+ */
+#define SET_ENC_KEY     "1a#!sCbZxcGj0a04hBz&S"
+
+#define SET_BACKBUF_LEN (512)       /* Backbuffer size (in lines) */
 #define SET_MAX_HISTORY (16)        /* Command history length */
 #define SET_KEEPALIVE   (15*60)     /* Ping/keepalive period in seconds */
 
@@ -66,7 +73,7 @@
 char    *setConfigFile = NULL,
         *setBrowser = NULL;
 cfgitem_t *cfg = NULL;
-
+nn_ringbuf_t *backBuf = NULL;
 
 /* Arguments
  */
@@ -950,6 +957,7 @@
     char *homeDir = NULL;
     
     memset(histBuf, 0, sizeof(histBuf));
+    backBuf = nn_ringbuf_new(SET_BACKBUF_LEN);
     
     /* Initialize */
     th_init("NNChat", "Newbie Nudes chat client", NN_VERSION,
@@ -1369,6 +1377,22 @@
 
             case KEY_NPAGE:
             case KEY_PPAGE:
+#if 0
+                {
+                int nlines, ncol, old;
+                getmaxyx(mainWin, nlines, ncol);
+                nlines /= 2;
+                old = backBufPos;
+
+                if (c == KEY_NPAGE)
+                    backBufPos = (backBufPos > nlines) ? backBufPos - nlines : 0;
+                else
+                    backBufPos = (backBufPos < );
+
+                if (old != backBufPos)
+                    updateMain();
+                }
+#endif
                 break;
 
             case ERR:
@@ -1422,7 +1446,7 @@
     /* Shutdown */
 err_exit:
     nn_userhash_free(nnUsers);
-
+    nn_ringbuf_free(backBuf);
     nn_editbuf_free(editBuf);
     for (histPos = 0; histPos <= SET_MAX_HISTORY; histPos++)
         nn_editbuf_free(histBuf[histPos]);