-
Notifications
You must be signed in to change notification settings - Fork 97
Fixes for issues 28 - 36 #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a157285
Support locales with names ending in ".UTF-8".
bshannon 88e726f
Avoid segfault when all messages are excluded.
bshannon 841018b
The describe_folder option was being ignored.
bshannon a36c5ae
Add show_received_date option to control output of "Received on"
bshannon b2e0ba5
Always output <a name="start%d" ... to tag the start of the message b…
bshannon 3bbab9f
Avoid segfault due to null pointer when given "From: <[email protected]"
bshannon 00bccd4
Be sure to null terminate copied charset string.
bshannon 1ecdaa5
Add more charset aliases.
bshannon 0912a1c
Fix ISO-2022-JP support.
bshannon 1829294
Add documentation for the show_received_date option.
bshannon 7481b36
Oops, forgot to malloc and copy input before returning it.
bshannon 2b2451b
Prevent segfault when incorrectly matching certain URI schemes - fixe…
bshannon 7fd26ca
Update show_received_date example and add "enabled by default" comment.
bshannon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,60 +26,43 @@ char *spamify(char *input) | |
|
||
char *spamify_small(char *input) | ||
{ | ||
int insertlen = strlen(set_antispam_at); | ||
/* we should replace the @-letter in the email address */ | ||
int newlen = strlen(input) + insertlen; | ||
|
||
char *atptr = strchr(input, '@'); | ||
|
||
if (atptr) { | ||
char *newbuf = malloc(newlen); | ||
int index = atptr - input; | ||
/* copy the part before the @ */ | ||
memcpy(newbuf, input, index); | ||
memcpy(newbuf + index, set_antispam_at, insertlen); | ||
|
||
/* append the part after the @ */ | ||
strcpy(newbuf + index + insertlen, input + index + 1); | ||
|
||
/* correct the pointer and free the old */ | ||
free(input); | ||
return newbuf; | ||
return replacechar(input, '@', set_antispam_at); | ||
} | ||
/* weird email, bail out */ | ||
return input; | ||
} | ||
|
||
char *spamify_replacedomain(char *input, char *antispamdomain) | ||
{ | ||
/* replace everything after the @-letter in the email address */ | ||
int newlen = strlen(input) + strlen(set_antispam_at); | ||
int domainlen = strlen(antispamdomain); | ||
|
||
char *atptr = strchr(input, '@'); | ||
|
||
if (domainlen > 0) { | ||
newlen = newlen + domainlen; | ||
} | ||
|
||
if (atptr) { | ||
char *newbuf = malloc(newlen); | ||
int index = atptr - input; | ||
/* copy the part before the @ */ | ||
memcpy(newbuf, input, index); | ||
/* append _at_ */ | ||
memcpy(newbuf + index, set_antispam_at, strlen(set_antispam_at)); | ||
if (domainlen > 0) { | ||
/* append the new domain */ | ||
strcpy(newbuf + index + strlen(set_antispam_at), antispamdomain); | ||
} | ||
else { | ||
/* append the part after the @ */ | ||
strcpy(newbuf + index + strlen(set_antispam_at), input + index + 1); | ||
} | ||
/* correct the pointer and free the old */ | ||
free(input); | ||
return newbuf; | ||
/* replace everything after the @-letter in the email address */ | ||
int domainlen = strlen(antispamdomain); | ||
struct Push buff; | ||
int in_ascii = TRUE, esclen = 0; | ||
|
||
INIT_PUSH(buff); | ||
|
||
for (; *input; input++) { | ||
if (set_iso2022jp) iso2022_state(input, &in_ascii, &esclen); | ||
if (in_ascii == TRUE && *input == '@') { | ||
PushString(&buff, set_antispam_at); | ||
if (domainlen > 0) { | ||
/* append the new domain */ | ||
PushString(&buff, antispamdomain); | ||
break; | ||
} | ||
} | ||
else | ||
PushByte(&buff, *input); | ||
} | ||
|
||
RETURN_PUSH(buff); | ||
} | ||
/* weird email, bail out */ | ||
return input; | ||
|
@@ -249,11 +232,14 @@ void getname(char *line, char **namep, char **emailp) | |
} | ||
else if (*c == '<') { /* Comment may be on the end */ | ||
/* From: <[email protected]> Bill Campbell */ | ||
c = strchr(line, '>') + 1; | ||
for (i = 0, len = NAMESTRLEN - 1; *c && *c != '\n' && i < len; c++) | ||
name[i++] = *c; | ||
char *c2 = strchr(line, '>'); | ||
if (c2 != NULL) { | ||
c = c2 + 1; | ||
for (i = 0, len = NAMESTRLEN - 1; *c && *c != '\n' && i < len; c++) | ||
name[i++] = *c; | ||
|
||
comment_fnd = 1; | ||
comment_fnd = 1; | ||
} | ||
} | ||
} | ||
else if (strchr(line, '(')) { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,6 +109,21 @@ char *setindex(char *dfltindex, char *indextype, char *suffix) | |
return (rp); | ||
} | ||
|
||
/* | ||
** Convert locale name to a UTF_8 locale name. | ||
** | ||
** Returns an ALLOCATED string! | ||
*/ | ||
static char *utf8locale(char *locale) | ||
{ | ||
struct Push buff; | ||
|
||
INIT_PUSH(buff); /* init macro */ | ||
PushString(&buff, locale); | ||
PushString(&buff, ".UTF-8"); | ||
RETURN_PUSH(buff); | ||
} /* end utf8locale() */ | ||
|
||
|
||
/* Print out the version number and die. */ | ||
|
||
|
@@ -365,9 +380,13 @@ int main(int argc, char **argv) | |
} | ||
|
||
#ifdef HAVE_LOCALE_H | ||
if (!setlocale(LC_ALL, locale_code)) { | ||
if (!setlocale(LC_ALL, locale_code)) { | ||
char *locale_code_utf8 = utf8locale(locale_code); | ||
if (!setlocale(LC_ALL, locale_code_utf8)) { | ||
snprintf(errmsg, sizeof(errmsg), "WARNING: locale \"%s\", not supported.\n", locale_code); | ||
fprintf(stderr, "%s", errmsg);/* AUDIT biege: avoid format-bug warning */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This patch look s ok. Could you explain what is "AUDIT biege"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No idea. That's not code that I added or touched. |
||
} | ||
free(locale_code_utf8); | ||
} | ||
#endif | ||
|
||
|
@@ -604,6 +623,7 @@ int main(int argc, char **argv) | |
} | ||
if (set_increment) { | ||
int num_displayable; | ||
int num_added; | ||
if (set_linkquotes) | ||
replylist = NULL; | ||
/* we have to start with the msgnum - 1 so that the rest of the | ||
|
@@ -613,29 +633,32 @@ int main(int argc, char **argv) | |
amount_old = max_msgnum + 1; /* counts gaps as messages */ | ||
|
||
/* start numbering at this number */ | ||
amount_new = num_displayable + parsemail(set_mbox, use_stdin, set_readone, set_increment, set_dir, set_inlinehtml, amount_old); | ||
if (set_linkquotes) | ||
analyze_headers(max_msgnum + 1); | ||
|
||
/* write the index of msgno/msgid_hash filenames */ | ||
if (set_nonsequential) | ||
write_messageindex(0, max_msgnum + 1); | ||
|
||
writearticles(amount_old, max_msgnum + 1); | ||
|
||
/* JK: in function of other hypermail configuration options, | ||
delete_incremental will continuous escape and add more markup | ||
to non-deleted messages that are replies to deleted messages. | ||
Thus, a setup option to disable it */ | ||
if (set_delete_incremental && deletedlist) | ||
update_deletions(amount_old); | ||
|
||
if (set_show_msg_links) { | ||
fixnextheader(set_dir, amount_old, -1); | ||
for (i = amount_old; i <= max_msgnum; ++i) { | ||
if (set_showreplies) | ||
fixreplyheader(set_dir, i, 0, amount_old); | ||
fixthreadheader(set_dir, i, amount_old); | ||
num_added = parsemail(set_mbox, use_stdin, set_readone, set_increment, set_dir, set_inlinehtml, amount_old); | ||
if (num_added > 0) { | ||
amount_new = num_displayable + num_added; | ||
if (set_linkquotes) | ||
analyze_headers(max_msgnum + 1); | ||
|
||
/* write the index of msgno/msgid_hash filenames */ | ||
if (set_nonsequential) | ||
write_messageindex(0, max_msgnum + 1); | ||
|
||
writearticles(amount_old, max_msgnum + 1); | ||
|
||
/* JK: in function of other hypermail configuration options, | ||
delete_incremental will continuous escape and add more markup | ||
to non-deleted messages that are replies to deleted messages. | ||
Thus, a setup option to disable it */ | ||
if (set_delete_incremental && deletedlist) | ||
update_deletions(amount_old); | ||
|
||
if (set_show_msg_links) { | ||
fixnextheader(set_dir, amount_old, -1); | ||
for (i = amount_old; i <= max_msgnum; ++i) { | ||
if (set_showreplies) | ||
fixreplyheader(set_dir, i, 0, amount_old); | ||
fixthreadheader(set_dir, i, amount_old); | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add (enabled by default) comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the example and added the comment, as is done for other options that are enabled by default.