comparison main.c @ 571:3ae357fd34bb

Rename quit-related internal variables.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 13 Dec 2012 15:49:43 +0200
parents de1af9652fef
children 7f83b1578bda
comparison
equal deleted inserted replaced
570:7e6917c30a09 571:3ae357fd34bb
1513 break; 1513 break;
1514 1514
1515 case 0x03: // ^C = quit 1515 case 0x03: // ^C = quit
1516 case KEY_F(9): // F9 = Quit 1516 case KEY_F(9): // F9 = Quit
1517 printMsg(currWin, "Quitting per user request (%d/0x%x).\n", c, c); 1517 printMsg(currWin, "Quitting per user request (%d/0x%x).\n", c, c);
1518 editState->exitProg = TRUE; 1518 appQuitFlag = TRUE;
1519 break; 1519 break;
1520 1520
1521 case 0x09: // Tab = complete username or command 1521 case 0x09: // Tab = complete username or command
1522 nn_tabcomplete_buffer(editBuf); 1522 nn_tabcomplete_buffer(editBuf);
1523 break; 1523 break;
1541 break; 1541 break;
1542 1542
1543 case 0x03: // ^C = quit 1543 case 0x03: // ^C = quit
1544 case KEY_F(9): // F9 = Quit 1544 case KEY_F(9): // F9 = Quit
1545 printMsg(currWin, "Quitting per user request (%d/0x%x).\n", c, c); 1545 printMsg(currWin, "Quitting per user request (%d/0x%x).\n", c, c);
1546 editState->exitProg = TRUE; 1546 appQuitFlag = TRUE;
1547 break; 1547 break;
1548 1548
1549 default: 1549 default:
1550 return FALSE; 1550 return FALSE;
1551 } 1551 }
1960 // Initialize curses windowing 1960 // Initialize curses windowing
1961 if (!optDaemon && !nnwin_init(SET_DELAY)) 1961 if (!optDaemon && !nnwin_init(SET_DELAY))
1962 goto err_exit; 1962 goto err_exit;
1963 1963
1964 1964
1965 if (cursesInit) 1965 if (appCursesInit)
1966 { 1966 {
1967 printMsg(NULL, "%s v%s - %s\n", th_prog_name, th_prog_version, th_prog_desc); 1967 printMsg(NULL, "%s v%s - %s\n", th_prog_name, th_prog_version, th_prog_desc);
1968 printMsg(NULL, "%s\n", th_prog_author); 1968 printMsg(NULL, "%s\n", th_prog_author);
1969 printMsg(NULL, "%s\n", th_prog_license); 1969 printMsg(NULL, "%s\n", th_prog_license);
1970 1970
1976 printMsg(NULL, "Please enter your NN login credentials.\n"); 1976 printMsg(NULL, "Please enter your NN login credentials.\n");
1977 printMsg(NULL, "You can avoid doing this every time by issuing '/save' after logging in.\n"); 1977 printMsg(NULL, "You can avoid doing this every time by issuing '/save' after logging in.\n");
1978 1978
1979 printMsg(NULL, "Enter your NN username ...\n"); 1979 printMsg(NULL, "Enter your NN username ...\n");
1980 optUserName = nnwin_prompt_requester(FALSE, &editState, processUserPrompt, updateUserPrompt); 1980 optUserName = nnwin_prompt_requester(FALSE, &editState, processUserPrompt, updateUserPrompt);
1981 if (editState.exitProg) 1981 if (appQuitFlag)
1982 goto err_exit; 1982 goto err_exit;
1983 1983
1984 editState.mask = TRUE; 1984 editState.mask = TRUE;
1985 printMsg(NULL, "Enter your NN password ...\n"); 1985 printMsg(NULL, "Enter your NN password ...\n");
1986 optPassword = nnwin_prompt_requester(TRUE, &editState, processUserPrompt, updateUserPrompt); 1986 optPassword = nnwin_prompt_requester(TRUE, &editState, processUserPrompt, updateUserPrompt);
1987 editState.mask = FALSE; 1987 editState.mask = FALSE;
1988 if (editState.exitProg) 1988 if (appQuitFlag)
1989 goto err_exit; 1989 goto err_exit;
1990 } 1990 }
1991 } 1991 }
1992 1992
1993 if (optUserName == NULL || optPassword == NULL) 1993 if (optUserName == NULL || optPassword == NULL)
2073 editState.prevKeepAlive = time(NULL); 2073 editState.prevKeepAlive = time(NULL);
2074 srandom((int) editState.prevKeepAlive); 2074 srandom((int) editState.prevKeepAlive);
2075 2075
2076 // Enter mainloop 2076 // Enter mainloop
2077 nn_conn_reset(conn); 2077 nn_conn_reset(conn);
2078 while (!editState.isError && !editState.exitProg) 2078 while (!editState.isError && !appQuitFlag)
2079 { 2079 {
2080 int retries = 3, cres; 2080 int retries = 3, cres;
2081 2081
2082 packet_retry: 2082 packet_retry:
2083 cres = nn_conn_pull(conn); 2083 cres = nn_conn_pull(conn);
2111 else 2111 else
2112 if (cres < 0 || !nn_conn_check(conn)) 2112 if (cres < 0 || !nn_conn_check(conn))
2113 editState.isError = TRUE; 2113 editState.isError = TRUE;
2114 2114
2115 // Handle user input 2115 // Handle user input
2116 if (cursesInit) 2116 if (appCursesInit)
2117 { 2117 {
2118 nnwin_input_process(editBuf, &editState, processUserInput); 2118 nnwin_input_process(editBuf, &editState, processUserInput);
2119 nnwin_update(editState.update, editState.mask, editBuf, optUserName, optUserColor); 2119 nnwin_update(editState.update, editState.mask, editBuf, optUserName, optUserColor);
2120 } 2120 }
2121 2121
2134 { 2134 {
2135 colorSet = TRUE; 2135 colorSet = TRUE;
2136 nn_conn_send_msg_v(conn, optUserNameEnc, "%%2FSetFontColor%%20%%2Dcolor%%20%06X", optUserColor); 2136 nn_conn_send_msg_v(conn, optUserNameEnc, "%%2FSetFontColor%%20%%2Dcolor%%20%06X", optUserColor);
2137 } 2137 }
2138 2138
2139 if (cursesInit) 2139 if (appCursesInit)
2140 { 2140 {
2141 nnwin_update(FALSE, editState.mask, editBuf, optUserName, optUserColor); 2141 nnwin_update(FALSE, editState.mask, editBuf, optUserName, optUserColor);
2142 } 2142 }
2143 2143
2144 updateCount = 0; 2144 updateCount = 0;