int backup; /* [DM] For zippy color lines */
char *p;
char talker[MSG_SIZ]; // [HGM] chat
+ int channel;
if (appData.debugMode) {
if (!error) {
//if(appData.debugMode) fprintf(debugFP, "hunt for tell, buf = %s\n", buf+i);
// [HGM] chat: intercept tells by users for which we have an open chat window
+ channel = -1;
if(started == STARTED_NONE && (looking_at(buf, &i, "* tells you:") || looking_at(buf, &i, "* says:") ||
- looking_at(buf, &i, "* whispers:"))) {
+ looking_at(buf, &i, "* whispers:") ||
+ looking_at(buf, &i, "*(*):") && (sscanf(star_match[1], "%d", &channel),1) ||
+ looking_at(buf, &i, "*(*)(*):") && sscanf(star_match[2], "%d", &channel) == 1 )) {
int p;
sscanf(star_match[0], "%[^(]", talker+1); // strip (C) or (U) off ICS handle
chattingPartner = -1;
- if(buf[i-3] == 'r') // whisper; look if there is a WHISPER chatbox
- for(p=0; p<MAX_CHAT; p++) if(!strcmp("WHISPER", chatPartner[p])) {
+
+ if(channel >= 0) // channel broadcast; look if there is a chatbox for this channel
+ for(p=0; p<MAX_CHAT; p++) {
+ if(channel == atoi(chatPartner[p])) {
talker[0] = '['; strcat(talker, "]");
chattingPartner = p; break;
+ }
+ } else
+ if(buf[i-3] == 'r') // whisper; look if there is a WHISPER chatbox
+ for(p=0; p<MAX_CHAT; p++) {
+ if(!strcmp("WHISPER", chatPartner[p])) {
+ talker[0] = '['; strcat(talker, "]");
+ chattingPartner = p; break;
+ }
}
if(chattingPartner<0) // if not, look if there is a chatbox for this indivdual
for(p=0; p<MAX_CHAT; p++) if(!strcasecmp(talker+1, chatPartner[p])) {
GetDlgItemText(hDlg, OPT_ChatInput, mess, MSG_SIZ);\r
SetDlgItemText(hDlg, OPT_ChatInput, "");\r
// from here on it could be back-end\r
- if(strcmp("WHISPER", chatPartner[partner])) {\r
- sprintf(buf, "> %s\n", mess); // echo only tells, not whispers\r
+ if(!strcmp("WHISPER", chatPartner[partner]))\r
+ sprintf(buf, "whisper %s\n", mess); // WHISPER box uses "whisper" to send\r
+ else {\r
+ if(!atoi(chatPartner[partner])) {\r
+ sprintf(buf, "> %s\n", mess); // echo only tells to handle, not channel\r
InsertIntoMemo(hDlg, buf);\r
+ }\r
sprintf(buf, "tell %s %s\n", chatPartner[partner], mess);\r
- } else sprintf(buf, "whisper %s\n", mess); // SAY box uses "say" to send\r
+ }\r
SendToICS(buf);\r
break;\r
\r
}\r
KillTimer(hwndMain, delayedTimerEvent);\r
delayedTimerEvent = 0;\r
+ if(delayedTimerCallback != cb) // [HGM] alive: do not "flush" same event, just postpone it\r
delayedTimerCallback();\r
}\r
delayedTimerCallback = cb;\r
{ "delayAfterQuit", "delayAfterQuit", XtRInt,
sizeof(int), XtOffset(AppDataPtr, delayAfterQuit),
XtRImmediate, (XtPointer) 0},
+ { "keepAlive", "keepAlive", XtRInt,
+ sizeof(int), XtOffset(AppDataPtr, keepAlive),
+ XtRImmediate, (XtPointer) 0},
};
XrmOptionDescRec shellOptions[] = {
{ "-secondOptions", "secondOptions", XrmoptionSepArg, NULL },
{ "-firstNeedsNoncompliantFEN", "firstNeedsNoncompliantFEN", XrmoptionSepArg, NULL },
{ "-secondNeedsNoncompliantFEN", "secondNeedsNoncompliantFEN", XrmoptionSepArg, NULL },
+ { "-keepAlive", "keepAlive", XrmoptionSepArg, NULL },
};
j = fprintf(stderr, " %s%s", shellOptions[i].option,
(shellOptions[i].argKind == XrmoptionSepArg
? " ARG" : ""));
- if (i++ < XtNumber(shellOptions)) {
+ if (i++ < XtNumber(shellOptions)) {
fprintf(stderr, "%*c%s%s\n", 40 - j, ' ',
shellOptions[i].option,
(shellOptions[i].argKind == XrmoptionSepArg
ScheduleDelayedEvent(cb, millisec)
DelayedEventCallback cb; long millisec;
{
+ if(delayedEventTimerXID && delayedEventCallback == cb)
+ // [HGM] alive: replace, rather than add or flush identical event
+ XtRemoveTimeOut(delayedEventTimerXID);
delayedEventCallback = cb;
delayedEventTimerXID =
XtAppAddTimeOut(appContext, millisec,