Updates for chat from the bbs
This commit is contained in:
@@ -155,7 +155,7 @@ menu.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs
|
||||
pop3.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h ../lib/msgtext.h ../lib/msg.h msgutil.h pop3.h
|
||||
lastcallers.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h input.h language.h lastcallers.h
|
||||
timeout.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h timeout.h funcs.h bye.h filesub.h language.h
|
||||
chat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h chat.h funcs.h input.h language.h misc.h whoson.h
|
||||
chat.o: ../config.h ../lib/libs.h ../lib/ansi.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h chat.h funcs.h input.h language.h misc.h whoson.h
|
||||
file.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h filesub.h file.h funcs.h input.h language.h misc.h timeout.h exitinfo.h whoson.h change.h
|
||||
mbstat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/mberrors.h mbstat.h
|
||||
misc.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h funcs.h input.h language.h misc.h timeout.h exitinfo.h
|
||||
|
416
mbsebbs/chat.c
416
mbsebbs/chat.c
@@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Sysop to user chat utility
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "../config.h"
|
||||
#include "../lib/libs.h"
|
||||
#include "../lib/ansi.h"
|
||||
#include "../lib/memwatch.h"
|
||||
#include "../lib/mbse.h"
|
||||
#include "../lib/structs.h"
|
||||
@@ -37,6 +38,7 @@
|
||||
#include "../lib/records.h"
|
||||
#include "../lib/common.h"
|
||||
#include "../lib/clcomm.h"
|
||||
#include "../lib/mberrors.h"
|
||||
#include "chat.h"
|
||||
#include "funcs.h"
|
||||
#include "input.h"
|
||||
@@ -45,150 +47,286 @@
|
||||
#include "whoson.h"
|
||||
|
||||
|
||||
|
||||
#define DEVICE "/tmp/chatdev"
|
||||
int chat_with_sysop = FALSE; /* Global sysop chat flag */
|
||||
int chatting = FALSE; /* Global chatting flag */
|
||||
char rbuf[50][80]; /* Chat receive buffer */ /* FIXME: must be a dynamic buffer */
|
||||
int rpointer = 0; /* Chat receive pointer */
|
||||
int rsize = 5; /* Chat receive size */
|
||||
extern pid_t mypid;
|
||||
|
||||
|
||||
void Chat(int channel)
|
||||
void DispMsg(char *);
|
||||
void clrtoeol(void);
|
||||
unsigned char testkey(int, int);
|
||||
|
||||
|
||||
|
||||
unsigned char testkey(int y, int x)
|
||||
{
|
||||
FILE *pGetDev, *pLog, *pBusy, *pChat;
|
||||
int ch;
|
||||
int iLetter = 0;
|
||||
char sDevice[20];
|
||||
char *sLog = NULL;
|
||||
char temp[81] = "";
|
||||
int rc;
|
||||
unsigned char ch = 0;
|
||||
|
||||
if (CFG.iAutoLog)
|
||||
sLog = calloc(56, sizeof(char));
|
||||
Nopper();
|
||||
locate(y, x);
|
||||
fflush(stdout);
|
||||
|
||||
WhosDoingWhat(SYSOPCHAT);
|
||||
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
||||
perror("open /dev/tty");
|
||||
exit(MBERR_TTYIO_ERROR);
|
||||
}
|
||||
Setraw();
|
||||
|
||||
clear();
|
||||
|
||||
if((pGetDev = fopen(DEVICE,"r")) == NULL)
|
||||
WriteError("Can't open file:", DEVICE);
|
||||
else {
|
||||
fscanf(pGetDev, "%19s", sDevice);
|
||||
fclose(pGetDev);
|
||||
}
|
||||
|
||||
if(( pChat = fopen(sDevice,"w")) == NULL)
|
||||
perror("Error");
|
||||
|
||||
/*
|
||||
* Check to see if it must load a external chat program
|
||||
* Check the length of the chat program is greater than Zero
|
||||
* Check if user has execute permisson on the chat program
|
||||
*/
|
||||
if(!CFG.iExternalChat || (strlen(CFG.sExternalChat) < 1) || \
|
||||
(access(CFG.sExternalChat, X_OK) != 0)) {
|
||||
if ((pBusy = fopen("/tmp/.BusyChatting", "w")) == NULL)
|
||||
WriteError("Unable to open BusyChatting file", "/tmp/.BusyChatting");
|
||||
else {
|
||||
fprintf(pBusy, "%s", pTTY);
|
||||
fclose(pBusy);
|
||||
}
|
||||
|
||||
sprintf(temp, "/tmp/.chat.%s", pTTY);
|
||||
if(( pBusy = fopen(temp, "w")) == NULL)
|
||||
WriteError("Unable to open chat.tty file", temp);
|
||||
else
|
||||
fclose(pBusy);
|
||||
|
||||
colour(10, 0);
|
||||
printf("%s\n\r", (char *) Language(59));
|
||||
fflush(stdout);
|
||||
Setraw();
|
||||
|
||||
sleep(2);
|
||||
|
||||
Syslog('+', "Sysop chat started");
|
||||
|
||||
fprintf(pChat, "%s is ready ... \n\r",exitinfo.sUserName);
|
||||
|
||||
while (1) {
|
||||
ch = getc(stdin);
|
||||
ch &= '\377';
|
||||
/* The next statement doesn't work, the chat will start again */
|
||||
if (ch == '\007') {
|
||||
Syslog('+', "Sysop chat ended - User exited chat");
|
||||
unlink("/tmp/chatdev");
|
||||
sprintf(temp, "/tmp/.chat.%s", pTTY);
|
||||
unlink(temp);
|
||||
unlink("/tmp/.BusyChatting");
|
||||
Unsetraw();
|
||||
break;
|
||||
}
|
||||
putchar(ch);
|
||||
putc(ch, pChat);
|
||||
|
||||
if(CFG.iAutoLog) {
|
||||
if(ch != '\b')
|
||||
iLetter++; /* Count the letters user presses for logging */
|
||||
sprintf(sLog, "%s%c", sLog, ch);
|
||||
}
|
||||
|
||||
if (ch == '\n') {
|
||||
ch = '\r';
|
||||
putchar(ch);
|
||||
putc(ch, pChat);
|
||||
}
|
||||
|
||||
if (ch == '\r') {
|
||||
ch = '\n';
|
||||
putchar(ch);
|
||||
putc(ch, pChat);
|
||||
}
|
||||
|
||||
if (ch == '\b') {
|
||||
ch = ' ';
|
||||
putchar(ch);
|
||||
putc(ch, pChat);
|
||||
ch = '\b';
|
||||
putchar(ch);
|
||||
putc(ch, pChat);
|
||||
|
||||
if(CFG.iAutoLog)
|
||||
sLog[--iLetter] = '\0';
|
||||
}
|
||||
|
||||
/* Check if log chat is on and if so log chat to disk */
|
||||
if(CFG.iAutoLog) {
|
||||
if(iLetter >= 55 || ch == '\n') {
|
||||
iLetter = 0;
|
||||
sprintf(temp, "%s/etc/%s", getenv("MBSE_ROOT"), CFG.chat_log);
|
||||
if(( pLog = fopen(temp, "a+")) != NULL) {
|
||||
fflush(pLog);
|
||||
fprintf(pLog, "%s [%s]: %s\n", exitinfo.sUserName, (char *) GetLocalHM(), sLog);
|
||||
fclose(pLog);
|
||||
strcpy(sLog, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(access("/tmp/chatdev", R_OK) != 0) {
|
||||
colour(10, 0);
|
||||
printf("\n\n\n%s\n\n\r", (char *) Language(60));
|
||||
Syslog('+', "Sysop chat ended");
|
||||
sprintf(temp, "/tmp/.chat.%s", pTTY);
|
||||
unlink(temp);
|
||||
unlink("/tmp/.BusyChatting");
|
||||
Unsetraw();
|
||||
Pause();
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* End of ExternalChat Check */
|
||||
} else {
|
||||
system(CFG.sExternalChat);
|
||||
printf("\n\n");
|
||||
Pause();
|
||||
}
|
||||
|
||||
if(CFG.iAutoLog)
|
||||
free(sLog);
|
||||
|
||||
fclose(pChat);
|
||||
rc = Waitchar(&ch, 50);
|
||||
if (rc == 1) {
|
||||
if (ch == KEY_ESCAPE)
|
||||
rc = Escapechar(&ch);
|
||||
}
|
||||
Unsetraw();
|
||||
close(ttyfd);
|
||||
if (rc == 1)
|
||||
return ch;
|
||||
else
|
||||
return '\0';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Display received chat message in the chat window.
|
||||
*/
|
||||
void DispMsg(char *msg)
|
||||
{
|
||||
int i;
|
||||
|
||||
strncpy(rbuf[rpointer], msg, 80);
|
||||
mvprintw(2 + rpointer, 1, rbuf[rpointer]);
|
||||
if (rpointer == rsize) {
|
||||
/*
|
||||
* Scroll buffer
|
||||
*/
|
||||
for (i = 0; i <= rsize; i++) {
|
||||
locate(i + 2, 1);
|
||||
clrtoeol();
|
||||
sprintf(rbuf[i], "%s", rbuf[i+1]);
|
||||
mvprintw(i + 2, 1, rbuf[i]);
|
||||
}
|
||||
} else {
|
||||
rpointer++;
|
||||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Clear to End Of Line
|
||||
*/
|
||||
void clrtoeol(void)
|
||||
{
|
||||
fprintf(stdout, ANSI_CLREOL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Chat, if the parameters are not NULL, a connection with the named
|
||||
* channel is made with the give username which will be forced to the
|
||||
* used nick name. This mode is used for forced sysop chat.
|
||||
* If the parameters are NULL, then it's up to the user what happens.
|
||||
*/
|
||||
void Chat(char *username, char *channel)
|
||||
{
|
||||
int curpos = 0, stop = FALSE, data;
|
||||
unsigned char ch;
|
||||
char sbuf[81], resp[128], *cnt, *msg;
|
||||
static char buf[200];
|
||||
|
||||
WhosDoingWhat(SYSOPCHAT);
|
||||
clear();
|
||||
|
||||
rsize = exitinfo.iScreenLen - 5;
|
||||
rpointer = 0;
|
||||
|
||||
if (username && channel) {
|
||||
colour(LIGHTGREEN, BLACK);
|
||||
/* *** Sysop is starting chat *** */
|
||||
printf("\007%s\n\r", (char *) Language(59));
|
||||
fflush(stdout);
|
||||
sleep(1);
|
||||
printf("\007");
|
||||
fflush(stdout);
|
||||
sleep(1);
|
||||
printf("\007");
|
||||
fflush(stdout);
|
||||
Syslog('+', "Sysop chat started");
|
||||
chat_with_sysop = TRUE;
|
||||
} else {
|
||||
Syslog('+', "User started chatting");
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the screen, this is only possible in ANSI mode.
|
||||
*/
|
||||
clear();
|
||||
locate(1, 1);
|
||||
colour(WHITE, BLUE);
|
||||
clrtoeol();
|
||||
mvprintw(1, 2, "MBSE BBS Chat Server");
|
||||
|
||||
sprintf(buf, "CCON,2,%d,%s", mypid, CFG.sysop);
|
||||
Syslog('-', "> %s", buf);
|
||||
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';
|
||||
colour(LIGHTRED, BLACK);
|
||||
mvprintw(4, 1, msg);
|
||||
sleep(2);
|
||||
Pause();
|
||||
return;
|
||||
chat_with_sysop = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
locate(exitinfo.iScreenLen - 2, 1);
|
||||
colour(WHITE, BLUE);
|
||||
clrtoeol();
|
||||
mvprintw(exitinfo.iScreenLen - 2, 2, "Chat, type \"/EXIT\" to exit");
|
||||
|
||||
colour(LIGHTGRAY, BLACK);
|
||||
mvprintw(exitinfo.iScreenLen - 1, 1, ">");
|
||||
memset(&sbuf, 0, sizeof(sbuf));
|
||||
memset(&rbuf, 0, sizeof(rbuf));
|
||||
|
||||
Syslog('-', "Start loop");
|
||||
chatting = TRUE;
|
||||
|
||||
while (stop == FALSE) {
|
||||
|
||||
/*
|
||||
* Check for new message, loop fast until no more data available.
|
||||
*/
|
||||
data = TRUE;
|
||||
while (data) {
|
||||
sprintf(buf, "CGET:1,%d;", mypid);
|
||||
if (socket_send(buf) == 0) {
|
||||
strcpy(buf, socket_receive());
|
||||
if (strncmp(buf, "100:1,", 6) == 0) {
|
||||
Syslog('-', "> CGET:1,%d;", mypid);
|
||||
Syslog('-', "< %s", buf);
|
||||
strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */
|
||||
strncpy(resp, strtok(NULL, ","), 5); /* Should be 1 */
|
||||
strncpy(resp, strtok(NULL, "\0"), 80); /* The message */
|
||||
resp[strlen(resp)-1] = '\0';
|
||||
DispMsg(resp);
|
||||
} else {
|
||||
data = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for a pressed key, if so then process it
|
||||
*/
|
||||
ch = testkey(exitinfo.iScreenLen -1, curpos + 2);
|
||||
if (ch == '@') {
|
||||
break;
|
||||
} else if (isprint(ch)) {
|
||||
if (curpos < 77) {
|
||||
putchar(ch);
|
||||
fflush(stdout);
|
||||
sbuf[curpos] = ch;
|
||||
curpos++;
|
||||
} else {
|
||||
putchar(7);
|
||||
fflush(stdout);
|
||||
}
|
||||
} else if ((ch == KEY_BACKSPACE) || (ch == KEY_RUBOUT) || (ch == KEY_DEL)) {
|
||||
if (curpos) {
|
||||
curpos--;
|
||||
sbuf[curpos] = '\0';
|
||||
printf("\b \b");
|
||||
} else {
|
||||
putchar(7);
|
||||
}
|
||||
} else if ((ch == '\r') && curpos) {
|
||||
if (strncasecmp(sbuf, "/exit", 5) == 0)
|
||||
stop = TRUE;
|
||||
sprintf(buf, "CPUT:2,%d,%s;", mypid, sbuf);
|
||||
Syslog('-', "> %s", buf);
|
||||
if (socket_send(buf) == 0) {
|
||||
strcpy(buf, socket_receive());
|
||||
Syslog('-', "< %s", buf);
|
||||
if (strncmp(buf, "100:1,", 6) == 0) {
|
||||
strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */
|
||||
strncpy(resp, strtok(NULL, ","), 5); /* Should be 1 */
|
||||
strncpy(resp, strtok(NULL, "\0"), 80); /* The message */
|
||||
resp[strlen(resp)-1] = '\0';
|
||||
DispMsg(resp);
|
||||
}
|
||||
}
|
||||
curpos = 0;
|
||||
memset(&sbuf, 0, sizeof(sbuf));
|
||||
locate(exitinfo.iScreenLen - 1, 2);
|
||||
clrtoeol();
|
||||
mvprintw(exitinfo.iScreenLen - 1, 1, ">");
|
||||
}
|
||||
}
|
||||
chatting = FALSE;
|
||||
|
||||
|
||||
/*
|
||||
* Before sending the close command, purge all outstanding messages.
|
||||
*/
|
||||
data = TRUE;
|
||||
while (data) {
|
||||
sprintf(buf, "CGET:1,%d;", mypid);
|
||||
if (socket_send(buf) == 0) {
|
||||
strcpy(buf, socket_receive());
|
||||
if (strncmp(buf, "100:1,", 6) == 0) {
|
||||
Syslog('-', "> CGET:1,%d;", mypid);
|
||||
Syslog('-', "< %s", buf);
|
||||
strncpy(resp, strtok(buf, ":"), 10); /* Should be 100 */
|
||||
strncpy(resp, strtok(NULL, ","), 5); /* Should be 1 */
|
||||
strncpy(resp, strtok(NULL, "\0"), 80); /* The message */
|
||||
resp[strlen(resp)-1] = '\0';
|
||||
DispMsg(resp);
|
||||
} else {
|
||||
data = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (username && channel) {
|
||||
/*
|
||||
* Disjoin sysop channel
|
||||
*/
|
||||
|
||||
/* *** Sysop has terminated chat *** */
|
||||
sprintf(buf, "%s", (char *) Language(60));
|
||||
DispMsg(buf);
|
||||
Syslog('+', "Sysop chat ended");
|
||||
chat_with_sysop = FALSE;
|
||||
} else {
|
||||
Syslog('+', "User chat ended");
|
||||
}
|
||||
|
||||
/*
|
||||
* Close server connection
|
||||
*/
|
||||
sprintf(buf, "CCLO,1,%d", mypid);
|
||||
Syslog('-', "> %s", buf);
|
||||
if (socket_send(buf) == 0) {
|
||||
strcpy(buf, socket_receive());
|
||||
Syslog('-', "< %s", buf);
|
||||
if (strncmp(buf, "100:1,", 6)) {
|
||||
}
|
||||
}
|
||||
sleep(2);
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -3,6 +3,6 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void Chat(int); /* Chat Function */
|
||||
void Chat(char *, char *); /* Chat Function */
|
||||
|
||||
#endif
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Main startup
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@@ -157,10 +157,6 @@ int main(int argc, char **argv)
|
||||
*/
|
||||
TermInit(1);
|
||||
|
||||
sprintf(temp, "chat.%s", pTTY);
|
||||
if (access(temp, F_OK) == 0)
|
||||
unlink(temp);
|
||||
|
||||
/*
|
||||
* Now it's time to check if the bbs is open. If not, we
|
||||
* log the user off.
|
||||
|
@@ -67,6 +67,8 @@
|
||||
#include "signature.h"
|
||||
|
||||
|
||||
extern pid_t mypid;
|
||||
|
||||
|
||||
/*
|
||||
* Menu stack, 50 levels deep.
|
||||
@@ -93,7 +95,7 @@ void menu()
|
||||
{
|
||||
FILE *pMenuFile;
|
||||
int iFoundKey = FALSE, Key, IsANSI;
|
||||
char *Input, *Semfile, *sMenuPathFileName;
|
||||
char *Input, *Semfile, *sMenuPathFileName, buf[81];
|
||||
|
||||
Input = calloc(PATH_MAX, sizeof(char));
|
||||
sMenuPathFileName = calloc(PATH_MAX, sizeof(char));
|
||||
@@ -191,19 +193,23 @@ void menu()
|
||||
free(Semfile);
|
||||
|
||||
/*
|
||||
* Check if SysOp wants to chat to user everytime user
|
||||
* gets prompt. Make sure /tmp/chatdev exists before
|
||||
* before calling chat(). Make sure if a second user
|
||||
* logs in, that .BusyChatting does exist.
|
||||
* Check if SysOp wants to chat to user everytime user gets prompt.
|
||||
*/
|
||||
if (CFG.iChatPromptChk && (access("/tmp/chatdev", R_OK) == 0) && (access("/tmp/.BusyChatting", F_OK) != 0))
|
||||
Chat(0);
|
||||
if (CFG.iChatPromptChk) {
|
||||
sprintf(buf, "CISC:1,%d", mypid);
|
||||
if (socket_send(buf) == 0) {
|
||||
strcpy(buf, socket_receive());
|
||||
if (strcmp(buf, "100:1,1;") == 0) {
|
||||
Syslog('+', "Forced sysop/user chat");
|
||||
Chat(exitinfo.Name, (char *)"#sysop");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check users timeleft
|
||||
*/
|
||||
TimeCheck();
|
||||
|
||||
alarm_on();
|
||||
|
||||
if (exitinfo.HotKeys) {
|
||||
@@ -409,6 +415,11 @@ void DoMenu(int Type)
|
||||
/* display menuline only */
|
||||
break;
|
||||
|
||||
case 22:
|
||||
/* Chat with any user */
|
||||
Chat(NULL, NULL);
|
||||
break;
|
||||
|
||||
case 101:
|
||||
FileArea_List(menus.OptionalData);
|
||||
break;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* BBS and unix accounts.
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@@ -66,6 +66,7 @@ char UnixName[9]; /* Unix Name */
|
||||
extern char *ieHandle; /* Users Handle */
|
||||
extern time_t t_start; /* Program starttime */
|
||||
int do_mailout = FALSE; /* Just for linking */
|
||||
int chat_with_sysop = FALSE; /* Just for linking */
|
||||
|
||||
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Todo ..................: Implement new config settings.
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@@ -191,10 +191,22 @@ void Page_Sysop(char *String)
|
||||
fflush(stdout);
|
||||
sleep(1);
|
||||
|
||||
// if drop into chat
|
||||
// Chat();
|
||||
// free(Reason);
|
||||
// return;
|
||||
sprintf(buf, "CISC:1,%d", mypid);
|
||||
if (socket_send(buf) == 0) {
|
||||
strcpy(buf, socket_receive());
|
||||
if (strcmp(buf, "100:1,1;") == 0) {
|
||||
/*
|
||||
* First cancel page request
|
||||
*/
|
||||
sprintf(buf, "CCAN:1,%d", mypid);
|
||||
socket_send(buf);
|
||||
socket_receive();
|
||||
Syslog('+', "Sysop responded to paging request");
|
||||
Chat(exitinfo.Name, (char *)"#sysop");
|
||||
free(Reason);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Timecheck functions
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10 Internet: mbroek@users.sourceforge.net
|
||||
@@ -46,10 +46,11 @@
|
||||
#include "input.h"
|
||||
|
||||
|
||||
extern pid_t mypid; /* Pid of this program */
|
||||
extern pid_t mypid; /* Pid of this program */
|
||||
extern int chat_with_sysop; /* True if chatting with sysop */
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* Check for a personal message, this will go via mbsed. If there
|
||||
* is a message, it will be displayed, else nothing happens.
|
||||
*/
|
||||
@@ -103,11 +104,10 @@ void TimeCheck(void)
|
||||
iUserTimeLeft -= Elapsed;
|
||||
sprintf(sUserTimeleft, "%d", iUserTimeLeft);
|
||||
|
||||
sprintf(temp, "/tmp/.chat.%s", pTTY);
|
||||
/*
|
||||
* Update users counter if not chatting
|
||||
*/
|
||||
if(!CFG.iStopChatTime || (access(temp, F_OK) != 0)) {
|
||||
if (!CFG.iStopChatTime || (! chat_with_sysop)) {
|
||||
exitinfo.iTimeLeft -= Elapsed;
|
||||
exitinfo.iConnectTime += Elapsed;
|
||||
exitinfo.iTimeUsed += Elapsed;
|
||||
|
Reference in New Issue
Block a user