From 78395335556d16a58bb4a9eebf609dd5a69a0ce1 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Thu, 1 Sep 2005 21:06:05 +0000 Subject: [PATCH] Fixed errormessage if chatserver is not available --- ChangeLog | 4 ++++ mbmon/mbmon.c | 9 +++------ mbsebbs/chat.c | 12 +++++------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index bdf960fd..7ec9a20a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,6 +46,7 @@ v0.71.5 18-Aug-2005 Code cleanup. Changed syntax for calling mbpasswd. Blocked sysop to chat and page the sysop. Sysops use mbmon. + Fixed errormessage if chatserver is not available. mbnewusr: Changed syntax for calling mbpasswd. @@ -61,6 +62,9 @@ v0.71.5 18-Aug-2005 Added node setup switch to override node Hold or Down status. Changed syntax for calling mbpasswd. + mbmon: + Fixed error if chatserver is not available. + script: Added mbfile check to monthly maintenance script. diff --git a/mbmon/mbmon.c b/mbmon/mbmon.c index e77de2f6..4c78ad28 100644 --- a/mbmon/mbmon.c +++ b/mbmon/mbmon.c @@ -542,7 +542,7 @@ void Chat(int sysop) { int curpos = 0, stop = FALSE, data, rc; unsigned char ch = 0; - char sbuf[81], resp[128], *cnt, *msg; + char sbuf[81], resp[128]; static char buf[200]; clr_index(); @@ -554,12 +554,9 @@ void Chat(int sysop) if (socket_send(buf) == 0) { strcpy(buf, socket_receive()); Syslog('-', "< %s", buf); - if (strncmp(buf, "100:1,", 6) == 0) { - cnt = strtok(buf, ","); - msg = strtok(NULL, "\0"); - msg[strlen(msg)-1] = '\0'; + if (strncmp(buf, "200:1,", 6) == 0) { set_color(LIGHTRED, BLACK); - mbse_mvprintw(4, 1, msg); + mbse_mvprintw(4, 1, (char *)"The chatserver is not configured in /etc/services"); working(2, 0, 0); working(0, 0, 0); center_addstr(lines -4, (char *)"Press any key"); diff --git a/mbsebbs/chat.c b/mbsebbs/chat.c index 12899d85..d5c18d62 100644 --- a/mbsebbs/chat.c +++ b/mbsebbs/chat.c @@ -162,7 +162,7 @@ void Chat(char *username, char *channel) { int curpos = 0, stop = FALSE, data, rc; unsigned char ch; - char sbuf[81], resp[128], *cnt, *msg; + char sbuf[81], resp[128]; static char buf[200]; WhosDoingWhat(SYSOPCHAT, NULL); @@ -213,13 +213,11 @@ void Chat(char *username, char *channel) if (socket_send(buf) == 0) { strncpy(buf, socket_receive(), sizeof(buf)-1); Syslog('c', "< %s", buf); - if (strncmp(buf, "100:1,", 6) == 0) { - cnt = strtok(buf, ","); - msg = strtok(NULL, "\0"); - msg[strlen(msg)-1] = '\0'; + if (strncmp(buf, "200:1,", 6) == 0) { + Syslog('!', "Chatsever is not available"); colour(LIGHTRED, BLACK); - mvprintw(4, 1, msg); - sleep(2); + mvprintw(4, 1, (char *)"Sorry, the chatserver is not available"); + Enter(2); Pause(); chat_with_sysop = FALSE; return;