{ "autocomm", ArgTrue, (void *) &appData.autoComment, FALSE, INVALID },
{ "xautocomm", ArgFalse, (void *) &appData.autoComment, FALSE, INVALID },
{ "-autocomm", ArgFalse, (void *) &appData.autoComment, FALSE, INVALID },
+ { "autoCreateLogon", ArgBoolean, (void *) &appData.autoCreateLogon, TRUE, (ArgIniType) FALSE },
{ "autoObserve", ArgBoolean, (void *) &appData.autoObserve, TRUE, (ArgIniType) FALSE },
{ "autobs", ArgTrue, (void *) &appData.autoObserve, FALSE, INVALID },
{ "xautobs", ArgFalse, (void *) &appData.autoObserve, FALSE, INVALID },
{
int outError, outCount;
static int gotEof = 0;
+ static FILE *ini;
/* Pass data read from player on to ICS */
if (count > 0) {
if (outCount < count) {
DisplayFatalError(_("Error writing to ICS"), outError, 1);
}
+ if(have_sent_ICS_logon == 2) {
+ if(ini = fopen(appData.icsLogon, "w")) { // save first two lines (presumably username & password) on init script file
+ fprintf(ini, "%s", message);
+ have_sent_ICS_logon = 3;
+ } else
+ have_sent_ICS_logon = 1;
+ } else if(have_sent_ICS_logon == 3) {
+ fprintf(ini, "%s", message);
+ fclose(ini);
+ have_sent_ICS_logon = 1;
+ }
} else if (count < 0) {
RemoveInputSource(isr);
DisplayFatalError(_("Error reading from keyboard"), error, 1);
continue;
}
- if (!have_sent_ICS_logon && looking_at(buf, &i, "login:")) {
- ICSInitScript();
- have_sent_ICS_logon = 1;
+ if (looking_at(buf, &i, "login:")) {
+ if (!have_sent_ICS_logon) {
+ if(ICSInitScript())
+ have_sent_ICS_logon = 1;
+ else // no init script was found
+ have_sent_ICS_logon = (appData.autoCreateLogon ? 2 : 1); // flag that we should capture username + password
+ } else { // we have sent (or created) the InitScript, but apparently the ICS rejected it
+ have_sent_ICS_logon = (appData.autoCreateLogon ? 2 : 1); // request creation of a new script
+ }
continue;
}
Boolean ponderNextMove;
Boolean periodicUpdates;
Boolean autoObserve;
+ Boolean autoCreateLogon;
Boolean autoComment;
Boolean getMoveList;
Boolean testLegality;
{ 0, 0, 0, NULL, (void*) &appData.autoComment, "", NULL, CheckBox, N_("Auto-Comment") },
{ 0, 0, 0, NULL, (void*) &appData.autoObserve, "", NULL, CheckBox, N_("Auto-Observe") },
{ 0, 0, 0, NULL, (void*) &appData.autoRaiseBoard, "", NULL, CheckBox, N_("Auto-Raise Board") },
+{ 0, 0, 0, NULL, (void*) &appData.autoCreateLogon, "", NULL, CheckBox, N_("Auto-Create Logon Script") },
{ 0, 0, 0, NULL, (void*) &appData.bgObserve, "", NULL, CheckBox, N_("Background Observe while Playing") },
{ 0, 0, 0, NULL, (void*) &appData.dualBoard, "", NULL, CheckBox, N_("Dual Board for Background-Observed Game") },
{ 0, 0, 0, NULL, (void*) &appData.getMoveList, "", NULL, CheckBox, N_("Get Move List") },
void TagsPopDown P((void));
void ParseIcsTextColors P((void));
-void ICSInitScript P((void));
+int ICSInitScript P((void));
void StartAnalysisClock P((void));
void EngineOutputPopUp P((void));
void EgineOutputPopDown P((void));
gboolean KeyPressProc P((GtkWindow *window, GdkEventKey *eventkey, gpointer data));
Boolean TempBackwardActive = False;
void DisplayMove P((int moveNumber));
-void ICSInitScript P((void));
void update_ics_width P(());
int CopyMemoProc P(());
static gboolean EventProc P((GtkWidget *widget, GdkEvent *event, gpointer g));
return outCount;
}
-void
+int
ICSInitScript ()
{
/* try to open the icsLogon script, either in the location given
}
}
- if (f != NULL)
+ if (f != NULL) {
ProcessICSInitScript(f);
- else
+ return TRUE;
+ } else
printf("Warning: Couldn't open icsLogon file (checked %s and %s).\n", appData.icsLogon, buf);
- return;
+ return FALSE;
}
void
#define CBO_Sounds 1350\r
#define OPT_DefaultSounds 1351\r
#define OPT_AlwaysOnTop 1352\r
+#define OPT_AutoCreate 1352\r
#define OPT_AutoFlag 1353\r
#define OPT_AlwaysQueen 1354\r
#define OPT_AutoComment 1354\r
/* see wedittags.c for Edit Tags functions */\r
\r
\r
-VOID\r
+int\r
ICSInitScript()\r
{\r
FILE *f;\r
if (f != NULL) {\r
ProcessICSInitScript(f);\r
fclose(f);\r
+ return TRUE;\r
}\r
}\r
+ return FALSE;\r
}\r
\r
\r
VOID InitDrawingColors(VOID);\r
VOID InitDrawingSizes(BoardSize boardSize, int flags);\r
VOID InitMenuChecks(VOID);\r
-VOID ICSInitScript(VOID);\r
+int ICSInitScript(VOID);\r
BOOL CenterWindow(HWND hwndChild, HWND hwndParent);\r
VOID ResizeEditPlusButtons(HWND hDlg, HWND hText, int sizeX, int sizeY, int newSizeX, int newSizeY);\r
VOID PromotionPopup(HWND hwnd);\r
CONTROL "&Auto Kibitz",OPT_AutoKibitz,"Button",BS_AUTOCHECKBOX | \r
WS_TABSTOP,94,12,73,8\r
CONTROL "Auto &Observe",OPT_AutoObserve,"Button",BS_AUTOCHECKBOX | \r
- WS_TABSTOP,10,25,150,8\r
+ WS_TABSTOP,10,25,73,8\r
+ CONTROL "Auto &Create Logon",OPT_AutoCreate,"Button",BS_AUTOCHECKBOX | \r
+ WS_TABSTOP,94,25,73,8\r
CONTROL "&Get Move List",OPT_GetMoveList,"Button",\r
BS_AUTOCHECKBOX | WS_TABSTOP,10,38,150,8\r
CONTROL "&Local Line Editing",OPT_LocalLineEditing,"Button",\r
CHECK_BOX(OPT_AutoKibitz, appData.autoKibitz);\r
CHECK_BOX(OPT_AutoComment, appData.autoComment);\r
CHECK_BOX(OPT_AutoObserve, appData.autoObserve);\r
+ CHECK_BOX(OPT_AutoCreate, appData.autoCreateLogon);\r
CHECK_BOX(OPT_GetMoveList, appData.getMoveList);\r
CHECK_BOX(OPT_LocalLineEditing, appData.localLineEditing);\r
CHECK_BOX(OPT_QuietPlay, appData.quietPlay);\r
appData.autoKibitz = IS_CHECKED(OPT_AutoKibitz);\r
appData.autoComment = IS_CHECKED(OPT_AutoComment);\r
appData.autoObserve = IS_CHECKED(OPT_AutoObserve);\r
+ appData.autoCreateLogon = IS_CHECKED(OPT_AutoCreate);\r
appData.getMoveList = IS_CHECKED(OPT_GetMoveList);\r
appData.localLineEditing = IS_CHECKED(OPT_LocalLineEditing);\r
appData.quietPlay = IS_CHECKED(OPT_QuietPlay);\r
Boolean TempBackwardActive = False;
void ManInner P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void DisplayMove P((int moveNumber));
-void ICSInitScript P((void));
void update_ics_width P(());
int CopyMemoProc P(());