Mercurial > hg > nnchat
comparison nnchat.c @ 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 | 3140ea43d4a3 |
comparison
equal
deleted
inserted
replaced
229:08d4355d6fc9 | 230:b64500bb7fbe |
---|---|
30 #define SET_CONFIG_FILE ".nnchat" | 30 #define SET_CONFIG_FILE ".nnchat" |
31 #define SET_DIR_SEPARATOR "/" | 31 #define SET_DIR_SEPARATOR "/" |
32 #define SET_DELAY (5) | 32 #define SET_DELAY (5) |
33 #endif | 33 #endif |
34 | 34 |
35 #define SET_MIN_BACKBUF (1024) /* Backbuffer size (in lines) */ | 35 /* Define the weak "encryption" key used for locally stored passwords. |
36 * This has no other purpose than to obfuscate keys in configuration | |
37 * file(s) from casual observers. In NO WAY this can be seen as a | |
38 * true security measure! | |
39 */ | |
40 #define SET_ENC_KEY "1a#!sCbZxcGj0a04hBz&S" | |
41 | |
42 #define SET_BACKBUF_LEN (512) /* Backbuffer size (in lines) */ | |
36 #define SET_MAX_HISTORY (16) /* Command history length */ | 43 #define SET_MAX_HISTORY (16) /* Command history length */ |
37 #define SET_KEEPALIVE (15*60) /* Ping/keepalive period in seconds */ | 44 #define SET_KEEPALIVE (15*60) /* Ping/keepalive period in seconds */ |
38 | 45 |
39 | 46 |
40 /* Options | 47 /* Options |
64 qlist_t *nnIgnoreList = NULL; | 71 qlist_t *nnIgnoreList = NULL; |
65 nn_userhash_t *nnUsers = NULL; | 72 nn_userhash_t *nnUsers = NULL; |
66 char *setConfigFile = NULL, | 73 char *setConfigFile = NULL, |
67 *setBrowser = NULL; | 74 *setBrowser = NULL; |
68 cfgitem_t *cfg = NULL; | 75 cfgitem_t *cfg = NULL; |
69 | 76 nn_ringbuf_t *backBuf = NULL; |
70 | 77 |
71 /* Arguments | 78 /* Arguments |
72 */ | 79 */ |
73 optarg_t optList[] = { | 80 optarg_t optList[] = { |
74 { 0, '?', "help", "Show this help", OPT_NONE }, | 81 { 0, '?', "help", "Show this help", OPT_NONE }, |
948 | 955 |
949 cfgitem_t *tmpcfg; | 956 cfgitem_t *tmpcfg; |
950 char *homeDir = NULL; | 957 char *homeDir = NULL; |
951 | 958 |
952 memset(histBuf, 0, sizeof(histBuf)); | 959 memset(histBuf, 0, sizeof(histBuf)); |
960 backBuf = nn_ringbuf_new(SET_BACKBUF_LEN); | |
953 | 961 |
954 /* Initialize */ | 962 /* Initialize */ |
955 th_init("NNChat", "Newbie Nudes chat client", NN_VERSION, | 963 th_init("NNChat", "Newbie Nudes chat client", NN_VERSION, |
956 "Written and designed by Anonymous Finnish Guy (C) 2008-2010", | 964 "Written and designed by Anonymous Finnish Guy (C) 2008-2010", |
957 "This software is freeware, use and distribute as you wish."); | 965 "This software is freeware, use and distribute as you wish."); |
1367 updateWindows(); | 1375 updateWindows(); |
1368 break; | 1376 break; |
1369 | 1377 |
1370 case KEY_NPAGE: | 1378 case KEY_NPAGE: |
1371 case KEY_PPAGE: | 1379 case KEY_PPAGE: |
1380 #if 0 | |
1381 { | |
1382 int nlines, ncol, old; | |
1383 getmaxyx(mainWin, nlines, ncol); | |
1384 nlines /= 2; | |
1385 old = backBufPos; | |
1386 | |
1387 if (c == KEY_NPAGE) | |
1388 backBufPos = (backBufPos > nlines) ? backBufPos - nlines : 0; | |
1389 else | |
1390 backBufPos = (backBufPos < ); | |
1391 | |
1392 if (old != backBufPos) | |
1393 updateMain(); | |
1394 } | |
1395 #endif | |
1372 break; | 1396 break; |
1373 | 1397 |
1374 case ERR: | 1398 case ERR: |
1375 /* Ignore */ | 1399 /* Ignore */ |
1376 break; | 1400 break; |
1420 } | 1444 } |
1421 | 1445 |
1422 /* Shutdown */ | 1446 /* Shutdown */ |
1423 err_exit: | 1447 err_exit: |
1424 nn_userhash_free(nnUsers); | 1448 nn_userhash_free(nnUsers); |
1425 | 1449 nn_ringbuf_free(backBuf); |
1426 nn_editbuf_free(editBuf); | 1450 nn_editbuf_free(editBuf); |
1427 for (histPos = 0; histPos <= SET_MAX_HISTORY; histPos++) | 1451 for (histPos = 0; histPos <= SET_MAX_HISTORY; histPos++) |
1428 nn_editbuf_free(histBuf[histPos]); | 1452 nn_editbuf_free(histBuf[histPos]); |
1429 | 1453 |
1430 if (cursesInit) { | 1454 if (cursesInit) { |