Changeset 3922 for trunk/console
- Timestamp:
- 09/30/04 10:51:03 (4 years ago)
- Location:
- trunk/console
- Files:
-
- 9 modified
-
configure.in (modified) (1 diff)
-
README (modified) (1 diff)
-
src/console.cpp (modified) (52 diffs)
-
src/console.h (modified) (4 diffs)
-
src/console_menu.cpp (modified) (29 diffs)
-
src/console_print.cpp (modified) (20 diffs)
-
src/Makefile.am (modified) (1 diff)
-
src/window.cpp (modified) (5 diffs)
-
src/window.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/console/configure.in
r3832 r3922 63 63 ])) 64 64 65 dnl check for cdk 66 AC_CHECK_LIB(cdk, initCDKScreen,, 67 AC_MSG_ERROR([ 68 69 I can't find the cdk library. This is needed if you want 70 to compile this plugin. Sorry. 71 ])) 72 65 73 AC_OUTPUT( 66 74 src/Makefile \ -
trunk/console/README
r2929 r3922 18 18 For help using the console, type "/help" once inside. F1-F8 will toggle between 19 19 8 different virtual screens, PgUp/PgDown will scroll the screen, 20 and F9 is the standard Licq log (network window). 20 and F9 is the standard Licq log (network window). Press F10 to activate the 21 contact list. Up/down/right/left will scroll the list, pressing space when 22 a contact is selected will bring up another window with options to choose from. 23 Pressing Enter when a user is selected will message the user, or, if events 24 are pending (e.g. a message), will view the event. 21 25 22 Address any questions to Jon Keating <jon@licq.org>, uin 16325723. 26 Here is a list of key bindings when the userlist is activated: 27 28 Key Action 29 Left Arrow Shifts the whole list left one character. 30 Right Arrow Shifts the whole list right one character. 31 Up Arrow Selects the next item up in the list. 32 Down Arrow Selects the next item down in the list. 33 Prev Page Moves one page backwards. 34 Ctrl-B Moves one page backwards. 35 Next Page Moves one page forwards. 36 Ctrl-F Moves one page forwards. 37 g Moves to the first element in the list. 38 1 Moves to the first element in the list. 39 G Moves to the last element in the list. 40 $ Shifts the whole list to the far right. 41 | Shifts the whole list to the far left. 42 Return Sends a message to the user, or, if events 43 are pending (e.g. a message), will view 44 the event. 45 Tab Same as Return. 46 Space Brings up a popup window with extra options 47 to choose from. 48 Escape Exits the widget. 23 49 24 50 51 52 Address any questions to Philip Nelson <phatfil@optusnet.com.au>, uin 16385042, msn 53 phatagrajag@hotmail.com or Jon Keating <jon@licq.org>, uin 16325723 or on irc in #licq 54 on irc.freenode.net. 55 56 -
trunk/console/src/console.cpp
r3907 r3922 27 27 // Undefine what stupid ncurses defines as wclear(WINDOW *) 28 28 #undef clear 29 30 using namespace std; 29 31 30 32 extern "C" const char *LP_Version(); … … 85 87 const struct SColorMap aColorMaps[NUM_COLORMAPS] = 86 88 { 87 { "green", COLOR_GREEN, A_NORMAL }89 { "green", 24, A_NORMAL } 88 90 , // 0 89 { "red", COLOR_RED, A_NORMAL }91 { "red", 16, A_NORMAL } 90 92 , // 1 91 { "cyan", COLOR_CYAN, A_NORMAL }93 { "cyan", 56, A_NORMAL } 92 94 , // 2 93 { "white", COLOR_WHITE, A_NORMAL }95 { "white", 8, A_NORMAL } 94 96 , // 3 95 { "magenta", COLOR_MAGENTA, A_NORMAL }97 { "magenta", 48, A_NORMAL } 96 98 , // 4 97 { "blue", COLOR_BLUE, A_NORMAL }99 { "blue", 40, A_NORMAL } 98 100 , // 5 99 { "yellow", COLOR_YELLOW, A_NORMAL }101 { "yellow", 32, A_NORMAL } 100 102 , // 6 101 { "black", COLOR_BLACK, A_NORMAL }103 { "black", 8, A_NORMAL } 102 104 , // 7 103 { "bright_green", COLOR_GREEN, A_BOLD }105 { "bright_green", 24, A_BOLD } 104 106 , // 8 105 { "bright_red", COLOR_RED, A_BOLD }107 { "bright_red", 16, A_BOLD } 106 108 , // 9 107 { "bright_cyan", COLOR_CYAN, A_BOLD }109 { "bright_cyan", 56, A_BOLD } 108 110 , // 10 109 { "bright_white", COLOR_WHITE, A_BOLD }111 { "bright_white", 8, A_BOLD } 110 112 , // 11 111 { "bright_magenta", COLOR_MAGENTA, A_BOLD }113 { "bright_magenta", 48, A_BOLD } 112 114 , // 12 113 { "bright_blue", COLOR_BLUE, A_BOLD }115 { "bright_blue", 40, A_BOLD } 114 116 , // 13 115 { "bright_yellow", COLOR_YELLOW, A_BOLD } // 14117 { "bright_yellow", 32, A_BOLD } // 14 116 118 }; 117 119 … … 155 157 licqConf.ReadNum("ColorInfo", m_nColorInfo, 13); 156 158 licqConf.ReadNum("ColorError", m_nColorError, 9); 157 licqConf.ReadStr("OnlineFormat", m_szOnlineFormat, "% -20a");158 licqConf.ReadStr("OtherOnlineFormat", m_szOtherOnlineFormat, "% -20a[%6S]");159 licqConf.ReadStr("AwayFormat", m_szAwayFormat, "% -20a[%6S]");160 licqConf.ReadStr("OfflineFormat", m_szOfflineFormat, "% -20a");159 licqConf.ReadStr("OnlineFormat", m_szOnlineFormat, "%a"); 160 licqConf.ReadStr("OtherOnlineFormat", m_szOtherOnlineFormat, "%a [%S]"); 161 licqConf.ReadStr("AwayFormat", m_szAwayFormat, "%a [%S]"); 162 licqConf.ReadStr("OfflineFormat", m_szOfflineFormat, "%a"); 161 163 licqConf.ReadStr("CommandCharacter", m_szCommandChar, "/"); 162 164 … … 250 252 for (unsigned short i = 0; i <= MAX_CON; i++) 251 253 { 252 winCon[i] = new CWindow(LINES - 5, COLS - USER_WIN_WIDTH - 1, 2, 0,253 SCROLLBACK_BUFFER );254 winCon[i] = new CWindow(LINES - 5, COLS - USER_WIN_WIDTH - 1, 2, USER_WIN_WIDTH, 255 SCROLLBACK_BUFFER, true); 254 256 scrollok(winCon[i]->Win(), true); 255 257 winCon[i]->fProcessInput = &CLicqConsole::InputCommand; … … 263 265 winConStatus->SetActive(true); 264 266 winBar = new CWindow(LINES - 5, 1, 2, COLS - USER_WIN_WIDTH - 1, false); 265 winUsers = new CWindow(LINES - 5, USER_WIN_WIDTH, 2, COLS - USER_WIN_WIDTH, false);267 winUsers = new CWindow(LINES - 5, USER_WIN_WIDTH, 2, 0, false, true); 266 268 winBar->SetActive(true); 267 269 winUsers->SetActive(true); … … 421 423 { 422 424 case L_WARN: 423 cp = COLOR_YELLOW;425 cp = 32; 424 426 break; 425 427 case L_ERROR: 426 cp = COLOR_RED;428 cp = 16; 427 429 break; 428 430 case L_PACKET: 429 cp = COLOR_BLUE;431 cp = 40; 430 432 break; 431 433 case L_UNKNOWN: 432 cp = COLOR_MAGENTA;434 cp = 48; 433 435 break; 434 436 case L_INFO: 435 437 default: 436 cp = COLOR_WHITE;438 cp = 8; 437 439 break; 438 440 } … … 440 442 char *l = &p[LOG_PREFIX_OFFSET]; 441 443 p[LOG_PREFIX_OFFSET - 1] = '\0'; 442 winLog->wprintf("%C%s %C%s", COLOR_GREEN, p, cp, l);444 winLog->wprintf("%C%s %C%s", 24, p, cp, l); 443 445 if (log->NextLogType() == L_ERROR) 444 446 { 445 winMain->wprintf("%C%s %C%s", COLOR_GREEN, p, cp, l);447 winMain->wprintf("%C%s %C%s", 24, p, cp, l); 446 448 winMain->RefreshWin(); 447 449 } … … 617 619 case ICQ_CMDxSND_LOGON: 618 620 if (e->Result() != EVENT_SUCCESS) 619 winMain->wprintf("%CLogon failed. See the log console for details.\n", COLOR_RED);621 winMain->wprintf("%CLogon failed. See the log console for details.\n", 16); 620 622 break; 621 623 … … 626 628 gUserManager.OwnerUin()); 627 629 winMain->fProcessInput = &CLicqConsole::InputCommand; 630 PrintStatus(); 628 631 break; 629 632 … … 654 657 winMain->wprintf("%C%AFile transfer could not connect. See network " 655 658 "window for details.%C%Z\n", 656 COLOR_RED, A_BOLD, COLOR_WHITE, A_BOLD);659 16, A_BOLD, 8, A_BOLD); 657 660 bCloseFT = true; 658 661 break; … … 661 664 winMain->wprintf("%C%AFile transfer could not bind to a port. See " 662 665 "network window for details.%C%Z\n", 663 COLOR_RED, A_BOLD, COLOR_WHITE, A_BOLD);666 16, A_BOLD, 8, A_BOLD); 664 667 bCloseFT = true; 665 668 break; … … 668 671 winMain->wprintf("%C%AFile transfer unable to create new thread. See " 669 672 "network window for details.%C%Z\n", 670 COLOR_RED, A_BOLD, COLOR_WHITE, A_BOLD);673 16, A_BOLD, 8, A_BOLD); 671 674 bCloseFT = true; 672 675 break; … … 677 680 case FT_DONExBATCH: 678 681 winMain->wprintf("%C%AFile transfer successfuly finished.%C%Z\n", 679 COLOR_GREEN, A_BOLD, COLOR_WHITE, A_BOLD);682 24, A_BOLD, 8, A_BOLD); 680 683 bCloseFT = true; 681 684 break; … … 683 686 case FT_ERRORxCLOSED: 684 687 winMain->wprintf("%C%AFile transfer closed.%C%Z\n", 685 COLOR_RED, A_BOLD, COLOR_WHITE, A_BOLD);688 16, A_BOLD, 8, A_BOLD); 686 689 bCloseFT = true; 687 690 break; … … 689 692 case FT_ERRORxFILE: 690 693 winMain->wprintf("%C%AFile transfer I/O error.%C%Z\n", 691 COLOR_RED, A_BOLD, COLOR_WHITE, A_BOLD);694 16, A_BOLD, 8, A_BOLD); 692 695 bCloseFT = true; 693 696 break; … … 695 698 case FT_ERRORxHANDSHAKE: 696 699 winMain->wprintf("%C%AFile transfer handshake error.%C%Z\n", 697 COLOR_RED, A_BOLD, COLOR_WHITE, A_BOLD);700 16, A_BOLD, 8, A_BOLD); 698 701 bCloseFT = true; 699 702 break; … … 742 745 if (e == NULL) 743 746 { 744 win->wprintf("%A%Cerror\n", A_BOLD, COLOR_RED);747 win->wprintf("%A%Cerror\n", A_BOLD, 16); 745 748 } 746 749 else … … 778 781 { 779 782 win->wprintf("%C%ADirect send failed, send through server (y/N)? %C%Z", 780 m_cColorQuery->nColor, m_cColorQuery->nAttr, COLOR_WHITE,783 m_cColorQuery->nColor, m_cColorQuery->nAttr, 8, 781 784 A_BOLD); 782 785 win->state = STATE_QUERY; … … 946 949 { 947 950 win->wprintf("%C%s%A,%Z %s %s %A(%Z%s%A) -%Z %lu %A(%Z%s%A)\n", 948 COLOR_WHITE,951 8, 949 952 e->SearchAck()->Alias(), 950 953 A_BOLD, A_BOLD, … … 984 987 else 985 988 { 986 win->wprintf("%CSearch failed.\n", COLOR_RED);989 win->wprintf("%CSearch failed.\n", 16); 987 990 } 988 991 … … 1008 1011 1009 1012 // Print the header 1010 wbkgdset(winConStatus->Win(), COLOR_PAIR( COLOR_YELLOW_BLUE));1013 wbkgdset(winConStatus->Win(), COLOR_PAIR(29)); 1011 1014 werase(winConStatus->Win()); 1012 1015 winConStatus->wprintf("%A[ %CLicq Console Plugin v%C%s%C (", 1013 A_BOLD, COLOR_WHITE_BLUE,1014 COLOR_CYAN_BLUE, LP_Version(), COLOR_YELLOW_BLUE);1016 A_BOLD, 5, 1017 53, LP_Version(), 29); 1015 1018 if (m_nCon != 0) 1016 winConStatus->wprintf("%A%Cconsole %C%d", A_BOLD, COLOR_WHITE_BLUE,1017 COLOR_CYAN_BLUE, m_nCon);1019 winConStatus->wprintf("%A%Cconsole %C%d", A_BOLD, 5, 1020 53, m_nCon); 1018 1021 else 1019 winConStatus->wprintf("%A%Clog console", A_BOLD, COLOR_WHITE_BLUE);1020 winConStatus->wprintf("%A%C) ]", A_BOLD, COLOR_YELLOW_BLUE);1022 winConStatus->wprintf("%A%Clog console", A_BOLD, 5); 1023 winConStatus->wprintf("%A%C) ]", A_BOLD, 29); 1021 1024 wclrtoeol(winConStatus->Win()); 1022 wbkgdset(winConStatus->Win(), COLOR_PAIR( COLOR_WHITE));1025 wbkgdset(winConStatus->Win(), COLOR_PAIR(8)); 1023 1026 mvwhline(winConStatus->Win(), 1, 0, ACS_HLINE, COLS); 1024 mvwaddch(winConStatus->Win(), 1, COLS - USER_WIN_WIDTH - 1, ACS_TTEE);1027 //mvwaddch(winConStatus->Win(), 1, COLS - USER_WIN_WIDTH - 1, ACS_TTEE); 1025 1028 winConStatus->RefreshWin(); 1026 1029 … … 1049 1052 { 1050 1053 SwitchToCon(0); 1054 return; 1055 } 1056 if (cIn == KEY_F(MAX_CON + 2)) 1057 { 1058 MenuList((char *)NULL); 1051 1059 return; 1052 1060 } … … 1238 1246 { // No matches 1239 1247 Beep(); 1240 winMain->wprintf("%CNo matches.\n", COLOR_RED);1248 winMain->wprintf("%CNo matches.\n", 16); 1241 1249 wprintw(winPrompt->Win(), ""); 1242 1250 break; … … 1414 1422 if (iter == listMacros.end()) 1415 1423 { 1416 winMain->wprintf("%CNo such macro \"%A%s%Z\"\n", COLOR_RED, A_BOLD,1424 winMain->wprintf("%CNo such macro \"%A%s%Z\"\n", 16, A_BOLD, 1417 1425 szMacro, A_BOLD); 1418 1426 szMacro[0] = '\0'; … … 1477 1485 "for %s (%s)? %C%Z", 1478 1486 m_cColorQuery->nColor, m_cColorQuery->nAttr, 1479 u->GetAlias(), szId, COLOR_WHITE, A_BOLD);1487 u->GetAlias(), szId, 8, A_BOLD); 1480 1488 winMain->RefreshWin(); 1481 1489 gUserManager.DropUser(u); … … 1519 1527 break; 1520 1528 default: 1521 winMain->wprintf("%CInvalid key.\n", COLOR_RED);1529 winMain->wprintf("%CInvalid key.\n", 16); 1522 1530 } 1523 1531 … … 1535 1543 1536 1544 default: 1537 winMain->wprintf("%CInvalid state: %A%d%Z.\n", COLOR_RED, A_BOLD, A_BOLD);1545 winMain->wprintf("%CInvalid state: %A%d%Z.\n", 16, A_BOLD, A_BOLD); 1538 1546 } 1539 1547 … … 1611 1619 winMain->wprintf("%C%ARemove %s (%s) from contact list (y/N)? %C%Z", 1612 1620 m_cColorQuery->nColor, m_cColorQuery->nAttr, 1613 u->GetAlias(), szId, COLOR_WHITE, A_BOLD);1621 u->GetAlias(), szId, 8, A_BOLD); 1614 1622 winMain->RefreshWin(); 1615 1623 gUserManager.DropUser(u); … … 1652 1660 1653 1661 default: 1654 winMain->wprintf("%CInvalid state: %A%d%Z.\n", COLOR_RED, A_BOLD, A_BOLD);1662 winMain->wprintf("%CInvalid state: %A%d%Z.\n", 16, A_BOLD, A_BOLD); 1655 1663 } 1656 1664 … … 1758 1766 { 1759 1767 winMain->wprintf("%CYou must specify an event number. (1-%d)\n", 1760 COLOR_RED, nLast);1768 16, nLast); 1761 1769 } 1762 1770 else 1763 1771 { 1764 winMain->wprintf("%CNo System Events.\n", COLOR_WHITE);1772 winMain->wprintf("%CNo System Events.\n", 8); 1765 1773 } 1766 1774 return; … … 1778 1786 if (nStart == -1) 1779 1787 { 1780 winMain->wprintf("%CInvalid start range: %A%s\n", COLOR_RED,1788 winMain->wprintf("%CInvalid start range: %A%s\n", 16, 1781 1789 A_BOLD, szStart); 1782 1790 return; … … 1785 1793 { 1786 1794 winMain->wprintf("%CStart value out of range, history contains %d events.\n", 1787 COLOR_RED, nLast);1795 16, nLast); 1788 1796 return; 1789 1797 } … … 1794 1802 if (nEnd == -1) 1795 1803 { 1796 winMain->wprintf("%CInvalid end range: %A%s\n", COLOR_RED,1804 winMain->wprintf("%CInvalid end range: %A%s\n", 16, 1797 1805 A_BOLD, szEnd); 1798 1806 return; … … 1801 1809 { 1802 1810 winMain->wprintf("%CEnd value out of range, history contains %d events.\n", 1803 COLOR_RED, nLast);1811 16, nLast); 1804 1812 return; 1805 1813 } … … 1931 1939 1932 1940 default: 1933 winMain->wprintf("%CInvalid state: %A%d%Z.\n", COLOR_RED, A_BOLD, A_BOLD);1941 winMain->wprintf("%CInvalid state: %A%d%Z.\n", 16, A_BOLD, A_BOLD); 1934 1942 } 1935 1943 … … 2100 2108 2101 2109 default: 2102 winMain->wprintf("%CInvalid state: %A%d%Z.\n", COLOR_RED, A_BOLD, A_BOLD);2110 winMain->wprintf("%CInvalid state: %A%d%Z.\n", 16, A_BOLD, A_BOLD); 2103 2111 } 2104 2112 … … 2207 2215 2208 2216 default: 2209 winMain->wprintf("%CInvalid state: %A%d%Z.\n", COLOR_RED, A_BOLD, A_BOLD);2217 winMain->wprintf("%CInvalid state: %A%d%Z.\n", 16, A_BOLD, A_BOLD); 2210 2218 } 2211 2219 … … 2280 2288 2281 2289 default: 2282 winMain->wprintf("%CInvalid state: %A%d%Z.\n", COLOR_RED, A_BOLD, A_BOLD);2290 winMain->wprintf("%CInvalid state: %A%d%Z.\n", 16, A_BOLD, A_BOLD); 2283 2291 } 2284 2292 … … 2342 2350 2343 2351 default: 2344 winMain->wprintf("%CInvalid state: %A%d%Z.\n", COLOR_RED, A_BOLD, A_BOLD);2352 winMain->wprintf("%CInvalid state: %A%d%Z.\n", 16, A_BOLD, A_BOLD); 2345 2353 } 2346 2354 … … 2452 2460 else 2453 2461 szNL++; 2454 if ( ( *szNL == '.' || *szNL == ',' ) && strlen( szNL ) == 1) 2462 if ( (( *szNL == '.' || *szNL == ',' ) && strlen( szNL ) == 1) || 2463 !strcmp(szNL, ".s") || !strcmp(szNL, ".d") || !strcmp(szNL, ".u")) 2455 2464 return szNL; 2456 2465 … … 2640 2649 "2 %A-%Z Male\n" 2641 2650 "%A%CGender: ", 2642 COLOR_WHITE, A_BOLD, A_BOLD, A_BOLD, A_BOLD,2651 8, A_BOLD, A_BOLD, A_BOLD, A_BOLD, 2643 2652 A_BOLD, A_BOLD, m_cColorQuery->nAttr, m_cColorQuery->nColor); 2644 2653 return; … … 2670 2679 { 2671 2680 winMain->wprintf("%C%s %A(%Z%d%A)%s%Z", 2672 COLOR_WHITE, gLanguages[i].szName,2681 8, gLanguages[i].szName, 2673 2682 A_BOLD, A_BOLD, gLanguages[i].nCode, 2674 2683 A_BOLD, … … 2728 2737 { 2729 2738 winMain->wprintf("%C%s %A(%Z%d%A)%s%Z", 2730 COLOR_WHITE, gCountries[i].szName,2739 8, gCountries[i].szName, 2731 2740 A_BOLD, A_BOLD, gCountries[i].nCode, 2732 2741 A_BOLD, … … 2840 2849 2841 2850 winMain->wprintf("%A%CWelcome to the Licq Console Registration Wizard\n\nPress 1 to register a new UIN\nPress 2 if you have a UIN and password\n\n", 2842 A_BOLD, COLOR_GREEN);2851 A_BOLD, 24); 2843 2852 2844 2853 return; … … 3007 3016 winMain->state = STATE_COMMAND; 3008 3017 winMain->fProcessInput = &CLicqConsole::InputCommand; 3018 PrintStatus(); 3009 3019 } 3010 3020 } … … 3025 3035 winMain->data = new DataFileChatOffer(_nSequence, _szId, _nPPID); 3026 3036 winMain->wprintf("%C%ADo you wish to accept this request? (y/N) %C%Z", 3027 m_cColorQuery->nColor, m_cColorQuery->nAttr, COLOR_WHITE, A_BOLD);3037 m_cColorQuery->nColor, m_cColorQuery->nAttr, 8, A_BOLD); 3028 3038 winMain->RefreshWin(); 3029 3039 … … 3047 3057 case 'y': 3048 3058 { 3049 winMain->wprintf("%C%A\nAccepting file\n", COLOR_GREEN, A_BOLD);3059 winMain->wprintf("%C%A\nAccepting file\n", 24, A_BOLD); 3050 3060 3051 3061 // Make the ftman … … 3121 3131 { 3122 3132 winMain->wprintf("%CYou need to recompile Licq with OpenSSL for this " 3123 "feature to work!\n", COLOR_RED);3133 "feature to work!\n", 16); 3124 3134 return; 3125 3135 } … … 3128 3138 { 3129 3139 winMain->wprintf("%CThe remote end is not using a supported client. " 3130 "This may not work!\n", COLOR_RED);3140 "This may not work!\n", 16); 3131 3141 } 3132 3142 … … 3170 3180 else 3171 3181 { 3172 winMain->wprintf("%C<user> secure <open | close | (blank)>\n", COLOR_RED);3182 winMain->wprintf("%C<user> secure <open | close | (blank)>\n", 16); 3173 3183 } 3174 3184 … … 3194 3204 ICQOwner *o = gUserManager.FetchOwner(LOCK_R); 3195 3205 winMain->wprintf("%A%CEnter your password for %s (%lu):%C%Z\n", A_BOLD, 3196 COLOR_GREEN, o->GetAlias(), o->Uin(), COLOR_WHITE, A_BOLD);3206 24, o->GetAlias(), o->Uin(), 8, A_BOLD); 3197 3207 gUserManager.DropOwner(); 3198 3208 } … … 3216 3226 3217 3227 // Next stage is saving the password possibly 3218 winMain->wprintf("%C%ASave password? (y/N) %C%Z", COLOR_GREEN, A_BOLD,3219 COLOR_WHITE, A_BOLD);3228 winMain->wprintf("%C%ASave password? (y/N) %C%Z", 24, A_BOLD, 3229 8, A_BOLD); 3220 3230 winMain->state = STATE_QUERY; 3221 3231 break; -
trunk/console/src/console.h
r3801 r3922 37 37 }; 38 38 39 40 // for keeping track of where a user is 41 // in the cdkUserList <
