Code cleanup in OLR
This commit is contained in:
parent
27a2222baa
commit
4347378fe8
@ -67,6 +67,7 @@ v0.35.02 22-Jun-2002
|
||||
optional data to use handles or unix names.
|
||||
The display lastcaller list now also supports the /U optional
|
||||
data to display Unix names.
|
||||
Code cleanup in offline reader.
|
||||
|
||||
mbtask:
|
||||
When first run the goldnode command is only filled in if it
|
||||
|
2
TODO
2
TODO
@ -34,6 +34,8 @@ mbsebbs:
|
||||
N: When a file is attached with netmail that doesn't exist the user
|
||||
doesn't see an error message.
|
||||
|
||||
N: OLR, implement file requests.
|
||||
|
||||
mbfido:
|
||||
U: Code cleanup and make a structure in this program. Remove duplicate
|
||||
or similar functions.
|
||||
|
@ -637,7 +637,7 @@ int Save_Msg(int IsReply, faddr *Dest)
|
||||
MsgText_Add2(Message[i]);
|
||||
}
|
||||
|
||||
Add_Footkludges(TRUE);
|
||||
Add_Footkludges(TRUE, NULL);
|
||||
|
||||
/*
|
||||
* Save if to disk
|
||||
|
@ -244,7 +244,7 @@ void Add_Headkludges(faddr *dest, int IsReply)
|
||||
* Add bottom message kludges. The flag Quote is false if this is called
|
||||
* from Offline Reader, the user then may or may have not added a quote.
|
||||
*/
|
||||
void Add_Footkludges(int Quote)
|
||||
void Add_Footkludges(int Quote, char *tear)
|
||||
{
|
||||
char *temp;
|
||||
char *aka;
|
||||
@ -276,7 +276,16 @@ void Add_Footkludges(int Quote)
|
||||
MsgText_Add2(temp);
|
||||
MsgText_Add2((char *)"");
|
||||
}
|
||||
|
||||
/*
|
||||
* The offline reader may override the tearline
|
||||
*/
|
||||
if (tear == NULL) {
|
||||
MsgText_Add2(TearLine());
|
||||
} else {
|
||||
sprintf(temp, "--- %s", tear);
|
||||
MsgText_Add2(temp);
|
||||
}
|
||||
|
||||
if ((msgs.Type == ECHOMAIL) || (msgs.Type == LIST)) {
|
||||
/* RANDOM ORIGIN LINES IMPLEMENTEREN */
|
||||
|
@ -6,7 +6,7 @@ char *rfcdate(time_t); /* Create RFC style date */
|
||||
int Open_Msgbase(char *, int); /* Open msgbase for read/write */
|
||||
void Close_Msgbase(void); /* Close msgbase */
|
||||
void Add_Headkludges(faddr *, int); /* Header part of kludges */
|
||||
void Add_Footkludges(int); /* Footer part of kludges */
|
||||
void Add_Footkludges(int, char *); /* Footer part of kludges */
|
||||
void Sema_Mailout(void); /* Set mailout semafore */
|
||||
|
||||
|
||||
|
@ -64,6 +64,7 @@ unsigned short BarWidth;
|
||||
lastread LR;
|
||||
static char TempStr[128];
|
||||
extern int do_mailout;
|
||||
char *newtear = NULL;
|
||||
|
||||
|
||||
typedef struct _msg_high {
|
||||
@ -132,8 +133,6 @@ void fill_high(msg_high **hdp, unsigned long Area, unsigned long Last, unsigned
|
||||
{
|
||||
msg_high *tmp;
|
||||
|
||||
Syslog('M', "fill_high Area %lu Msg %lu, Pers %lu", Area, Last, Pers);
|
||||
|
||||
tmp = (msg_high *)malloc(sizeof(msg_high));
|
||||
tmp->next = *hdp;
|
||||
tmp->Area = Area;
|
||||
@ -204,29 +203,17 @@ void UpdateLR(msg_high *mhl, FILE *mf)
|
||||
*/
|
||||
void Add_Kludges(fidoaddr dest, int IsReply, char *fn)
|
||||
{
|
||||
char *temp, *aka;
|
||||
FILE *tp;
|
||||
|
||||
temp = calloc(2048, sizeof(char));
|
||||
aka = calloc(81, sizeof(char));
|
||||
|
||||
Add_Headkludges(fido2faddr(dest), IsReply);
|
||||
Syslog('m', "Kludges done, start textfile %s", fn);
|
||||
|
||||
if ((tp = fopen(fn, "r")) != NULL) {
|
||||
Msg_Write(tp);
|
||||
fclose(tp);
|
||||
}
|
||||
|
||||
Syslog('m', "Add footer");
|
||||
Add_Footkludges(FALSE);
|
||||
|
||||
Syslog('m', "Add message now");
|
||||
Add_Footkludges(FALSE, newtear);
|
||||
Msg_AddMsg();
|
||||
Syslog('m', "Msg added");
|
||||
|
||||
free(aka);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
|
||||
@ -288,8 +275,7 @@ void OLR_TagArea()
|
||||
} else
|
||||
total = 0;
|
||||
colour(3, 0);
|
||||
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) &&
|
||||
(!olrtagrec.Tagged) && strlen(msgs.QWKname)) {
|
||||
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && (!olrtagrec.Tagged) && strlen(msgs.QWKname)) {
|
||||
if ( (lines != 0) || (ignore) ) {
|
||||
lines--;
|
||||
printf("%-20.20s %-5ld %-5ld %s\n", msgs.QWKname, Area, total, msgs.Name);
|
||||
@ -322,16 +308,14 @@ void OLR_TagArea()
|
||||
}
|
||||
fclose(ma);
|
||||
}
|
||||
} else
|
||||
if (buf[0] != '\0') {
|
||||
} else if (buf[0] != '\0') {
|
||||
if (atoi(buf) != 0) {
|
||||
if ((ma = fopen(Msgname, "r")) != NULL) {
|
||||
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
||||
Offset = msgshdr.hdrsize + ((atoi(buf)-1) * (msgshdr.recsize + msgshdr.syssize));
|
||||
fseek(ma, Offset, SEEK_SET);
|
||||
if (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
||||
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) &&
|
||||
strlen(msgs.QWKname)) {
|
||||
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname)) {
|
||||
if ((tf = fopen(Tagname, "r+")) != NULL) {
|
||||
fseek(tf, (atoi(buf)-1) * sizeof(olrtagrec), SEEK_SET);
|
||||
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
||||
@ -339,8 +323,7 @@ void OLR_TagArea()
|
||||
olrtagrec.Tagged = TRUE;
|
||||
fseek(tf, - sizeof(olrtagrec), SEEK_CUR);
|
||||
fwrite(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
||||
Syslog('+', "OLR Tagged %d %s",
|
||||
atoi(buf), msgs.QWKname);
|
||||
Syslog('+', "OLR Tagged %d %s", atoi(buf), msgs.QWKname);
|
||||
}
|
||||
fclose(tf);
|
||||
}
|
||||
@ -355,8 +338,7 @@ void OLR_TagArea()
|
||||
while (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
||||
fseek(ma, msgshdr.syssize, SEEK_CUR);
|
||||
Area++;
|
||||
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) &&
|
||||
strlen(msgs.QWKname)) {
|
||||
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname)) {
|
||||
if (strcasecmp(msgs.QWKname, buf) == 0) {
|
||||
if ((tf = fopen(Tagname, "r+")) != NULL) {
|
||||
fseek(tf, (Area-1) * sizeof(olrtagrec), SEEK_SET);
|
||||
@ -365,8 +347,7 @@ void OLR_TagArea()
|
||||
olrtagrec.Tagged = TRUE;
|
||||
fseek(tf, - sizeof(olrtagrec), SEEK_CUR);
|
||||
fwrite(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
||||
Syslog('+', "OLR Tagged %d %s",
|
||||
Area, msgs.QWKname);
|
||||
Syslog('+', "OLR Tagged %d %s", Area, msgs.QWKname);
|
||||
}
|
||||
fclose(tf);
|
||||
}
|
||||
@ -437,8 +418,7 @@ void OLR_UntagArea()
|
||||
} else
|
||||
total = 0;
|
||||
colour(3, 0);
|
||||
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) &&
|
||||
olrtagrec.Tagged && strlen(msgs.QWKname)) {
|
||||
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && olrtagrec.Tagged && strlen(msgs.QWKname)) {
|
||||
if ( (lines != 0) || (ignore) ) {
|
||||
lines--;
|
||||
printf("%-20.20s %-5ld %-5ld %s\n", msgs.QWKname, Area, total, msgs.Name);
|
||||
@ -471,16 +451,14 @@ void OLR_UntagArea()
|
||||
}
|
||||
fclose(ma);
|
||||
}
|
||||
} else
|
||||
if (buf[0] != '\0') {
|
||||
} else if (buf[0] != '\0') {
|
||||
if (atoi(buf) != 0) {
|
||||
if ((ma = fopen(Msgname, "r")) != NULL) {
|
||||
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
||||
Offset = msgshdr.hdrsize + ((atoi(buf)-1) * (msgshdr.recsize + msgshdr.syssize));
|
||||
fseek(ma, Offset, SEEK_SET);
|
||||
if (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
||||
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) &&
|
||||
strlen(msgs.QWKname)) {
|
||||
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname)) {
|
||||
if ((tf = fopen(Tagname, "r+")) != NULL) {
|
||||
fseek(tf, (atoi(buf)-1) * sizeof(olrtagrec), SEEK_SET);
|
||||
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
||||
@ -491,8 +469,7 @@ void OLR_UntagArea()
|
||||
olrtagrec.Tagged = FALSE;
|
||||
fseek(tf, - sizeof(olrtagrec), SEEK_CUR);
|
||||
fwrite(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
||||
Syslog('+', "OLR Untagged %d %s",
|
||||
atoi(buf), msgs.QWKname);
|
||||
Syslog('+', "OLR Untagged %d %s", atoi(buf), msgs.QWKname);
|
||||
}
|
||||
}
|
||||
fclose(tf);
|
||||
@ -508,8 +485,7 @@ void OLR_UntagArea()
|
||||
while (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
||||
fseek(ma, msgshdr.syssize, SEEK_CUR);
|
||||
Area++;
|
||||
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) &&
|
||||
strlen(msgs.QWKname)) {
|
||||
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname)) {
|
||||
if (strcasecmp(msgs.QWKname, buf) == 0) {
|
||||
if ((tf = fopen(Tagname, "r+")) != NULL) {
|
||||
fseek(tf, (Area-1) * sizeof(olrtagrec), SEEK_SET);
|
||||
@ -521,8 +497,7 @@ void OLR_UntagArea()
|
||||
olrtagrec.Tagged = FALSE;
|
||||
fseek(tf, - sizeof(olrtagrec), SEEK_CUR);
|
||||
fwrite(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
||||
Syslog('+', "OLR Untagged %d %s",
|
||||
Area, msgs.QWKname);
|
||||
Syslog('+', "OLR Untagged %d %s", Area, msgs.QWKname);
|
||||
}
|
||||
}
|
||||
fclose(tf);
|
||||
@ -1637,6 +1612,9 @@ void BlueWave_Fetch()
|
||||
}
|
||||
Syslog('+', "Login %s, Alias %s", Uph.loginname, Uph.aliasname);
|
||||
Syslog('m', "Tear: %s", Uph.reader_tear);
|
||||
if (strlen(Uph.reader_tear))
|
||||
newtear = xstrcpy(Uph.reader_tear);
|
||||
|
||||
/* MORE CHECKS HERE */
|
||||
|
||||
colour(CFG.TextColourF, CFG.TextColourB);
|
||||
@ -1717,7 +1695,8 @@ void BlueWave_Fetch()
|
||||
Msg.Private = TRUE;
|
||||
if (msgs.MsgKinds == PRIVATE)
|
||||
Msg.Private = TRUE;
|
||||
Msg.Written = Upr.unix_date;
|
||||
// Msg.Written = Upr.unix_date;
|
||||
Msg.Written = Upr.unix_date - (gmt_offset((time_t)0) * 60);
|
||||
Msg.Arrived = time(NULL) - (gmt_offset((time_t)0) * 60);
|
||||
Msg.Local = TRUE;
|
||||
dest.zone = Upr.destzone;
|
||||
@ -1778,6 +1757,12 @@ void BlueWave_Fetch()
|
||||
unlink(temp);
|
||||
}
|
||||
|
||||
if (newtear) {
|
||||
free(newtear);
|
||||
newtear = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If a .UPL file was not found it is possible we received an version 2
|
||||
* reply packet.
|
||||
@ -2012,8 +1997,7 @@ void BlueWave_Fetch()
|
||||
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
||||
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
||||
fread(&olrtagrec, sizeof(olrtagrec), 1, up);
|
||||
if ((strcmp(msgs.QWKname, Pdr.echotag) == 0) &&
|
||||
(msgs.Active) &&
|
||||
if ((strcmp(msgs.QWKname, Pdr.echotag) == 0) && (msgs.Active) &&
|
||||
(Access(exitinfo.Security, msgs.RDSec))) {
|
||||
Syslog('m', " Area %s", Pdr.echotag);
|
||||
olrtagrec.Tagged = TRUE;
|
||||
@ -2601,7 +2585,7 @@ void QWK_Fetch()
|
||||
MsgText_Add2(szLine);
|
||||
}
|
||||
|
||||
Add_Footkludges(FALSE);
|
||||
Add_Footkludges(FALSE, NULL);
|
||||
Msg_AddMsg();
|
||||
|
||||
Syslog('+', "Msg (%ld) to \"%s\", \"%s\", in %s", Msg.Id,
|
||||
|
Reference in New Issue
Block a user