Code cleanup

This commit is contained in:
Michiel Broek 2005-08-14 18:59:50 +00:00
parent 533ce0b634
commit e4aeefa582
3 changed files with 6 additions and 95 deletions

View File

@ -1190,15 +1190,12 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
*/
if ((p=hdr((char *)"Content-Type",msg))) {
sprintf(temp, "Content-Type: text/plain; charset=%s\n", getrfcchrs(msgs.Charset));
// sprintf(temp,"Content-Type:%s",p);
Send(newsmode, temp);
} else if ((p=hdr((char *)"RFC-Content-Type",kmsg))) {
sprintf(temp, "Content-Type: text/plain; charset=%s\n", getrfcchrs(msgs.Charset));
// sprintf(temp,"Content-Type: %s",p);
Send(newsmode, temp);
} else if ((p=hdr((char *)"Content-Type",kmsg))) {
sprintf(temp, "Content-Type: text/plain; charset=%s\n", getrfcchrs(msgs.Charset));
// sprintf(temp,"Content-Type: %s",p);
Send(newsmode, temp);
}
@ -1275,7 +1272,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
Send(newsmode, temp);
}
Syslog('m', "=== starting qmsg loop");
for (qmsg = msg; qmsg; qmsg = qmsg->next) {
if (strcasecmp(qmsg->key,"CHRS") &&
strcasecmp(qmsg->key,"MSGID") &&
@ -1316,7 +1312,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
Send(newsmode, temp);
}
}
Syslog('m', "=== ending qmsg loop");
if ((p=compose_flags(flags,hdr((char *)"FLAGS",kmsg)))) {
sprintf(temp,"X-FTN-FLAGS:%s\n",p);
@ -1324,7 +1319,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
free(p);
}
Syslog('m', "=== starting qmsg loop 2");
for (qmsg = kmsg; qmsg; qmsg = qmsg->next) {
if (strcasecmp(qmsg->key,"INTL") &&
strcasecmp(qmsg->key,"FMPT") &&
@ -1411,7 +1405,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
}
}
}
Syslog('m', "=== ending qmsg loop 2");
if (newsmode) {
fa_list *tmpl,*ptl=NULL;
@ -1483,8 +1476,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
free(p);
first = FALSE;
/* FIXME: Maybe scan now for repeating headers and drop them as they will appear in the message text */
if ((p=hdr((char *)"X-Body-Start",msg))) {
lines++;
q = xstrcpy(p);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Announce new files and FileFind
*
*****************************************************************************
* Copyright (C) 1997-2004
* Copyright (C) 1997-2005
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10

View File

@ -126,68 +126,6 @@ int kludgewrite(char *s, FILE *fp)
/*
* Build a faked RFC msgid, use the CRC32 of the FTN msgid,
* the current group and the configured system's fqdn. This
* gives a unique string specific for the message.
*/
char *make_msgid(char *msgid)
{
static char buf[100];
sprintf(buf, "<%8lx$%s@%s>", StringCRC32(msgid), currentgroup, CFG.sysdomain);
return buf;
}
int findorigmsg(char *msgid, char *o)
{
unsigned long i, start, end;
char *gen2;
if (msgid == NULL) {
return 0;
}
if (!Msg_Open(msgs.Base)) {
return 0;
}
Msg_Number();
Msg_Highest();
Msg_Lowest();
if (MsgBase.Open == FALSE) {
Syslog('-', "Base closed");
return 0;
}
strcpy(currentgroup, msgs.Newsgroup);
start = MsgBase.Lowest;
end = MsgBase.Highest;
gen2 = calloc(strlen(msgid)+1,sizeof(char));
strcpy(gen2, strchr(msgid,'<'));
Syslog('m', "findorigmsg(%s): gen2=%s", msgid, gen2);
for (i = start; i <= end; i++) {
if (Msg_ReadHeader(i)) {
// Syslog('m', "findorigmsg() %d, %s / %s (%s)", i, gen2, make_msgid(Msg.Msgid), Msg.Msgid);
if (strncmp(gen2, make_msgid(Msg.Msgid),strlen(gen2)-1) == 0) {
Syslog('m',"Found msgid: %s",make_msgid(Msg.Msgid));
// realloc(o,(strlen(Msg.Msgid)+1)* sizeof(char));
strcpy(o,Msg.Msgid);
free(gen2);
return 1;
}
}
}
free(gen2);
return 0;
}
/*
* Input a RFC message.
*/
@ -229,14 +167,14 @@ int rfc2ftn(FILE *fp, faddr *recipient)
if (!CFG.allowcontrol) {
if (hdr((char *)"Control",msg)) {
Syslog('+', "Control message skipped");
Syslog('+', "Rfc2ftn: Control message skipped");
tidyrfc(msg);
return 1;
}
}
if ((fmsg = mkftnhdr(msg, newsmode, recipient)) == NULL) {
WriteError("Unable to create FTN headers from RFC ones, aborting");
WriteError("Rfc2ftn: unable to create FTN headers from RFC ones, aborting");
tidyrfc(msg);
return 1;
}
@ -253,19 +191,6 @@ int rfc2ftn(FILE *fp, faddr *recipient)
if ((p = hdr((char *)"References",msg))) {
p = strrchr(p,' ');
ftnmsgid(p,&fmsg->reply_a, &fmsg->reply_n,fmsg->area);
//Griffin
// fmsg->reply_s = calloc(256,sizeof(char));
// if (findorigmsg(p, fmsg->reply_s)) {
// fmsg->to->name = calloc(strlen(Msg.From)+1, sizeof(char));
// strcpy(fmsg->to->name, Msg.From);
// Syslog('m', "fmsg to-name %s", fmsg->to->name);
// Syslog('m', "reply_s %s", fmsg->reply_s);
// } else {
// Syslog('m', "findorigmsg nothing found");
// }
if (!chkftnmsgid(p)) {
hash_update_s(&fmsg->reply_n, fmsg->area);
}
@ -285,10 +210,6 @@ int rfc2ftn(FILE *fp, faddr *recipient)
removereturnto = TRUE;
ftnorigin = fmsg->ftnorigin;
Syslog('m', "removemime=%s removemsgid=%s removeref=%s removeinreply=%s removereplyto=%s removereturnto=%s",
removemime ?"TRUE ":"FALSE", removemsgid ?"TRUE ":"FALSE", removeref ?"TRUE ":"FALSE",
removeinreply ?"TRUE ":"FALSE", removereplyto ?"TRUE ":"FALSE", removereturnto ?"TRUE ":"FALSE");
q = hdr((char *)"Content-Transfer-Encoding",msg);
if (q)
while (*q && isspace(*q))
@ -298,7 +219,6 @@ int rfc2ftn(FILE *fp, faddr *recipient)
if ((p = hdr((char *)"Content-Type",msg))) {
while (*p && isspace(*p))
p++;
Syslog('m', "Content-Type: %s", printable(p, 0));
/*
* Check for mime to remove.
@ -320,7 +240,6 @@ int rfc2ftn(FILE *fp, faddr *recipient)
if (strchr(q, '"')) {
charset = xstrcpy(q + 9);
charset[strlen(charset)-1] = '\0';
Syslog('m', "Unquoted charset name");
} else {
charset = xstrcpy(q + 8);
}
@ -427,6 +346,7 @@ int rfc2ftn(FILE *fp, faddr *recipient)
if (splitpart) {
sprintf(newsubj,"[part %d] ",splitpart+1);
strncat(newsubj,fmsg->subj,MAXSUBJ-strlen(newsubj));
Syslog('+', "Rfc2ftn: split message part %d", splitpart);
} else {
strncpy(newsubj,fmsg->subj,MAXSUBJ);
}
@ -442,7 +362,7 @@ int rfc2ftn(FILE *fp, faddr *recipient)
* Create a new temp message in FTN style format
*/
if ((ofp = tmpfile()) == NULL) {
WriteError("$Can't open second tmpfile");
WriteError("$Rfc2ftn: Can't open second tmpfile");
tidyrfc(msg);
return 1;
}
@ -459,7 +379,7 @@ int rfc2ftn(FILE *fp, faddr *recipient)
}
if ((fmsg->msgid_a == NULL) || (fmsg->msgid_n == 0)) {
Syslog('!', "Warning, no MSGID %s %08lx", MBSE_SS(fmsg->msgid_a), fmsg->msgid_n);
Syslog('!', "Rfc2ftn: warning, no MSGID %s %08lx", MBSE_SS(fmsg->msgid_a), fmsg->msgid_n);
}
fprintf(ofp, "\001MSGID: %s %08lx\n", MBSE_SS(fmsg->msgid_a),fmsg->msgid_n);