This patch affects editing of the score file. Usenet suffers from a lot
of Google Groups spam, and it is often identified well through the
Injection*: headers. These headers are not propagated to the score
file, so I've had to manually copy and paste, which is annoying.
This change makes slrn scan through the list of additional headers and
pick out anything that starts with "Injection" or contains
"Posting-Host". (Note that I'm not seeing the NNTP-Posting-Host header
show up in the list, but if that is fixed, it will be included.)
I sent the patch upstream to J.E.D.
From c84453f2def8f78721d4f31166c1e75568a2fd90 Mon Sep 17 00:00:00 2001
From: Kaz Kylheku <
[email protected]>
Date: Mon, 28 Aug 2023 00:01:05 -0700
Subject: [PATCH 2/2] Include Injection headers when editing scores.
Google Groups posts contain headers that are useful in
filtering, identifying the account and IP address.
SLRN should propagate these to the score file to make
it easier to make use of them.
* src/editscore.c (slrn_edit_score):Walk the additional
headers in h->add_hdrs. If the name of any header starts
with "Inject" or contain "Posting-Host", then include it.
---
src/editscore.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/src/editscore.c b/src/editscore.c
index 5c7d2df..ba1d022 100644
--- a/src/editscore.c
+++ b/src/editscore.c
@@ -186,6 +186,8 @@ int slrn_edit_score (Slrn_Header_Type *h, char *newsgroup)
if (Slrn_Prefix_Arg_Ptr == NULL)
{
+ Slrn_Header_Line_Type *ah_iter;
+
char *line;
int comment;
linenum = 1;
@@ -292,6 +294,47 @@ int slrn_edit_score (Slrn_Header_Type *h, char *newsgroup)
fprintf (fp, "%%\tNewsgroup: %s\n", q);
}
+
+ for (ah_iter = h->add_hdrs; ah_iter != NULL; ah_iter = ah_iter->next)
+ {
+ char *value = ah_iter->value;
+ char *name = ah_iter->name;
+
+ if (name == NULL || value == NULL)
+ continue;
+
+ if (strncmp(name, "Inject", 6) != 0 &&
+ strstr(name, "Posting-Host") == 0)
+ continue;
+
+ line = slrn_safe_strmalloc (value);
+ remove_linebreaks (line);
+ if ((NULL == (q = SLregexp_qu