Added doors single user mode
This commit is contained in:
@@ -62,10 +62,13 @@ void Good_Bye(int onsig)
|
||||
if (onsig != SIGHUP)
|
||||
DisplayFile((char *)"goodbye");
|
||||
|
||||
Syslog('b', "goodbye displayed");
|
||||
|
||||
if (do_mailout)
|
||||
CreateSema((char *)"mailout");
|
||||
|
||||
SaveLastCallers();
|
||||
Syslog('b', "Lastcallers written");
|
||||
|
||||
/*
|
||||
* Update the users database record.
|
||||
|
@@ -175,7 +175,7 @@ void Chat(char *username, char *channel)
|
||||
char sbuf[81], resp[128], *cnt, *msg;
|
||||
static char buf[200];
|
||||
|
||||
WhosDoingWhat(SYSOPCHAT);
|
||||
WhosDoingWhat(SYSOPCHAT, NULL);
|
||||
clear();
|
||||
|
||||
rsize = exitinfo.iScreenLen - 5;
|
||||
|
@@ -97,17 +97,54 @@ char *Rdate(char *ind, int Y2K)
|
||||
/*
|
||||
* Function will run a external program or door
|
||||
*/
|
||||
void ExtDoor(char *Program, int NoDoorsys, int Y2Kdoorsys, int Comport, int NoSuid, int NoPrompt)
|
||||
void ExtDoor(char *Program, int NoDoorsys, int Y2Kdoorsys, int Comport, int NoSuid, int NoPrompt, int SingleUser, char *What)
|
||||
{
|
||||
char *String, *String1;
|
||||
int i, rc;
|
||||
char *temp1;
|
||||
int i, rc, Start;
|
||||
char *temp1, buf[128];
|
||||
FILE *fp;
|
||||
|
||||
temp1 = calloc(PATH_MAX, sizeof(char));
|
||||
String = calloc(81, sizeof(char));
|
||||
|
||||
WhosDoingWhat(DOOR);
|
||||
Start = TRUE;
|
||||
if (SingleUser && What) {
|
||||
/*
|
||||
* Check if the door is in use
|
||||
*/
|
||||
while (TRUE) {
|
||||
if (Start)
|
||||
sprintf(buf, "GMON:1,1;");
|
||||
else
|
||||
sprintf(buf, "GMON:1,0;");
|
||||
Start = FALSE;
|
||||
if (socket_send(buf) == 0) {
|
||||
strcpy(buf, socket_receive());
|
||||
if (strncmp(buf, "100:0;", 6) == 0)
|
||||
break; /* No more data */
|
||||
if (strstr(buf, "mbsebbs")) {
|
||||
strtok(buf, ","); /* Nr of parameters */
|
||||
strtok(NULL, ","); /* Pid */
|
||||
strtok(NULL, ","); /* tty */
|
||||
strtok(NULL, ","); /* username */
|
||||
strtok(NULL, ","); /* program name */
|
||||
strtok(NULL, ","); /* location */
|
||||
if (strcmp(strtok(NULL, ","), menus.DoorName) == 0) {
|
||||
Syslog('+', "User tried single user door %s, but door is in use", menus.DoorName);
|
||||
colour(LIGHTRED, BLACK);
|
||||
/* The door is in use by another user, try again later */
|
||||
printf("\n%s\n\n", (char *) Language(20));
|
||||
Pause();
|
||||
free(temp1);
|
||||
free(String);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WhosDoingWhat(DOOR, What);
|
||||
|
||||
if ((strstr(Program, "/N")) != NULL) {
|
||||
sprintf(temp1, "%d", iNode);
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#ifndef _DOOR_H
|
||||
#define _DOOR_H
|
||||
|
||||
void ExtDoor(char *, int, int, int, int, int); /* Run external door */
|
||||
void ExtDoor(char *, int, int, int, int, int, int, char *); /* Run external door */
|
||||
int exec_nosuid(char *); /* Execute as real user */
|
||||
|
||||
#endif
|
||||
|
@@ -178,7 +178,7 @@ int Export_a_Email(unsigned long Num)
|
||||
|
||||
LastNum = Num;
|
||||
iLineCount = 7;
|
||||
WhosDoingWhat(READ_POST);
|
||||
WhosDoingWhat(READ_POST, NULL);
|
||||
Syslog('+', "Export email %d in area %s", Num, sMailbox);
|
||||
|
||||
/*
|
||||
@@ -374,7 +374,7 @@ int Read_a_Email(unsigned long Num)
|
||||
|
||||
LastNum = Num;
|
||||
iLineCount = 7;
|
||||
WhosDoingWhat(READ_POST);
|
||||
WhosDoingWhat(READ_POST, NULL);
|
||||
|
||||
/*
|
||||
* The area data is already set, so we can do the next things
|
||||
@@ -519,7 +519,7 @@ int EmailPanel(void)
|
||||
{
|
||||
int input;
|
||||
|
||||
WhosDoingWhat(READ_POST);
|
||||
WhosDoingWhat(READ_POST, NULL);
|
||||
|
||||
colour(15, 4);
|
||||
/* (A)gain, (N)ext, (L)ast, (R)eply, (E)nter, (D)elete, (Q)uit, e(X)port */
|
||||
@@ -681,7 +681,7 @@ void Reply_Email(int IsReply)
|
||||
|
||||
x = 0;
|
||||
Line = 1;
|
||||
WhosDoingWhat(READ_POST);
|
||||
WhosDoingWhat(READ_POST, NULL);
|
||||
clear();
|
||||
colour(1,7);
|
||||
printf(" %-71s", sMailbox);
|
||||
@@ -817,7 +817,7 @@ void Write_Email(void)
|
||||
orgbox = xstrcpy(sMailbox);
|
||||
SetEmailArea((char *)"mailbox");
|
||||
|
||||
WhosDoingWhat(READ_POST);
|
||||
WhosDoingWhat(READ_POST, NULL);
|
||||
clear();
|
||||
|
||||
for (i = 0; i < (TEXTBUFSIZE + 1); i++)
|
||||
@@ -907,7 +907,7 @@ void QuickScan_Email(void)
|
||||
long i;
|
||||
|
||||
iLineCount = 2;
|
||||
WhosDoingWhat(READ_POST);
|
||||
WhosDoingWhat(READ_POST, NULL);
|
||||
|
||||
if (EmailBase.Total == 0) {
|
||||
Enter(1);
|
||||
|
@@ -99,7 +99,7 @@ void File_List()
|
||||
_Tag T;
|
||||
|
||||
iLineCount = 0;
|
||||
WhosDoingWhat(FILELIST);
|
||||
WhosDoingWhat(FILELIST, NULL);
|
||||
|
||||
Syslog('+', "Listing File Area # %d", iAreaNumber);
|
||||
|
||||
@@ -184,7 +184,7 @@ void Download(void)
|
||||
|
||||
Enter(2);
|
||||
OldArea = iAreaNumber;
|
||||
WhosDoingWhat(DOWNLOAD);
|
||||
WhosDoingWhat(DOWNLOAD, NULL);
|
||||
system("rm -f ./tag/*");
|
||||
|
||||
if ((tf = fopen("taglist", "r+")) == NULL) {
|
||||
@@ -1005,7 +1005,7 @@ int Upload()
|
||||
char *arc;
|
||||
|
||||
|
||||
WhosDoingWhat(UPLOAD);
|
||||
WhosDoingWhat(UPLOAD, NULL);
|
||||
|
||||
/*
|
||||
* Select default protocol if users hasn't any.
|
||||
@@ -1278,7 +1278,7 @@ int DownloadDirect(char *Name, int Wait)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WhosDoingWhat(DOWNLOAD);
|
||||
WhosDoingWhat(DOWNLOAD, NULL);
|
||||
ReadExitinfo();
|
||||
|
||||
clear();
|
||||
@@ -1524,7 +1524,7 @@ int Download_Home()
|
||||
File = calloc(PATH_MAX, sizeof(char));
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
|
||||
WhosDoingWhat(DOWNLOAD);
|
||||
WhosDoingWhat(DOWNLOAD, NULL);
|
||||
|
||||
colour(14,0);
|
||||
/* Please enter filename: */
|
||||
@@ -1589,7 +1589,7 @@ int Upload_Home()
|
||||
int err;
|
||||
struct stat statfile;
|
||||
|
||||
WhosDoingWhat(UPLOAD);
|
||||
WhosDoingWhat(UPLOAD, NULL);
|
||||
if (!ForceProtocol())
|
||||
return 0;
|
||||
|
||||
|
@@ -402,7 +402,7 @@ void Post_Msg()
|
||||
unsigned short point;
|
||||
|
||||
Line = 1;
|
||||
WhosDoingWhat(READ_POST);
|
||||
WhosDoingWhat(READ_POST, NULL);
|
||||
SetMsgArea(iMsgAreaNumber);
|
||||
|
||||
clear();
|
||||
@@ -811,7 +811,7 @@ int Export_a_Msg(unsigned long Num)
|
||||
|
||||
LastNum = Num;
|
||||
iLineCount = 7;
|
||||
WhosDoingWhat(READ_POST);
|
||||
WhosDoingWhat(READ_POST, NULL);
|
||||
|
||||
/*
|
||||
* The sysop has a choice to export to the rules directory.
|
||||
@@ -960,7 +960,7 @@ int Read_a_Msg(unsigned long Num, int UpdateLR)
|
||||
|
||||
LastNum = Num;
|
||||
iLineCount = 7;
|
||||
WhosDoingWhat(READ_POST);
|
||||
WhosDoingWhat(READ_POST, NULL);
|
||||
|
||||
/*
|
||||
* The area data is already set, so we can do the next things
|
||||
@@ -1172,7 +1172,7 @@ int ReadPanel()
|
||||
{
|
||||
int input;
|
||||
|
||||
WhosDoingWhat(READ_POST);
|
||||
WhosDoingWhat(READ_POST, NULL);
|
||||
|
||||
colour(WHITE, RED);
|
||||
/*
|
||||
@@ -1310,7 +1310,7 @@ void Reply_Msg(int IsReply)
|
||||
strncpy(msgid, Msg.Msgid, 80);
|
||||
|
||||
x = 0;
|
||||
WhosDoingWhat(READ_POST);
|
||||
WhosDoingWhat(READ_POST, NULL);
|
||||
clear();
|
||||
colour(BLUE, LIGHTGRAY);
|
||||
printf(" %-71s", sMsgAreaDesc);
|
||||
@@ -1486,7 +1486,7 @@ void QuickScan_Msgs()
|
||||
long i;
|
||||
|
||||
iLineCount = 2;
|
||||
WhosDoingWhat(READ_POST);
|
||||
WhosDoingWhat(READ_POST, NULL);
|
||||
|
||||
if (MsgBase.Total == 0) {
|
||||
Enter(1);
|
||||
@@ -1552,7 +1552,7 @@ void Delete_Msg()
|
||||
char *temp;
|
||||
unsigned long Msgnum = 0L;
|
||||
|
||||
WhosDoingWhat(READ_POST);
|
||||
WhosDoingWhat(READ_POST, NULL);
|
||||
|
||||
/*
|
||||
* The area data is already set, so we can do the next things
|
||||
@@ -2524,7 +2524,7 @@ int Ext_Edit()
|
||||
}
|
||||
fclose(fd);
|
||||
stat( tmpname, &st1 );
|
||||
ExtDoor(CFG.externaleditor,FALSE,TRUE,TRUE,FALSE,TRUE);
|
||||
ExtDoor(CFG.externaleditor,FALSE,TRUE,TRUE,FALSE,TRUE, FALSE, (char *)"Write message");
|
||||
stat( tmpname, &st2 );
|
||||
}
|
||||
|
||||
|
@@ -104,7 +104,7 @@ void menu()
|
||||
*/
|
||||
while (TRUE) {
|
||||
|
||||
WhosDoingWhat(BROWSING);
|
||||
WhosDoingWhat(BROWSING, NULL);
|
||||
|
||||
/*
|
||||
* Open menufile, first users language menu, if it fails
|
||||
@@ -333,7 +333,15 @@ void DoMenu(int Type)
|
||||
|
||||
case 7:
|
||||
/* Run external program */
|
||||
ExtDoor(menus.OptionalData, menus.NoDoorsys, menus.Y2Kdoorsys, menus.Comport, menus.NoSuid, menus.NoPrompt);
|
||||
if (strlen(menus.DoorName) && !menus.HideDoor) {
|
||||
memset(temp, 0, sizeof(temp));
|
||||
strcpy(temp, menus.DoorName);
|
||||
ExtDoor(menus.OptionalData, menus.NoDoorsys, menus.Y2Kdoorsys, menus.Comport,
|
||||
menus.NoSuid, menus.NoPrompt, menus.SingleUser, temp);
|
||||
} else {
|
||||
ExtDoor(menus.OptionalData, menus.NoDoorsys, menus.Y2Kdoorsys, menus.Comport,
|
||||
menus.NoSuid, menus.NoPrompt, menus.SingleUser, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
|
@@ -232,7 +232,7 @@ void OLR_TagArea()
|
||||
long total, Offset, Area;
|
||||
int lines, input, ignore = FALSE, maxlines;
|
||||
|
||||
WhosDoingWhat(OLR);
|
||||
WhosDoingWhat(OLR, NULL);
|
||||
|
||||
Msgname = calloc(PATH_MAX, sizeof(char));
|
||||
Tagname = calloc(PATH_MAX, sizeof(char));
|
||||
@@ -375,7 +375,7 @@ void OLR_UntagArea()
|
||||
long total, Offset, Area;
|
||||
int lines, input, ignore = FALSE, maxlines;
|
||||
|
||||
WhosDoingWhat(OLR);
|
||||
WhosDoingWhat(OLR, NULL);
|
||||
|
||||
Msgname = calloc(PATH_MAX, sizeof(char));
|
||||
Tagname = calloc(PATH_MAX, sizeof(char));
|
||||
@@ -719,7 +719,7 @@ void OLR_ViewTags()
|
||||
long total, Area = 0;
|
||||
int lines, input, ignore = FALSE, maxlines;
|
||||
|
||||
WhosDoingWhat(OLR);
|
||||
WhosDoingWhat(OLR, NULL);
|
||||
|
||||
Tagname = calloc(PATH_MAX, sizeof(char));
|
||||
Msgname = calloc(PATH_MAX, sizeof(char));
|
||||
@@ -813,7 +813,7 @@ int OLR_Prescan()
|
||||
FILE *mf, *tf;
|
||||
int x;
|
||||
|
||||
WhosDoingWhat(OLR);
|
||||
WhosDoingWhat(OLR, NULL);
|
||||
clear();
|
||||
colour(LIGHTMAGENTA, BLACK);
|
||||
/* Offline Reader Download */
|
||||
@@ -939,7 +939,7 @@ void DrawBar(char *Pktname)
|
||||
|
||||
void OLR_RestrictDate()
|
||||
{
|
||||
WhosDoingWhat(OLR);
|
||||
WhosDoingWhat(OLR, NULL);
|
||||
|
||||
printf("Not Yet Implemented\n");
|
||||
Pause();
|
||||
@@ -1022,7 +1022,7 @@ void OLR_Upload(void)
|
||||
return;
|
||||
}
|
||||
|
||||
WhosDoingWhat(OLR);
|
||||
WhosDoingWhat(OLR, NULL);
|
||||
clear();
|
||||
colour(LIGHTMAGENTA, BLACK);
|
||||
/* Offline Reader Upload */
|
||||
|
@@ -62,7 +62,7 @@ void WhosOn(char *OpData)
|
||||
Underline = calloc(81, sizeof(char));
|
||||
Heading = calloc(81, sizeof(char));
|
||||
|
||||
WhosDoingWhat(WHOSON);
|
||||
WhosDoingWhat(WHOSON, NULL);
|
||||
|
||||
clear();
|
||||
Enter(1);
|
||||
@@ -174,9 +174,15 @@ void WhosOn(char *OpData)
|
||||
else if (strstr(isdoing, "Offline"))
|
||||
/* Offline Reader */
|
||||
printf("%-15s", (char *) Language(429));
|
||||
else
|
||||
/* Browsing */ /* This is default when nothing matches */
|
||||
printf("%-15s", (char *) Language(418));
|
||||
else {
|
||||
/*
|
||||
* This is default when nothing matches, with doors this
|
||||
* will show the name of the door.
|
||||
*/
|
||||
if (strlen(isdoing) > 15)
|
||||
isdoing[15] = '\0';
|
||||
printf("%-15s", isdoing);
|
||||
}
|
||||
|
||||
colour(LIGHTRED, BLACK);
|
||||
printf("%-25s\n", location);
|
||||
@@ -200,7 +206,7 @@ void WhosOn(char *OpData)
|
||||
/*
|
||||
* Function will update users file and and update exitinfo.iStatus
|
||||
*/
|
||||
void WhosDoingWhat(int iStatus)
|
||||
void WhosDoingWhat(int iStatus, char *what)
|
||||
{
|
||||
char *temp;
|
||||
|
||||
@@ -226,7 +232,10 @@ void WhosDoingWhat(int iStatus)
|
||||
LC_Read = TRUE;
|
||||
break;
|
||||
|
||||
case DOOR: strcpy(temp, "External Door");
|
||||
case DOOR: if (what)
|
||||
strcpy(temp, what);
|
||||
else
|
||||
strcpy(temp, "External Door");
|
||||
LC_Door = TRUE;
|
||||
break;
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#define _WHOSON_H
|
||||
|
||||
void WhosOn(char *); /* What users are currently online */
|
||||
void WhosDoingWhat(int); /* Update what user is doing */
|
||||
void WhosDoingWhat(int, char *); /* Update what user is doing */
|
||||
void SendOnlineMsg(char *); /* Send On-Line Message to User */
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user