Small fixes for file announces
This commit is contained in:
parent
49dbc82685
commit
6b3aca987f
@ -293,6 +293,10 @@ long Report(gr_list *ta, long filepos)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MacroVars("GJZ", "ssd", "", "", 0);
|
||||||
|
MacroVars("slbkdt", "ssddss", "", "", 0, 0, "", "");
|
||||||
|
MacroVars("ABZ", "ddd", 0, 0, 0);
|
||||||
|
|
||||||
while (fread(&T_File, sizeof(T_File), 1, fp) == 1) {
|
while (fread(&T_File, sizeof(T_File), 1, fp) == 1) {
|
||||||
if ((!strcmp(T_File.Echo, ta->echo)) && (!strcmp(T_File.Group, ta->group)))
|
if ((!strcmp(T_File.Echo, ta->echo)) && (!strcmp(T_File.Group, ta->group)))
|
||||||
break;
|
break;
|
||||||
@ -322,7 +326,7 @@ long Report(gr_list *ta, long filepos)
|
|||||||
* Report one newfile, first line.
|
* Report one newfile, first line.
|
||||||
*/
|
*/
|
||||||
fseek(fi, filepos1, SEEK_SET);
|
fseek(fi, filepos1, SEEK_SET);
|
||||||
MacroVars("slbkdt", "ssddss", T_File.Name, T_File.LName, T_File.Size, T_File.SizeKb, " ",
|
MacroVars("slbkdt", "ssddss", T_File.Name, T_File.LName, T_File.Size, T_File.SizeKb, rfcdate(T_File.Fdate),
|
||||||
To_Low(T_File.LDesc[0],newfiles.HiAscii));
|
To_Low(T_File.LDesc[0],newfiles.HiAscii));
|
||||||
Msg_Macro(fi);
|
Msg_Macro(fi);
|
||||||
filepos2 = ftell(fi);
|
filepos2 = ftell(fi);
|
||||||
@ -335,8 +339,8 @@ long Report(gr_list *ta, long filepos)
|
|||||||
if (strlen(T_File.LDesc[i])) {
|
if (strlen(T_File.LDesc[i])) {
|
||||||
Msg_Macro(fi);
|
Msg_Macro(fi);
|
||||||
} else {
|
} else {
|
||||||
line = calloc(255, sizeof(char));
|
line = calloc(MAXSTR, sizeof(char));
|
||||||
while ((fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))) {}
|
while ((fgets(line, MAXSTR-2, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))) {}
|
||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
filepos3 = ftell(fi);
|
filepos3 = ftell(fi);
|
||||||
@ -397,7 +401,7 @@ int Announce()
|
|||||||
Uploads();
|
Uploads();
|
||||||
IsDoing("Announce files");
|
IsDoing("Announce files");
|
||||||
|
|
||||||
temp = calloc(128, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(temp, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
|
||||||
if ((fp = fopen(temp, "r")) == NULL) {
|
if ((fp = fopen(temp, "r")) == NULL) {
|
||||||
Syslog('+', "No new files to announce");
|
Syslog('+', "No new files to announce");
|
||||||
@ -470,11 +474,12 @@ int Announce()
|
|||||||
if ((filepos1 = StartMsg()) != -1) {
|
if ((filepos1 = StartMsg()) != -1) {
|
||||||
filepos2 = 0;
|
filepos2 = 0;
|
||||||
while (fread(&group, 13, 1, fp) == 1) {
|
while (fread(&group, 13, 1, fp) == 1) {
|
||||||
for (tmp = fgr; tmp; tmp = tmp->next)
|
for (tmp = fgr; tmp; tmp = tmp->next) {
|
||||||
if (!strcmp(tmp->group, group)) {
|
if (!strcmp(tmp->group, group)) {
|
||||||
filepos2 = Report(tmp, filepos1);
|
filepos2 = Report(tmp, filepos1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
FinishMsg(TRUE, filepos2);
|
FinishMsg(TRUE, filepos2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -106,10 +106,11 @@ void Msg_Macro(FILE *fi)
|
|||||||
char *temp, *line;
|
char *temp, *line;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
temp = calloc(256, sizeof(char));
|
temp = calloc(MAXSTR, sizeof(char));
|
||||||
line = calloc(256, sizeof(char));
|
line = calloc(MAXSTR, sizeof(char));
|
||||||
|
|
||||||
|
while ((fgets(line, MAXSTR-2, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))) {
|
||||||
|
|
||||||
while ((fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))) {
|
|
||||||
/*
|
/*
|
||||||
* Skip comment lines
|
* Skip comment lines
|
||||||
*/
|
*/
|
||||||
@ -121,7 +122,7 @@ void Msg_Macro(FILE *fi)
|
|||||||
*/
|
*/
|
||||||
MsgText_Add2((char *)"");
|
MsgText_Add2((char *)"");
|
||||||
} else {
|
} else {
|
||||||
strncpy(temp, ParseMacro(line,&res), 254);
|
strncpy(temp, ParseMacro(line,&res), MAXSTR-2);
|
||||||
if (res)
|
if (res)
|
||||||
Syslog('!', "Macro error line: \"%s\"", line);
|
Syslog('!', "Macro error line: \"%s\"", line);
|
||||||
/*
|
/*
|
||||||
@ -160,6 +161,7 @@ long Msg_Top(char *template, int language, fidoaddr aka)
|
|||||||
if ((fp = fopen(temp, "r")) != NULL) {
|
if ((fp = fopen(temp, "r")) != NULL) {
|
||||||
fread(&ttyinfohdr, sizeof(ttyinfohdr), 1, fp);
|
fread(&ttyinfohdr, sizeof(ttyinfohdr), 1, fp);
|
||||||
|
|
||||||
|
MacroVars("pqrf", "dsss", 0, "", "", "");
|
||||||
while (fread(&ttyinfo, ttyinfohdr.recsize, 1, fp) == 1) {
|
while (fread(&ttyinfo, ttyinfohdr.recsize, 1, fp) == 1) {
|
||||||
if (((ttyinfo.type == POTS) || (ttyinfo.type == ISDN)) && ttyinfo.available && strlen(ttyinfo.phone)) {
|
if (((ttyinfo.type == POTS) || (ttyinfo.type == ISDN)) && ttyinfo.available && strlen(ttyinfo.phone)) {
|
||||||
MacroVars("pqrf", "dsss", ttyinfo.type, ttyinfo.phone, ttyinfo.speed, ttyinfo.flags);
|
MacroVars("pqrf", "dsss", ttyinfo.type, ttyinfo.phone, ttyinfo.speed, ttyinfo.flags);
|
||||||
@ -250,7 +252,7 @@ char *To_Low(char *inp, int High)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
memset(&temp, 0, sizeof(temp));
|
memset(&temp, 0, sizeof(temp));
|
||||||
sprintf(temp, "%s", inp);
|
strncpy(temp, inp, 80);
|
||||||
|
|
||||||
if (High)
|
if (High)
|
||||||
return temp;
|
return temp;
|
||||||
|
@ -228,8 +228,8 @@ int ProcessTic(fa_list *sbl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(T_File.Echo, tic.Name);
|
strncpy(T_File.Echo, tic.Name, 20);
|
||||||
strcpy(T_File.Group, tic.Group);
|
strncpy(T_File.Group, tic.Group, 12);
|
||||||
TIC.KeepNum = tic.KeepLatest;
|
TIC.KeepNum = tic.KeepLatest;
|
||||||
|
|
||||||
Magic_Keepnum();
|
Magic_Keepnum();
|
||||||
@ -267,9 +267,9 @@ int ProcessTic(fa_list *sbl)
|
|||||||
* the group to that name.
|
* the group to that name.
|
||||||
*/
|
*/
|
||||||
if (strlen(area.NewGroup))
|
if (strlen(area.NewGroup))
|
||||||
strcpy(T_File.Group, area.NewGroup);
|
strncpy(T_File.Group, area.NewGroup, 12);
|
||||||
}
|
}
|
||||||
strcpy(T_File.Comment, tic.Comment);
|
strncpy(T_File.Comment, tic.Comment, 55);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if the destination area really exists, it may be that
|
* Check if the destination area really exists, it may be that
|
||||||
@ -701,10 +701,11 @@ int ProcessTic(fa_list *sbl)
|
|||||||
Magic_UpDateAlias();
|
Magic_UpDateAlias();
|
||||||
|
|
||||||
for (i = 0; i <= TIC.File_Id_Ct; i++)
|
for (i = 0; i <= TIC.File_Id_Ct; i++)
|
||||||
strcpy(T_File.LDesc[i], TIC.File_Id[i]);
|
strncpy(T_File.LDesc[i], TIC.File_Id[i], 48);
|
||||||
T_File.TotLdesc = TIC.File_Id_Ct;
|
T_File.TotLdesc = TIC.File_Id_Ct;
|
||||||
T_File.Announce = tic.Announce;
|
T_File.Announce = tic.Announce;
|
||||||
strcpy(T_File.Name, TIC.NewName);
|
strncpy(T_File.Name, TIC.NewName, 12);
|
||||||
|
strncpy(T_File.LName, TIC.NewName, 80);
|
||||||
T_File.Fdate = TIC.FileDate;
|
T_File.Fdate = TIC.FileDate;
|
||||||
T_File.Cost = TIC.TicIn.Cost;
|
T_File.Cost = TIC.TicIn.Cost;
|
||||||
Add_ToBeRep();
|
Add_ToBeRep();
|
||||||
|
@ -67,8 +67,9 @@ int main(int argc, char **argv)
|
|||||||
printf("File echo %s\n", rep.Echo);
|
printf("File echo %s\n", rep.Echo);
|
||||||
printf("Comment %s\n", rep.Comment);
|
printf("Comment %s\n", rep.Comment);
|
||||||
printf("Group %s\n", rep.Group);
|
printf("Group %s\n", rep.Group);
|
||||||
printf("File name %s\n", rep.Name);
|
printf("Short name %s\n", rep.Name);
|
||||||
printf("FIle size %lu\n", (long)(rep.Size));
|
printf("Long name %s\n", rep.LName);
|
||||||
|
printf("File size %lu\n", (long)(rep.Size));
|
||||||
printf("File size Kb %lu\n", rep.SizeKb);
|
printf("File size Kb %lu\n", rep.SizeKb);
|
||||||
printf("File date %s", ctime(&rep.Fdate));
|
printf("File date %s", ctime(&rep.Fdate));
|
||||||
printf("File CRC %s\n", rep.Crc);
|
printf("File CRC %s\n", rep.Crc);
|
||||||
|
Reference in New Issue
Block a user