# HG changeset patch # User Matti Hamalainen # Date 1298227558 -7200 # Node ID b64500bb7fbebb25f9a4c40c513e51ee9766c768 # Parent 08d4355d6fc98f4f4dd648994d4ea9a32a8eb551 Some yet-unused backbuffer related code. diff -r 08d4355d6fc9 -r b64500bb7fbe nnchat.c --- 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]);