author | Martin Szulecki <opensuse@sukimashita.com> | 2009-08-07 12:05:17 (UTC) |
---|---|---|
committer | Martin Szulecki <opensuse@sukimashita.com> | 2009-08-08 12:23:28 (UTC) |
commit | 2f56e390f04fe6975b75e512c1436ef173e4aafe (patch) (side-by-side diff) | |
tree | 4e187a5cf039a39a1908623b97e0676c6e7cb756 | |
parent | 286a905842dc0bec6d21a614ec4a97c5f19d5bc4 (diff) | |
download | cgit-2f56e390f04fe6975b75e512c1436ef173e4aafe.zip cgit-2f56e390f04fe6975b75e512c1436ef173e4aafe.tar.gz cgit-2f56e390f04fe6975b75e512c1436ef173e4aafe.tar.bz2 |
Introduce noplainemail option to hide email adresses from spambots
Signed-off-by: Martin Szulecki <opensuse@sukimashita.com>
-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc.5.txt | 4 | ||||
-rw-r--r-- | ui-atom.c | 2 | ||||
-rw-r--r-- | ui-commit.c | 4 | ||||
-rw-r--r-- | ui-patch.c | 6 | ||||
-rw-r--r-- | ui-tag.c | 2 |
7 files changed, 18 insertions, 3 deletions
@@ -52,4 +52,6 @@ void config_cb(const char *name, const char *value) } else if (!strcmp(name, "nocache")) ctx.cfg.nocache = atoi(value); + else if (!strcmp(name, "noplainemail")) + ctx.cfg.noplainemail = atoi(value); else if (!strcmp(name, "noheader")) ctx.cfg.noheader = atoi(value); @@ -169,4 +169,5 @@ struct cgit_config { int max_stats; int nocache; + int noplainemail; int noheader; int renamelimit; diff --git a/cgitrc.5.txt b/cgitrc.5.txt index a207fe0..7754923 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -159,4 +159,8 @@ nocache:: value: "0". +noplainemail:: + If set to "1" showing full author email adresses will be disabled. + Default value: "0". + noheader:: Flag which, when set to "1", will make cgit omit the standard header @@ -33,5 +33,5 @@ void add_entry(struct commit *commit, char *host) html("</name>\n"); } - if (info->author_email) { + if (info->author_email && !ctx.cfg.noplainemail) { mail = xstrdup(info->author_email); t = strchr(mail, '<'); diff --git a/ui-commit.c b/ui-commit.c index 41ce70e..9fdb8ee 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -41,6 +41,8 @@ void cgit_print_commit(char *hex) html("<tr><th>author</th><td>"); html_txt(info->author); + if (!ctx.cfg.noplainemail) { html(" "); html_txt(info->author_email); + } html("</td><td class='right'>"); cgit_print_date(info->author_date, FMT_LONGDATE, ctx.cfg.local_time); @@ -48,6 +50,8 @@ void cgit_print_commit(char *hex) html("<tr><th>committer</th><td>"); html_txt(info->committer); + if (!ctx.cfg.noplainemail) { html(" "); html_txt(info->committer_email); + } html("</td><td class='right'>"); cgit_print_date(info->committer_date, FMT_LONGDATE, ctx.cfg.local_time); @@ -109,5 +109,9 @@ void cgit_print_patch(char *hex) cgit_print_http_headers(&ctx); htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1)); - htmlf("From: %s %s\n", info->author, info->author_email); + htmlf("From: %s", info->author); + if (!ctx.cfg.noplainemail) { + htmlf(" %s", info->author_email); + } + html("\n"); html("Date: "); cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time); @@ -65,5 +65,5 @@ void cgit_print_tag(char *revname) html("<tr><td>Tagged by</td><td>"); html_txt(info->tagger); - if (info->tagger_email) { + if (info->tagger_email && !ctx.cfg.noplainemail) { html(" "); html_txt(info->tagger_email); |