From: Art Cancro Date: Wed, 3 Mar 2004 05:36:41 +0000 (+0000) Subject: * Close chat socket if already open X-Git-Tag: v7.86~5557 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=f134d89644094fc23aea0a0436eb8849eaeff624;p=citadel.git * Close chat socket if already open --- diff --git a/webcit/paging.c b/webcit/paging.c index 3d879eaac..87b877076 100644 --- a/webcit/paging.c +++ b/webcit/paging.c @@ -117,7 +117,25 @@ void page_user(void) */ void do_chat(void) { + char buf[SIZ]; + + /* First, check to make sure we're still allowed in this room. */ + serv_printf("GOTO %s", WC->wc_roomname); + serv_gets(buf); + if (buf[0] != '2') { + smart_goto("_BASEROOM_"); + return; + } + + /* If the chat socket is still open from a previous chat, + * close it -- because it might be stale or in the wrong room. + */ + if (WC->chat_sock < 0) { + close(WC->chat_sock); + WC->chat_sock = (-1); + } + /* Ok, we're good. Here we go. */ output_headers(3); wprintf("
"