2001-11-10 17:14:16 +00:00
|
|
|
|
/*****************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* $Id$
|
|
|
|
|
* Purpose ...............: Display ANSI/ASCII textfiles
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************
|
2007-02-17 12:14:16 +00:00
|
|
|
|
* Copyright (C) 1997-2007
|
2001-11-10 17:14:16 +00:00
|
|
|
|
*
|
|
|
|
|
* 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
|
2003-08-15 20:05:34 +00:00
|
|
|
|
* Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
2001-11-10 17:14:16 +00:00
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
2002-06-30 12:48:44 +00:00
|
|
|
|
#include "../config.h"
|
2004-02-21 17:22:00 +00:00
|
|
|
|
#include "../lib/mbselib.h"
|
2001-11-10 17:14:16 +00:00
|
|
|
|
#include "../lib/mbse.h"
|
2002-01-07 19:16:03 +00:00
|
|
|
|
#include "../lib/users.h"
|
2001-11-10 17:14:16 +00:00
|
|
|
|
#include "../lib/msgtext.h"
|
|
|
|
|
#include "../lib/msg.h"
|
|
|
|
|
#include "funcs.h"
|
|
|
|
|
#include "language.h"
|
|
|
|
|
#include "oneline.h"
|
|
|
|
|
#include "misc.h"
|
|
|
|
|
#include "timeout.h"
|
|
|
|
|
#include "timecheck.h"
|
|
|
|
|
#include "exitinfo.h"
|
|
|
|
|
#include "mail.h"
|
|
|
|
|
#include "email.h"
|
2003-02-07 20:49:01 +00:00
|
|
|
|
#include "input.h"
|
2001-11-10 17:14:16 +00:00
|
|
|
|
#include "dispfile.h"
|
2003-04-12 11:12:26 +00:00
|
|
|
|
#include "filesub.h"
|
2004-10-27 11:08:09 +00:00
|
|
|
|
#include "term.h"
|
2004-11-03 20:48:45 +00:00
|
|
|
|
#include "ttyio.h"
|
2001-11-10 17:14:16 +00:00
|
|
|
|
|
|
|
|
|
|
2005-10-07 20:42:35 +00:00
|
|
|
|
extern int rows;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-11-10 17:14:16 +00:00
|
|
|
|
/*
|
|
|
|
|
* Function returns total number of bbs users
|
|
|
|
|
*/
|
|
|
|
|
int TotalUsers(void);
|
|
|
|
|
int TotalUsers(void)
|
|
|
|
|
{
|
2004-11-03 20:48:45 +00:00
|
|
|
|
FILE *pUsrConfig;
|
|
|
|
|
int ch = 0;
|
|
|
|
|
char *temp;
|
|
|
|
|
struct userhdr uhdr;
|
|
|
|
|
struct userrec u;
|
|
|
|
|
|
|
|
|
|
temp = calloc(PATH_MAX, sizeof(char));
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
2004-11-03 20:48:45 +00:00
|
|
|
|
if(( pUsrConfig = fopen(temp,"rb")) == NULL)
|
|
|
|
|
WriteError("ControlCodeK: Can't open users file %s for reading", temp);
|
|
|
|
|
else {
|
|
|
|
|
fread(&uhdr, sizeof(uhdr), 1, pUsrConfig);
|
|
|
|
|
|
|
|
|
|
while (fread(&u, uhdr.recsize, 1, pUsrConfig) == 1)
|
|
|
|
|
if ((!u.Deleted) && (strlen(u.sUserName) > 0))
|
|
|
|
|
ch++;
|
|
|
|
|
|
|
|
|
|
fclose(pUsrConfig);
|
|
|
|
|
}
|
|
|
|
|
free(temp);
|
|
|
|
|
|
|
|
|
|
return ch;
|
2001-11-10 17:14:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-02-07 20:49:01 +00:00
|
|
|
|
/*
|
|
|
|
|
* Function will display a aras rulefile to the user.
|
|
|
|
|
* Searches in rules directory first for a file with
|
|
|
|
|
* the full name of the area, then the fule name of the
|
|
|
|
|
* area with a .rul suffix, and finally for the first
|
|
|
|
|
* 8 characters of the areaname with a .rul suffix.
|
|
|
|
|
* The search is case insensitive.
|
|
|
|
|
*
|
|
|
|
|
* Menu 221.
|
|
|
|
|
*/
|
|
|
|
|
void DisplayRules(void)
|
|
|
|
|
{
|
|
|
|
|
DIR *dp;
|
|
|
|
|
struct dirent *de;
|
|
|
|
|
int Found = FALSE;
|
2005-08-29 12:50:02 +00:00
|
|
|
|
char temp[PATH_MAX];
|
2003-02-07 20:49:01 +00:00
|
|
|
|
|
|
|
|
|
if ((dp = opendir(CFG.rulesdir)) == NULL) {
|
|
|
|
|
WriteError("$Can't open directory %s", CFG.rulesdir);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
2003-02-07 20:49:01 +00:00
|
|
|
|
/* Can't open directory for listing: */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(LIGHTRED, BLACK, (char *) Language(290));
|
|
|
|
|
Enter(2);
|
2003-02-07 20:49:01 +00:00
|
|
|
|
Pause();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while ((de = readdir(dp))) {
|
|
|
|
|
if (de->d_name[0] != '.') {
|
|
|
|
|
strcpy(temp, msgs.Tag);
|
|
|
|
|
if (strcasecmp(de->d_name, temp) == 0) {
|
|
|
|
|
Found = TRUE;
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s/%s", CFG.rulesdir, de->d_name);
|
2003-02-07 20:49:01 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s.rul", temp);
|
2003-02-07 20:49:01 +00:00
|
|
|
|
if (strcasecmp(de->d_name, temp) == 0) {
|
|
|
|
|
Found = TRUE;
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s/%s", CFG.rulesdir, de->d_name);
|
2003-02-07 20:49:01 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
memset(&temp, 0, sizeof(temp));
|
|
|
|
|
strncpy(temp, msgs.Tag, 8);
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s.rul", temp);
|
2003-02-07 20:49:01 +00:00
|
|
|
|
if (strcasecmp(de->d_name, temp) == 0) {
|
|
|
|
|
Found = TRUE;
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s/%s", CFG.rulesdir, de->d_name);
|
2003-02-07 20:49:01 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
closedir(dp);
|
|
|
|
|
|
|
|
|
|
if (Found) {
|
|
|
|
|
Syslog('+', "Display rules: %s", temp);
|
|
|
|
|
DisplayTextFile(temp);
|
|
|
|
|
} else {
|
|
|
|
|
Syslog('+', "Display rules for %s failed, not found", msgs.Tag);
|
|
|
|
|
Enter(1);
|
|
|
|
|
/* No rules found for this area */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(LIGHTRED, BLACK, (char *) Language(13));
|
|
|
|
|
Enter(2);
|
2003-02-07 20:49:01 +00:00
|
|
|
|
Pause();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Function will display a flat ascii textfile to the
|
|
|
|
|
* user without control codes. This is used to display
|
|
|
|
|
* area rules, but is also called from the menu function
|
|
|
|
|
* that will display a textfile or the contents of a archive.
|
|
|
|
|
*/
|
|
|
|
|
int DisplayTextFile(char *filename)
|
|
|
|
|
{
|
2004-11-03 20:48:45 +00:00
|
|
|
|
FILE *fp;
|
|
|
|
|
char *buf;
|
|
|
|
|
int i, x, z, lc = 0;
|
|
|
|
|
unsigned char c;
|
2003-02-07 20:49:01 +00:00
|
|
|
|
|
|
|
|
|
if ((fp = fopen(filename, "r")) == NULL) {
|
|
|
|
|
WriteError("$DisplayTextFile(%s) failed");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buf = calloc(81, sizeof(char));
|
|
|
|
|
clear();
|
|
|
|
|
colour(CFG.TextColourF, CFG.TextColourB);
|
|
|
|
|
|
|
|
|
|
while (fgets(buf, 79, fp)) {
|
|
|
|
|
i = strlen(buf);
|
|
|
|
|
|
|
|
|
|
for (x = 0; x < i; x++) {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
c = (*(buf + x) & 0xff);
|
2003-02-07 20:49:01 +00:00
|
|
|
|
if (isprint(c))
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTCHAR(c);
|
2003-02-07 20:49:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
2003-02-07 20:49:01 +00:00
|
|
|
|
lc++;
|
|
|
|
|
|
2005-10-07 20:42:35 +00:00
|
|
|
|
if ((lc >= rows) && (lc < 1000)) {
|
2003-02-07 20:49:01 +00:00
|
|
|
|
lc = 0;
|
2003-04-12 11:12:26 +00:00
|
|
|
|
/* More (Y/n/=) */
|
|
|
|
|
pout(CFG.MoreF, CFG.MoreB, (char *) Language(61));
|
|
|
|
|
alarm_on();
|
2004-11-03 20:48:45 +00:00
|
|
|
|
z = toupper(Readkey());
|
2003-04-12 11:12:26 +00:00
|
|
|
|
|
|
|
|
|
if (z == Keystroke(61, 1)) {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
2003-04-12 11:12:26 +00:00
|
|
|
|
fclose(fp);
|
|
|
|
|
free(buf);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (z == Keystroke(61, 2))
|
|
|
|
|
lc = 50000;
|
|
|
|
|
|
|
|
|
|
Blanker(strlen(Language(61)));
|
2003-02-07 20:49:01 +00:00
|
|
|
|
colour(CFG.TextColourF, CFG.TextColourB);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
|
free(buf);
|
|
|
|
|
|
|
|
|
|
Enter(1);
|
|
|
|
|
/* Press ENTER to continue */
|
2003-04-12 11:12:26 +00:00
|
|
|
|
language(CFG.MoreF, CFG.MoreB, 436);
|
2003-02-07 20:49:01 +00:00
|
|
|
|
alarm_on();
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Readkey();
|
2003-02-07 20:49:01 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-11-10 17:14:16 +00:00
|
|
|
|
/*
|
|
|
|
|
* Function will display textfile in either ansi or ascii and
|
|
|
|
|
* display control codes if they exist.
|
|
|
|
|
* Returns Success if it can display the requested file
|
|
|
|
|
*/
|
|
|
|
|
int DisplayFile(char *filename)
|
|
|
|
|
{
|
2007-02-25 20:28:00 +00:00
|
|
|
|
FILE *fp = NULL;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
int iSec = 0;
|
2007-02-25 20:28:00 +00:00
|
|
|
|
char tmp[256], tmp1[256], buf[256], out[1024], newfile[PATH_MAX];
|
|
|
|
|
int x;
|
2004-11-03 20:48:45 +00:00
|
|
|
|
unsigned char c;
|
|
|
|
|
|
2003-04-12 11:12:26 +00:00
|
|
|
|
/*
|
|
|
|
|
* Open the file in the following search order:
|
2007-02-25 20:28:00 +00:00
|
|
|
|
* 1 - users language .ans
|
|
|
|
|
* 2 - default language .ans
|
|
|
|
|
* 3 - Abort, there is no file to show.
|
2003-04-12 11:12:26 +00:00
|
|
|
|
*/
|
2007-02-25 20:28:00 +00:00
|
|
|
|
snprintf(newfile, PATH_MAX, "%s/share/int/txtfiles/%s/%s.ans", getenv("MBSE_ROOT"), lang.lc, filename);
|
|
|
|
|
if ((fp = fopen(newfile, "rb")) == NULL) {
|
|
|
|
|
snprintf(newfile, PATH_MAX, "%s/share/int/txtfiles/%s/%s.ans", getenv("MBSE_ROOT"), CFG.deflang, filename);
|
|
|
|
|
if ((fp = fopen(newfile, "rb")) == NULL) {
|
|
|
|
|
return FALSE;
|
2001-11-10 17:14:16 +00:00
|
|
|
|
}
|
2003-04-12 11:12:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
if (utf8) {
|
|
|
|
|
chartran_init((char *)"CP437", (char *)"UTF-8", 'B');
|
|
|
|
|
}
|
|
|
|
|
Syslog('b', "Displayfile %s %s mode", newfile, utf8? "UTF-8":"CP437");
|
|
|
|
|
memset(&out, 0, sizeof(out));
|
2001-11-10 17:14:16 +00:00
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
while (fgets(buf, sizeof(buf)-1, fp)) {
|
2003-04-12 11:12:26 +00:00
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
for (x = 0; x < strlen(buf); x++) {
|
|
|
|
|
c = buf[x] & 0xff;
|
2004-11-03 20:48:45 +00:00
|
|
|
|
switch (c) {
|
2007-02-25 20:28:00 +00:00
|
|
|
|
case '': strncat(out, ControlCodeU(buf[++x]), sizeof(out)-1);
|
2003-04-12 11:12:26 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
case '': strncat(out, ControlCodeF(buf[++x]), sizeof(out)-1);
|
2003-04-12 11:12:26 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
case '': strncat(out, ControlCodeK(buf[++x]), sizeof(out)-1);
|
2003-04-12 11:12:26 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
case '': PUTSTR(chartran(out));
|
|
|
|
|
memset(&out, 0, sizeof(out));
|
|
|
|
|
alarm_on();
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Readkey();
|
2003-04-12 11:12:26 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '': /*
|
|
|
|
|
* This code will allow you to specify a security level
|
|
|
|
|
* in front of the text, ie ^B32000^Bthis is a test^B
|
|
|
|
|
* will print this is a test only if you have security
|
|
|
|
|
* above 32000. Only one set of control chars per line.
|
|
|
|
|
* You cannot have multiple securitys etc
|
|
|
|
|
*/
|
|
|
|
|
x++;
|
|
|
|
|
strcpy(tmp1, "");
|
2007-02-25 20:28:00 +00:00
|
|
|
|
while (buf[x] != '') {
|
|
|
|
|
snprintf(tmp, sizeof(tmp)-1, "%c", buf[x]);
|
|
|
|
|
strncat(tmp1, tmp, sizeof(tmp1)-1);
|
2003-04-12 11:12:26 +00:00
|
|
|
|
x++;
|
|
|
|
|
}
|
|
|
|
|
x++;
|
|
|
|
|
iSec = atoi(tmp1);
|
2007-02-25 20:28:00 +00:00
|
|
|
|
while ((x <= strlen(buf)) && buf[x] != '') {
|
|
|
|
|
if (exitinfo.Security.level >= iSec) {
|
|
|
|
|
snprintf(tmp1, sizeof(tmp1) -1, "%c", buf[x]);
|
|
|
|
|
strncat(out, tmp1, sizeof(out)-1);
|
|
|
|
|
}
|
2003-04-12 11:12:26 +00:00
|
|
|
|
x++;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
case '\r': break;
|
2003-04-12 11:12:26 +00:00
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
case '\n': strncat(out, (char *)"\r\n", sizeof(out));
|
2004-11-03 20:48:45 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
case '': PUTSTR(chartran(out));
|
|
|
|
|
memset(&out, 0, sizeof(out));
|
|
|
|
|
FLUSHOUT();
|
|
|
|
|
sleep(1);
|
|
|
|
|
break;
|
2003-04-12 11:12:26 +00:00
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
default: snprintf(tmp1, sizeof(tmp1)-1, "%c", buf[x]);
|
|
|
|
|
strncat(out, tmp1, sizeof(out));
|
2003-04-12 11:12:26 +00:00
|
|
|
|
} /* switch */
|
|
|
|
|
} /* for */
|
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
PUTSTR(chartran(out));
|
|
|
|
|
memset(&out, 0, sizeof(out));
|
|
|
|
|
|
|
|
|
|
} /* while fgets */
|
|
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
|
chartran_close();
|
2003-04-12 11:12:26 +00:00
|
|
|
|
return TRUE;
|
2001-11-10 17:14:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int DisplayFileEnter(char *File)
|
|
|
|
|
{
|
2003-04-12 11:12:26 +00:00
|
|
|
|
int rc;
|
2001-11-10 17:14:16 +00:00
|
|
|
|
|
2003-04-12 11:12:26 +00:00
|
|
|
|
rc = DisplayFile(File);
|
|
|
|
|
Enter(1);
|
|
|
|
|
/* Press ENTER to continue */
|
2005-08-20 12:27:08 +00:00
|
|
|
|
language(LIGHTMAGENTA, BLACK, 436);
|
2003-04-12 11:12:26 +00:00
|
|
|
|
alarm_on();
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Readkey();
|
2003-04-12 11:12:26 +00:00
|
|
|
|
return rc;
|
2001-11-10 17:14:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
char *ControlCodeF(int ch)
|
2001-11-10 17:14:16 +00:00
|
|
|
|
{
|
2007-02-25 20:28:00 +00:00
|
|
|
|
static char temp[81];
|
2004-11-03 20:48:45 +00:00
|
|
|
|
|
|
|
|
|
/* Update user info */
|
|
|
|
|
ReadExitinfo();
|
2001-11-10 17:14:16 +00:00
|
|
|
|
|
2004-11-03 20:48:45 +00:00
|
|
|
|
switch (toupper(ch)) {
|
2001-11-10 17:14:16 +00:00
|
|
|
|
case '!':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.sProtocol);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
case 'A':
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(temp, 81, "%d", exitinfo.Uploads);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'B':
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(temp, 81, "%d", exitinfo.Downloads);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'C':
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(temp, 81, "%u", exitinfo.DownloadK);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'D':
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(temp, 81, "%u", exitinfo.UploadK);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'E':
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(temp, 81, "%u", exitinfo.DownloadK + exitinfo.UploadK);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'F':
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(temp, 81, "%u", LIMIT.DownK);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'H':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%d", iAreaNumber);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'I':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", sAreaDesc);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'J':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%u", LIMIT.DownF);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'K':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", LIMIT.Description);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, " ");
|
2004-11-03 20:48:45 +00:00
|
|
|
|
}
|
2007-02-25 20:28:00 +00:00
|
|
|
|
|
|
|
|
|
return temp;
|
2001-11-10 17:14:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
char *ControlCodeU(int ch)
|
2001-11-10 17:14:16 +00:00
|
|
|
|
{
|
2007-02-25 20:28:00 +00:00
|
|
|
|
static char temp[81];
|
2004-11-03 20:48:45 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Update user info
|
|
|
|
|
*/
|
|
|
|
|
TimeCheck();
|
|
|
|
|
ReadExitinfo();
|
2001-11-10 17:14:16 +00:00
|
|
|
|
|
2004-11-03 20:48:45 +00:00
|
|
|
|
switch (toupper(ch)) {
|
2001-11-10 17:14:16 +00:00
|
|
|
|
case 'A':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.sUserName);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'B':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.sLocation);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'C':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.sVoicePhone);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'D':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.sDataPhone);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'E':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", LastLoginDate);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'F':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s %s", StrDateDMY(exitinfo.tFirstLoginDate), StrTimeHMS(exitinfo.tFirstLoginDate));
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'G':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", LastLoginTime);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'H':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%d", exitinfo.Security.level);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'I':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%d", exitinfo.iTotalCalls);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'J':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%d", exitinfo.iTimeUsed);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'K':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%d", exitinfo.iConnectTime);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'L':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%d", exitinfo.iTimeLeft);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'M':
|
2005-10-07 20:42:35 +00:00
|
|
|
|
snprintf(temp, 81, "%d", rows);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'N':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", FirstName);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'O':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", LastName);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'Q':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.ieNEWS ? (char *) Language(147) : (char *) Language(148));
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'P':
|
2007-02-25 20:28:00 +00:00
|
|
|
|
snprintf(temp, 81, "%s", (char *) Language(147));
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'R':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.HotKeys ? (char *) Language(147) : (char *) Language(148));
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'S':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%d", exitinfo.iTimeUsed + exitinfo.iTimeLeft);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'T':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.sDateOfBirth);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'U':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%d", exitinfo.iPosted);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'X':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", lang.Name);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'Y':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.sHandle);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'Z':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.DoNotDisturb ? (char *) Language(147) : (char *) Language(148));
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '1':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.MailScan ? (char *) Language(147) : (char *) Language(148));
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '2':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.ieFILE ? (char *) Language(147) : (char *) Language(148));
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '3':
|
2002-03-05 21:32:52 +00:00
|
|
|
|
switch(exitinfo.MsgEditor) {
|
2005-11-08 21:03:09 +00:00
|
|
|
|
case X_LINEEDIT: snprintf(temp, 81, "%s", Language(388));
|
|
|
|
|
break;
|
|
|
|
|
case FSEDIT: snprintf(temp, 81, "%s", Language(388));
|
|
|
|
|
break;
|
|
|
|
|
case EXTEDIT: snprintf(temp, 81, "%s", Language(389));
|
|
|
|
|
break;
|
|
|
|
|
default: snprintf(temp, 81, "?");
|
2002-03-05 21:32:52 +00:00
|
|
|
|
}
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '4':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.FSemacs ? (char *) Language(147) : (char *) Language(148));
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '5':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.address[0]);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '6':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.address[1]);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '7':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.address[2]);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
case '8':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.OL_ExtInfo ? (char *) Language(147) : (char *) Language(148));
|
2003-03-02 13:29:33 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2004-02-24 22:09:27 +00:00
|
|
|
|
case '9':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", getftnchrs(exitinfo.Charset));
|
2004-02-24 22:09:27 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2006-03-05 12:57:50 +00:00
|
|
|
|
case '0':
|
|
|
|
|
snprintf(temp, 81, "%s", exitinfo.Archiver);
|
|
|
|
|
break;
|
|
|
|
|
|
2001-11-10 17:14:16 +00:00
|
|
|
|
default:
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, " ");
|
2004-11-03 20:48:45 +00:00
|
|
|
|
}
|
2007-02-25 20:28:00 +00:00
|
|
|
|
|
|
|
|
|
return temp;
|
2001-11-10 17:14:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
char *ControlCodeK(int ch)
|
2001-11-10 17:14:16 +00:00
|
|
|
|
{
|
2004-11-03 20:48:45 +00:00
|
|
|
|
FILE *pCallerLog;
|
2007-02-25 20:28:00 +00:00
|
|
|
|
char sDataFile[PATH_MAX];
|
|
|
|
|
static char temp[81];
|
2004-11-03 20:48:45 +00:00
|
|
|
|
lastread LR;
|
2001-11-10 17:14:16 +00:00
|
|
|
|
|
2004-11-03 20:48:45 +00:00
|
|
|
|
switch (toupper(ch)) {
|
2001-11-10 17:14:16 +00:00
|
|
|
|
case 'A':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", (char *) GetDateDMY());
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'B':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", (char *) GetLocalHMS());
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'C':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", (char *) GLCdate());
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'D':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", (char *) GLCdateyy());
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'E':
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(temp, 81, "%d", Speed());
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'F':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", LastCaller);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'G':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%d", TotalUsers());
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'H':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(sDataFile, PATH_MAX, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
|
2001-11-10 17:14:16 +00:00
|
|
|
|
if((pCallerLog = fopen(sDataFile, "rb")) != NULL) {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
fread(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(temp, 81, "%d", SYSINFO.SystemCalls);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
fclose(pCallerLog);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'I':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%d", iMsgAreaNumber + 1);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'J':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", sMsgAreaDesc);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'K':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", Oneliner_Get());
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'L':
|
|
|
|
|
SetMsgArea(iMsgAreaNumber);
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(temp, 81, "%d", MsgBase.Total);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'M':
|
|
|
|
|
LR.UserID = grecno;
|
|
|
|
|
if (Msg_Open(sMsgAreaBase)) {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
if (Msg_GetLastRead(&LR) == TRUE) {
|
|
|
|
|
if (LR.HighReadMsg > MsgBase.Highest)
|
|
|
|
|
LR.HighReadMsg = MsgBase.Highest;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(temp, 81, "%d", LR.HighReadMsg);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
} else
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "?");
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Msg_Close();
|
2001-11-10 17:14:16 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'N':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s", sMailbox);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'O':
|
|
|
|
|
SetEmailArea(sMailbox);
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(temp, 81, "%d", EmailBase.Total);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'P':
|
2005-10-08 21:05:28 +00:00
|
|
|
|
SetEmailArea(sMailbox);
|
2001-11-10 17:14:16 +00:00
|
|
|
|
LR.UserID = grecno;
|
2005-10-08 21:05:28 +00:00
|
|
|
|
if (Msg_Open(sMailpath)) {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
if (Msg_GetLastRead(&LR) == TRUE) {
|
|
|
|
|
if (LR.HighReadMsg > EmailBase.Highest)
|
|
|
|
|
LR.HighReadMsg = EmailBase.Highest;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(temp, 81, "%d", LR.HighReadMsg);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
} else
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "?");
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Msg_Close();
|
2001-11-10 17:14:16 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2001-11-12 21:42:17 +00:00
|
|
|
|
case 'Q':
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, "%s %s", StrDateDMY(LastCallerTime), StrTimeHMS(LastCallerTime));
|
2001-11-12 21:42:17 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2001-11-10 17:14:16 +00:00
|
|
|
|
default:
|
2005-08-29 12:50:02 +00:00
|
|
|
|
snprintf(temp, 81, " ");
|
2001-11-10 17:14:16 +00:00
|
|
|
|
|
2004-11-03 20:48:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-25 20:28:00 +00:00
|
|
|
|
return temp;
|
2001-11-10 17:14:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|