Thread View: news.software.nntp
1 messages
1 total messages
Started by Kaz Kylheku
Mon, 28 Aug 2023 19:54
[PATCH]: SLRN: check against excess quoting.
Author: Kaz Kylheku
Date: Mon, 28 Aug 2023 19:54
Date: Mon, 28 Aug 2023 19:54
1159 lines
30889 bytes
30889 bytes
This patch implements new configuration variables for defending
against too much quoted material in a follow-up article. Over the years,
I have screwed up a number of times, posting too much quoted material,
mostly due to getting distracted and forgetting about the part of the
followup that is off-screen.
I included a utility for renumbering the sections in manual.txt
and regenearting the TOC.
I sent the patch upstream.
From 2cb6f0febecfb5b7d0eca7e30af303b11bee7b26 Mon Sep 17 00:00:00 2001
From: Kaz Kylheku <kaz@kylheku.com>
Date: Thu, 24 Aug 2023 22:00:02 -0700
Subject: [PATCH 1/2] Implement rejection of too much quoted material.
* src/post.c (Slrn_Reject_Excess_Quoting,
Slrn_Min_Original_Percentage): New config variables.
(prepare_body): Calculate the number of original and
quoted lines, then check against minimum original
percentage, if configured.
* src/post.h (Slrn_Reject_Excess_Quoting,
Slrn_Min_Original_Percentage): Declared.
* src/startup.c (Slrn_Int_Variables): Registering
new config variables as "reject_excess_quoting"
and "min_original_percentage".
* doc/manual.txt: Documented. There is a slight change
in format: in the table of contents, there are now blank
lines before top-level section headings even if they
are preceded by other top-level section headings.
* doc/manual-renumber.txr: TXR script for regenerating
the manual with renumbered sections.
---
doc/manual-renumber.txr | 77 +++++++++
doc/manual.txt | 370 ++++++++++++++++++++++++----------------
src/post.c | 40 ++++-
src/post.h | 2 +
src/startup.c | 2 +
5 files changed, 340 insertions(+), 151 deletions(-)
create mode 100644 doc/manual-renumber.txr
diff --git a/doc/manual-renumber.txr b/doc/manual-renumber.txr
new file mode 100644
index 0000000..5b54437
--- /dev/null
+++ b/doc/manual-renumber.txr
@@ -0,0 +1,77 @@
+@; Script to renumber sections of manual.txt and generate TOC.
+@;
+@; Requires TXR (https://nongnu.org/txr).
+@;
+@; Copyright 2023 Kaz Kylheku <kaz@kylheku.com>
+@; See slrn ../COPYING file for copying info.
+@;
+@; How to use:
+@;
+@; 1. Do not manually edit the table of contents.
+@;
+@; 2. Add your new sections under some dummy section numbers which have the
+@; right depth. Observe the exact formatting rules.
+@;
+@; 3. Run this:
+@;
+@; txr manual-renumber manual.txt > temp.txt
+@;
+@; Now temp.txt has the renumbered manual with regenerated TOC.
+@;
+@; 4. Check it:
+@;
+@; diff -u manual.txt temp.txt
+@;
+@; 5. If happy:
+@;
+@; mv temp.txt manual.txt
+@;
+@; 6. If unhappy, fix manual.txt or this script.
+@;
+@(collect)
+@preamble
+@(until)
+ Table of Contents
+
+@(end)
+@(skip)
+ ______________________________________________________________________
+
+@(collect :vars (depth line title))
+ @{sec /(\d+\.)+/} @title
+@ (bind depth @(count #\. sec))
+@ (collect)
+@line
+@ (until)
+ @/\d+/.@nil
+@ (end)
+@(end)
+@(bind renum
+ @(let* ((prevnum '()))
+ (collect-each ((d depth))
+ (let ((renum (if (> d (len prevnum))
+ ^(,*prevnum 1)
+ (let* ((pd (pred d)))
+ ^(,*[prevnum 0..pd] ,(succ [prevnum pd]))))))
+ (set prevnum renum)))))
+@(output)
+@ (repeat)
+@ preamble
+@ (end)
+ Table of Contents
+@ (repeat)
+@ (caseq (len renum)
+ (1 `\n @renum. @title`)
+ (2 ` @{renum "."} @title`)
+ (3 ` @{renum "."} @title`))
+@ (end)
+ ______________________________________________________________________
+
+
+@ (repeat)
+ @{renum "."}. @title
+@ (repeat)
+@ line
+@ (end)
+@(end)
+@(end)
diff --git a/doc/manual.txt b/doc/manual.txt
index 9f74e3b..af8d9a2 100644
--- a/doc/manual.txt
+++ b/doc/manual.txt
@@ -20,7 +20,9 @@
2.1 A brief introduction to the built-in S-Lang prompt
3. Command line switches
+
4. Environment variables
+
5. The slrn configuration file
5.1 Basics
5.2 Preprocessing of configuration files
@@ -119,79 +121,81 @@
6.61 metamail_command
6.62 mime_charset
6.63 min_high_score
- 6.64 mouse
- 6.65 netiquette_warnings
- 6.66 new_subject_breaks_threads
- 6.67 no_autosave
- 6.68 no_backups
- 6.69 non_Xbrowser
- 6.70 organization
- 6.71 overview_date_format
- 6.72 post_editor_command
- 6.73 post_object
- 6.74 postpone_directory
- 6.75 prefer_head
- 6.76 printer_name
- 6.77 process_verbatim_marks
- 6.78 query_next_article
- 6.79 query_next_group
- 6.80 query_read_group_cutoff
- 6.81 quote_string
- 6.82 read_active
- 6.83 realname
- 6.84 reject_long_lines
- 6.85 reply_custom_headers
- 6.86 reply_string
- 6.87 replyto
- 6.88 save_directory
- 6.89 save_posts
- 6.90 save_replies
- 6.91 score_editor_command
- 6.92 scorefile
- 6.93 scroll_by_page
- 6.94 sendmail_command
- 6.95 server_object
- 6.96 show_article
- 6.97 show_thread_subject
- 6.98 signature
- 6.99 signoff_string
- 6.100 simulate_graphic_chars
- 6.101 smart_quote
- 6.102 sorting_method
- 6.103 spoiler_char
- 6.104 spoiler_display_mode
- 6.105 spool_active_file
- 6.106 spool_activetimes_file
- 6.107 spool_check_up_on_nov
- 6.108 spool_inn_root
- 6.109 spool_newsgroups_file
- 6.110 spool_nov_file
- 6.111 spool_nov_root
- 6.112 spool_overview_file
- 6.113 spool_root
- 6.114 supersedes_custom_headers
- 6.115 top_status_line
- 6.116 uncollapse_threads
- 6.117 unsubscribe_new_groups
- 6.118 use_blink
- 6.119 use_color
- 6.120 use_flow_control
- 6.121 use_grouplens
- 6.122 use_header_numbers
- 6.123 use_localtime
- 6.124 use_metamail
- 6.125 use_mime
- 6.126 use_recommended_msg_id
- 6.127 use_slrnpull
- 6.128 use_tilde
- 6.129 use_tmpdir
- 6.130 use_uudeview
- 6.131 username
- 6.132 warn_followup_to
- 6.133 wrap_flags
- 6.134 wrap_method
- 6.135 write_newsrc_flags
- 6.136 Xbrowser
+ 6.64 min_original_percentage
+ 6.65 mouse
+ 6.66 netiquette_warnings
+ 6.67 new_subject_breaks_threads
+ 6.68 no_autosave
+ 6.69 no_backups
+ 6.70 non_Xbrowser
+ 6.71 organization
+ 6.72 overview_date_format
+ 6.73 post_editor_command
+ 6.74 post_object
+ 6.75 postpone_directory
+ 6.76 prefer_head
+ 6.77 printer_name
+ 6.78 process_verbatim_marks
+ 6.79 query_next_article
+ 6.80 query_next_group
+ 6.81 query_read_group_cutoff
+ 6.82 quote_string
+ 6.83 read_active
+ 6.84 realname
+ 6.85 reject_excess_quoting
+ 6.86 reject_long_lines
+ 6.87 reply_custom_headers
+ 6.88 reply_string
+ 6.89 replyto
+ 6.90 save_directory
+ 6.91 save_posts
+ 6.92 save_replies
+ 6.93 score_editor_command
+ 6.94 scorefile
+ 6.95 scroll_by_page
+ 6.96 sendmail_command
+ 6.97 server_object
+ 6.98 show_article
+ 6.99 show_thread_subject
+ 6.100 signature
+ 6.101 signoff_string
+ 6.102 simulate_graphic_chars
+ 6.103 smart_quote
+ 6.104 sorting_method
+ 6.105 spoiler_char
+ 6.106 spoiler_display_mode
+ 6.107 spool_active_file
+ 6.108 spool_activetimes_file
+ 6.109 spool_check_up_on_nov
+ 6.110 spool_inn_root
+ 6.111 spool_newsgroups_file
+ 6.112 spool_nov_file
+ 6.113 spool_nov_root
+ 6.114 spool_overview_file
+ 6.115 spool_root
+ 6.116 supersedes_custom_headers
+ 6.117 top_status_line
+ 6.118 uncollapse_threads
+ 6.119 unsubscribe_new_groups
+ 6.120 use_blink
+ 6.121 use_color
+ 6.122 use_flow_control
+ 6.123 use_grouplens
+ 6.124 use_header_numbers
+ 6.125 use_localtime
+ 6.126 use_metamail
+ 6.127 use_mime
+ 6.128 use_recommended_msg_id
+ 6.129 use_slrnpull
+ 6.130 use_tilde
+ 6.131 use_tmpdir
+ 6.132 use_uudeview
+ 6.133 username
+ 6.134 warn_followup_to
+ 6.135 wrap_flags
+ 6.136 wrap_method
+ 6.137 write_newsrc_flags
+ 6.138 Xbrowser
7. Interactive functions
7.1 group functions
@@ -329,9 +333,9 @@
7.3.15 self_insert
7.3.16 trim
7.3.17 up
-
______________________________________________________________________
+
1. Introduction
slrn (``S-Lang read news'') is a newsreader, i.e. a program that
@@ -2534,7 +2538,56 @@
See also: ``kill_score'', ``max_low_score'', ``sorting_method''
- 6.64. mouse
+ 6.64. min_original_percentage
+
+ Type: integer
+ Default: 50
+
+ This variable determines the minimum acceptable original content
+ in an article, expressed as a percentage. This threshold is enforced
+ when ``reject_excess_quoting'' is enabled. If that option is not
+ enabled this variable has no effect.
+
+ Note that if ``min_original_percentage`` is zero or negative, then the
+ feature is also effectively disabled.
+
+ Original content is defined as follows.
+
+ Everything between verbatim marks (#+v and #v-) is original content,
+ including the mark lines themselves, and any blank lines in the
+ verbatim block.
+
+ Otherwise, all lines of the article body which are not signature
+ lines, empty lines or quoted lines are counted as original.
+ An empty line is one which contains only spaces or tabs, or no
+ characters at all.
+
+ The attribution line which introduces quoted text also counts
+ as original.
+
+ However, the "-- " line which separates the signature does not count
+ as original.
+
+ Quoted lines are those which begin with the character sequence given
+ by ``quote_string'', or else those which begin with ">" if that
+ variable is not specified.
+
+ The total number of lines, for the percentage calculation, is the sum
+ of the original lines and quoted lines.
+
+ The percentage of original content is calculated by multiplying the
+ original number of lines by 100 and dividing by the total number of
+ lines, by a division that truncates to an integer value toward zero.
+ This calculated percentage is required to be at least as high as the
+ ``min_original_percentage'' value.
+
+ Empty articles are also rejected: those which contain no quoted or
+ original lines. The rejection diagnostic has a different wording in
+ that situation.
+
+ See also: ``reject_excess_quoting'', ``quote_string''
+
+ 6.65. mouse
Type: integer
Default: 0
@@ -2580,7 +2633,7 @@
even if it does not work (and is therefore useless) on the current
terminal.
- 6.65. netiquette_warnings
+ 6.66. netiquette_warnings
Type: integer
Default: 1
@@ -2595,9 +2648,9 @@
To:" header line contains multiple groups. Additionally, you are
notified if your signature has more than four lines.
- See also: ``reject_long_lines''
+ See also: ``reject_long_lines'', ``reject_excess_quoting''
- 6.66. new_subject_breaks_threads
+ 6.67. new_subject_breaks_threads
Type: integer
Default: 0
@@ -2618,7 +2671,7 @@
"(was: ...)" is cut off. However, the regular expressions in
``strip_re_regexp'' and ``strip_was_regexp'' are not used.
- 6.67. no_autosave
+ 6.68. no_autosave
Type: integer
Default: 0
@@ -2633,7 +2686,7 @@
See also: ``no_backups''
- 6.68. no_backups
+ 6.69. no_backups
Type: integer
Default: 0
@@ -2642,7 +2695,7 @@
See also: ``no_autosave''
- 6.69. non_Xbrowser
+ 6.70. non_Xbrowser
Type: string
Default: (unset)
@@ -2652,7 +2705,7 @@
will chose the text mode web browser if ``$DISPLAY'' is unset or no
command could be found in ``Xbrowser''.
- 6.70. organization
+ 6.71. organization
Type: string
Default: (compile time setting)
@@ -2661,7 +2714,7 @@
arbitrary string. A discussion on how slrn obtains the default value
can be found in the entry on ``$ORGANIZATION''.
- 6.71. overview_date_format
+ 6.72. overview_date_format
Type: string
Default: (unset)
@@ -2674,7 +2727,7 @@
See also: ``use_localtime''
- 6.72. post_editor_command
+ 6.73. post_editor_command
Type: string
Default: (unset)
@@ -2689,7 +2742,7 @@
See also: ``mail_editor_command'', ``score_editor_command''
- 6.73. post_object
+ 6.74. post_object
Type: string
Default: (unset)
@@ -2702,7 +2755,7 @@
See also: ``server_object'', ``use_slrnpull''
- 6.74. postpone_directory
+ 6.75. postpone_directory
Type: string
Default: (unset)
@@ -2711,7 +2764,7 @@
variable is unset, slrn will try to use "News/postponed" for this
purpose.
- 6.75. prefer_head
+ 6.76. prefer_head
Type: integer
Default: 0
@@ -2727,7 +2780,7 @@
When set to 2, slrn never tries to use XOVER. This is only useful for
servers with broken XOVER implementations.
- 6.76. printer_name
+ 6.77. printer_name
Type: string
Default: (unset)
@@ -2750,7 +2803,7 @@
print is not yet implemented for VMS.
- 6.77. process_verbatim_marks
+ 6.78. process_verbatim_marks
Type: integer
Default: 1
@@ -2768,7 +2821,7 @@
See also: ``emphasized_text_mask'', ``emphasized_text_mode'',
``hide_verbatim_marks''
- 6.78. query_next_article
+ 6.79. query_next_article
Type: integer
Default: 1
@@ -2781,7 +2834,7 @@
See also: ``query_next_group''
- 6.79. query_next_group
+ 6.80. query_next_group
Type: integer
Default: 1
@@ -2794,7 +2847,7 @@
See also: ``query_next_article''
- 6.80. query_read_group_cutoff
+ 6.81. query_read_group_cutoff
Type: integer
Default: 100
@@ -2808,7 +2861,7 @@
However, slrn will not prompt you in this case; instead, it will
automatically download n articles if more are present.
- 6.81. quote_string
+ 6.82. quote_string
Type: string
Default: (unset)
@@ -2822,7 +2875,7 @@
See Also: ``smart_quote''
- 6.82. read_active
+ 6.83. read_active
Type: integer
Default: 0
@@ -2833,7 +2886,7 @@
newsserver), this may lead to a faster startup. If it is slow, you
should leave the default setting untouched.
- 6.83. realname
+ 6.84. realname
Type: string
Default: (unset)
@@ -2845,7 +2898,28 @@
See also: ``hostname'', ``username''
- 6.84. reject_long_lines
+ 6.85. reject_excess_quoting
+
+ Type: integer
+ Default: 0
+
+ If set to 1, slrn will not allow you to post articles containing
+ too many quoted lines. The rejection threshold is controlled by
+ the variable ``min_original_percentage'', which defaults to 50.
+ That variable must have a positive value, otherwise the feature is
+ disabled.
+
+ It is good netiquette to avoid quoting too much material in
+ a follow-up posting. Some moderated newsgroups will automatically
+ reject postings with insufficient original material in relation
+ to quoted material.
+
+ Quoted lines are those which begin with ``quote_string``, or
+ else lines which begin with ">" if ``quote_string'' isn't defined.
+
+ See also: ``min_original_percentage'', ``quote_string''
+
+ 6.86. reject_long_lines
Type: integer
Default: 2
@@ -2859,7 +2933,7 @@
See also: ``netiquette_warnings''
- 6.85. reply_custom_headers
+ 6.87. reply_custom_headers
Type: string
Default: (unset)
@@ -2875,7 +2949,7 @@
See also: ``custom_headers'', ``followup_custom_headers'',
``supersedes_custom_headers''
- 6.86. reply_string
+ 6.88. reply_string
Type: string
Default: "In %n, you wrote:" (localized)
@@ -2883,7 +2957,7 @@
This variable determines the attribution line slrn uses when replying
via email. You can use the same % escapes as in ``followup_string''.
- 6.87. replyto
+ 6.89. replyto
Type: string
Default: (unset)
@@ -2896,7 +2970,7 @@
See also: ``hostname'', ``username''
- 6.88. save_directory
+ 6.90. save_directory
Type: string
Default: (unset)
@@ -2910,7 +2984,7 @@
See also: ``decode_directory'', ``postpone_directory''
- 6.89. save_posts
+ 6.91. save_posts
Type: string
Default: (unset)
@@ -2929,7 +3003,7 @@
See also: ``save_replies''
- 6.90. save_replies
+ 6.92. save_replies
Type: string
Default: (unset)
@@ -2942,7 +3016,7 @@
the posting will only be appended to the folder in save_posts, not to
save_replies.
- 6.91. score_editor_command
+ 6.93. score_editor_command
Type: string
Default: (unset)
@@ -2955,7 +3029,7 @@
See also: ``mail_editor_command'', ``post_editor_command''
- 6.92. scorefile
+ 6.94. scorefile
Type: string
Default: (unset)
@@ -2975,7 +3049,7 @@
version of this manual might also include a separate section about the
concept of "scoring".
- 6.93. scroll_by_page
+ 6.95. scroll_by_page
Type: integer
Default: 0
@@ -2988,7 +3062,7 @@
Note: If you change this variable at runtime, the change will take
effect as soon as you select a group or enter group mode.
- 6.94. sendmail_command
+ 6.96. sendmail_command
Type: string
Default: (compile time setting)
@@ -3007,7 +3081,7 @@
piped to the program, what slrn is not able to do. You can handle this
by adding a "<" at the end of the string.
- 6.95. server_object
+ 6.97. server_object
Type: string
Default: (unset)
@@ -3021,7 +3095,7 @@
See also: ``post_object'', ``use_slrnpull''
- 6.96. show_article
+ 6.98. show_article
Type: integer
Default: 0
@@ -3029,7 +3103,7 @@
If non-zero, the first article is automatically displayed when
entering a group.
- 6.97. show_thread_subject
+ 6.99. show_thread_subject
Type: integer
Default: 0
@@ -3040,7 +3114,7 @@
If you still prefer to have all subject lines displayed, you can set
this variable to a non-zero value.
- 6.98. signature
+ 6.100. signature
Type: string
Default: (compile time setting)
@@ -3062,7 +3136,7 @@
See also: ``signoff_string''
- 6.99. signoff_string
+ 6.101. signoff_string
Type: string
Default: (unset)
@@ -3076,7 +3150,7 @@
the URL of your homepage or append some funny quote to your postings,
put it in your ``signature file''.
- 6.100. simulate_graphic_chars
+ 6.102. simulate_graphic_chars
Type: integer
Default: 0
@@ -3091,7 +3165,7 @@
line drawing (which looks much better). Please see the slrn FAQ for
details.
- 6.101. smart_quote
+ 6.103. smart_quote
Type: integer
Default: 1
@@ -3104,7 +3178,7 @@
2 Do not quote blank lines
3 Do not quote blank lines, but insert a whitespace before others
- 6.102. sorting_method
+ 6.104. sorting_method
Type: integer
Default: 3
@@ -3134,7 +3208,7 @@
look at the variables ``custom_sort_order'' and
``custom_sort_by_threads''.
- 6.103. spoiler_char
+ 6.105. spoiler_char
Type: character
Default: '*'
@@ -3147,7 +3221,7 @@
See also: ``spoiler_display_mode''
- 6.104. spoiler_display_mode
+ 6.106. spoiler_display_mode
Type: integer
Default: 1
@@ -3163,7 +3237,7 @@
See also: ``spoiler_char''
- 6.105. spool_active_file
+ 6.107. spool_active_file
Type: string
Default: "data/active"
@@ -3182,7 +3256,7 @@
See also: ``spool_inn_root'', ``server_object'', ``post_object'',
``use_slrnpull''
- 6.106. spool_activetimes_file
+ 6.108. spool_activetimes_file
Type: string
Default: "data/active.times"
@@ -3195,7 +3269,7 @@
See also: ``spool_inn_root''
- 6.107. spool_check_up_on_nov
+ 6.109. spool_check_up_on_nov
Type: integer
Default: 0
@@ -3211,7 +3285,7 @@
See also: ``spool_active_file'', ``spool_nov_file''
- 6.108. spool_inn_root
+ 6.110. spool_inn_root
Type: string
Default: "/var/lib/news"
@@ -3225,7 +3299,7 @@
See also: ``spool_active_file'', ``spool_activetimes_file'',
``spool_newsgroups_file''
- 6.109. spool_newsgroups_file
+ 6.111. spool_newsgroups_file
Type: string
Default: "data/newsgroups"
@@ -3239,7 +3313,7 @@
See also: ``spool_inn_root''
- 6.110. spool_nov_file
+ 6.112. spool_nov_file
Type: string
Default: ".overview"
@@ -3248,7 +3322,7 @@
See also: ``spool_nov_root''
- 6.111. spool_nov_root
+ 6.113. spool_nov_root
Type: string
Default: "/var/spool/news"
@@ -3258,7 +3332,7 @@
See also: ``spool_nov_file''
- 6.112. spool_overview_file
+ 6.114. spool_overview_file
Type: string
Default: "data/overview.fmt"
@@ -3271,7 +3345,7 @@
See also: ``spool_inn_root''
- 6.113. spool_root
+ 6.115. spool_root
Type: string
Default: "/var/spool/news"
@@ -3280,7 +3354,7 @@
See also: ``spool_inn_root'', ``spool_nov_root''
- 6.114. supersedes_custom_headers
+ 6.116. supersedes_custom_headers
Type: string
Default: (unset)
@@ -3290,7 +3364,7 @@
See also: ``custom_headers'', ``reply_custom_headers''
- 6.115. top_status_line
+ 6.117. top_status_line
Type: string
Default: (unset)
@@ -3318,21 +3392,21 @@
information in the status line, you should be aware that it is not
automatically redrawn every second.
- 6.116. uncollapse_threads
+ 6.118. uncollapse_threads
Type: integer
Default: 0
If non-zero, all threads will be uncollapsed when entering a group.
- 6.117. unsubscribe_new_groups
+ 6.119. unsubscribe_new_groups
Type: integer
Default: 0
If non-zero, new newsgroups won't be subscribed automatically.
- 6.118. use_blink
+ 6.120. use_blink
Type: integer
Default: (system dependent)
@@ -3345,7 +3419,7 @@
look into using a different terminfo entry. See section ``color'' for
details.
- 6.119. use_color
+ 6.121. use_color
Type: integer
Default: (system dependent)
@@ -3354,7 +3428,7 @@
(if set to 0). When unset, color is automatically used if your
terminal supports it according to its termcap entry.
- 6.120. use_flow_control
+ 6.122. use_flow_control
Type: integer
Default: 0
@@ -3363,7 +3437,7 @@
enabled. This means that you will be able to "freeze" the screen using
Control-S and "thaw" it by pressing Control-Q.
- 6.121. use_grouplens
+ 6.123. use_grouplens
Type: integer
Default: 0
@@ -3378,7 +3452,7 @@
If this is incorrect, we would be grateful for a pointer to additional
information on it.
- 6.122. use_header_numbers
+ 6.124. use_header_numbers
Type: integer
Default: 1
@@ -3386,7 +3460,7 @@
If non-zero, header numbers are displayed at the left margin to make
article selection more efficient.
- 6.123. use_localtime
+ 6.125. use_localtime
Type: integer
Default: 1
@@ -3404,7 +3478,7 @@
own postings. They are not even generated by slrn, unless you set
``generate_date_header''. VMS and BeOS do not support using GMT.
- 6.124. use_metamail
+ 6.126. use_metamail
Type: integer
Default: 1
@@ -3412,11 +3486,11 @@
If non-zero, slrn calls the program given in ``metamail_command'' to
processes MIME articles it cannot handle.
- 6.125. use_mime
+ 6.127. use_mime
This variable is obsolete.
- 6.126. use_recommended_msg_id
+ 6.128. use_recommended_msg_id
Type: integer
Default: 0
@@ -3430,7 +3504,7 @@
If both this variable and ``generate_message_id'' are set, slrn uses
the server's ID rather than generating its own.
- 6.127. use_slrnpull
+ 6.129. use_slrnpull
Type: integer
Default: 0
@@ -3441,7 +3515,7 @@
See also: ``server_object''
- 6.128. use_tilde
+ 6.130. use_tilde
Type: integer
Default: 1
@@ -3449,7 +3523,7 @@
If non-zero, tildes ("~") are displayed at the end of an article like
it is done in the vi editor.
- 6.129. use_tmpdir
+ 6.131. use_tmpdir
Type: integer
Default: 0
@@ -3459,7 +3533,7 @@
explains what will happen if $TMP is unset), and Randomized filenames
will be used for posts instead of .article, .followup and .letter.
- 6.130. use_uudeview
+ 6.132. use_uudeview
Type: integer
Default: (compile time setting)
@@ -3469,7 +3543,7 @@
sophisticated) builtin routines for decoding binary files, set this
variable to 0. Otherwise, it has no effect.
- 6.131. username
+ 6.133. username
Type: string
Default: (system specific)
@@ -3487,7 +3561,7 @@
See also: ``hostname'', ``realname''
- 6.132. warn_followup_to
+ 6.134. warn_followup_to
Type: integer
Default: 1
@@ -3499,7 +3573,7 @@
group you are currently reading; setting it to 0 disables this warning
completely.
- 6.133. wrap_flags
+ 6.135. wrap_flags
Type: integer
Default: 3
@@ -3522,7 +3596,7 @@
See also: ``wrap_method'', ``wrap_article''
- 6.134. wrap_method
+ 6.136. wrap_method
Type: integer
Default: 2
@@ -3535,7 +3609,7 @@
See also: ``wrap_flags''
- 6.135. write_newsrc_flags
+ 6.137. write_newsrc_flags
Type: integer
Default: 0
@@ -3545,7 +3619,7 @@
2, unsubscribed groups are not saved if there are any unread messages
in them.
- 6.136. Xbrowser
+ 6.138. Xbrowser
Type: string
Default: (unset)
diff --git a/src/post.c b/src/post.c
index 024667b..132da6a 100644
--- a/src/post.c
+++ b/src/post.c
@@ -88,6 +88,8 @@ int Slrn_Generate_Date_Header = 0;
int Slrn_Generate_Message_Id = 1;
int Slrn_Netiquette_Warnings = 1;
int Slrn_Reject_Long_Lines = 2;
+int Slrn_Reject_Excess_Quoting = 0;
+int Slrn_Min_Original_Percentage = 50;
int Slrn_Use_Recom_Id = 0;
/*}}}*/
@@ -874,7 +876,7 @@ static Slrn_Mime_Error_Obj *
unsigned int vlen;
unsigned int lineno=*linenum;
char *qs = Slrn_Quote_String;
- int qlen, not_quoted=0, sig_lines=-1, longline=0, hibin=0;
+ int qlen, quoted=0, original = 0, sig_lines=-1, longline=0, hibin=0;
int verbatim = 0, check_verbatim = 1;
Slrn_Mime_Error_Obj *err = NULL;
Slrn_Article_Line_Type *raw_line=a->raw_lines;
@@ -887,6 +889,8 @@ static Slrn_Mime_Error_Obj *
/* put body into a->raw_lines */
while (NULL != (vline = vgets (vp, &vlen)))
{
+ int is_empty = 0;
+
Slrn_Article_Line_Type *tmp;
/*remove trailing \n*/
if (vline[vlen-1] == '\n')
@@ -895,6 +899,8 @@ static Slrn_Mime_Error_Obj *
line = slrn_safe_strnmalloc (vline, vlen);
lineno++;
+ is_empty = (line[strspn(line, "\t ")] == 0);
+
if (!hibin && slrn_string_nonascii(line))
hibin=1;
@@ -923,8 +929,13 @@ static Slrn_Mime_Error_Obj *
if (0 == strcmp (line, "-- "))
sig_lines = 0;
- if ((!not_quoted) &&(strncmp (line, qs, qlen)))
- not_quoted=1;
+ if (sig_lines == -1)
+ {
+ if (!strncmp (line, qs, qlen))
+ quoted++;
+ else if (sig_lines == -1 && !is_empty)
+ original++;
+ }
if (Slrn_Reject_Long_Lines
&& (longline == 0)
@@ -941,6 +952,10 @@ static Slrn_Mime_Error_Obj *
line, lineno, severity);
}
}
+ else if (!is_empty)
+ {
+ original++;
+ }
tmp = (Slrn_Article_Line_Type *) slrn_safe_malloc(sizeof(Slrn_Article_Line_Type));
@@ -960,6 +975,25 @@ static Slrn_Mime_Error_Obj *
err = slrn_add_mime_error(err,
_("Please keep your signature short. 4 lines is a commonly accepted limit."),
NULL, lineno, MIME_ERROR_NET);
+
+ if (Slrn_Reject_Excess_Quoting && Slrn_Min_Original_Percentage > 0)
+ {
+ int total = original + quoted;
+
+ if (total > 0 &&
+ 100 * original / total < Slrn_Min_Original_Percentage)
+ {
+ err = slrn_add_mime_error(err,
+ _("Please trim the amount of quoted material."),
+ NULL, lineno, MIME_ERROR_NET);
+ }
+ else if (total == 0)
+ {
+ err = slrn_add_mime_error(err,
+ _("Article is empty."),
+ NULL, lineno, MIME_ERROR_NET);
+ }
+ }
*linenum=lineno;
return err;
}
diff --git a/src/post.h b/src/post.h
index 08f47e9..d024d2c 100644
--- a/src/post.h
+++ b/src/post.h
@@ -32,6 +32,8 @@ extern char *Slrn_Save_Posts_File;
extern char *Slrn_Save_Replies_File;
extern char *Slrn_Post_Custom_Headers;
extern int Slrn_Reject_Long_Lines;
+extern int Slrn_Reject_Excess_Quoting;
+extern int Slrn_Min_Original_Percentage;
extern char *Slrn_Postpone_Dir;
extern int Slrn_Generate_Message_Id;
extern int Slrn_Generate_Date_Header;
diff --git a/src/startup.c b/src/startup.c
index e4b585e..2f5f429 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -590,6 +590,8 @@ Slrn_Int_Var_Type Slrn_Int_Variables [] = /*{{{*/
{"use_color", NULL, get_set_use_color_callback},
{"ignore_signature", &Slrn_Sig_Is_End_Of_Article, NULL},
{"reject_long_lines", &Slrn_Reject_Long_Lines, NULL},
+ {"reject_excess_quoting", &Slrn_Reject_Excess_Quoting, NULL},
+ {"min_original_percentage", &Slrn_Min_Original_Percentage, NULL},
{"netiquette_warnings", &Slrn_Netiquette_Warnings, NULL},
{"generate_date_header", &Slrn_Generate_Date_Header, NULL},
{"generate_message_id", &Slrn_Generate_Message_Id, NULL},
--
2.17.1
--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads