Add -chatBoxes option to open Chat Boxes at startup
authorH.G. Muller <h.g.muller@hccnet.nl>
Tue, 16 Feb 2010 21:34:23 +0000 (22:34 +0100)
committerArun Persaud <arun@nubati.net>
Sun, 21 Feb 2010 00:35:02 +0000 (16:35 -0800)
This string option contains a semicolon-separated list of handles for
which Chat Boxes should be opened at startup. The value saved in the ini
file is the value that was read, not the actual chat boxes that were
open at the time of saving.

args.h
common.h
winboard/winboard.c

diff --git a/args.h b/args.h
index 615b3ff..cbd63dc 100644 (file)
--- a/args.h
+++ b/args.h
@@ -624,6 +624,7 @@ ArgDescriptor argDescriptors[] = {
   { "zippyReplyTimeout", ArgInt, (void *)&junk, FALSE, INVALID },
 #endif
   /* [HGM] options for broadcasting and time odds */
+  { "chatBoxes", ArgString, (void *) &appData.chatBoxes, !XBOARD, (ArgIniType) NULL },
   { "serverMoves", ArgString, (void *) &appData.serverMovesName, FALSE, (ArgIniType) NULL },
   { "suppressLoadMoves", ArgBoolean, (void *) &appData.suppressLoadMoves, FALSE, (ArgIniType) FALSE },
   { "serverPause", ArgInt, (void *) &appData.serverPause, FALSE, (ArgIniType) 15 },
index 35c04c8..01c2460 100644 (file)
--- a/common.h
+++ b/common.h
@@ -519,6 +519,7 @@ typedef struct {
     int fontSizeTolerance; /* xboard only */
     char *initialMode;
     char *variant;
+    char *chatBoxes;
     int firstProtocolVersion;
     int secondProtocolVersion;
     Boolean showButtonBar;
index e6227ec..8053123 100644 (file)
@@ -859,6 +859,17 @@ InitInstance(HINSTANCE hInstance, int nCmdShow, LPSTR lpCmdLine)
                  0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);\r
 #endif\r
     ShowWindow(hwndConsole, nCmdShow);\r
+    if(appData.chatBoxes) { // [HGM] chat: open chat boxes\r
+      char buf[MSG_SIZ], *p = buf, *q;\r
+      strcpy(buf, appData.chatBoxes);\r
+      do {\r
+       q = strchr(p, ';');\r
+       if(q) *q++ = 0;\r
+       if(*p) ChatPopUp(p);\r
+      } while(p=q);\r
+//      Sleep(1000);\r
+    }\r
+    SetActiveWindow(hwndConsole);\r
   }\r
   if(!appData.noGUI)   UpdateWindow(hwnd);  else ShowWindow(hwnd, SW_MINIMIZE);\r
   if(gameListDialog) SetFocus(gameListDialog); // [HGM] jaws: for if we clicked multi-game game file\r