Fixes to mbmon screen layout, added basic files for chatserver
This commit is contained in:
@@ -6,13 +6,13 @@ include ../Makefile.global
|
||||
|
||||
SRCS = callstat.c scanout.c taskcomm.c taskinfo.c taskstat.c \
|
||||
mbtask.c outstat.c signame.c taskdisk.c taskregs.c taskutil.c \
|
||||
ports.c calllist.c ping.c crc.c
|
||||
ports.c calllist.c ping.c crc.c taskchat.c
|
||||
HDRS = callstat.h mbtask.h outstat.h signame.h taskdisk.h taskregs.h taskutil.h \
|
||||
libs.h scanout.h taskcomm.h taskinfo.h taskstat.h \
|
||||
ports.h calllist.h ping.h crc.h
|
||||
ports.h calllist.h ping.h crc.h taskchat.h
|
||||
OBJS = callstat.o scanout.o taskcomm.o taskinfo.o taskstat.o \
|
||||
mbtask.o outstat.o signame.o taskdisk.o taskregs.o taskutil.o \
|
||||
ports.o calllist.o ping.o crc.o
|
||||
ports.o calllist.o ping.o crc.o taskchat.o
|
||||
LIBS += ../lib/libnodelist.a
|
||||
OTHER = Makefile issue issue.netbsd
|
||||
|
||||
@@ -93,4 +93,5 @@ ports.o: ../config.h libs.h ../lib/structs.h taskutil.h ../lib/nodelist.h ports.
|
||||
calllist.o: ../config.h libs.h ../lib/structs.h taskstat.h taskutil.h callstat.h outstat.h mbtask.h calllist.h
|
||||
ping.o: ../config.h libs.h ../lib/structs.h ../lib/mberrors.h taskstat.h taskutil.h ping.h
|
||||
crc.o: ../config.h libs.h crc.h
|
||||
taskchat.o: ../config.h libs.h ../lib/structs.h taskchat.h
|
||||
# End of generated dependencies
|
||||
|
36
mbtask/taskchat.c
Normal file
36
mbtask/taskchat.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* Purpose ...............: mbtask - chat server
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
* 1971 BV IJmuiden
|
||||
* the Netherlands
|
||||
*
|
||||
* This file is part of MBSE BBS.
|
||||
*
|
||||
* This BBS is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* MBSE BBS is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with MBSE BBS; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../config.h"
|
||||
#include "libs.h"
|
||||
#include "../lib/structs.h"
|
||||
#include "taskchat.h"
|
||||
|
||||
|
7
mbtask/taskchat.h
Normal file
7
mbtask/taskchat.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef _TASKCHAT_H
|
||||
#define _TASKCHAT_H
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
#endif
|
@@ -360,10 +360,28 @@ int reg_user(char *data)
|
||||
*/
|
||||
int reg_sysop(char *data)
|
||||
{
|
||||
char *cnt;
|
||||
char *cnt, *pid;
|
||||
int rec;
|
||||
|
||||
cnt = strtok(data, ",");
|
||||
pid = strtok(NULL, ",");
|
||||
sysop_present = atoi(strtok(NULL, ";"));
|
||||
|
||||
if ((rec = reg_find(pid)) != -1) {
|
||||
if (sysop_present) {
|
||||
/*
|
||||
* Allthough the sysop is not really chatting, still put channel 0
|
||||
* into chatmode for the sysop's process.
|
||||
*/
|
||||
reginfo[rec].channel = 0;
|
||||
reginfo[rec].chatting = TRUE;
|
||||
} else {
|
||||
reginfo[rec].channel = -1;
|
||||
reginfo[rec].chatting = FALSE;
|
||||
}
|
||||
reginfo[rec].lastcon = time(NULL);
|
||||
}
|
||||
|
||||
Syslog('+', "Sysop present for chat: %s", sysop_present ? "True":"False");
|
||||
return 0;
|
||||
}
|
||||
@@ -415,7 +433,7 @@ char *reg_ipm(char *data)
|
||||
int reg_spm(char *data)
|
||||
{
|
||||
char *cnt, *ch, *from, *too, *txt, *log;
|
||||
int i;
|
||||
int i, error = 0;
|
||||
|
||||
cnt = strtok(data, ",");
|
||||
ch = strtok(NULL, ",");
|
||||
@@ -424,7 +442,7 @@ int reg_spm(char *data)
|
||||
txt = strtok(NULL, "\0");
|
||||
txt[strlen(txt)-1] = '\0';
|
||||
|
||||
Syslog('-', "SIPM:%s,%d,%s,%s,%s;", cnt, ch, from, too, txt);
|
||||
Syslog('-', "SIPM:%s,%s,%s,%s,%s;", cnt, ch, from, too, txt);
|
||||
log = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(log, "%s/log/%s", getenv("MBSE_ROOT"), CFG.chat_log);
|
||||
|
||||
@@ -432,24 +450,23 @@ int reg_spm(char *data)
|
||||
/*
|
||||
* Personal messages and sysop/user chat messages.
|
||||
*/
|
||||
if (reginfo[i].pid && (strcasecmp(reginfo[i].uname, too) == 0) &&
|
||||
((atoi(ch) == -1) || (atoi(ch) == 0)) && (atoi(ch) == reginfo[i].channel)) {
|
||||
if (reginfo[i].pid &&
|
||||
(((strcasecmp(reginfo[i].uname, too) == 0) && (atoi(ch) == -1)) || (atoi(ch) == 0)) &&
|
||||
(atoi(ch) == reginfo[i].channel)) {
|
||||
/*
|
||||
* If the in and out pointers are the same and the
|
||||
* message present flag is still set, then this user
|
||||
* can't get anymore new messages.
|
||||
*/
|
||||
if (reginfo[i].ismsg && (reginfo[i].ptr_in == reginfo[i].ptr_out)) {
|
||||
free(log);
|
||||
return 2;
|
||||
error = 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* If user has the "do not distrurb" flag set, but the sysop ignore's this.
|
||||
*/
|
||||
if (reginfo[i].silent && (atoi(ch) == -1)) {
|
||||
free(log);
|
||||
return 1;
|
||||
error = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -467,9 +484,11 @@ int reg_spm(char *data)
|
||||
ulog(log, (char *)"+", from, ch, txt);
|
||||
}
|
||||
|
||||
Syslog('+', "reg_spm: in=%d out=%d ismsg=%d", reginfo[i].ptr_in, reginfo[i].ptr_out, reginfo[i].ismsg);
|
||||
Syslog('+', "reg_spm: rec=%d in=%d out=%d ismsg=%d", i, reginfo[i].ptr_in, reginfo[i].ptr_out, reginfo[i].ismsg);
|
||||
}
|
||||
if ((atoi(ch) == -1) || (atoi(ch) == 0)) {
|
||||
free(log);
|
||||
return 0;
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user