Removed most debug logging in chat

This commit is contained in:
Michiel Broek 2006-02-05 13:21:34 +00:00
parent da37ef7bbb
commit 81266cc973
3 changed files with 48 additions and 35 deletions

View File

@ -16,6 +16,10 @@ v0.83.11 28-Jan-2006
mbmon: mbmon:
In chat beeps are heared for system messages. 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 v0.83.10 25-Jan-2006 - 28-Jan-2006

View File

@ -475,13 +475,11 @@ void soft_info(void)
/* /*
* Colorize the chat window * Colorize the chat window
*/ */
void Showline(int y, int x, char *msgin) void Showline(int y, int x, char *msg)
{ {
int i, done = FALSE; int i, done = FALSE;
char *msg;
if (strlen(msgin)) { if (strlen(msg)) {
msg = xstrcpy(cldecode(msgin));
if (msg[0] == '<') { if (msg[0] == '<') {
mbse_locate(y, x); mbse_locate(y, x);
mbse_colour(LIGHTCYAN, BLACK); mbse_colour(LIGHTCYAN, BLACK);
@ -511,7 +509,6 @@ void Showline(int y, int x, char *msgin)
mbse_colour(GREEN, BLACK); mbse_colour(GREEN, BLACK);
mbse_mvprintw(y, x, msg); mbse_mvprintw(y, x, msg);
} }
free(msg);
} }
} }
@ -546,6 +543,7 @@ void DispMsg(char *msg)
} else { } else {
rpointer++; rpointer++;
} }
fflush(stdout); 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"); snprintf(buf, 200, "CCON,4,%d,%s,%s,%s;", mypid, sysop_name, name, sysop ? "1":"0");
free(sysop_name); free(sysop_name);
free(name); free(name);
Syslog('-', "> %s", buf); // Syslog('-', "> %s", buf);
if (socket_send(buf) == 0) { if (socket_send(buf) == 0) {
strcpy(buf, socket_receive()); strcpy(buf, socket_receive());
Syslog('-', "< %s", buf); // Syslog('-', "< %s", buf);
if (strncmp(buf, "200:1,", 6) == 0) { if (strncmp(buf, "200:1,", 6) == 0) {
set_color(LIGHTRED, BLACK); set_color(LIGHTRED, BLACK);
mbse_mvprintw(4, 1, (char *)"Add \"fido 60179/udp # Chatserver\" to /etc/services"); 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); mbse_locate(rows - 2, 1);
set_color(WHITE, BLUE); set_color(WHITE, BLUE);
clrtoeol(); 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); set_color(WHITE, BLACK);
mbse_mvprintw(rows - 1, 1, ">"); mbse_mvprintw(rows - 1, 1, ">");
@ -607,7 +605,7 @@ void Chat(int sysop)
} }
} }
Syslog('-', "Start loop"); // Syslog('-', "Start loop");
while (stop == FALSE) { while (stop == FALSE) {
@ -621,8 +619,8 @@ void Chat(int sysop)
memset(&buf, 0, sizeof(buf)); memset(&buf, 0, sizeof(buf));
strncpy(buf, socket_receive(), sizeof(buf)-1); strncpy(buf, socket_receive(), sizeof(buf)-1);
if (strncmp(buf, "100:2,", 6) == 0) { if (strncmp(buf, "100:2,", 6) == 0) {
Syslog('-', "> CGET:1,%d;", mypid); // Syslog('-', "> CGET:1,%d;", mypid);
Syslog('-', "< %s", buf); // Syslog('-', "< %s", buf);
strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */ strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */
strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */ strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */
strncpy(resp, strtok(NULL, ","), 5); /* 1= fatal error */ strncpy(resp, strtok(NULL, ","), 5); /* 1= fatal error */
@ -674,10 +672,10 @@ void Chat(int sysop)
} }
} else if ((ch == '\r') && curpos) { } else if ((ch == '\r') && curpos) {
snprintf(buf, 200, "CPUT:2,%d,%s;", mypid, clencode(sbuf)); snprintf(buf, 200, "CPUT:2,%d,%s;", mypid, clencode(sbuf));
Syslog('-', "> %s", buf); // Syslog('-', "> %s", buf);
if (socket_send(buf) == 0) { if (socket_send(buf) == 0) {
strcpy(buf, socket_receive()); strcpy(buf, socket_receive());
Syslog('-', "< %s", buf); // Syslog('-', "< %s", buf);
if (strncmp(buf, "100:2,", 6) == 0) { if (strncmp(buf, "100:2,", 6) == 0) {
strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */ strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */
strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */ strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */
@ -709,8 +707,8 @@ void Chat(int sysop)
if (socket_send(buf) == 0) { if (socket_send(buf) == 0) {
strncpy(buf, socket_receive(), sizeof(buf)-1); strncpy(buf, socket_receive(), sizeof(buf)-1);
if (strncmp(buf, "100:2,", 6) == 0) { if (strncmp(buf, "100:2,", 6) == 0) {
Syslog('-', "> CGET:1,%d;", mypid); // Syslog('-', "> CGET:1,%d;", mypid);
Syslog('-', "< %s", buf); // Syslog('-', "< %s", buf);
strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */ strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */
strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */ strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */
strncpy(resp, strtok(NULL, ","), 5); /* 1= fatal error */ strncpy(resp, strtok(NULL, ","), 5); /* 1= fatal error */
@ -732,10 +730,10 @@ void Chat(int sysop)
* Close server connection * Close server connection
*/ */
snprintf(buf, 200, "CCLO,1,%d;", mypid); snprintf(buf, 200, "CCLO,1,%d;", mypid);
Syslog('-', "> %s", buf); // Syslog('-', "> %s", buf);
if (socket_send(buf) == 0) { if (socket_send(buf) == 0) {
strcpy(buf, socket_receive()); strcpy(buf, socket_receive());
Syslog('-', "< %s", buf); // Syslog('-', "< %s", buf);
} }
sleep(1); sleep(1);
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: Sysop to user chat utility * Purpose ...............: Sysop to user chat utility
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2006
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -89,7 +89,7 @@ unsigned char testkey(int y, int x)
*/ */
void Showline(int y, int x, char *msg) void Showline(int y, int x, char *msg)
{ {
int i; int i, done = FALSE;
if (strlen(msg)) { if (strlen(msg)) {
if (msg[0] == '<') { if (msg[0] == '<') {
@ -98,19 +98,24 @@ void Showline(int y, int x, char *msg)
PUTCHAR('<'); PUTCHAR('<');
colour(LIGHTBLUE, BLACK); colour(LIGHTBLUE, BLACK);
for (i = 1; i < strlen(msg); i++) { for (i = 1; i < strlen(msg); i++) {
if (msg[i] == '>') { if ((msg[i] == '>') && (! done)) {
colour(LIGHTCYAN, BLACK); colour(LIGHTCYAN, BLACK);
PUTCHAR(msg[i]); PUTCHAR(msg[i]);
colour(CYAN, BLACK); colour(CYAN, BLACK);
done = TRUE;
} else { } else {
PUTCHAR(msg[i]); PUTCHAR(msg[i]);
} }
} }
} else if ((msg[0] == '*') && (msg[1] == '*')) {
colour(LIGHTRED, BLACK);
mvprintw(y, x, msg);
} else if (msg[0] == '*') { } 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); mvprintw(y, x, msg);
} else { } else {
colour(GREEN, BLACK); colour(GREEN, BLACK);
@ -128,6 +133,12 @@ void DispMsg(char *msg)
{ {
int i; int i;
/*
* Beep on minor system messages
*/
if ((msg[0] == '*') && (msg[1] != '*'))
putchar('\007');
strncpy(rbuf[rpointer], msg, RBUFLEN); strncpy(rbuf[rpointer], msg, RBUFLEN);
Showline(2 + rpointer, 1, rbuf[rpointer]); Showline(2 + rpointer, 1, rbuf[rpointer]);
if (rpointer == rsize) { 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); snprintf(buf, 200, "CCON,4,%d,%s,%s,0;", mypid, mname, name);
free(mname); free(mname);
free(name); free(name);
Syslog('c', "> %s", buf); // Syslog('c', "> %s", buf);
if (socket_send(buf) == 0) { if (socket_send(buf) == 0) {
strncpy(buf, socket_receive(), sizeof(buf)-1); strncpy(buf, socket_receive(), sizeof(buf)-1);
Syslog('c', "< %s", buf); // Syslog('c', "< %s", buf);
if (strncmp(buf, "200:1,", 6) == 0) { if (strncmp(buf, "200:1,", 6) == 0) {
Syslog('!', "Chatsever is not available"); Syslog('!', "Chatsever is not available");
colour(LIGHTRED, BLACK); colour(LIGHTRED, BLACK);
@ -257,7 +268,7 @@ void Chat(char *username, char *channel)
strcpy(buf, socket_receive()); strcpy(buf, socket_receive());
} }
Syslog('c', "Start loop"); // Syslog('c', "Start loop");
chatting = TRUE; chatting = TRUE;
while (stop == FALSE) { while (stop == FALSE) {
@ -271,8 +282,8 @@ void Chat(char *username, char *channel)
if (socket_send(buf) == 0) { if (socket_send(buf) == 0) {
strncpy(buf, socket_receive(), sizeof(buf)-1); strncpy(buf, socket_receive(), sizeof(buf)-1);
if (strncmp(buf, "100:2,", 6) == 0) { if (strncmp(buf, "100:2,", 6) == 0) {
Syslog('c', "> CGET:1,%d;", mypid); // Syslog('c', "> CGET:1,%d;", mypid);
Syslog('c', "< %s", buf); // Syslog('c', "< %s", buf);
strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */ strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */
strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */ strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */
strncpy(resp, strtok(NULL, ","), 5); /* 1= fatal, chat ended */ strncpy(resp, strtok(NULL, ","), 5); /* 1= fatal, chat ended */
@ -321,10 +332,10 @@ void Chat(char *username, char *channel)
} else if ((ch == '\r') && curpos) { } else if ((ch == '\r') && curpos) {
alarm_on(); alarm_on();
snprintf(buf, 200, "CPUT:2,%d,%s;", mypid, clencode(sbuf)); 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) { if (socket_send(buf) == 0) {
strcpy(buf, socket_receive()); strcpy(buf, socket_receive());
Syslog('c', "< %s", buf); // Syslog('c', "< %s", buf);
if (strncmp(buf, "100:2,", 6) == 0) { if (strncmp(buf, "100:2,", 6) == 0) {
strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */ strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */
strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */ strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */
@ -356,8 +367,8 @@ void Chat(char *username, char *channel)
if (socket_send(buf) == 0) { if (socket_send(buf) == 0) {
strncpy(buf, socket_receive(), sizeof(buf)-1); strncpy(buf, socket_receive(), sizeof(buf)-1);
if (strncmp(buf, "100:2,", 6) == 0) { if (strncmp(buf, "100:2,", 6) == 0) {
Syslog('c', "> CGET:1,%d;", mypid); // Syslog('c', "> CGET:1,%d;", mypid);
Syslog('c', "< %s", buf); // Syslog('c', "< %s", buf);
strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */ strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */
strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */ strncpy(resp, strtok(NULL, ","), 5); /* Should be 2 */
strncpy(resp, strtok(NULL, ","), 5); /* 1= fatal error */ strncpy(resp, strtok(NULL, ","), 5); /* 1= fatal error */
@ -393,10 +404,10 @@ void Chat(char *username, char *channel)
* Close server connection * Close server connection
*/ */
snprintf(buf, 200, "CCLO,1,%d;", mypid); snprintf(buf, 200, "CCLO,1,%d;", mypid);
Syslog('c', "> %s", buf); // Syslog('c', "> %s", buf);
if (socket_send(buf) == 0) { if (socket_send(buf) == 0) {
strcpy(buf, socket_receive()); strcpy(buf, socket_receive());
Syslog('c', "< %s", buf); // Syslog('c', "< %s", buf);
} }
sleep(2); sleep(2);
clear(); clear();