//---------------------------- Chat Windows ----------------------------------------------
static char *line, *memo, *chatMemo, *partner, *texts[MAX_CHAT], dirty[MAX_CHAT], *inputs[MAX_CHAT], *icsLine, *tmpLine;
-static int activePartner, hidden = 1;
+static int activePartner;
+int hidden = 1;
void ChatSwitch P((int n));
int ChatOK P((int n));
#define CHAT_ICS 6
#define CHAT_PARTNER 8
-#define CHAT_OUT 10
-#define CHAT_PANE 11
-#define CHAT_IN 12
+#define CHAT_OUT 11
+#define CHAT_PANE 12
+#define CHAT_IN 13
void PaneSwitch P((void));
+void ClearChat P((void));
WindowPlacement wpTextMenu;
{ 250, T_VSCRL | T_FILL | T_WRAP | T_TOP, 510, NULL, (void*) &memo, NULL, (void*) &ContextMenu, TextBox, "" },
{ 0, 0, 0, NULL, NULL, "", NULL, Break , "" },
{ 0, T_TOP, 100, NULL, (void*) &partner, NULL, NULL, TextBox, N_("Chat partner:") },
+{ 0, SAME_ROW, 0, NULL, (void*) &ClearChat, NULL, NULL, Button, N_("End Chat") },
{ 0, SAME_ROW, 0, NULL, (void*) &PaneSwitch, NULL, NULL, Button, N_("Hide") },
{ 250, T_VSCRL | T_FILL | T_WRAP | T_TOP, 510, NULL, (void*) &chatMemo, NULL, (void*) &ContextMenu, TextBox, "" },
{ 0, 0, 0, NULL, NULL, "", NULL, Break , "" },
if(hidden) BoardToTop();
else PaneSwitch();
break;
+ case 15:
+ NewChat(lastTalker);
+ break;
case 14:
for(chat=0; chat < MAX_CHAT; chat++) if(!chatPartner[chat][0]) break;
if(chat < MAX_CHAT) ChatSwitch(chat + 1);
// from here on it could be back-end
if(line[strlen(line)-1] == '\n') line[strlen(line)-1] = NULLCHAR;
SaveInHistory(line);
- if(hidden) snprintf(buf, MSG_SIZ, "%s\n", line); else // command for ICS
+ if(hidden || !*chatPartner[activePartner]) snprintf(buf, MSG_SIZ, "%s\n", line); else // command for ICS
if(!strcmp("whispers", chatPartner[activePartner]))
snprintf(buf, MSG_SIZ, "whisper %s\n", line); // WHISPER box uses "whisper" to send
else if(!strcmp("shouts", chatPartner[activePartner]))
// SetInsertPos(&chatOptions[CHAT_IN], strlen(icsLine));
}
+void
+ClearChat ()
+{ // clear the chat to make it free for other use
+ chatPartner[activePartner][0] = NULLCHAR;
+ ASSIGN(texts[activePartner], "");
+ ASSIGN(inputs[activePartner], "");
+ SetWidgetText(&chatOptions[CHAT_PARTNER], "", ChatDlg);
+ SetWidgetText(&chatOptions[CHAT_OUT], "", ChatDlg);
+ SetWidgetText(&chatOptions[CHAT_IN], "", ChatDlg);
+ SetWidgetLabel(&chatOptions[activePartner+1], _("New Chat"));
+ HardSetFocus(&chatOptions[CHAT_PARTNER], 0);
+}
+
static void
NewChat (char *name)
{ // open a chat on program request. If no empty one available, use last
if(GenericPopUp(chatOptions, _("ICS Interaction"), ChatDlg, BoardWindow, NONMODAL, appData.topLevel))
AddHandler(&chatOptions[CHAT_PARTNER], ChatDlg, 2), AddHandler(&chatOptions[CHAT_IN], ChatDlg, 2); // treats return as OK
Show(&chatOptions[CHAT_PANE], hidden = 1); // hide
- HardSetFocus(&chatOptions[CHAT_IN], 0);
+// HardSetFocus(&chatOptions[CHAT_IN], 0);
MarkMenu("View.OpenChatWindow", ChatDlg);
CursorAtEnd(&chatOptions[CHAT_IN]);
}