From 81266cc973c4cfb2d3f1b19637706fbc3f3a355b Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 5 Feb 2006 13:21:34 +0000 Subject: [PATCH] Removed most debug logging in chat --- ChangeLog | 4 ++++ mbmon/mbmon.c | 32 +++++++++++++++----------------- mbsebbs/chat.c | 47 +++++++++++++++++++++++++++++------------------ 3 files changed, 48 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4eb057a..a670f5fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,10 @@ v0.83.11 28-Jan-2006 mbmon: In chat beeps are heared for system messages. + Removed most debug logging in chat. + + mbsebbs: + Removed most debug logging in chat. v0.83.10 25-Jan-2006 - 28-Jan-2006 diff --git a/mbmon/mbmon.c b/mbmon/mbmon.c index c2051db0..9ce94845 100644 --- a/mbmon/mbmon.c +++ b/mbmon/mbmon.c @@ -475,13 +475,11 @@ void soft_info(void) /* * Colorize the chat window */ -void Showline(int y, int x, char *msgin) +void Showline(int y, int x, char *msg) { int i, done = FALSE; - char *msg; - if (strlen(msgin)) { - msg = xstrcpy(cldecode(msgin)); + if (strlen(msg)) { if (msg[0] == '<') { mbse_locate(y, x); mbse_colour(LIGHTCYAN, BLACK); @@ -511,7 +509,6 @@ void Showline(int y, int x, char *msgin) mbse_colour(GREEN, BLACK); mbse_mvprintw(y, x, msg); } - free(msg); } } @@ -546,6 +543,7 @@ void DispMsg(char *msg) } else { rpointer++; } + fflush(stdout); } @@ -570,11 +568,11 @@ void Chat(int sysop) snprintf(buf, 200, "CCON,4,%d,%s,%s,%s;", mypid, sysop_name, name, sysop ? "1":"0"); free(sysop_name); free(name); - Syslog('-', "> %s", buf); +// Syslog('-', "> %s", buf); if (socket_send(buf) == 0) { strcpy(buf, socket_receive()); - Syslog('-', "< %s", buf); +// Syslog('-', "< %s", buf); if (strncmp(buf, "200:1,", 6) == 0) { set_color(LIGHTRED, BLACK); mbse_mvprintw(4, 1, (char *)"Add \"fido 60179/udp # Chatserver\" to /etc/services"); @@ -590,7 +588,7 @@ void Chat(int sysop) mbse_locate(rows - 2, 1); set_color(WHITE, BLUE); clrtoeol(); - mbse_mvprintw(rows - 2, 2, "Chat, type \"/EXIT\" to exit"); + mbse_mvprintw(rows - 2, 2, "Chat, type \"/EXIT\" to exit or \"/HELP\" for help"); set_color(WHITE, BLACK); mbse_mvprintw(rows - 1, 1, ">"); @@ -607,7 +605,7 @@ void Chat(int sysop) } } - Syslog('-', "Start loop"); +// Syslog('-', "Start loop"); while (stop == FALSE) { @@ -621,8 +619,8 @@ void Chat(int sysop) memset(&buf, 0, sizeof(buf)); strncpy(buf, socket_receive(), sizeof(buf)-1); if (strncmp(buf, "100:2,", 6) == 0) { - Syslog('-', "> CGET:1,%d;", mypid); - Syslog('-', "< %s", buf); +// Syslog('-', "> CGET:1,%d;", mypid); +// Syslog('-', "< %s", buf); strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */ strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */ strncpy(resp, strtok(NULL, ","), 5); /* 1= fatal error */ @@ -674,10 +672,10 @@ void Chat(int sysop) } } else if ((ch == '\r') && curpos) { snprintf(buf, 200, "CPUT:2,%d,%s;", mypid, clencode(sbuf)); - Syslog('-', "> %s", buf); +// Syslog('-', "> %s", buf); if (socket_send(buf) == 0) { strcpy(buf, socket_receive()); - Syslog('-', "< %s", buf); +// Syslog('-', "< %s", buf); if (strncmp(buf, "100:2,", 6) == 0) { strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */ strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */ @@ -709,8 +707,8 @@ void Chat(int sysop) if (socket_send(buf) == 0) { strncpy(buf, socket_receive(), sizeof(buf)-1); if (strncmp(buf, "100:2,", 6) == 0) { - Syslog('-', "> CGET:1,%d;", mypid); - Syslog('-', "< %s", buf); +// Syslog('-', "> CGET:1,%d;", mypid); +// Syslog('-', "< %s", buf); strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */ strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */ strncpy(resp, strtok(NULL, ","), 5); /* 1= fatal error */ @@ -732,10 +730,10 @@ void Chat(int sysop) * Close server connection */ snprintf(buf, 200, "CCLO,1,%d;", mypid); - Syslog('-', "> %s", buf); +// Syslog('-', "> %s", buf); if (socket_send(buf) == 0) { strcpy(buf, socket_receive()); - Syslog('-', "< %s", buf); +// Syslog('-', "< %s", buf); } sleep(1); } diff --git a/mbsebbs/chat.c b/mbsebbs/chat.c index adc21d06..b945a03c 100644 --- a/mbsebbs/chat.c +++ b/mbsebbs/chat.c @@ -4,7 +4,7 @@ * Purpose ...............: Sysop to user chat utility * ***************************************************************************** - * Copyright (C) 1997-2005 + * Copyright (C) 1997-2006 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -89,7 +89,7 @@ unsigned char testkey(int y, int x) */ void Showline(int y, int x, char *msg) { - int i; + int i, done = FALSE; if (strlen(msg)) { if (msg[0] == '<') { @@ -98,19 +98,24 @@ void Showline(int y, int x, char *msg) PUTCHAR('<'); colour(LIGHTBLUE, BLACK); for (i = 1; i < strlen(msg); i++) { - if (msg[i] == '>') { + if ((msg[i] == '>') && (! done)) { colour(LIGHTCYAN, BLACK); PUTCHAR(msg[i]); colour(CYAN, BLACK); + done = TRUE; } else { PUTCHAR(msg[i]); } } - } else if ((msg[0] == '*') && (msg[1] == '*')) { - colour(LIGHTRED, BLACK); - mvprintw(y, x, msg); } else if (msg[0] == '*') { - colour(LIGHTMAGENTA, BLACK); + if (msg[1] == '*') { + if (msg[2] == '*') + mbse_colour(YELLOW, BLACK); + else + colour(LIGHTRED, BLACK); + } else { + colour(LIGHTMAGENTA, BLACK); + } mvprintw(y, x, msg); } else { colour(GREEN, BLACK); @@ -128,6 +133,12 @@ void DispMsg(char *msg) { int i; + /* + * Beep on minor system messages + */ + if ((msg[0] == '*') && (msg[1] != '*')) + putchar('\007'); + strncpy(rbuf[rpointer], msg, RBUFLEN); Showline(2 + rpointer, 1, rbuf[rpointer]); if (rpointer == rsize) { @@ -218,10 +229,10 @@ void Chat(char *username, char *channel) snprintf(buf, 200, "CCON,4,%d,%s,%s,0;", mypid, mname, name); free(mname); free(name); - Syslog('c', "> %s", buf); +// Syslog('c', "> %s", buf); if (socket_send(buf) == 0) { strncpy(buf, socket_receive(), sizeof(buf)-1); - Syslog('c', "< %s", buf); +// Syslog('c', "< %s", buf); if (strncmp(buf, "200:1,", 6) == 0) { Syslog('!', "Chatsever is not available"); colour(LIGHTRED, BLACK); @@ -257,7 +268,7 @@ void Chat(char *username, char *channel) strcpy(buf, socket_receive()); } - Syslog('c', "Start loop"); +// Syslog('c', "Start loop"); chatting = TRUE; while (stop == FALSE) { @@ -271,8 +282,8 @@ void Chat(char *username, char *channel) if (socket_send(buf) == 0) { strncpy(buf, socket_receive(), sizeof(buf)-1); if (strncmp(buf, "100:2,", 6) == 0) { - Syslog('c', "> CGET:1,%d;", mypid); - Syslog('c', "< %s", buf); +// Syslog('c', "> CGET:1,%d;", mypid); +// Syslog('c', "< %s", buf); strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */ strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */ strncpy(resp, strtok(NULL, ","), 5); /* 1= fatal, chat ended */ @@ -321,10 +332,10 @@ void Chat(char *username, char *channel) } else if ((ch == '\r') && curpos) { alarm_on(); snprintf(buf, 200, "CPUT:2,%d,%s;", mypid, clencode(sbuf)); - Syslog('c', "> %s", clencode(buf)); +// Syslog('c', "> %s", clencode(buf)); if (socket_send(buf) == 0) { strcpy(buf, socket_receive()); - Syslog('c', "< %s", buf); +// Syslog('c', "< %s", buf); if (strncmp(buf, "100:2,", 6) == 0) { strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */ strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */ @@ -356,8 +367,8 @@ void Chat(char *username, char *channel) if (socket_send(buf) == 0) { strncpy(buf, socket_receive(), sizeof(buf)-1); if (strncmp(buf, "100:2,", 6) == 0) { - Syslog('c', "> CGET:1,%d;", mypid); - Syslog('c', "< %s", buf); +// Syslog('c', "> CGET:1,%d;", mypid); +// Syslog('c', "< %s", buf); strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */ strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */ strncpy(resp, strtok(NULL, ","), 5); /* 1= fatal error */ @@ -393,10 +404,10 @@ void Chat(char *username, char *channel) * Close server connection */ snprintf(buf, 200, "CCLO,1,%d;", mypid); - Syslog('c', "> %s", buf); +// Syslog('c', "> %s", buf); if (socket_send(buf) == 0) { strcpy(buf, socket_receive()); - Syslog('c', "< %s", buf); +// Syslog('c', "< %s", buf); } sleep(2); clear();