Fixed mbsebbs /H for whoson, lastcallers, etc. Added /U switch

This commit is contained in:
Michiel Broek 2002-06-26 20:29:45 +00:00
parent 208fa17e1b
commit 4ae500914c
9 changed files with 418 additions and 355 deletions

View File

@ -4,6 +4,9 @@ $Id$
v0.35.02 22-Jun-2002 v0.35.02 22-Jun-2002
upgrade:
Delete ~/etc/lastcall.data
general: general:
Added checks for GoldED in external program checks. Added checks for GoldED in external program checks.
Added new empty path /opt/mbse/var/boxes. 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 The email address in new created .signature files is only
added if global Give Email is true and in the userecord the added if global Give Email is true and in the userecord the
email is also enabled. 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: mbtask:
When first run the goldnode command is only filled in if it 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. Implemented nodes special outbound boxes.

8
TODO
View File

@ -19,8 +19,6 @@ mbsebbs:
mail, must be user selectable. see remarks of William McBrine. mail, must be user selectable. see remarks of William McBrine.
The default is oke now. 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: Rewrite chat to use "mbtask". Write chat functions into "mbmon"
N: Implement session and time/day limits. N: Implement session and time/day limits.
@ -29,10 +27,6 @@ mbsebbs:
N: Check for tagged files before logoff 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: Better word wrapping or paragraph justification in editor.
L: E-mail downloads with e-mail verification. L: E-mail downloads with e-mail verification.
@ -80,7 +74,7 @@ mbfido:
mbcico: mbcico:
L: Implement modem connect response translation for ISDN lines, i.e. L: Implement modem connect response translation for ISDN lines, i.e.
make the CAUSE responses human readable. see McMail for this 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. N: Implement MD5 crypt in binkp protocol driver.

View File

@ -12,7 +12,7 @@
</HEAD> </HEAD>
<BODY> <BODY>
<BLOCKQUOTE> <BLOCKQUOTE>
<h5>Last update 22-Oct-2001</h5> <h5>Last update 26-Jun-2002</h5>
<P>&nbsp;<P> <P>&nbsp;<P>
<h1>MBSE BBS Global Menus</h1> <h1>MBSE BBS Global Menus</h1>
@ -87,12 +87,14 @@
<LI value="9"><strong>Display todays callers:</strong> This will display a <LI value="9"><strong>Display todays callers:</strong> This will display a
list of todays callers to the BBS.<br> 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> <P>
<LI value="10"><strong>Display userlist:</strong> Display all users in the <LI value="10"><strong>Display userlist:</strong> Display all users in the
users database except those that are hidden.<br> 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> <P>
<LI value="11"><strong>Time statistics:</strong> Display the users time <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 <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> 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> <P>
<LI value="17"><strong>Comment to sysop:</strong> Enter the texteditor and <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 <LI value="18"><strong>Send online message:</strong> Send an online message
to a user on another line.</br> 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> <P>
<LI value="19"><strong>Display textfile with more:</strong> This will display <LI value="19"><strong>Display textfile with more:</strong> This will display

View File

