Added T-Mail support to mbcico
This commit is contained in:
parent
f0fe1e3378
commit
c4eea97ff1
@ -6,6 +6,7 @@ v0.39.6 11-Jan-2004
|
||||
New binkp/1.1 driver fixes for Sun NetBSD.
|
||||
Removed TCP ignore check in EOB state.
|
||||
Transmiter file close now right after last block.
|
||||
Added support for T-Mail fileboxes.
|
||||
|
||||
mbsetup:
|
||||
Reorganised menu 1.4 screen 1 and 2.
|
||||
|
@ -9,7 +9,7 @@ SRCS = zmmisc.c zmrle.c zmrecv.c zmsend.c binkp.c binkpnew.c md5b.c \
|
||||
answer.c chat.c dial.c dietifna.c emsidat.c filelist.c \
|
||||
openfile.c openport.c opentcp.c rdoptions.c yoohoo.c \
|
||||
recvbark.c respfreq.c sendbark.c tcp.c tcpproto.c wazoo.c \
|
||||
filetime.c ftsc.c atoul.c portsel.c \
|
||||
filetime.c ftsc.c atoul.c portsel.c shortbox.c \
|
||||
ttyio.c lutil.c scanout.c emsi.c ulock.c \
|
||||
callstat.c session.c call.c mbcico.c \
|
||||
outstat.c nlinfo.c mbout.c mbtelind.c mbtelout.c
|
||||
@ -18,7 +18,7 @@ HDRS = zmodem.h binkp.h binkpnew.h config.h statetbl.h md5b.h \
|
||||
answer.h chat.h dial.h dietifna.h emsidat.h filelist.h \
|
||||
openfile.h openport.h opentcp.h rdoptions.h yoohoo.h \
|
||||
recvbark.h respfreq.h sendbark.h tcp.h tcpproto.h wazoo.h \
|
||||
filetime.h ftsc.h atoul.h portsel.h \
|
||||
filetime.h ftsc.h atoul.h portsel.h shortbox.h \
|
||||
ttyio.h lutil.h scanout.h emsi.h ulock.h \
|
||||
callstat.h session.h call.h mbcico.h \
|
||||
outstat.h nlinfo.h mbtelind.h mbtelout.h
|
||||
@ -27,7 +27,7 @@ MBCICO_OBJS = zmmisc.o zmrle.o zmrecv.o zmsend.o binkp.o binkpnew.o md5b.o \
|
||||
answer.o chat.o dial.o dietifna.o emsidat.o filelist.o \
|
||||
openfile.o openport.o opentcp.o rdoptions.o yoohoo.o \
|
||||
recvbark.o respfreq.o sendbark.o tcp.o tcpproto.o wazoo.o \
|
||||
filetime.o ftsc.o atoul.o portsel.o \
|
||||
filetime.o ftsc.o atoul.o portsel.o shortbox.o \
|
||||
ttyio.o lutil.o scanout.o emsi.o ulock.o \
|
||||
callstat.o session.o call.o mbcico.o
|
||||
MBOUT_OBJS = outstat.o nlinfo.o mbout.o scanout.o callstat.o
|
||||
@ -113,7 +113,7 @@ chat.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records
|
||||
dial.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/dbnode.h ../lib/mberrors.h config.h chat.h ttyio.h session.h dial.h
|
||||
dietifna.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h emsi.h dietifna.h respfreq.h filelist.h xmrecv.h xmsend.h
|
||||
emsidat.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h emsi.h session.h lutil.h config.h emsidat.h filetime.h
|
||||
filelist.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h config.h session.h filelist.h
|
||||
filelist.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h config.h shortbox.h session.h filelist.h
|
||||
openfile.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h ../lib/users.h ../lib/records.h config.h lutil.h openfile.h
|
||||
openport.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ulock.h ttyio.h mbcico.h openport.h
|
||||
opentcp.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h session.h ttyio.h openport.h opentcp.h
|
||||
@ -129,6 +129,7 @@ filetime.o: ../config.h ../lib/libs.h filetime.h
|
||||
ftsc.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/mberrors.h session.h ttyio.h statetbl.h config.h ftsc.h rdoptions.h recvbark.h filelist.h sendbark.h respfreq.h xmrecv.h xmsend.h inbound.h
|
||||
atoul.o: ../config.h ../lib/libs.h atoul.h
|
||||
portsel.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h portsel.h
|
||||
shortbox.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h shortbox.h
|
||||
ttyio.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ttyio.h lutil.h
|
||||
lutil.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h lutil.h
|
||||
scanout.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbftn.h config.h scanout.h lutil.h
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: fidonet mailer
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2003
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -37,6 +37,7 @@
|
||||
#include "../lib/common.h"
|
||||
#include "../lib/nodelist.h"
|
||||
#include "config.h"
|
||||
#include "shortbox.h"
|
||||
#include "session.h"
|
||||
#include "filelist.h"
|
||||
|
||||
@ -219,46 +220,24 @@ static void check_flo(file_list **lst, char *nm)
|
||||
|
||||
|
||||
|
||||
file_list *create_filelist(fa_list *al, char *fl, int create)
|
||||
void check_filebox(char *, file_list *);
|
||||
void check_filebox(char *boxpath, file_list *st)
|
||||
{
|
||||
file_list *st = NULL, *tmpf;
|
||||
fa_list *tmpa;
|
||||
char flavor, *tmpfl, *nm, *temp, tmpreq[13];
|
||||
struct stat stbuf;
|
||||
int packets = 0;
|
||||
FILE *fp;
|
||||
char *temp;
|
||||
DIR *dp;
|
||||
struct dirent *de;
|
||||
unsigned char buffer[2];
|
||||
struct passwd *pw;
|
||||
struct stat stbuf;
|
||||
|
||||
Syslog('o', "Create_filelist(%s,\"%s\",%d)", al?ascfnode(al->addr,0x1f):"<none>", MBSE_SS(fl), create);
|
||||
made_request = 0;
|
||||
|
||||
for (tmpa = al; tmpa; tmpa = tmpa->next) {
|
||||
Syslog('o', "Check address %s", ascfnode(tmpa->addr, 0x1f));
|
||||
|
||||
/*
|
||||
* For the main aka, check the outbox.
|
||||
*/
|
||||
if ((tmpa->addr) && Loaded && strlen(nodes.OutBox) &&
|
||||
(tmpa->addr->zone == nodes.Aka[0].zone) && (tmpa->addr->net == nodes.Aka[0].net) &&
|
||||
(tmpa->addr->node == nodes.Aka[0].node) && (tmpa->addr->point == nodes.Aka[0].point)) {
|
||||
Syslog('o', "checking outbox %s", nodes.OutBox);
|
||||
if (nodes.Crash)
|
||||
flavor = 'c';
|
||||
else if (nodes.Hold)
|
||||
flavor = 'h';
|
||||
else
|
||||
flavor = 'o';
|
||||
if ((dp = opendir(nodes.OutBox)) == NULL) {
|
||||
Syslog('o', "\"%s\" cannot be opened, proceed", MBSE_SS(nodes.OutBox));
|
||||
if ((dp = opendir(boxpath)) == NULL) {
|
||||
Syslog('o', "\"%s\" cannot be opened, proceed", MBSE_SS(boxpath));
|
||||
} else {
|
||||
Syslog('o', "checking filebox \"%s\"", boxpath);
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
pw = getpwnam((char *)"mbse");
|
||||
while ((de = readdir(dp))) {
|
||||
if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
|
||||
sprintf(temp, "%s/%s", nodes.OutBox, de->d_name);
|
||||
sprintf(temp, "%s/%s", boxpath, de->d_name);
|
||||
if (stat(temp, &stbuf) == 0) {
|
||||
Syslog('o' ,"checking file \"%s\"", de->d_name);
|
||||
if (S_ISREG(stbuf.st_mode)) {
|
||||
@ -303,6 +282,63 @@ file_list *create_filelist(fa_list *al, char *fl, int create)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
file_list *create_filelist(fa_list *al, char *fl, int create)
|
||||
{
|
||||
file_list *st = NULL, *tmpf;
|
||||
fa_list *tmpa;
|
||||
char flavor, *tmpfl, *nm, *temp, tmpreq[13];
|
||||
struct stat stbuf;
|
||||
int packets = 0;
|
||||
FILE *fp;
|
||||
unsigned char buffer[2];
|
||||
|
||||
Syslog('o', "Create_filelist(%s,\"%s\",%d)", al?ascfnode(al->addr,0x1f):"<none>", MBSE_SS(fl), create);
|
||||
made_request = 0;
|
||||
|
||||
for (tmpa = al; tmpa; tmpa = tmpa->next) {
|
||||
Syslog('o', "Check address %s", ascfnode(tmpa->addr, 0x1f));
|
||||
|
||||
/*
|
||||
* For the main aka, check the outbox.
|
||||
*/
|
||||
if ((tmpa->addr) && Loaded && strlen(nodes.OutBox) &&
|
||||
(tmpa->addr->zone == nodes.Aka[0].zone) && (tmpa->addr->net == nodes.Aka[0].net) &&
|
||||
(tmpa->addr->node == nodes.Aka[0].node) && (tmpa->addr->point == nodes.Aka[0].point)) {
|
||||
if (nodes.Crash)
|
||||
flavor = 'c';
|
||||
else if (nodes.Hold)
|
||||
flavor = 'h';
|
||||
else
|
||||
flavor = 'o';
|
||||
check_filebox(nodes.OutBox, st);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check T-Mail style fileboxes
|
||||
*/
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
if (strlen(CFG.tmailshort)) {
|
||||
sprintf(temp, "%s/%s", CFG.tmailshort, shortboxname(tmpa->addr));
|
||||
check_filebox(temp, st);
|
||||
if (strchr(fl, 'h')) {
|
||||
sprintf(temp, "%s/%sh", CFG.tmailshort, shortboxname(tmpa->addr));
|
||||
check_filebox(temp, st);
|
||||
}
|
||||
}
|
||||
if (strlen(CFG.tmaillong)) {
|
||||
sprintf(temp, "%s/%d.%d.%d.%d", CFG.tmaillong, tmpa->addr->zone,
|
||||
tmpa->addr->net, tmpa->addr->node, tmpa->addr->point);
|
||||
check_filebox(temp, st);
|
||||
if (strchr(fl, 'h')) {
|
||||
sprintf(temp, "%s/%d.%d.%d.%d.h", CFG.tmaillong, tmpa->addr->zone,
|
||||
tmpa->addr->net, tmpa->addr->node, tmpa->addr->point);
|
||||
check_filebox(temp, st);
|
||||
}
|
||||
}
|
||||
free(temp);
|
||||
|
||||
/*
|
||||
* Check spool files, these are more or less useless but they
|
||||
* create a filelist of files to send which are never send.
|
||||
|
@ -67,36 +67,6 @@ static struct _alist
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Returns name of T-Mail filebox in Dos format (8+3).
|
||||
* I know, this code looks ungly, but it works. - MiCHA :-)
|
||||
*/
|
||||
const char* shortboxname(const faddr *fa) {
|
||||
static char dirname[12];
|
||||
unsigned z=fa->zone, n=fa->net, f=fa->node, p=fa->point;
|
||||
unsigned u,v;
|
||||
|
||||
u=z%32; z/=32; if (z>=32) return NULL;
|
||||
dirname[0]=z<10?z+'0':z-10+'a';
|
||||
dirname[1]=u<10?u+'0':u-10+'a';
|
||||
u=n%32; n/=32; v=n%32; n/=32; if (n>=32) return NULL;
|
||||
dirname[2]=n<10?n+'0':n-10+'a';
|
||||
dirname[3]=v<10?v+'0':v-10+'a';
|
||||
dirname[4]=u<10?u+'0':u-10+'a';
|
||||
u=f%32; f/=32; v=f%32; f/=32; if (f>=32) return NULL;
|
||||
dirname[5]=f<10?f+'0':f-10+'a';
|
||||
dirname[6]=v<10?v+'0':v-10+'a';
|
||||
dirname[7]=u<10?u+'0':u-10+'a';
|
||||
dirname[8]='.';
|
||||
u=p%32; p/=32; if (p>=32) return NULL;
|
||||
dirname[9]=p<10?p+'0':p-10+'a';
|
||||
dirname[10]=u<10?u+'0':u-10+'a';
|
||||
dirname[11]=0;
|
||||
return dirname;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int outstat()
|
||||
{
|
||||
int rc;
|
||||
@ -220,6 +190,34 @@ int outstat()
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
/*
|
||||
* Start checking T-Mail fileboxes
|
||||
*/
|
||||
if (strlen(CFG.tmailshort) && (dp = opendir(CFG.tmailshort))) {
|
||||
Syslog('o', "Checking T-Mail short box \"%s\"", CFG.tmailshort);
|
||||
while ((de = readdir(dp))) {
|
||||
if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
|
||||
sprintf(temp, "%s/%s", CFG.tmailshort, de->d_name);
|
||||
if (stat(temp, &sb) == 0) {
|
||||
Syslog('o' ,"checking \"%s\"", de->d_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dp);
|
||||
}
|
||||
if (strlen(CFG.tmaillong) && (dp = opendir(CFG.tmaillong))) {
|
||||
Syslog('o', "Checking T-Mail long box \"%s\"", CFG.tmaillong);
|
||||
while ((de = readdir(dp))) {
|
||||
if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
|
||||
sprintf(temp, "%s/%s", CFG.tmailshort, de->d_name);
|
||||
if (stat(temp, &sb) == 0) {
|
||||
Syslog('o' ,"checking \"%s\"", de->d_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dp);
|
||||
}
|
||||
|
||||
if (!do_quiet) {
|
||||
colour(10, 0);
|
||||
printf("flavor try size age address\n");
|
||||
|
69
mbcico/shortbox.c
Normal file
69
mbcico/shortbox.c
Normal file
@ -0,0 +1,69 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* Purpose ...............: Fidonet mailer
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* 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
|
||||
* Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../config.h"
|
||||
#include "../lib/libs.h"
|
||||
#include "../lib/structs.h"
|
||||
#include "../lib/users.h"
|
||||
#include "../lib/records.h"
|
||||
#include "../lib/clcomm.h"
|
||||
#include "../lib/common.h"
|
||||
#include "shortbox.h"
|
||||
|
||||
|
||||
/*
|
||||
* Returns name of T-Mail filebox in Dos format (8+3).
|
||||
* I know, this code looks ungly, but it works. - MiCHA :-)
|
||||
*/
|
||||
char* shortboxname(faddr *fa) {
|
||||
static char dirname[12];
|
||||
unsigned z=fa->zone, n=fa->net, f=fa->node, p=fa->point;
|
||||
unsigned u,v;
|
||||
|
||||
u=z%32; z/=32; if (z>=32) return NULL;
|
||||
dirname[0]=z<10?z+'0':z-10+'a';
|
||||
dirname[1]=u<10?u+'0':u-10+'a';
|
||||
u=n%32; n/=32; v=n%32; n/=32; if (n>=32) return NULL;
|
||||
dirname[2]=n<10?n+'0':n-10+'a';
|
||||
dirname[3]=v<10?v+'0':v-10+'a';
|
||||
dirname[4]=u<10?u+'0':u-10+'a';
|
||||
u=f%32; f/=32; v=f%32; f/=32; if (f>=32) return NULL;
|
||||
dirname[5]=f<10?f+'0':f-10+'a';
|
||||
dirname[6]=v<10?v+'0':v-10+'a';
|
||||
dirname[7]=u<10?u+'0':u-10+'a';
|
||||
dirname[8]='.';
|
||||
u=p%32; p/=32; if (p>=32) return NULL;
|
||||
dirname[9]=p<10?p+'0':p-10+'a';
|
||||
dirname[10]=u<10?u+'0':u-10+'a';
|
||||
dirname[11]=0;
|
||||
return dirname;
|
||||
}
|
||||
|
||||
|
8
mbcico/shortbox.h
Normal file
8
mbcico/shortbox.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef _SHORTBOX_H
|
||||
#define _SHORTBOX_H
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
char *shortboxname(faddr *);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user