# HG changeset patch # User Matti Hamalainen # Date 1217914977 -10800 # Node ID e49ea6febfebc8d35b574b1e70141cc727b1be07 # Parent 67ec4073e38c59ce364138207e0e23ecd9652bc0 Cleanups. Added option to specify/fake "site" where logging in from. diff -r 67ec4073e38c -r e49ea6febfeb nnchat.c --- a/nnchat.c Mon Aug 04 06:44:11 2008 +0300 +++ b/nnchat.c Tue Aug 05 08:42:57 2008 +0300 @@ -29,7 +29,8 @@ *optUserName2 = NULL, *optPassword = NULL, *optLogFilename = NULL, - *setTarget = NULL; + *setTarget = NULL, + *optSite = "NN"; BOOL optDaemon = FALSE; FILE *optLogFile = NULL; WINDOW *mainWin = NULL, @@ -37,6 +38,7 @@ *editWin = NULL; BOOL setPrvMode = FALSE; + /* Arguments */ optarg_t optList[] = { @@ -47,6 +49,7 @@ { 4, 'C', "color", "Initial color in RGB hex 000000", OPT_ARGREQ }, { 5, 'l', "logfile", "Log filename", OPT_ARGREQ }, { 6, 'D', "daemon", "A pseudo-daemon mode for logging", OPT_NONE }, + { 7, 'S', "site", "Site (default: NN)", OPT_ARGREQ }, }; const int optListN = (sizeof(optList) / sizeof(optarg_t)); @@ -111,6 +114,10 @@ optLogFilename = optArg; break; + case 7: + optSite = optArg; + break; + case 6: optDaemon = TRUE; THMSG(1, "Running in pseudo-daemon mode.\n"); @@ -1047,13 +1054,13 @@ goto err_exit; } - THMSG(1, "Connected, logging in as '%s'.\n", optUserName); + THMSG(1, "Connected, logging in as '%s', site '%s'.\n", optUserName, optSite); optUserName2 = encodeStr1(optUserName); + tmpStr = encodeStr1(optSite); + sendUserMsg(tmpSocket, optUserName2, "%%2Flogin%%20%%2Dsite%%20%s%%20%%2Dpassword%%20%s", tmpStr, optPassword); + th_free(tmpStr); - sendUserMsg(tmpSocket, optUserName2, "%%2Flogin%%20%%2Dsite%%20NN%%20%%2Dpassword%%20%s", optPassword); - - /* Initialize curses */ - + /* Initialize NCurses */ if (!optDaemon) { initscr(); raw(); @@ -1243,7 +1250,7 @@ break; case 0x111: /* F9 */ - printMsg("Quitting per user request."); + printMsg("Quitting per user request.\n"); exitProg = TRUE; break;