Fixed chat debug logging

This commit is contained in:
Michiel Broek 2003-11-07 20:57:17 +00:00
parent 963e9d1da4
commit 739f4e303d
2 changed files with 12 additions and 11 deletions

View File

@ -17,6 +17,7 @@ v0.39.1 22-Oct-2003
mbsebbs: mbsebbs:
Fixed a bug where the bbs goes into a loop after idle timeout Fixed a bug where the bbs goes into a loop after idle timeout
during login (and maybe in other situations). during login (and maybe in other situations).
Fixed chat debug logging to only the debug.log file.
mbfile: mbfile:
When the areanumber with the adopt command was not given, the When the areanumber with the adopt command was not given, the

View File

@ -208,10 +208,10 @@ void Chat(char *username, char *channel)
mvprintw(1, 2, "MBSE BBS Chat Server"); mvprintw(1, 2, "MBSE BBS Chat Server");
sprintf(buf, "CCON,3,%d,%s,0;", mypid, exitinfo.Name); sprintf(buf, "CCON,3,%d,%s,0;", mypid, exitinfo.Name);
Syslog('-', "> %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('-', "< %s", buf); Syslog('c', "< %s", buf);
if (strncmp(buf, "100:1,", 6) == 0) { if (strncmp(buf, "100:1,", 6) == 0) {
cnt = strtok(buf, ","); cnt = strtok(buf, ",");
msg = strtok(NULL, "\0"); msg = strtok(NULL, "\0");
@ -248,7 +248,7 @@ void Chat(char *username, char *channel)
strcpy(buf, socket_receive()); strcpy(buf, socket_receive());
} }
Syslog('-', "Start loop"); Syslog('c', "Start loop");
chatting = TRUE; chatting = TRUE;
while (stop == FALSE) { while (stop == FALSE) {
@ -262,8 +262,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('-', "> CGET:1,%d;", mypid); Syslog('c', "> CGET:1,%d;", mypid);
Syslog('-', "< %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 */
@ -310,10 +310,10 @@ void Chat(char *username, char *channel)
} }
} else if ((ch == '\r') && curpos) { } else if ((ch == '\r') && curpos) {
sprintf(buf, "CPUT:2,%d,%s;", mypid, sbuf); sprintf(buf, "CPUT:2,%d,%s;", mypid, sbuf);
Syslog('-', "> %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('-', "< %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 */
@ -346,8 +346,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('-', "> CGET:1,%d;", mypid); Syslog('c', "> CGET:1,%d;", mypid);
Syslog('-', "< %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 */
@ -384,10 +384,10 @@ void Chat(char *username, char *channel)
* Close server connection * Close server connection
*/ */
sprintf(buf, "CCLO,1,%d;", mypid); sprintf(buf, "CCLO,1,%d;", mypid);
Syslog('-', "> %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('-', "< %s", buf); Syslog('c', "< %s", buf);
if (strncmp(buf, "100:1,", 6)) { if (strncmp(buf, "100:1,", 6)) {
} }
} }