Added subject line cleaner

This commit is contained in:
Michiel Broek 2005-08-10 15:32:42 +00:00
parent abdbbc862e
commit ccfd32e420
11 changed files with 150 additions and 106 deletions

View File

@ -6,6 +6,10 @@ v0.71.3 13-Jun-2005
upgrade:
Check mbsetup 7.n.3.14 and 7.n.3.15 settings.
mbselib.a:
Added a function to clean subject lines from garbage, trailing
spaces etc. to improve message linking.
mbcico:
Added support for binkp GZ and BZ2 compression. Can be turned
off per node. Only effective with originating calls. Incoming
@ -14,12 +18,14 @@ v0.71.3 13-Jun-2005
mbsebbs:
Added logging of remote host and terminal.
Added subject line clean in several places.
mbnewuser:
Added logging of remote host and terminal.
mbfido:
Fixed commandline parser for mail recipients.
Added subject line clean in several places.
mbsetup:
Added setup switches per node to disable PLZ or GZ and BZ2

3
TODO
View File

@ -126,9 +126,6 @@ mbfido:
N: Make mailhistory.html a lot shorter, maybe day or week versions.
N: Strip trailing spaces from subject lines to make sure reply linking
works.
mbcico:
L: Implement binkp option ND.

View File

@ -2345,7 +2345,8 @@ unsigned char mbse_Readkey(void); /* Read a translated key */
*/
char *padleft(char *str, int size, char pad);
char *tl(char *str);
void Striplf(char *String);
void Striplf(char *);
void mbse_CleanSubject(char *);
void tlf(char *str);
char *tu(char *str);
char *tlcap(char *);

View File

@ -83,6 +83,35 @@ void Striplf(char *String)
void mbse_CleanSubject(char *String)
{
int i, fixed = FALSE;
i = strlen(String) -1;
while ((isspace(String[i])) && i) {
String[i] = '\0';
i--;
fixed = TRUE;
}
if ((strncasecmp(String, "Re: ", 4) == 0) && (strncmp(String, "Re: ", 4))) {
/*
* Fix Re:
*/
String[0] = 'R';
String[1] = 'e';
String[2] = ':';
String[3] = ' ';
fixed = TRUE;
}
if (fixed)
Syslog('m', "Fixed subj: \"%s\"", printable(String, 0));
}
/*
* Converts first letter to UpperCase
*/

View File

@ -50,6 +50,8 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor)
time_t tt;
struct tm *t;
mbse_CleanSubject(Subj);
if (!do_quiet) {
mbse_colour(3, 0);
printf("Post \"%s\" to \"%s\" in area %ld\n", File, To, Area);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Import a echomail message
*
*****************************************************************************
* Copyright (C) 1997-2004
* Copyright (C) 1997-2005
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -60,6 +60,8 @@ int storeecho(faddr *f, faddr *t, time_t mdate, int flags, char *subj, char *msg
unsigned long crc2;
char *buf;
mbse_CleanSubject(subj);
/*
* Update import counters
*/
@ -144,8 +146,7 @@ int storeecho(faddr *f, faddr *t, time_t mdate, int flags, char *subj, char *msg
/*
* Start write the message
* If not a bad or dupe message, eat the first
* line (AREA:tag).
* If not a bad or dupe message, eat the first line (AREA:tag).
*/
buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
rewind(fp);

View File

@ -62,6 +62,8 @@ int storenet(faddr *f, faddr *t, time_t mdate, int flags, char *Subj, char *msgi
unsigned long crc2;
char *Buf;
mbse_CleanSubject(Subj);
if (! SearchNetBoard(t->zone, t->net)) {
bad = TRUE;
WriteError("Can't find netmail board for %d:%d/%d", t->zone, t->net, t->node);

View File

@ -676,6 +676,7 @@ void Reply_Email(int IsReply)
} else {
sprintf(subj, "%s", Msg.Subject);
}
mbse_CleanSubject(subj);
Syslog('m', "Reply msg to %s, subject %s", to, subj);
Syslog('m', "Msgid was %s", Msg.Msgid);
sprintf(msgid, "%s", Msg.Msgid);
@ -876,6 +877,7 @@ void Write_Email(void)
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
alarm_on();
GetstrP(Msg.Subject, 65, 0);
mbse_CleanSubject(Msg.Subject);
if ((strcmp(Msg.Subject, "")) == 0) {
Enter(1);

View File

@ -566,6 +566,7 @@ void Post_Msg()
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
alarm_on();
GetstrP(Msg.Subject, 65, 0);
mbse_CleanSubject(Msg.Subject);
if ((strcmp(Msg.Subject, "")) == 0) {
Enter(1);
@ -1642,6 +1643,7 @@ void Reply_Msg(int IsReply)
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
GetstrP(subj, 50, x);
mbse_CleanSubject(subj);
if (strlen(subj))
strcpy(Msg.Subject, subj);

View File

@ -1588,6 +1588,7 @@ void BlueWave_Fetch()
strcpy(Msg.From, Upr.from);
strcpy(Msg.To, Upr.to);
strcpy(Msg.Subject, Upr.subj);
mbse_CleanSubject(Msg.Subject);
if (Upr.msg_attr & UPL_PRIVATE)
Msg.Private = TRUE;
if (msgs.MsgKinds == PRIVATE)

View File

@ -89,6 +89,7 @@ void retr_msg(int msgnum)
if (strlen(p) > 109)
p[109] = '\0';
sprintf(Msg.Subject, "%s", p+9);
mbse_CleanSubject(Msg.Subject);
}
if (strncmp(p, "Date: ", 6) == 0)
Msg.Written = parsedate(p+6, NULL) - (gmt_offset((time_t)0) * 60);