Fixed missing caller id on ISDN lines

This commit is contained in:
Michiel Broek 2002-12-05 20:44:38 +00:00
parent 91868bcec7
commit 6857476bf8
2 changed files with 136 additions and 136 deletions

View File

@ -55,6 +55,7 @@ v0.35.06
Uploaded files will now also have a 8.3 hard link to the long Uploaded files will now also have a 8.3 hard link to the long
filename. filename.
Filesearch on filename now uses regexp to find the files. Filesearch on filename now uses regexp to find the files.
The caller id didn't show up when the info was available.
mbfido: mbfido:
TIC file forwarding now uses a list of qualified systems to TIC file forwarding now uses a list of qualified systems to

View File

@ -57,168 +57,167 @@ time_t t_start;
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
FILE *pTty; FILE *pTty;
char *p, *tty; char *p, *tty, temp[PATH_MAX];
int i; int i;
char temp[PATH_MAX];
#ifdef MEMWATCH #ifdef MEMWATCH
mwInit(); mwInit();
#endif #endif
printf("Loading MBSE BBS ...\n"); printf("Loading MBSE BBS ...\n");
pTTY = calloc(15, sizeof(char)); pTTY = calloc(15, sizeof(char));
tty = ttyname(1); tty = ttyname(1);
/* /*
* Find username from the environment * Find username from the environment
*/ */
sUnixName[0] = '\0'; sUnixName[0] = '\0';
if (getenv("LOGNAME") != NULL) { if (getenv("LOGNAME") != NULL) {
strcpy(sUnixName, getenv("LOGNAME")); strncpy(sUnixName, getenv("LOGNAME"), 8);
} else if (getenv("USER") != NULL) { } else if (getenv("USER") != NULL) {
strcpy(sUnixName, getenv("USER")); strcpy(sUnixName, getenv("USER"));
} else { } else {
WriteError("No username in environment"); WriteError("No username in environment");
Quick_Bye(MBERR_OK); Quick_Bye(MBERR_OK);
} }
/* /*
* Set the users device to writable by other bbs users, so they * Set the users device to writable by other bbs users, so they
* can send one-line messages * can send one-line messages
*/ */
chmod(tty, 00666); chmod(tty, 00666);
/* /*
* Get MBSE_ROOT Path and load Config into Memory * Get MBSE_ROOT Path and load Config into Memory
*/ */
FindMBSE(); FindMBSE();
/* /*
* Set local time and statistic indexes. * Set local time and statistic indexes.
*/ */
Time_Now = t_start = time(NULL); Time_Now = t_start = time(NULL);
l_date = localtime(&Time_Now); l_date = localtime(&Time_Now);
Diw = l_date->tm_wday; Diw = l_date->tm_wday;
Miy = l_date->tm_mon; Miy = l_date->tm_mon;
ltime = time(NULL); ltime = time(NULL);
/* /*
* Initialize this client with the server. * Initialize this client with the server.
*/ */
do_quiet = TRUE; do_quiet = TRUE;
InitClient(sUnixName, (char *)"mbsebbs", (char *)"Unknown", CFG.logfile, CFG.bbs_loglevel, CFG.error_log, CFG.mgrlog); InitClient(sUnixName, (char *)"mbsebbs", (char *)"Unknown", CFG.logfile, CFG.bbs_loglevel, CFG.error_log, CFG.mgrlog);
IsDoing("Loging in"); IsDoing("Loging in");
Syslog(' ', " "); Syslog(' ', " ");
Syslog(' ', "MBSEBBS v%s", VERSION); Syslog(' ', "MBSEBBS v%s", VERSION);
if ((p = getenv("CONNECT")) != NULL) if ((p = getenv("CONNECT")) != NULL)
Syslog('+', "CONNECT %s", p); Syslog('+', "CONNECT %s", p);
if ((p = getenv("CALLER_ID")) != NULL) if ((p = getenv("CALLER_ID")) != NULL)
if (!strncmp(p, "none", 4)) if (strncmp(p, "none", 4))
Syslog('+', "CALLER %s", p); Syslog('+', "CALLER %s", p);
/* /*
* Initialize * Initialize
*/ */
InitLanguage(); InitLanguage();
InitMenu(); InitMenu();
memset(&MsgBase, 0, sizeof(MsgBase)); memset(&MsgBase, 0, sizeof(MsgBase));
i = getpid(); i = getpid();
if ((tty = ttyname(0)) == NULL) { if ((tty = ttyname(0)) == NULL) {
WriteError("Not at a tty"); WriteError("Not at a tty");
Quick_Bye(MBERR_OK); Quick_Bye(MBERR_OK);
} }
if (strncmp("/dev/", tty, 5) == 0) if (strncmp("/dev/", tty, 5) == 0)
sprintf(pTTY, "%s", tty+5); sprintf(pTTY, "%s", tty+5);
else if (*tty == '/') { else if (*tty == '/') {
tty = strrchr(ttyname(0), '/'); tty = strrchr(ttyname(0), '/');
++tty; ++tty;
sprintf(pTTY, "%s", tty); sprintf(pTTY, "%s", tty);
} }
umask(007); umask(007);
/* /*
* Trap signals * Trap signals
*/ */
for(i = 0; i < NSIG; i++) { for(i = 0; i < NSIG; i++) {
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL)) if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL))
signal(i, (void (*))die); signal(i, (void (*))die);
else else
signal(i, SIG_IGN); signal(i, SIG_IGN);
} }
/* /*
* Default set the terminal to ANSI mode. If your logo * Default set the terminal to ANSI mode. If your logo
* is in color, the user will see color no mather what. * is in color, the user will see color no mather what.
*/ */
TermInit(1); TermInit(1);
sprintf(temp, "chat.%s", pTTY); sprintf(temp, "chat.%s", pTTY);
if(access(temp, F_OK) == 0) if (access(temp, F_OK) == 0)
unlink(temp); unlink(temp);
/* /*
* Now it's time to check if the bbs is open. If not, we * Now it's time to check if the bbs is open. If not, we
* log the user off. * log the user off.
*/ */
if (CheckStatus() == FALSE) { if (CheckStatus() == FALSE) {
Syslog('+', "Kicking user out, the BBS is closed"); Syslog('+', "Kicking user out, the BBS is closed");
Quick_Bye(MBERR_OK); Quick_Bye(MBERR_OK);
} }
clear(); clear();
DisplayLogo(); DisplayLogo();
colour(YELLOW, BLACK); colour(YELLOW, BLACK);
printf("MBSE BBS v%s (Release: %s) on %s/%s\n", VERSION, ReleaseDate, OsName(), OsCPU()); printf("MBSE BBS v%s (Release: %s) on %s/%s\n", VERSION, ReleaseDate, OsName(), OsCPU());
colour(WHITE, BLACK); colour(WHITE, BLACK);
printf("%s\n\n", COPYRIGHT); printf("%s\n\n", COPYRIGHT);
/* /*
* Check if this port is available. * Check if this port is available. In iNode we set a fake
*/ * line number, this will be used by doors.
sprintf(temp, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT")); */
sprintf(temp, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT"));
iNode = 0;
if ((pTty = fopen(temp, "r")) == NULL) {
WriteError("Can't read %s", temp);
} else {
fread(&ttyinfohdr, sizeof(ttyinfohdr), 1, pTty);
iNode = 0; while (fread(&ttyinfo, ttyinfohdr.recsize, 1, pTty) == 1) {
if ((pTty = fopen(temp, "r")) == NULL) { iNode++;
WriteError("Can't read %s", temp); if (strcmp(ttyinfo.tty, pTTY) == 0)
} else { break;
fread(&ttyinfohdr, sizeof(ttyinfohdr), 1, pTty);
while (fread(&ttyinfo, ttyinfohdr.recsize, 1, pTty) == 1) {
iNode++;
if (strcmp(ttyinfo.tty, pTTY) == 0)
break;
}
fclose(pTty);
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
printf("No BBS on this port allowed!\n\n");
Quick_Bye(MBERR_OK);
}
Syslog('b', "Node number %d", iNode);
/*
* Ask whether to display Connect String
*/
if (CFG.iConnectString) {
/* Connected on port */
colour(CYAN, BLACK);
printf("%s\"%s\" ", (char *) Language(348), ttyinfo.comment);
/* on */
printf("%s %s\n", (char *) Language(135), ctime(&ltime));
}
} }
fclose(pTty);
sprintf(sMailbox, "mailbox"); if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
colour(LIGHTGRAY, BLACK); Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
user(); printf("No BBS on this port allowed!\n\n");
return 0; Quick_Bye(MBERR_OK);
}
Syslog('b', "Node number %d", iNode);
/*
* Display Connect String if turned on.
*/
if (CFG.iConnectString) {
/* Connected on port */
colour(CYAN, BLACK);
printf("%s\"%s\" ", (char *) Language(348), ttyinfo.comment);
/* on */
printf("%s %s\n", (char *) Language(135), ctime(&ltime));
}
}
sprintf(sMailbox, "mailbox");
colour(LIGHTGRAY, BLACK);
user();
return 0;
} }