@ -470,6 +470,7 @@ struct lastcallershdr {
struct lastcallers { struct lastcallers {
char UserName[36]; /* User Name */ char UserName[36]; /* User Name */
char Handle[36]; /* User Handle */ char Handle[36]; /* User Handle */
char Name[9]; /* Unix Name */
char TimeOn[6]; /* Time user called bbs */ char TimeOn[6]; /* Time user called bbs */
int CallTime; /* Time this call */ int CallTime; /* Time this call */
char Device[10]; /* Device user used */ char Device[10]; /* Device user used */

View File

@ -86,7 +86,7 @@ int CheckName(char *Name)
struct userhdr ushdr; struct userhdr ushdr;
struct userrec us; struct userrec us;
temp = calloc(81, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
temp1 = calloc(81, sizeof(char)); temp1 = calloc(81, sizeof(char));
strcpy(temp1, tl(Name)); strcpy(temp1, tl(Name));

View File

@ -59,95 +59,94 @@ extern int LC_Door;
*/ */
void LastCallers(char *OpData) void LastCallers(char *OpData)
{ {
FILE *pLC; FILE *pLC;
int LineCount = 5; int LineCount = 5, count = 0, i, x;
int count = 0; char *sFileName, *Heading, *Underline;
char *sFileName; struct lastcallers lcall;
char *Heading; struct lastcallershdr lcallhdr;
char *Underline;
int i, x;
struct lastcallers lcall;
struct lastcallershdr lcallhdr;
sFileName = calloc(PATH_MAX, sizeof(char)); sFileName = calloc(PATH_MAX, sizeof(char));
Heading = calloc(81, sizeof(char)); Heading = calloc(81, sizeof(char));
Underline = calloc(81, sizeof(char)); Underline = calloc(81, sizeof(char));
clear(); clear();
sprintf(sFileName,"%s/etc/lastcall.data", getenv("MBSE_ROOT")); sprintf(sFileName,"%s/etc/lastcall.data", getenv("MBSE_ROOT"));
if((pLC = fopen(sFileName,"r")) == NULL) if ((pLC = fopen(sFileName,"r")) == NULL)
WriteError("$LastCallers: Can't open %s", sFileName); WriteError("$LastCallers: Can't open %s", sFileName);
else { else {
fread(&lcallhdr, sizeof(lcallhdr), 1, pLC); fread(&lcallhdr, sizeof(lcallhdr), 1, pLC);
colour(15, 0); colour(WHITE, BLACK);
/* Todays callers to */ /* Todays callers to */
sprintf(Heading, "%s%s", (char *) Language(84), CFG.bbs_name); sprintf(Heading, "%s%s", (char *) Language(84), CFG.bbs_name);
Center(Heading); Center(Heading);
x = strlen(Heading); x = strlen(Heading);
for(i = 0; i < x; i++) for(i = 0; i < x; i++)
sprintf(Underline, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45); sprintf(Underline, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45);
colour(12, 0); colour(LIGHTRED, BLACK);
Center(Underline); Center(Underline);
printf("\n"); printf("\n");
/* # User Name Device timeOn Calls Location */ /* # User Name Device timeOn Calls Location */
pout(10, 0, (char *) Language(85)); pout(LIGHTGREEN, BLACK, (char *) Language(85));
Enter(1); Enter(1);
colour(2, 0); colour(GREEN, BLACK);
fLine(79); fLine(79);
while (fread(&lcall, lcallhdr.recsize, 1, pLC) == 1) { while (fread(&lcall, lcallhdr.recsize, 1, pLC) == 1) {
if(!lcall.Hidden) { if (!lcall.Hidden) {
count++; count++;
colour(15,0); colour(WHITE, BLACK);
printf("%-5d", count); printf("%-5d", count);
colour(11, 0); colour(LIGHTCYAN, BLACK);
if((strcmp(OpData, "/H")) == 0) { if ((strcasecmp(OpData, "/H")) == 0) {
if((strcmp(lcall.Handle, "") != 0 && *(lcall.Handle) != ' ')) if ((strcmp(lcall.Handle, "") != 0 && *(lcall.Handle) != ' '))
printf("%-20s", lcall.Handle); printf("%-20s", lcall.Handle);
else else
printf("%-20s", lcall.UserName); printf("%-20s", lcall.UserName);
} else } else if (strcasecmp(OpData, "/U") == 0) {
printf("%-20s", lcall.UserName); printf("%-20s", lcall.Name);
} else {
colour(9, 0); printf("%-20s", lcall.UserName);
printf("%-8s", lcall.Device);
colour(13, 0);
printf("%-8s", lcall.TimeOn);
colour(14, 0);
printf("%-7d", lcall.Calls);
colour(12, 0);
printf("%-32s\n", lcall.Location);
LineCount++;
if (LineCount == exitinfo.iScreenLen) {
Pause();
LineCount = 0;
}
} /* End of check if user is sysop */
} }
colour(2, 0); colour(LIGHTBLUE, BLACK);
fLine(79); printf("%-8s", lcall.Device);
fclose(pLC); colour(LIGHTMAGENTA, BLACK);
printf("\n"); printf("%-8s", lcall.TimeOn);
Pause();
colour(YELLOW, BLACK);
printf("%-7d", lcall.Calls);
colour(LIGHTRED, BLACK);
printf("%-32s\n", lcall.Location);
LineCount++;
if (LineCount == exitinfo.iScreenLen) {
Pause();
LineCount = 0;
}
} /* End of check if user is hidden */
} }
free(sFileName);
free(Heading); colour(GREEN, BLACK);
free(Underline); fLine(79);
fclose(pLC);
printf("\n");
Pause();
}
free(sFileName);
free(Heading);
free(Underline);
} }

View File

@ -192,6 +192,7 @@ void SaveLastCallers()
memset(&LCALL, 0, sizeof(LCALL)); memset(&LCALL, 0, sizeof(LCALL));
sprintf(LCALL.UserName,"%s", exitinfo.sUserName); sprintf(LCALL.UserName,"%s", exitinfo.sUserName);
sprintf(LCALL.Handle,"%s", exitinfo.sHandle); sprintf(LCALL.Handle,"%s", exitinfo.sHandle);
sprintf(LCALL.Name, "%s", exitinfo.Name);
sprintf(LCALL.TimeOn,"%s", StartTime); sprintf(LCALL.TimeOn,"%s", StartTime);
sprintf(LCALL.Device,"%s", pTTY); sprintf(LCALL.Device,"%s", pTTY);
LCALL.SecLevel = exitinfo.Security.level; LCALL.SecLevel = exitinfo.Security.level;

View File

@ -44,111 +44,116 @@
void UserList(char *OpData) void UserList(char *OpData)
{ {
FILE *pUsrConfig; FILE *pUsrConfig;
int LineCount = 2; int LineCount = 2, iFoundName = FALSE, iNameCount = 0;
int iFoundName = FALSE; char *Name, *sTemp, *User, *temp;
int iNameCount = 0; struct userhdr uhdr;
char *Name, *sTemp, *User; struct userrec u;
char *temp;
struct userhdr uhdr;
struct userrec u;
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
Name = calloc(37, sizeof(char)); Name = calloc(37, sizeof(char));
sTemp = calloc(81, sizeof(char)); sTemp = calloc(81, sizeof(char));
User = calloc(81, sizeof(char)); User = calloc(81, sizeof(char));
clear(); clear();
/* User List */ /* User List */
language(WHITE, BLACK, 126); language(WHITE, BLACK, 126);
Enter(1); Enter(1);
LineCount = 1; LineCount = 1;
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT")); sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((pUsrConfig = fopen(temp, "rb")) == NULL) { if ((pUsrConfig = fopen(temp, "rb")) == NULL) {
WriteError("UserList: Can't open file: %s", temp); WriteError("UserList: Can't open file: %s", temp);
return; return;
} }
fread(&uhdr, sizeof(uhdr), 1, pUsrConfig); fread(&uhdr, sizeof(uhdr), 1, pUsrConfig);
/* Enter Username search string or (Enter) for all users: */ /* Enter Username search string or (Enter) for all users: */
language(WHITE, BLACK, 127); language(WHITE, BLACK, 127);
colour(CFG.InputColourF, CFG.InputColourB); colour(CFG.InputColourF, CFG.InputColourB);
alarm_on(); alarm_on();
GetstrC(Name, 35); GetstrC(Name, 35);
clear(); clear();
/* Name Location Last On Calls */ /* Name Location Last On Calls */
language(WHITE, BLACK, 128); language(WHITE, BLACK, 128);
Enter(1); Enter(1);
colour(GREEN, BLACK); colour(GREEN, BLACK);
fLine(79); fLine(79);
colour(CYAN, BLACK); colour(CYAN, BLACK);
while (fread(&u, uhdr.recsize, 1, pUsrConfig) == 1) { while (fread(&u, uhdr.recsize, 1, pUsrConfig) == 1) {
if ((strcmp(Name,"")) != 0) { if ((strcmp(Name,"")) != 0) {
if((strcmp(OpData, "/H")) == 0) if (((strcasecmp(OpData, "/H")) == 0) && strlen(u.sHandle))
sprintf(User, "%s", 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 ((strcasecmp(OpData, "/H")) == 0) {
if ((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
printf("%-25s", u.sHandle);
else else
sprintf(User, "%s", u.sUserName); printf("%-25s", u.sUserName);
} else if (strcasecmp(OpData, "/U") == 0) {
printf("%-25s", u.Name);
} else {
printf("%-25s", u.sUserName);
}
if ((strstr(tl(User), tl(Name)) != NULL)) { printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
if ((!u.Hidden) && (!u.Deleted)) { iFoundName = TRUE;
if((strcmp(OpData, "/H")) == 0) { LineCount++;
if((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' ')) iNameCount++;
printf("%-25s", u.sHandle); Enter(1);
else
printf("%-25s", u.sUserName);
} else
printf("%-25s", u.sUserName);
printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
iFoundName = TRUE;
LineCount++;
iNameCount++;
}
}
} else
if ((!u.Hidden) && (!u.Deleted) && (strlen(u.sUserName) > 0)) {
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
printf("%-25s", u.sHandle);
else
printf("%-25s", u.sUserName);
} else
printf("%-25s", u.sUserName);
printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
iFoundName = TRUE;
LineCount++;
iNameCount++;
Enter(1);
}
if (LineCount >= exitinfo.iScreenLen - 2) {
LineCount = 0;
Pause();
colour(CYAN, BLACK);
} }
}
} else if ((!u.Hidden) && (!u.Deleted) && (strlen(u.sUserName) > 0)) {
if ((strcmp(OpData, "/H")) == 0) {
if ((strcasecmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
printf("%-25s", u.sHandle);
else
printf("%-25s", u.sUserName);
} 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);
} }
if(!iFoundName) { if (LineCount >= exitinfo.iScreenLen - 2) {
language(CYAN, BLACK, 129); LineCount = 0;
Enter(1); Pause();
colour(CYAN, BLACK);
} }
}
fclose(pUsrConfig); if (!iFoundName) {
language(CYAN, BLACK, 129);
Enter(1);
}
colour(GREEN, BLACK); fclose(pUsrConfig);
fLine(79);
free(temp); colour(GREEN, BLACK);
free(Name); fLine(79);
free(sTemp);
free(User);
Pause(); free(temp);
free(Name);
free(sTemp);
free(User);
Pause();
} }

View File

@ -51,119 +51,146 @@ extern int LC_Download, LC_Upload, LC_Read, LC_Chat, LC_Olr, LC_Door;
*/ */
void WhosOn(char *OpData) void WhosOn(char *OpData)
{ {
char buf[128], *Heading, *Underline, *cnt, *isdoing, *location, *device; char buf[128], *Heading, *Underline, *cnt, *isdoing, *location, *device;
int i, x, Start = TRUE; char *fullname, *temp;
int i, x, Start = TRUE;
FILE *fp;
struct userhdr ushdr;
struct userrec us;
Underline = calloc(81, sizeof(char)); Underline = calloc(81, sizeof(char));
Heading = calloc(81, sizeof(char)); Heading = calloc(81, sizeof(char));
WhosDoingWhat(WHOSON); WhosDoingWhat(WHOSON);
clear(); clear();
Enter(1); Enter(1);
colour(WHITE, BLACK); colour(WHITE, BLACK);
/* Callers On-Line to */ /* Callers On-Line to */
sprintf(Heading, "%s%s", (char *) Language(414), CFG.bbs_name); sprintf(Heading, "%s%s", (char *) Language(414), CFG.bbs_name);
Center(Heading); Center(Heading);
x = strlen(Heading); x = strlen(Heading);
for(i = 0; i < x; i++) for(i = 0; i < x; i++)
sprintf(Underline, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45); sprintf(Underline, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45);
colour(LIGHTRED, BLACK); colour(LIGHTRED, BLACK);
Center(Underline); Center(Underline);
printf("\n"); printf("\n");
/* Name Device Status Location */ /* Name Device Status Location */
pout(LIGHTGREEN, BLACK, (char *) Language(415)); pout(LIGHTGREEN, BLACK, (char *) Language(415));
Enter(1); Enter(1);
colour(GREEN, BLACK); colour(GREEN, BLACK);
fLine(79); fLine(79);
while (TRUE) { while (TRUE) {
if (Start) if (Start)
sprintf(buf, "GMON:1,1;"); sprintf(buf, "GMON:1,1;");
else else
sprintf(buf, "GMON:1,0;"); sprintf(buf, "GMON:1,0;");
Start = FALSE; Start = FALSE;
if (socket_send(buf) == 0) { if (socket_send(buf) == 0) {
strcpy(buf, socket_receive()); strcpy(buf, socket_receive());
if (strncmp(buf, "100:0;", 6) == 0) if (strncmp(buf, "100:0;", 6) == 0)
break; /* No more data */ break; /* No more data */
if (strstr(buf, "mbsebbs")) { if (strstr(buf, "mbsebbs")) {
cnt = strtok(buf, ","); /*
strtok(NULL, ","); * We are only interested in copies of the mbsebbs program
device = xstrcpy(strtok(NULL, ",")); */
cnt = strtok(buf, ",");
strtok(NULL, ",");
device = xstrcpy(strtok(NULL, ","));
fullname = xstrcpy(strtok(NULL, ","));
if (((strcasecmp(OpData, "/H")) == 0) || (strcasecmp(OpData, "/U") == 0)) {
/* /*
* We are only interested in copies of the mbsebbs program * The mbtask daemon has only the users real names, we
* want the handle or unix name instead.
*/ */
if ((strcmp(OpData, "/H")) == 0) { temp = calloc(PATH_MAX, sizeof(char));
/* sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
* The mbtask daemon has only the users real names, we if ((fp = fopen(temp,"rb")) != NULL) {
* want the handle instead. 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);
} }
colour(LIGHTCYAN, BLACK); free(temp);
printf("%-30s", strtok(NULL, ","));
colour(LIGHTBLUE, BLACK);
printf("%-9s", device);
free(device);
strtok(NULL, ",");
location = xstrcpy(strtok(NULL, ","));
isdoing = xstrcpy(strtok(NULL, ","));
colour(WHITE, BLACK);
if (strstr(isdoing, "Browsing"))
/* Browseng */
printf("%-15s", (char *) Language(418));
else if (strstr(isdoing, "Downloading"))
/* Downloading */
printf("%-15s", (char *) Language(419));
else if (strstr(isdoing, "Uploading"))
/* Uploading */
printf("%-15s", (char *) Language(420));
else if (strstr(isdoing, "Read"))
/* Msg Section */
printf("%-15s", (char *) Language(421));
else if (strstr(isdoing, "External"))
/* External Door */
printf("%-15s", (char *) Language(422));
else if (strstr(isdoing, "Chat"))
/* Chatting */
printf("%-15s", (char *) Language(423));
else if (strstr(isdoing, "Files"))
/* Listing Files */
printf("%-15s", (char *) Language(424));
else if (strstr(isdoing, "Time"))
/* Banking Door */
printf("%-15s", (char *) Language(426));
else if (strstr(isdoing, "Safe"))
/* Safe Door */
printf("%-15s", (char *) Language(427));
else if (strstr(isdoing, "Whoson"))
/* WhosOn List */
printf("%-15s", (char *) Language(428));
else if (strstr(isdoing, "Offline"))
/* Idle */
printf("%-15s", (char *) Language(429));
else
printf("System error ");
colour(LIGHTRED, BLACK);
printf("%-25s\n", location);
free(location);
free(isdoing);
} }
colour(LIGHTCYAN, BLACK);
printf("%-30s", fullname);
free(fullname);
colour(LIGHTBLUE, BLACK);
printf("%-9s", device);
free(device);
strtok(NULL, ",");
location = xstrcpy(strtok(NULL, ","));
isdoing = xstrcpy(strtok(NULL, ","));
colour(WHITE, BLACK);
if (strstr(isdoing, "Browsing"))
/* Browseng */
printf("%-15s", (char *) Language(418));
else if (strstr(isdoing, "Downloading"))
/* Downloading */
printf("%-15s", (char *) Language(419));
else if (strstr(isdoing, "Uploading"))
/* Uploading */
printf("%-15s", (char *) Language(420));
else if (strstr(isdoing, "Read"))
/* Msg Section */
printf("%-15s", (char *) Language(421));
else if (strstr(isdoing, "External"))
/* External Door */
printf("%-15s", (char *) Language(422));
else if (strstr(isdoing, "Chat"))
/* Chatting */
printf("%-15s", (char *) Language(423));
else if (strstr(isdoing, "Files"))
/* Listing Files */
printf("%-15s", (char *) Language(424));
else if (strstr(isdoing, "Time"))
/* Banking Door */
printf("%-15s", (char *) Language(426));
else if (strstr(isdoing, "Safe"))
/* Safe Door */
printf("%-15s", (char *) Language(427));
else if (strstr(isdoing, "Whoson"))
/* WhosOn List */
printf("%-15s", (char *) Language(428));
else if (strstr(isdoing, "Offline"))
/* Idle */
printf("%-15s", (char *) Language(429));
else
printf("System error ");
colour(LIGHTRED, BLACK);
printf("%-25s\n", location);
free(location);
free(isdoing);
} }
} }
}
colour(GREEN, BLACK); colour(GREEN, BLACK);
fLine(79); fLine(79);
free(Underline); free(Underline);
free(Heading); free(Heading);
printf("\n"); printf("\n");
} }
@ -173,70 +200,59 @@ void WhosOn(char *OpData)
*/ */
void WhosDoingWhat(int iStatus) void WhosDoingWhat(int iStatus)
{ {
char *temp; char *temp;
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
ReadExitinfo(); ReadExitinfo();
exitinfo.iStatus = iStatus; exitinfo.iStatus = iStatus;
WriteExitinfo(); WriteExitinfo();
switch(iStatus) { switch(iStatus) {
case BROWSING: case BROWSING: strcpy(temp, "Browsing Menus");
strcpy(temp, "Browsing Menus");
break; break;
case DOWNLOAD: case DOWNLOAD: strcpy(temp, "Downloading");
strcpy(temp, "Downloading");
LC_Download = TRUE; LC_Download = TRUE;
break; break;
case UPLOAD: case UPLOAD: strcpy(temp, "Uploading");
strcpy(temp, "Uploading");
LC_Upload = TRUE; LC_Upload = TRUE;
break; break;
case READ_POST: case READ_POST: strcpy(temp, "Read/post Messages");
strcpy(temp, "Read/post Messages");
LC_Read = TRUE; LC_Read = TRUE;
break; break;
case DOOR: case DOOR: strcpy(temp, "External Door");
strcpy(temp, "External Door");
LC_Door = TRUE; LC_Door = TRUE;
break; break;
case SYSOPCHAT: case SYSOPCHAT: strcpy(temp, "Sysop Chat");
strcpy(temp, "Sysop Chat");
LC_Chat = TRUE; LC_Chat = TRUE;
break; break;
case FILELIST: case FILELIST: strcpy(temp, "List Files");
strcpy(temp, "List Files");
break; break;
case TIMEBANK: case TIMEBANK: strcpy(temp, "Time Bank");
strcpy(temp, "Time Bank");
LC_Door = TRUE; LC_Door = TRUE;
break; break;
case SAFE: case SAFE: strcpy(temp, "Safe Cracker");
strcpy(temp, "Safe Cracker");
LC_Door = TRUE; LC_Door = TRUE;
break; break;
case WHOSON: case WHOSON: strcpy(temp, "View Whoson List");
strcpy(temp, "View Whoson List");
break; break;
case OLR: case OLR: strcpy(temp, "Offline Reader");
strcpy(temp, "Offline Reader");
LC_Olr = TRUE; LC_Olr = TRUE;
break; break;
} }
IsDoing(temp); IsDoing(temp);
free(temp); free(temp);
} }
@ -244,66 +260,98 @@ void WhosDoingWhat(int iStatus)
/* /*
* Function will allow a user to send a on-line message to another user * 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 * 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) void SendOnlineMsg(char *OpData)
{ {
static char buf[128]; static char buf[128];
char *User, *String; char *User, *String, *temp;
FILE *fp;
struct userhdr ushdr;
struct userrec us;
User = calloc(36, sizeof(char)); User = calloc(36, sizeof(char));
String = calloc(77, sizeof(char)); String = calloc(77, sizeof(char));
WhosOn(OpData); WhosOn(OpData);
/* Please enter username to send message to: */
pout(3, 0, (char *) Language(430));
colour(CFG.InputColourF, CFG.InputColourB);
fflush(stdout);
GetstrC(User, 35);
if (!strcmp(User, "")) {
free(User);
free(String);
return;
}
/* Please enter message to send (Max 76 Characters) */
pout(10, 0, (char *)Language(433));
pout(10, 0, (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 (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:1,3;", 8) == 0) {
/* Sorry, there is no user on */
printf("\n%s %s\n\n", (char *) Language(431), User);
}
if (strncmp(buf, "100:1,2;", 8) == 0) {
printf("\nNo more room in users message buffer\n\n");
}
if (strncmp(buf, "100:1,1;", 8) == 0) {
colour(12, 0);
/* doesn't wish to be disturbed */
printf("\n%s %s\n", User, (char *) Language(432));
}
if (strncmp(buf, "100:0;", 6) == 0) {
printf("Message Sent!\n");
Syslog('+', "Online msg to %s: \"%s\"", User, String);
}
}
}
/* Please enter username to send message to: */
pout(CYAN, BLACK, (char *) Language(430));
colour(CFG.InputColourF, CFG.InputColourB);
fflush(stdout);
GetstrC(User, 35);
if (!strcmp(User, "")) {
free(User); free(User);
free(String); free(String);
Pause(); 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(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';
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());
if (strncmp(buf, "100:1,3;", 8) == 0) {
/* Sorry, there is no user on */
printf("\n%s %s\n\n", (char *) Language(431), User);
}
if (strncmp(buf, "100:1,2;", 8) == 0) {
printf("\nNo more room in users message buffer\n\n");
}
if (strncmp(buf, "100:1,1;", 8) == 0) {
colour(LIGHTRED, BLACK);
/* doesn't wish to be disturbed */
printf("\n%s %s\n", User, (char *) Language(432));
}
if (strncmp(buf, "100:0;", 6) == 0) {
printf("Message Sent!\n");
Syslog('+', "Online msg to %s: \"%s\"", User, String);
}
}
}
free(User);
free(String);
Pause();
} }