Automatic tearline and originline adding

This commit is contained in:
Michiel Broek 2004-08-30 13:43:37 +00:00
parent 87f7c526de
commit 2343ed5a8b
2 changed files with 31 additions and 13 deletions

View File

@ -46,7 +46,9 @@ v0.61.4 11-Aug-2004
mbmsg:
Fixed counter in log that should show the number of linked
messages.
With the post command no tearline is added anymore.
With the post command a check is done to see if the input file
has a tearline and origin line, if not mbmsg will add these
lines, else the lines of the input file are used.
mbsebbs:
The exec_nosuid function for doors now also has a extra small

View File

@ -43,7 +43,7 @@ extern int do_quiet; /* Suppress screen output */
int Post(char *To, long Area, char *Subj, char *File, char *Flavor)
{
int i, rc = FALSE;
int i, rc = FALSE, has_tear = FALSE, has_origin = FALSE;
char *aka, *temp, *sAreas;
FILE *fp, *tp;
unsigned long crc = -1;
@ -226,6 +226,15 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor)
sprintf(temp, "\001TZUTC: %s", gmtoffset(tt));
MsgText_Add2(temp);
while ((Fgets(temp, PATH_MAX -1, tp)) != NULL) {
if (strncmp(temp, "--- ", 4) == 0)
has_tear = TRUE;
if (strncmp(temp, " * Origin: ", 11) == 0)
has_origin = TRUE;
}
rewind(tp);
Syslog('m', "has tearline=%s, has origin=%s", has_tear?"True":"False", has_origin?"True":"False");
/*
* Add the file as text
*/
@ -235,6 +244,12 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor)
/*
* Finish the message
*/
if (! has_tear) {
MsgText_Add2((char *)"");
MsgText_Add2(TearLine());
}
if (! has_origin) {
aka = calloc(40, sizeof(char));
if (msgs.Aka.point)
@ -249,6 +264,7 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor)
MsgText_Add2(temp);
free(aka);
}
Msg_AddMsg();
Msg_UnLock();