Fixed mbsebbs /H for whoson, lastcallers, etc. Added /U switch
This commit is contained in:
parent
208fa17e1b
commit
4ae500914c
13
ChangeLog
13
ChangeLog
@ -4,6 +4,9 @@ $Id$
|
||||
|
||||
v0.35.02 22-Jun-2002
|
||||
|
||||
upgrade:
|
||||
Delete ~/etc/lastcall.data
|
||||
|
||||
general:
|
||||
Added checks for GoldED in external program checks.
|
||||
Added new empty path /opt/mbse/var/boxes.
|
||||
@ -44,10 +47,18 @@ v0.35.02 22-Jun-2002
|
||||
The email address in new created .signature files is only
|
||||
added if global Give Email is true and in the userecord the
|
||||
email is also enabled.
|
||||
The whoson list now supports the /H and /U optional data to
|
||||
display handles or unix names.
|
||||
The send online message now supports the /H and /U optional
|
||||
data to use handles or unix names.
|
||||
The display userlist function now supports the /H and /U
|
||||
optional data to use handles or unix names.
|
||||
The display lastcaller list now also supports the /U optional
|
||||
data to display Unix names.
|
||||
|
||||
mbtask:
|
||||
When first run the goldnode command is only filled in if it
|
||||
excists in the mbtask configuration.
|
||||
exists in the mbtask configuration.
|
||||
Implemented nodes special outbound boxes.
|
||||
|
||||
|
||||
|
8
TODO
8
TODO
@ -19,8 +19,6 @@ mbsebbs:
|
||||
mail, must be user selectable. see remarks of William McBrine.
|
||||
The default is oke now.
|
||||
|
||||
N: The whosin display doesn't honnor the /H switch.
|
||||
|
||||
N: Rewrite chat to use "mbtask". Write chat functions into "mbmon"
|
||||
|
||||
N: Implement session and time/day limits.
|
||||
@ -29,10 +27,6 @@ mbsebbs:
|
||||
|
||||
N: Check for tagged files before logoff
|
||||
|
||||
L: Implement telnet door.
|
||||
|
||||
L: Spell checker in full screen editor.
|
||||
|
||||
L: Better word wrapping or paragraph justification in editor.
|
||||
|
||||
L: E-mail downloads with e-mail verification.
|
||||
@ -80,7 +74,7 @@ mbfido:
|
||||
mbcico:
|
||||
L: Implement modem connect response translation for ISDN lines, i.e.
|
||||
make the CAUSE responses human readable. see McMail for this
|
||||
option.
|
||||
option. Info received that this may be done using mgetty logs.
|
||||
|
||||
N: Implement MD5 crypt in binkp protocol driver.
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<BLOCKQUOTE>
|
||||
<h5>Last update 22-Oct-2001</h5>
|
||||
<h5>Last update 26-Jun-2002</h5>
|
||||
<P> <P>
|
||||
|
||||
<h1>MBSE BBS Global Menus</h1>
|
||||
@ -87,12 +87,14 @@
|
||||
|
||||
<LI value="9"><strong>Display todays callers:</strong> This will display a
|
||||
list of todays callers to the BBS.<br>
|
||||
<strong>Optional data:</strong> "/H" Show handles instead of real names.<br>
|
||||
<strong>Optional data:</strong> "/H" Show handles instead of real names, "/U"
|
||||
show Unix names instead of real names.<br>
|
||||
<P>
|
||||
|
||||
<LI value="10"><strong>Display userlist:</strong> Display all users in the
|
||||
users database except those that are hidden.<br>
|
||||
<strong>Optional data:</strong> "/H" Show handles instead of real names.<br>
|
||||
<strong>Optional data:</strong> "/H" Show handles instead of real names, "/U"
|
||||
show Unix names instead of real names.<br>
|
||||
<P>
|
||||
|
||||
<LI value="11"><strong>Time statistics:</strong> Display the users time
|
||||
@ -125,7 +127,8 @@
|
||||
|
||||
<LI value="16"><strong>Who is online:</strong> Displays the who is online
|
||||
list and what they are doing. Users that are hidden are not displayed.<br>
|
||||
<strong>Optional data:</strong> "/H" Show handles instead of real names.<br>
|
||||
<strong>Optional data:</strong> "/H" Show handles instead of real names, "/U"
|
||||
show Unix names instead of real names.<br>
|
||||
<P>
|
||||
|
||||
<LI value="17"><strong>Comment to sysop:</strong> Enter the texteditor and
|
||||
@ -136,7 +139,8 @@
|
||||
|
||||
<LI value="18"><strong>Send online message:</strong> Send an online message
|
||||
to a user on another line.</br>
|
||||
<strong>Optional data:</strong> "/H" Use handles instead of real names.<br>
|
||||
<strong>Optional data:</strong> "/H" Use handles instead of real names, "/U"
|
||||
use Unix names instead of real names.<br>
|
||||
<P>
|
||||
|
||||
<LI value="19"><strong>Display textfile with more:</strong> This will display
|
||||
|
@ -470,6 +470,7 @@ struct lastcallershdr {
|
||||
struct lastcallers {
|
||||
char UserName[36]; /* User Name */
|
||||
char Handle[36]; /* User Handle */
|
||||
char Name[9]; /* Unix Name */
|
||||
char TimeOn[6]; /* Time user called bbs */
|
||||
int CallTime; /* Time this call */
|
||||
char Device[10]; /* Device user used */
|
||||
|
@ -86,7 +86,7 @@ int CheckName(char *Name)
|
||||
struct userhdr ushdr;
|
||||
struct userrec us;
|
||||
|
||||
temp = calloc(81, sizeof(char));
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
temp1 = calloc(81, sizeof(char));
|
||||
|
||||
strcpy(temp1, tl(Name));
|
||||
|
@ -60,12 +60,8 @@ extern int LC_Door;
|
||||
void LastCallers(char *OpData)
|
||||
{
|
||||
FILE *pLC;
|
||||
int LineCount = 5;
|
||||
int count = 0;
|
||||
char *sFileName;
|
||||
char *Heading;
|
||||
char *Underline;
|
||||
int i, x;
|
||||
int LineCount = 5, count = 0, i, x;
|
||||
char *sFileName, *Heading, *Underline;
|
||||
struct lastcallers lcall;
|
||||
struct lastcallershdr lcallhdr;
|
||||
|
||||
@ -80,7 +76,7 @@ void LastCallers(char *OpData)
|
||||
WriteError("$LastCallers: Can't open %s", sFileName);
|
||||
else {
|
||||
fread(&lcallhdr, sizeof(lcallhdr), 1, pLC);
|
||||
colour(15, 0);
|
||||
colour(WHITE, BLACK);
|
||||
/* Todays callers to */
|
||||
sprintf(Heading, "%s%s", (char *) Language(84), CFG.bbs_name);
|
||||
Center(Heading);
|
||||
@ -90,44 +86,47 @@ void LastCallers(char *OpData)
|
||||
for(i = 0; i < x; i++)
|
||||
sprintf(Underline, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45);
|
||||
|
||||
colour(12, 0);
|
||||
colour(LIGHTRED, BLACK);
|
||||
Center(Underline);
|
||||
|
||||
printf("\n");
|
||||
|
||||
/* # User Name Device timeOn Calls Location */
|
||||
pout(10, 0, (char *) Language(85));
|
||||
pout(LIGHTGREEN, BLACK, (char *) Language(85));
|
||||
Enter(1);
|
||||
|
||||
colour(2, 0);
|
||||
colour(GREEN, BLACK);
|
||||
fLine(79);
|
||||
|
||||
while (fread(&lcall, lcallhdr.recsize, 1, pLC) == 1) {
|
||||
if (!lcall.Hidden) {
|
||||
count++;
|
||||
|
||||
colour(15,0);
|
||||
colour(WHITE, BLACK);
|
||||
printf("%-5d", count);
|
||||
|
||||
colour(11, 0);
|
||||
if((strcmp(OpData, "/H")) == 0) {
|
||||
colour(LIGHTCYAN, BLACK);
|
||||
if ((strcasecmp(OpData, "/H")) == 0) {
|
||||
if ((strcmp(lcall.Handle, "") != 0 && *(lcall.Handle) != ' '))
|
||||
printf("%-20s", lcall.Handle);
|
||||
else
|
||||
printf("%-20s", lcall.UserName);
|
||||
} else
|
||||
} else if (strcasecmp(OpData, "/U") == 0) {
|
||||
printf("%-20s", lcall.Name);
|
||||
} else {
|
||||
printf("%-20s", lcall.UserName);
|
||||
}
|
||||
|
||||
colour(9, 0);
|
||||
colour(LIGHTBLUE, BLACK);
|
||||
printf("%-8s", lcall.Device);
|
||||
|
||||
colour(13, 0);
|
||||
colour(LIGHTMAGENTA, BLACK);
|
||||
printf("%-8s", lcall.TimeOn);
|
||||
|
||||
colour(14, 0);
|
||||
colour(YELLOW, BLACK);
|
||||
printf("%-7d", lcall.Calls);
|
||||
|
||||
colour(12, 0);
|
||||
colour(LIGHTRED, BLACK);
|
||||
printf("%-32s\n", lcall.Location);
|
||||
|
||||
LineCount++;
|
||||
@ -135,10 +134,10 @@ void LastCallers(char *OpData)
|
||||
Pause();
|
||||
LineCount = 0;
|
||||
}
|
||||
} /* End of check if user is sysop */
|
||||
} /* End of check if user is hidden */
|
||||
}
|
||||
|
||||
colour(2, 0);
|
||||
colour(GREEN, BLACK);
|
||||
fLine(79);
|
||||
|
||||
fclose(pLC);
|
||||
|
@ -192,6 +192,7 @@ void SaveLastCallers()
|
||||
memset(&LCALL, 0, sizeof(LCALL));
|
||||
sprintf(LCALL.UserName,"%s", exitinfo.sUserName);
|
||||
sprintf(LCALL.Handle,"%s", exitinfo.sHandle);
|
||||
sprintf(LCALL.Name, "%s", exitinfo.Name);
|
||||
sprintf(LCALL.TimeOn,"%s", StartTime);
|
||||
sprintf(LCALL.Device,"%s", pTTY);
|
||||
LCALL.SecLevel = exitinfo.Security.level;
|
||||
|
@ -45,11 +45,8 @@
|
||||
void UserList(char *OpData)
|
||||
{
|
||||
FILE *pUsrConfig;
|
||||
int LineCount = 2;
|
||||
int iFoundName = FALSE;
|
||||
int iNameCount = 0;
|
||||
char *Name, *sTemp, *User;
|
||||
char *temp;
|
||||
int LineCount = 2, iFoundName = FALSE, iNameCount = 0;
|
||||
char *Name, *sTemp, *User, *temp;
|
||||
struct userhdr uhdr;
|
||||
struct userrec u;
|
||||
|
||||
@ -88,36 +85,44 @@ void UserList(char *OpData)
|
||||
colour(CYAN, BLACK);
|
||||
while (fread(&u, uhdr.recsize, 1, pUsrConfig) == 1) {
|
||||
if ((strcmp(Name,"")) != 0) {
|
||||
if((strcmp(OpData, "/H")) == 0)
|
||||
if (((strcasecmp(OpData, "/H")) == 0) && strlen(u.sHandle))
|
||||
sprintf(User, "%s", u.sHandle);
|
||||
else if ((strcasecmp(OpData, "/U")) == 0)
|
||||
sprintf(User, "%s", u.Name);
|
||||
else
|
||||
sprintf(User, "%s", u.sUserName);
|
||||
|
||||
if ((strstr(tl(User), tl(Name)) != NULL)) {
|
||||
if ((!u.Hidden) && (!u.Deleted)) {
|
||||
if((strcmp(OpData, "/H")) == 0) {
|
||||
if ((strcasecmp(OpData, "/H")) == 0) {
|
||||
if ((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
|
||||
printf("%-25s", u.sHandle);
|
||||
else
|
||||
printf("%-25s", u.sUserName);
|
||||
} else
|
||||
} else if (strcasecmp(OpData, "/U") == 0) {
|
||||
printf("%-25s", u.Name);
|
||||
} else {
|
||||
printf("%-25s", u.sUserName);
|
||||
}
|
||||
|
||||
printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
|
||||
iFoundName = TRUE;
|
||||
LineCount++;
|
||||
iNameCount++;
|
||||
Enter(1);
|
||||
}
|
||||
}
|
||||
} else
|
||||
if ((!u.Hidden) && (!u.Deleted) && (strlen(u.sUserName) > 0)) {
|
||||
} else if ((!u.Hidden) && (!u.Deleted) && (strlen(u.sUserName) > 0)) {
|
||||
if ((strcmp(OpData, "/H")) == 0) {
|
||||
if((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
|
||||
if ((strcasecmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
|
||||
printf("%-25s", u.sHandle);
|
||||
else
|
||||
printf("%-25s", u.sUserName);
|
||||
} else
|
||||
} else if (strcasecmp(OpData, "/U") == 0) {
|
||||
printf("%-25s", u.Name);
|
||||
} else {
|
||||
printf("%-25s", u.sUserName);
|
||||
}
|
||||
|
||||
printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
|
||||
iFoundName = TRUE;
|
||||
|
122
mbsebbs/whoson.c
122
mbsebbs/whoson.c
@ -52,7 +52,11 @@ extern int LC_Download, LC_Upload, LC_Read, LC_Chat, LC_Olr, LC_Door;
|
||||
void WhosOn(char *OpData)
|
||||
{
|
||||
char buf[128], *Heading, *Underline, *cnt, *isdoing, *location, *device;
|
||||
char *fullname, *temp;
|
||||
int i, x, Start = TRUE;
|
||||
FILE *fp;
|
||||
struct userhdr ushdr;
|
||||
struct userrec us;
|
||||
|
||||
Underline = calloc(81, sizeof(char));
|
||||
Heading = calloc(81, sizeof(char));
|
||||
@ -90,20 +94,43 @@ void WhosOn(char *OpData)
|
||||
if (strncmp(buf, "100:0;", 6) == 0)
|
||||
break; /* No more data */
|
||||
if (strstr(buf, "mbsebbs")) {
|
||||
cnt = strtok(buf, ",");
|
||||
strtok(NULL, ",");
|
||||
device = xstrcpy(strtok(NULL, ","));
|
||||
/*
|
||||
* We are only interested in copies of the mbsebbs program
|
||||
*/
|
||||
if ((strcmp(OpData, "/H")) == 0) {
|
||||
cnt = strtok(buf, ",");
|
||||
strtok(NULL, ",");
|
||||
device = xstrcpy(strtok(NULL, ","));
|
||||
fullname = xstrcpy(strtok(NULL, ","));
|
||||
|
||||
if (((strcasecmp(OpData, "/H")) == 0) || (strcasecmp(OpData, "/U") == 0)) {
|
||||
/*
|
||||
* The mbtask daemon has only the users real names, we
|
||||
* want the handle instead.
|
||||
* want the handle or unix name instead.
|
||||
*/
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
||||
if ((fp = fopen(temp,"rb")) != NULL) {
|
||||
fread(&ushdr, sizeof(ushdr), 1, fp);
|
||||
|
||||
while (fread(&us, ushdr.recsize, 1, fp) == 1) {
|
||||
if (strcmp(fullname, us.sUserName) == 0) {
|
||||
if ((strcasecmp(OpData, "/H") == 0) && strlen(us.sHandle)) {
|
||||
free(fullname);
|
||||
fullname = xstrcpy(us.sHandle);
|
||||
} else if (strcasecmp(OpData, "/U") == 0) {
|
||||
free(fullname);
|
||||
fullname = xstrcpy(us.Name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
free(temp);
|
||||
}
|
||||
colour(LIGHTCYAN, BLACK);
|
||||
printf("%-30s", strtok(NULL, ","));
|
||||
printf("%-30s", fullname);
|
||||
free(fullname);
|
||||
|
||||
colour(LIGHTBLUE, BLACK);
|
||||
printf("%-9s", device);
|
||||
@ -182,55 +209,44 @@ void WhosDoingWhat(int iStatus)
|
||||
WriteExitinfo();
|
||||
|
||||
switch(iStatus) {
|
||||
case BROWSING:
|
||||
strcpy(temp, "Browsing Menus");
|
||||
case BROWSING: strcpy(temp, "Browsing Menus");
|
||||
break;
|
||||
|
||||
case DOWNLOAD:
|
||||
strcpy(temp, "Downloading");
|
||||
case DOWNLOAD: strcpy(temp, "Downloading");
|
||||
LC_Download = TRUE;
|
||||
break;
|
||||
|
||||
case UPLOAD:
|
||||
strcpy(temp, "Uploading");
|
||||
case UPLOAD: strcpy(temp, "Uploading");
|
||||
LC_Upload = TRUE;
|
||||
break;
|
||||
|
||||
case READ_POST:
|
||||
strcpy(temp, "Read/post Messages");
|
||||
case READ_POST: strcpy(temp, "Read/post Messages");
|
||||
LC_Read = TRUE;
|
||||
break;
|
||||
|
||||
case DOOR:
|
||||
strcpy(temp, "External Door");
|
||||
case DOOR: strcpy(temp, "External Door");
|
||||
LC_Door = TRUE;
|
||||
break;
|
||||
|
||||
case SYSOPCHAT:
|
||||
strcpy(temp, "Sysop Chat");
|
||||
case SYSOPCHAT: strcpy(temp, "Sysop Chat");
|
||||
LC_Chat = TRUE;
|
||||
break;
|
||||
|
||||
case FILELIST:
|
||||
strcpy(temp, "List Files");
|
||||
case FILELIST: strcpy(temp, "List Files");
|
||||
break;
|
||||
|
||||
case TIMEBANK:
|
||||
strcpy(temp, "Time Bank");
|
||||
case TIMEBANK: strcpy(temp, "Time Bank");
|
||||
LC_Door = TRUE;
|
||||
break;
|
||||
|
||||
case SAFE:
|
||||
strcpy(temp, "Safe Cracker");
|
||||
case SAFE: strcpy(temp, "Safe Cracker");
|
||||
LC_Door = TRUE;
|
||||
break;
|
||||
|
||||
case WHOSON:
|
||||
strcpy(temp, "View Whoson List");
|
||||
case WHOSON: strcpy(temp, "View Whoson List");
|
||||
break;
|
||||
|
||||
case OLR:
|
||||
strcpy(temp, "Offline Reader");
|
||||
case OLR: strcpy(temp, "Offline Reader");
|
||||
LC_Olr = TRUE;
|
||||
break;
|
||||
}
|
||||
@ -244,19 +260,23 @@ void WhosDoingWhat(int iStatus)
|
||||
/*
|
||||
* Function will allow a user to send a on-line message to another user
|
||||
* It will prompt the user for the username. The message is sent thru
|
||||
* mbsed, from the resonse message we can see if we succeeded.
|
||||
* mbtask, from the response message we can see if we succeeded.
|
||||
* Optional data /H and /U for handles and unix names is supported.
|
||||
*/
|
||||
void SendOnlineMsg(char *OpData)
|
||||
{
|
||||
static char buf[128];
|
||||
char *User, *String;
|
||||
char *User, *String, *temp;
|
||||
FILE *fp;
|
||||
struct userhdr ushdr;
|
||||
struct userrec us;
|
||||
|
||||
User = calloc(36, sizeof(char));
|
||||
String = calloc(77, sizeof(char));
|
||||
WhosOn(OpData);
|
||||
|
||||
/* Please enter username to send message to: */
|
||||
pout(3, 0, (char *) Language(430));
|
||||
pout(CYAN, BLACK, (char *) Language(430));
|
||||
colour(CFG.InputColourF, CFG.InputColourB);
|
||||
fflush(stdout);
|
||||
GetstrC(User, 35);
|
||||
@ -266,18 +286,46 @@ void SendOnlineMsg(char *OpData)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we were displaying handles or unix names, then lookup the
|
||||
* users fullname to send to mbtask.
|
||||
*/
|
||||
if ((strcasecmp(OpData, "/H") == 0) || (strcasecmp(OpData, "/U") == 0)) {
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
||||
if ((fp = fopen(temp, "rb")) != NULL) {
|
||||
fread(&ushdr, sizeof(ushdr), 1, fp);
|
||||
Syslog('-', "Using translate");
|
||||
|
||||
while (fread(&us, ushdr.recsize, 1, fp) == 1) {
|
||||
if ((strcasecmp(OpData, "/H") == 0) && strlen(us.sHandle) && (strcasecmp(User, us.sHandle) == 0)) {
|
||||
sprintf(User, "%s", us.sUserName);
|
||||
break;
|
||||
} else if ((strcasecmp(OpData, "/U") == 0) && (strcasecmp(User, us.Name) == 0)) {
|
||||
sprintf(User, "%s", us.sUserName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
free(temp);
|
||||
}
|
||||
|
||||
/* Please enter message to send (Max 76 Characters) */
|
||||
pout(10, 0, (char *)Language(433));
|
||||
pout(10, 0, (char *)"\n> ");
|
||||
pout(LIGHTGREEN, BLACK, (char *)Language(433));
|
||||
pout(LIGHTGREEN, BLACK, (char *)"\n> ");
|
||||
colour(CFG.InputColourF, CFG.InputColourB);
|
||||
fflush(stdout);
|
||||
GetstrC(String, 76);
|
||||
|
||||
if ((strcmp(String, "")) != 0) {
|
||||
buf[0] = '\0';
|
||||
sprintf(buf, "CSPM:3,%s,%s,%s;", strcmp(OpData, "/H") != 0 ? exitinfo.sUserName : \
|
||||
strcmp(exitinfo.sHandle, "") == 0 ? exitinfo.sUserName : \
|
||||
exitinfo.sHandle, User, String);
|
||||
if ((strcasecmp(OpData, "/H") == 0) && strlen(exitinfo.sHandle))
|
||||
sprintf(buf, "CSPM:3,%s,%s,%s;", exitinfo.sHandle, User, String);
|
||||
else if (strcasecmp(OpData, "/U") == 0)
|
||||
sprintf(buf, "CSPM:3,%s,%s,%s;", exitinfo.Name, User, String);
|
||||
else
|
||||
sprintf(buf, "CSPM:3,%s,%s,%s;", exitinfo.sUserName, User, String);
|
||||
|
||||
if (socket_send(buf) == 0) {
|
||||
strcpy(buf, socket_receive());
|
||||
@ -290,7 +338,7 @@ void SendOnlineMsg(char *OpData)
|
||||
printf("\nNo more room in users message buffer\n\n");
|
||||
}
|
||||
if (strncmp(buf, "100:1,1;", 8) == 0) {
|
||||
colour(12, 0);
|
||||
colour(LIGHTRED, BLACK);
|
||||
/* doesn't wish to be disturbed */
|
||||
printf("\n%s %s\n", User, (char *) Language(432));
|
||||
}
|
||||
|
Reference in New Issue
Block a user