From 4052b5d3d1dadf89ba9c58b6cd952f7fc8d942ed Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Wed, 5 Feb 2014 22:15:03 +0100 Subject: [PATCH] Add End Chat button This button clears the current chat, so that it becomes free for assignement to another partner. --- dialogs.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/dialogs.c b/dialogs.c index a2cd3c5..6fa9065 100644 --- a/dialogs.c +++ b/dialogs.c @@ -1714,11 +1714,12 @@ 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; @@ -1758,6 +1759,7 @@ Option chatOptions[] = { { 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 , "" }, @@ -1930,6 +1932,19 @@ PaneSwitch () // 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 -- 1.7.0.4