diff options
Diffstat (limited to 'fetchmail.c')
-rw-r--r-- | fetchmail.c | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/fetchmail.c b/fetchmail.c index 726f93dc..872e22e8 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -636,106 +636,4 @@ struct hostrec *queryctl; } -/********************************************************************* - function: - description: hack message headers so replies will work properly - - arguments: - after where to put the hacked header - before header to hack - host name of the pop header - - return value: none. - calls: none. - globals: writes mda_argv. - *********************************************************************/ - -void reply_hack(buf, host) -/* hack local mail IDs -- code by Eric S. Raymond 20 Jun 1996 */ -char *buf; -const char *host; -{ - const char *from; - int state = 0; - char mycopy[POPBUFSIZE]; - - if (strncmp("From: ", buf, 6) - && strncmp("To: ", buf, 4) - && strncmp("Reply-", buf, 6) - && strncmp("Cc: ", buf, 4) - && strncmp("Bcc: ", buf, 5)) { - return; - } - - strcpy(mycopy, buf); - for (from = mycopy; *from; from++) - { - switch (state) - { - case 0: /* before header colon */ - if (*from == ':') - state = 1; - break; - - case 1: /* we've seen the colon, we're looking for addresses */ - if (*from == '"') - state = 2; - else if (*from == '(') - state = 3; - else if (*from == '<' || isalnum(*from)) - state = 4; - break; - - case 2: /* we're in a quoted human name, copy and ignore */ - if (*from == '"') - state = 1; - break; - - case 3: /* we're in a parenthesized human name, copy and ignore */ - if (*from == ')') - state = 1; - break; - - case 4: /* the real work gets done here */ - /* - * We're in something that might be an address part, - * either a bare unquoted/unparenthesized text or text - * enclosed in <> as per RFC822. - */ - /* if the address part contains an @, don't mess with it */ - if (*from == '@') - state = 5; - - /* If the address token is not properly terminated, ignore it. */ - else if (*from == ' ' || *from == '\t') - state = 1; - - /* - * On proper termination with no @, insert hostname. - * Case '>' catches <>-enclosed mail IDs. Case ',' catches - * comma-separated bare IDs. Cases \r and \n catch the case - * of a single ID alone on the line. - */ - else if (strchr(">,\r\n", *from)) - { - strcpy(buf, "@"); - strcat(buf, host); - buf += strlen(buf); - state = 1; - } - - /* everything else, including alphanumerics, just passes through */ - break; - - case 5: /* we're in a remote mail ID, no need to append hostname */ - if (*from == '>' || *from == ',' || isspace(*from)) - state = 1; - break; - } - - /* all characters from the old buffer get copied to the new one */ - *buf++ = *from; - } - *buf++ = '\0'; -} |