Mercurial > hg > nnchat
changeset 571:3ae357fd34bb
Rename quit-related internal variables.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 13 Dec 2012 15:49:43 +0200 |
parents | 7e6917c30a09 |
children | 7f83b1578bda |
files | main.c ui.c ui.h |
diffstat | 3 files changed, 15 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/main.c Tue Dec 11 13:50:19 2012 +0200 +++ b/main.c Thu Dec 13 15:49:43 2012 +0200 @@ -1515,7 +1515,7 @@ case 0x03: // ^C = quit case KEY_F(9): // F9 = Quit printMsg(currWin, "Quitting per user request (%d/0x%x).\n", c, c); - editState->exitProg = TRUE; + appQuitFlag = TRUE; break; case 0x09: // Tab = complete username or command @@ -1543,7 +1543,7 @@ case 0x03: // ^C = quit case KEY_F(9): // F9 = Quit printMsg(currWin, "Quitting per user request (%d/0x%x).\n", c, c); - editState->exitProg = TRUE; + appQuitFlag = TRUE; break; default: @@ -1962,7 +1962,7 @@ goto err_exit; - if (cursesInit) + if (appCursesInit) { printMsg(NULL, "%s v%s - %s\n", th_prog_name, th_prog_version, th_prog_desc); printMsg(NULL, "%s\n", th_prog_author); @@ -1978,14 +1978,14 @@ printMsg(NULL, "Enter your NN username ...\n"); optUserName = nnwin_prompt_requester(FALSE, &editState, processUserPrompt, updateUserPrompt); - if (editState.exitProg) + if (appQuitFlag) goto err_exit; editState.mask = TRUE; printMsg(NULL, "Enter your NN password ...\n"); optPassword = nnwin_prompt_requester(TRUE, &editState, processUserPrompt, updateUserPrompt); editState.mask = FALSE; - if (editState.exitProg) + if (appQuitFlag) goto err_exit; } } @@ -2075,7 +2075,7 @@ // Enter mainloop nn_conn_reset(conn); - while (!editState.isError && !editState.exitProg) + while (!editState.isError && !appQuitFlag) { int retries = 3, cres; @@ -2113,7 +2113,7 @@ editState.isError = TRUE; // Handle user input - if (cursesInit) + if (appCursesInit) { nnwin_input_process(editBuf, &editState, processUserInput); nnwin_update(editState.update, editState.mask, editBuf, optUserName, optUserColor); @@ -2136,7 +2136,7 @@ nn_conn_send_msg_v(conn, optUserNameEnc, "%%2FSetFontColor%%20%%2Dcolor%%20%06X", optUserColor); } - if (cursesInit) + if (appCursesInit) { nnwin_update(FALSE, editState.mask, editBuf, optUserName, optUserColor); }
--- a/ui.c Tue Dec 11 13:50:19 2012 +0200 +++ b/ui.c Thu Dec 13 15:49:43 2012 +0200 @@ -10,7 +10,7 @@ nn_window_t *chatWindows[SET_MAX_WINDOWS], *currWin = NULL; -BOOL cursesInit = FALSE; +BOOL appCursesInit = FALSE, appQuitFlag = FALSE; int cursorVisible = ERR, scrWidth, scrHeight; @@ -109,7 +109,7 @@ init_pair(16, COLOR_CYAN, COLOR_RED); } - cursesInit = TRUE; + appCursesInit = TRUE; nnwin_reset(); #ifdef PDCURSES @@ -132,7 +132,7 @@ for (i = 0; i < SET_MAX_WINDOWS; i++) nn_window_free(chatWindows[i]); - if (cursesInit) + if (appCursesInit) { if (cursorVisible != ERR) curs_set(cursorVisible); @@ -431,7 +431,7 @@ wmove(stdscr, sy, sx); // Update editbuf if needed - if (cursesInit && ebuf != NULL && (force || ebuf->dirty)) + if (appCursesInit && ebuf != NULL && (force || ebuf->dirty)) { int yoffs = ebuf->pos / scrWidth, xoffs = ebuf->pos % scrWidth; @@ -664,7 +664,7 @@ char *res; editState->done = FALSE; - while (!editState->isError && !editState->exitProg && !editState->done) + while (!editState->isError && !appQuitFlag && !editState->done) { nnwin_input_process(editBuf, editState, callback); update(editBuf, editState);
--- a/ui.h Tue Dec 11 13:50:19 2012 +0200 +++ b/ui.h Thu Dec 13 15:49:43 2012 +0200 @@ -56,14 +56,14 @@ typedef struct { time_t prevKeepAlive; - BOOL insertMode, exitProg, isError, update, mask, done; + BOOL insertMode, isError, update, mask, done; nn_conn_t *conn; void (*debugMsg)(const char *fmt, ...); } nn_editstate_t; extern nn_window_t *currWin; -extern BOOL cursesInit; +extern BOOL appCursesInit, appQuitFlag; extern int scrHeight, scrWidth; BOOL nnwin_init(int delay);