flnews_post_proc 2.02 → 2.05

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8817d100431b3efc184a9d04d9dd4e9f167522bedc1c18fafe73f8f53aa6a593
4
- data.tar.gz: c4edcbcff7e0aa31e9a98a1b77009a8e34fba8697d652b5723285e6e5ec7c1ff
3
+ metadata.gz: 87bf0a3e9a8c5ab513c440c94fd798aba136a4fd72fb351cfbf133f1270e2758
4
+ data.tar.gz: 32f644c07859db2b6569621b471a786e4409e0cdaffb5e67a193e54d7f7e99a7
5
5
  SHA512:
6
- metadata.gz: 415eb0c42645803f583cdafbfb6972d524175cb1ce7968f9089081ed946e9f5058e12181cea53ce978aed25942c64e52aad18f152276c967fe1b4cbdb08a86da
7
- data.tar.gz: ca800a99b820edbdef0eaff62dde3aca16b790593cc3358cc6da8399b8730b4d73fb6e925338ca046bb6a4ee45b6f535af302e11e5cae299ac2a6813786528b5
6
+ metadata.gz: ae7465a7d6e9ec4dee294344bbdb1d6c10950351f6d5eeddb84c324d3700e653d4bb305170415071632208b3f5ec0e2f4ec05ada59dee07d9426cde2f7e87a1d
7
+ data.tar.gz: e0180d504592a9ab223d46c994b5a79ae81bb5a2b62970915b0b683d546c79ef2affdd12c6b17932f71a63639d9fc8c25ad41289ec69ce03a429ae71db6c92b0
data/bin/flnews_post_proc CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  =begin
5
5
  /***************************************************************************
6
- * ©2023-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
6
+ * ©2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu> *
7
7
  * *
8
8
  * This program is free software; you can redistribute it and/or modify *
9
9
  * it under the terms of the DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE *
@@ -22,8 +22,7 @@ if ! (/linux/ =~ RUBY_PLATFORM)
22
22
  exit false
23
23
  end
24
24
 
25
- # needs the ruby-filemagic gem
26
- require 'filemagic'
25
+ require 'mimemagic'
27
26
  require 'tempfile'
28
27
 
29
28
  require_relative '../lib/override'
@@ -68,21 +67,24 @@ if (!STDIN.tty?)
68
67
  if !artext.strip.empty?
69
68
  # Be sure to know what you are doing.
70
69
  # Ask around in case of doubt.
71
- mime = FileMagic.mime.buffer artext
72
- debug('mime is ' << mime.split(';')[0])
73
- if (['news', 'rfc822'].none? {|m| mime.start_with?('message/' << m) } )
70
+ type = ''
71
+ magic = MimeMagic.by_magic(artext)
72
+ # mime = FileMagic.mime.buffer artext
73
+ debug('magic is ' << magic.to_s)
74
+ type = magic.type if magic
75
+ if (['news', 'rfc822'].none? {|m| type.start_with?('message/' << m) } )
74
76
  # Not a pure news message
75
77
  # Add more reactions, as you stumble upon them ...
76
- warn ("Input is of wrong mime-type " << mime.split(';')[0])
78
+ warn ("Input is of wrong type " << type)
77
79
 
78
80
  # Javascript okay
79
- if (['javascript'].any? {|m| mime.start_with?('application/' << m)} )
81
+ if (['javascript'].any? {|m| type.start_with?('application/' << m)} )
80
82
  warn 'Input contains java-script code!'
81
83
  # C okay
82
- elsif(['x-c'].any? {|m| mime.start_with?('text/' << m)} )
84
+ elsif(['x-c'].any? {|m| type.start_with?('text/' << m)} )
83
85
  warn 'Input contains C- or C++ code!'
84
86
  # Ruby okay
85
- elsif(['x-ruby'].any? {|m| mime.start_with?('text/' << m) })
87
+ elsif(['x-ruby'].any? {|m| type.start_with?('text/' << m) })
86
88
  warn 'Input contains Ruby-code!'
87
89
  else
88
90
  warn 'Input contains other things than plain-text, but I cannot say, what.'
data/changes.txt CHANGED
@@ -1,6 +1,20 @@
1
+ v.2.05
2
+ *) Gemspec: Dependency for io-console added.
3
+ v.2.04
4
+ *) Gemspec: Dependencies added
5
+ -) gem New_rfc_2047 was missing from the specs.
6
+ -) MimeMagic was already in the specs
7
+
8
+ v.2.03
9
+ *) Ruby-Filemagic has been replaced by MimeMagic.
10
+ *) Calls to force_encoding() prior String.gsub have been added
11
+ Ruby 4.1.0 appears to be stricter in handling encoding mismatches.
12
+ *) Bugfix: A typo in a require statement had been corrected.
13
+ *) Whiptail dialog code removed
14
+
1
15
  v.2.02
2
16
  *) Bugfix: There was output to STDOUT unrelated to the message in
3
- preparation and made Flnews complain. Also, posting was impossible.
17
+ preparation which made Flnews complain. Also, posting was impossible.
4
18
  v.2.01
5
19
  *) The documentation has been updated.
6
20
  *) Corrected behavior when logging is disabled in the interactive dialog
@@ -57,7 +57,7 @@
57
57
 
58
58
  <li>
59
59
  <p><a class="reference internal" href=
60
- "#dialogue-pour-desactiver-des-options" id=
60
+ "#dialogue-pour-desactiver-des-options-1" id=
61
61
  "toc-entry-4">Dialogue pour désactiver des
62
62
  options</a>
63
63
  </p>
@@ -289,10 +289,19 @@
289
289
  "#creation-des-notes-de-bas-de-page">Création des notes
290
290
  de bas de page</a>)</p>
291
291
  </li>
292
+
293
+ <li>
294
+ <p>flnews ne propose actuellement pas la sauvegarde
295
+ d'un article dont vous voulez retarder la publication.
296
+ <strong>flnews_post_proc</strong> vous laisse cette
297
+ option, si un répertoire pour les brouillons a été
298
+ configuré.</p>
299
+ </li>
292
300
  </ul>
293
301
  </section>
294
302
 
295
- <section id="dialogue-pour-desactiver-des-options">
303
+ <section id="dialogue-pour-desactiver-des-options-1">
304
+ <span id="dialogue-pour-desactiver-des-options"></span>
296
305
  <h3>Dialogue pour désactiver des options</h3>
297
306
 
298
307
  <p>ATTN! Depuis la version 1.72, YAD et Zenity ne sont plus
@@ -767,16 +776,15 @@ alt.fr.test: /home/[utilisateur]/.signatures</pre>
767
776
  <section id="remplacement-avec-signature">
768
777
  <h3>Remplacement avec signature</h3>
769
778
 
770
- <p>Lors du remplacement d'un article existant, aucune
771
- signature n'est appliquée automatiquement. Ceci permet de
772
- conserver autant de contenu original que possible.</p>
773
-
774
- <p>Pour conserver la signature originale dans la nouvelle
775
- version de l'article :</p>
779
+ <p>Depuis version 2.0, lors du remplacement d'un article
780
+ existant, la signature est appliquée de la même manière que
781
+ pour d'autres nouvelles articles. Quand même, si vous
782
+ souhaitez garder la signature de l'article que vous
783
+ remplacez, vous pouvez:</p>
776
784
 
777
785
  <ol class="arabic simple">
778
786
  <li>
779
- <p>Dans flnews, sélectionnez l'intégralité de l'article
787
+ <p>dans flnews, sélectionnez l'intégralité de l'article
780
788
  avec la souris – de la première ligne (y compris toute
781
789
  introduction) jusqu'à la dernière ligne de la
782
790
  signature.</p>
@@ -795,14 +803,17 @@ alt.fr.test: /home/[utilisateur]/.signatures</pre>
795
803
  </li>
796
804
 
797
805
  <li>
798
- <p>Envoyez l'article.</p>
806
+ <p>Dans le <a class="reference internal" href=
807
+ "#dialogue-pour-desactiver-des-options">Dialogue pour
808
+ désactiver des options</a> désactiver l'option pour les
809
+ signatures.</p>
799
810
  </li>
800
- </ol>
801
811
 
802
- <p><strong>Note :</strong> Le dialogue de configuration
803
- (voir ci-dessous : <a class="reference internal" href=
804
- "#override-config">OVERRIDE_CONFIG</a>) n'affecte pas les
805
- signatures lors d'un remplacement.</p>
812
+ <li>
813
+ <p>Appuyez sur '0' pour valider vos choix et faire
814
+ flnews envoyer l'article.</p>
815
+ </li>
816
+ </ol>
806
817
  </section>
807
818
 
808
819
  <section id="tester">
@@ -897,7 +908,7 @@ alt.fr.test: /home/[utilisateur]/.signatures</pre>
897
908
  "https://creativecommons.org/licenses/by-nd/4.0/deed.fr">CC
898
909
  BY-ND 4.0</a></p>
899
910
 
900
- <p>Date: 2026-06-30</p>
911
+ <p>Date: 2026-08-11</p>
901
912
 
902
913
  <p><strong>Ω</strong>
903
914
  </p>
@@ -906,7 +917,7 @@ alt.fr.test: /home/[utilisateur]/.signatures</pre>
906
917
  </main>
907
918
 
908
919
  <div id='page_dt'>
909
- 2026-06-30
920
+ 2026-08-11
910
921
  </div>
911
922
  </body>
912
923
  </html>
Binary file
Binary file
@@ -111,6 +111,12 @@ des raisons parfois arbitraires :
111
111
  l'objet plus précisément=% » (voir plus bas : `Création des notes de bas
112
112
  de page`_)
113
113
 
114
+ * flnews ne propose actuellement pas la sauvegarde d'un article dont vous voulez
115
+ retarder la publication. |program| vous laisse cette option, si un répertoire
116
+ pour les brouillons a été configuré.
117
+
118
+ .. _Dialogue pour désactiver des options:
119
+
114
120
  Dialogue pour désactiver des options
115
121
  ---------------------------------------
116
122
  ATTN! Depuis la version 1.72, YAD et Zenity ne sont plus utilisés pour le
@@ -458,13 +464,11 @@ fois que les marqueurs de notes de bas de page auront remplacé le texte intégr
458
464
  Remplacement avec signature
459
465
  ---------------------------
460
466
 
461
- Lors du remplacement d'un article existant, aucune signature n'est appliquée
462
- automatiquement. Ceci permet de conserver autant de contenu original que
463
- possible.
464
-
465
- Pour conserver la signature originale dans la nouvelle version de l'article :
467
+ Depuis version 2.0, lors du remplacement d'un article existant, la signature est appliquée
468
+ de la même manière que pour d'autres nouvelles articles. Quand même, si vous souhaitez
469
+ garder la signature de l'article que vous remplacez, vous pouvez:
466
470
 
467
- 1. Dans flnews, sélectionnez l'intégralité de l'article avec la souris – de la
471
+ 1. dans flnews, sélectionnez l'intégralité de l'article avec la souris – de la
468
472
  première ligne (y compris toute introduction) jusqu'à la dernière ligne de
469
473
  la signature.
470
474
 
@@ -474,10 +478,9 @@ Pour conserver la signature originale dans la nouvelle version de l'article :
474
478
  dans le texte modifiable, contrairement à la situation normale où flnews
475
479
  supprime les signatures avant d'ouvrir l'éditeur.
476
480
 
477
- 4. Envoyez l'article.
481
+ 4. Dans le `Dialogue pour désactiver des options`_ désactiver l'option pour les signatures.
478
482
 
479
- **Note :** Le dialogue de configuration (voir ci-dessous : `OVERRIDE_CONFIG`_)
480
- n'affecte pas les signatures lors d'un remplacement.
483
+ 5. Appuyez sur '0' pour valider vos choix et faire flnews envoyer l'article.
481
484
 
482
485
  Tester
483
486
  ------
@@ -257,6 +257,14 @@
257
257
  "#editing-footnotes">EDITING FOOTNOTES</a>,
258
258
  below.</p>
259
259
  </li>
260
+
261
+ <li>
262
+ <p>When you decide to postpone the publication of an
263
+ article, flnews does currently not offer a way to
264
+ keep draft messages. The post-processor lets you save
265
+ preliminary versions of your message in a configured
266
+ directory instead of posting them.</p>
267
+ </li>
260
268
  </ul>
261
269
  </blockquote>
262
270
  </section>
@@ -714,10 +722,43 @@ comp.*: /home/[user]/.my_sigs</pre>
714
722
  <span id="signatures-in-supersedes"></span>
715
723
  <h3>Signatures in Supersedes</h3>
716
724
 
717
- <p>Since version 2.0, signatures in supersedes are not
718
- handled differently from other articles. This paragraph
719
- will be removed in the next version of the
720
- documentation.</p>
725
+ <p>Since version 2.0, signatures in supersedes are by
726
+ default not handled differently from other articles, and
727
+ their signature is assigned in the same way as to a new
728
+ original article. However, if you want to maintain the
729
+ signature from the post that you want to replace, you
730
+ can:</p>
731
+
732
+ <blockquote>
733
+ <ul class="simple">
734
+ <li>
735
+ <p>select the complete message body of the original
736
+ article, including the signature</p>
737
+ </li>
738
+
739
+ <li>
740
+ <p>Trigger the supersedes in flnews.</p>
741
+ </li>
742
+
743
+ <li>
744
+ <p>Write your new version of the article while
745
+ leaving the current signature intact.</p>
746
+ </li>
747
+
748
+ <li>
749
+ <p>In the Override Dialog (see <a class=
750
+ "reference internal" href=
751
+ "#dialog-for-overriding-settings">Dialog for
752
+ Overriding Settings</a>), clear the signature
753
+ option.</p>
754
+ </li>
755
+
756
+ <li>
757
+ <p>Hit '0' to confirm your options and to make flnews
758
+ send the article.</p>
759
+ </li>
760
+ </ul>
761
+ </blockquote>
721
762
  </section>
722
763
 
723
764
  <section id="testing-1">
@@ -825,7 +866,7 @@ comp.*: /home/[user]/.my_sigs</pre>
825
866
  "https://creativecommons.org/licenses/by-nd/4.0/">CC
826
867
  BY-ND 4.0</a></p>
827
868
 
828
- <p>Date: 2026-08-01</p>
869
+ <p>Date: 2026-08-11</p>
829
870
  </blockquote>
830
871
 
831
872
  <p><strong>Ω</strong>
@@ -835,7 +876,7 @@ comp.*: /home/[user]/.my_sigs</pre>
835
876
  </main>
836
877
 
837
878
  <div id='page_dt'>
838
- 2026-08-01
879
+ 2026-08-11
839
880
  </div>
840
881
  </body>
841
882
  </html>
Binary file
Binary file
@@ -97,6 +97,11 @@ Limitations of Basic Newsreaders
97
97
  describing the object further=%". See also the hints under
98
98
  `EDITING FOOTNOTES`_, below.
99
99
 
100
+ * When you decide to postpone the publication of an article, flnews does
101
+ currently not offer a way to keep draft messages. The post-processor lets
102
+ you save preliminary versions of your message in a configured directory
103
+ instead of posting them.
104
+
100
105
  .. _Dialog for Overriding Settings:
101
106
 
102
107
  Dialog for Overriding Settings
@@ -409,9 +414,24 @@ Editing footnotes
409
414
 
410
415
  Signatures in Supersedes
411
416
  ------------------------
412
- Since version 2.0, signatures in supersedes are not handled differently from
413
- other articles. This paragraph will be removed in the next version of the
414
- documentation.
417
+ Since version 2.0, signatures in supersedes are by default not handled
418
+ differently from other articles, and their signature is assigned in the same
419
+ way as to a new original article.
420
+ However, if you want to maintain the signature from the post that you want to
421
+ replace, you can:
422
+
423
+ * select the complete message body of the original article, including the
424
+ signature
425
+
426
+ * Trigger the supersedes in flnews.
427
+
428
+ * Write your new version of the article while leaving the current signature
429
+ intact.
430
+
431
+ * In the Override Dialog (see `Dialog for Overriding Settings`_), clear the
432
+ signature option.
433
+
434
+ * Hit '0' to confirm your options and to make flnews send the article.
415
435
 
416
436
  .. _Testing:
417
437
 
data/lib/body.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  =begin
4
4
  /***************************************************************************
5
- * 2023-2025, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
+ * 2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu> *
6
6
  * This program is free software; you can redistribute it and/or modify *
7
7
  * it under the terms of the WTFPL 2.0 or later, see *
8
8
  * http://www.wtfpl.net/about/ *
@@ -167,7 +167,8 @@ class Body
167
167
  end
168
168
 
169
169
  def join
170
- new_body = @lines.join("\r\n") << "\r\n"
170
+ lines = @lines.collect{|l| l.force_encoding('utf-8')}
171
+ new_body = lines.join("\r\n") << "\r\n"
171
172
  # replace ellipsis
172
173
  new_body.gsub!('...', '…')
173
174
  return new_body
@@ -187,21 +188,11 @@ class Body
187
188
  if @@config.VFY_URLS
188
189
  debug 'verifying URLs'
189
190
  @lines.each_with_index do | l, i |
190
- # leave cited lines as they are.
191
+ # leave quoted lines as they are.
191
192
  if !l.start_with?( '>')
192
- =begin Currently Unused
193
- # IMPORTANT --------------------------------->
194
- # IT IS HENCEFORTH PROHIBITED TO WRITE AN EMAIL-ADDRESS
195
- # IN THE BODY OF A NEWS-POST AND TO NOT PREPEND IT WITH
196
- # mailto:
197
- # ... Because I do not know what to do in these cases,
198
- # and I am the boss!
199
- # <----------------------------
200
-
201
- # BUGFIX : Urls with @
202
- # BUGFIX : email address in the intro
203
- new_line = handle_news(l) if !@intro || l.strip != @intro.strip
204
- =end
193
+ # Handling of news- and mail-links has been
194
+ # removed.
195
+ #
205
196
  # http(s)
206
197
  if l.include?('http')
207
198
  new_line = handle_http(l)
@@ -218,7 +209,8 @@ class Body
218
209
  ref_delim = @@config.REFERENCES_DELIMITER
219
210
  debug('references delimiter is ' << ref_delim)
220
211
  references = Array.new
221
- body = @lines.join($LN)
212
+ # avoids a lot of trouble
213
+ body = @lines.join($LN).force_encoding('utf-8')
222
214
  if ref_delim && !ref_delim.strip.empty?
223
215
  unless ref_delim == ref_delim.reverse
224
216
  ref_delim.strip!
@@ -276,34 +268,6 @@ class Body
276
268
  end
277
269
  private
278
270
 
279
- # handle <news:..@...>
280
- def handle_news(l)
281
- # ... “Do not trust nobody!”
282
- if l.include?('@') && ! l.include?('http:') && ! l.include?('https:')
283
- # And I forgot how this works. It does.
284
- l.split.collect do |ele|
285
- # angular brackets are there alright. Hurra.
286
- url = ele.match(/\<(.*)\>/)
287
- unless !url
288
- debug(' with angular brackets: ' << url.inspect)
289
- l = l.sub(url[1], 'news:' << url[1]) if !url[1].start_with?('mailto') && !url[1].start_with?('news')
290
- else
291
- url = ele.match(/\S+@(\.|[^\p{P}]+)\S+/)
292
- if url
293
- debug(' withOUT angular brackets: ' << url.inspect)
294
- if !url[0].start_with?('mailto') && !url[0].start_with?('news')
295
- l.sub!(url[0], 'news:' << url[0] )
296
- end
297
- l.sub!('news:', '<news:')
298
- l.sub!(url[0], url[0] << '>')
299
- end
300
- end
301
- end # url_strs = collect
302
- debug(' news: line is now ' << l)
303
- return l
304
- end
305
- end
306
-
307
271
  # formatting http URLs, not much is done here.
308
272
  def handle_http(l)
309
273
  debug('handle http')
data/lib/color_output.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #encoding: UTF-8
2
2
  =begin
3
- /***************************************************************************
4
- * 2023-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
3
+ ***************************************************************************
4
+ * 2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
5
  * This program is free software; you can redistribute it and/or modify *
6
6
  * it under the terms of the WTFPL 2.0 or later, see *
7
7
  * http://www.wtfpl.net/about/ *
@@ -10,7 +10,7 @@
10
10
  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
11
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
12
12
  * *
13
- ***************************************************************************/
13
+ ***************************************************************************
14
14
  =end
15
15
 
16
16
  # Functions to apply colors to terminal output.
data/lib/configuration.rb CHANGED
@@ -1,16 +1,16 @@
1
1
  #encoding: UTF-8
2
2
  =begin
3
- /***************************************************************************
4
- * 2023-2025, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
- * This program is free software; you can redistribute it and/or modify *
6
- * it under the terms of the WTFPL 2.0 or later, see *
7
- * http://www.wtfpl.net/about/ *
8
- * *
9
- * This program is distributed in the hope that it will be useful, *
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
12
- * *
13
- ***************************************************************************/
3
+ ***************************************************************************
4
+ 2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu>
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the WTFPL 2.0 or later, see
7
+ http://www.wtfpl.net/about/
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+
13
+ ***************************************************************************
14
14
  =end
15
15
 
16
16
  require_relative 'basic_logging'
@@ -131,8 +131,7 @@ class Configuration
131
131
  rescue Exception => ex
132
132
  msg = "Cannot use the configuration-file (" << @config_file << ")"
133
133
  msg << "\n\t" << ex.message
134
- # No log.
135
- # error msg
134
+ # No log. Use STDERR.
136
135
  STDERR.puts(msg << "\nAborting, bye\n")
137
136
  exit false
138
137
  end
@@ -1,14 +1,14 @@
1
- #/***************************************************************************
2
- # * 2023-2025, Michael Uplawski <michael.uplawski@uplawski.eu> *
3
- # * *
4
- # * This program is free software; you can redistribute it and/or modify *
5
- # * it under the terms of the DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE *
6
- # * *
7
- # * This program is distributed in the hope that it will be useful, *
8
- # * but WITHOUT ANY WARRANTY; without even the implied warranty of *
9
- # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
10
- # * *
11
- # ***************************************************************************/
1
+ # ***************************************************************************
2
+ # 2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu>
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
6
+ #
7
+ # This program is distributed in the hope that it will be useful,
8
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
+ #
11
+ # ***************************************************************************
12
12
  # This is a YAML file. Keep intact these three dashes.
13
13
  ---
14
14
  # CONFIG_VERSION – DO NOT MODIFY
@@ -17,7 +17,7 @@
17
17
  # the process, if they are still valid.
18
18
  # ATTN! COMMENTS WILL BE REMOVED but a copy of your previous configuration
19
19
  # will be saved in a file with a version suffix.
20
- CONFIG_VERSION: 1.95
20
+ CONFIG_VERSION: 2.02
21
21
 
22
22
  # FUP_NAME
23
23
  # A Regular Expression, describing the string which contains the name of
@@ -1,16 +1,16 @@
1
1
  #encoding: UTF-8
2
2
  =begin
3
- /***************************************************************************
4
- * 2023-2025, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
- * This program is free software; you can redistribute it and/or modify *
6
- * it under the terms of the WTFPL 2.0 or later, see *
7
- * http://www.wtfpl.net/about/ *
8
- * *
9
- * This program is distributed in the hope that it will be useful, *
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
12
- * *
13
- ***************************************************************************/
3
+ ***************************************************************************
4
+ 2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
+ This program is free software; you can redistribute it and/or modify *
6
+ it under the terms of the WTFPL 2.0 or later, see *
7
+ http://www.wtfpl.net/about/ *
8
+ *
9
+ This program is distributed in the hope that it will be useful, *
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
12
+ *
13
+ ***************************************************************************
14
14
  =end
15
15
 
16
16
  require 'yaml'
@@ -50,6 +50,8 @@ class PostProcessor
50
50
  debug "\thave newsgroups " << @newsgroups.to_s
51
51
  rescue Exception => ex
52
52
  error "Cannot get Newsgroups: " << ex.message
53
+ error "Aborting, bye"
54
+ exit false
53
55
  end
54
56
 
55
57
  # Order matters. These actions work on a
@@ -68,7 +70,7 @@ class PostProcessor
68
70
 
69
71
  # get the headers and the body as a string.
70
72
  # Assemble.
71
- @article = headers.join << $LN << @body.join
73
+ @article = headers.join.force_encoding('utf-8') << $LN << @body.join
72
74
 
73
75
  diff = Diffy::Diff.new(article_text, @article, :context => 2).to_s
74
76
  info("\n" << "–" * 20 << "\nDiffs\n" << "–" * 20 << "\n" << diff)
data/lib/headers.rb CHANGED
@@ -1,16 +1,16 @@
1
1
  #encoding: UTF-8
2
2
  =begin
3
- /***************************************************************************
4
- * 2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
- * This program is free software; you can redistribute it and/or modify *
6
- * it under the terms of the WTFPL 2.0 or later, see *
7
- * http://www.wtfpl.net/about/ *
8
- * *
9
- * This program is distributed in the hope that it will be useful, *
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
12
- * *
13
- ***************************************************************************/
3
+ ***************************************************************************
4
+ 2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
+ This program is free software; you can redistribute it and/or modify *
6
+ it under the terms of the WTFPL 2.0 or later, see *
7
+ http://www.wtfpl.net/about/ *
8
+ *
9
+ This program is distributed in the hope that it will be useful, *
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
12
+ *
13
+ ***************************************************************************
14
14
  =end
15
15
 
16
16
  require 'rfc_2047'
@@ -64,10 +64,6 @@ class Headers
64
64
  rescue Exception => ex
65
65
  exit false;
66
66
  end
67
- # Consider the two following fixes as preliminary until proven.
68
- # Getting older, this kind of problem occupies me a lot more than
69
- # it should.
70
- #
71
67
  # value is all after the first colon
72
68
  val = l.match(/:(.*)/)[1].lstrip
73
69
  else # start_with?(' ')
@@ -196,7 +192,6 @@ class Headers
196
192
  hv = @headers[:Subject]
197
193
  if hv
198
194
  debug 'checking for altered Subject'
199
-
200
195
 
201
196
  # Our own very first article with an altered subject line, uses:
202
197
  # (old:
@@ -220,7 +215,7 @@ class Headers
220
215
  olds << /\s*\(etait\s?:.*/i
221
216
 
222
217
  #decode subject from header value
223
- subj = Rfc2047.decode(hv)
218
+ subj = Rfc2047.decode(hv.force_encoding('utf-8') )
224
219
  debug 'subject encoding: ' << hv.encoding.to_s
225
220
  debug 'decoded subject: ' << subj
226
221
  # check for each of those regexps
data/lib/newsgroups.rb CHANGED
@@ -1,16 +1,16 @@
1
1
  #encoding: UTF-8
2
2
  =begin
3
- /***************************************************************************
4
- * 2023-2025, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
- * This program is free software; you can redistribute it and/or modify *
6
- * it under the terms of the WTFPL 2.0 or later, see *
7
- * http://www.wtfpl.net/about/ *
8
- * *
9
- * This program is distributed in the hope that it will be useful, *
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
12
- * *
13
- ***************************************************************************/
3
+ ***************************************************************************
4
+ 2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu>
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the WTFPL 2.0 or later, see
7
+ http://www.wtfpl.net/about/
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+
13
+ ***************************************************************************
14
14
  =end
15
15
 
16
16
  # An object of this class concentrates the specificities of chosen
@@ -174,7 +174,7 @@ class Newsgroups
174
174
 
175
175
  # write a new rearranged version of the signature file for
176
176
  # better hazard.
177
- # EXPERIMENTAL
177
+ # UNUSED
178
178
  def rearrange_sigs(sigfile, all_sigs)
179
179
  if File.writable?(sigfile)
180
180
  new_sigs = Array.new(all_sigs.length)
data/lib/override.rb CHANGED
@@ -1,16 +1,16 @@
1
1
  #encoding: UTF-8
2
2
  =begin
3
- /***************************************************************************
4
- * 2023-2025, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
- * This program is free software; you can redistribute it and/or modify *
6
- * it under the terms of the WTFPL 2.0 or later, see *
7
- * http://www.wtfpl.net/about/ *
8
- * *
9
- * This program is distributed in the hope that it will be useful, *
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
12
- * *
13
- ***************************************************************************/
3
+ ***************************************************************************
4
+ 2023-2025, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
+ This program is free software; you can redistribute it and/or modify *
6
+ it under the terms of the WTFPL 2.0 or later, see *
7
+ http://www.wtfpl.net/about/ *
8
+ *
9
+ This program is distributed in the hope that it will be useful, *
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
12
+ *
13
+ ***************************************************************************
14
14
  =end
15
15
 
16
16
  # This class manages a dialog to alter the behavior of the
@@ -29,12 +29,10 @@ class OverrideDlg
29
29
 
30
30
  XTERM = 'xterm'
31
31
  # TERMINAL = 'x-terminal-emulator'
32
- WHIPTAIL = 'whiptail'
33
- # The external programs which are supported for the time. They will be run in
34
- # a new process (IO.popen() ). The first program from this array, which is
35
- # found in the Path, will be used. Whiptail and a pure ruby dialog
36
- # necessitate that xterm be found, too.
37
- @@Executables = [WHIPTAIL, XTERM]
32
+
33
+ # There used to be others, but only xterm remained.
34
+ @@Executables = [XTERM]
35
+
38
36
  @@LIBDIR = File::dirname(__FILE__)
39
37
  # The configuration variables that can be unset.
40
38
  # This class instance variable is exposed via a getter.
@@ -68,17 +66,7 @@ class OverrideDlg
68
66
  opts = nil
69
67
  begin
70
68
  if has? XTERM
71
- # if has?(WHIPTAIL)
72
- ########
73
- # Version 2.01 needs additional options in the override dialog.
74
- # The whiptail dialog is too cumbersome.
75
- ########
76
- # return whiptail_dlg
77
- #else
78
- # debug 'using naked xterm'
79
- #return ruby_dlg.split.collect {|o| o.to_s}.join(' ')
80
- return ruby_dlg
81
- #end
69
+ return ruby_dlg
82
70
  end
83
71
  rescue SystemExit
84
72
  msg = 'Process is cancelled (SystemExit)'
@@ -121,34 +109,7 @@ class OverrideDlg
121
109
  @executables.include? ex_name
122
110
  end
123
111
 
124
- ###### The following methods call a script, each, in an external process.
125
- # There appears to be some Exception handling missing, but it does not
126
- # hurt for the time being. Anyway, I do not care.
127
-
128
- # creates a whiptail dialog in xterm.
129
- def whiptail_dlg
130
- debug('whiptail dialog')
131
- # tf = Tempfile.new
132
- tf = File.new('/tmp/whiptail_out', "w+")
133
- debug 'writing Whiptail output to ' << tf.to_s
134
- # dlg = @config.BINDIR << File::Separator << 'whiptail_dlg'
135
- dlg = @@LIBDIR << File::Separator << 'whiptail_dlg'
136
- dialog = XTERM.dup << ' -e ' << dlg << ' ' << tf.path
137
- io = IO::popen(dialog)
138
- Process.wait(io.pid )
139
- nopts = []
140
- nopts = tf.readlines
141
- exit true if(nopts.empty? || 'exit' == nopts[0].strip)
142
- # tf.unlink
143
- return nopts
144
- end
145
-
146
112
  # Creates a textual dialog in xterm.
147
- # Some duplicate code, here, but I am afraid to oversee
148
- # unique requirements of the external programs. It had
149
- # not been necessary to correct the global behavior,
150
- # but adaptations in each single method should be
151
- # possible.
152
113
  def ruby_dlg
153
114
  debug('xterm dialog')
154
115
  tf = Tempfile.new
@@ -168,7 +129,7 @@ class OverrideDlg
168
129
  end
169
130
  nopts = tf.readlines
170
131
  debug 'nopts is ' << nopts.to_s
171
- exit true if('exit' == nopts[0].strip)
132
+ exit true if(nopts && !nopts.empty? && 'exit' == nopts[0].strip)
172
133
  tf.unlink
173
134
  return nopts
174
135
  end
data/lib/ruby_dlg CHANGED
@@ -1,23 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  =begin
4
- /***************************************************************************
5
- * This program is free software; you can redistribute it and/or modify *
6
- * it under the terms of the WTFPL 2.0 or later, see *
7
- * http://www.wtfpl.net/about/ *
8
- * *
9
- * This program is distributed in the hope that it will be useful, *
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
12
- * *
13
- ***************************************************************************/
4
+ ***************************************************************************
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the WTFPL 2.0 or later, see
7
+ http://www.wtfpl.net/about/
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+
13
+ ***************************************************************************
14
14
  =end
15
15
 
16
16
  require 'readline'
17
17
  require_relative 'color_output'
18
18
  require 'io/wait'
19
19
  require 'io/console'
20
- require 'configuration'
21
20
 
22
21
  if !ARGV.empty? && ARGV.length > 0
23
22
  ofl = nil
data/lib/version.rb CHANGED
@@ -1,20 +1,20 @@
1
1
  #encoding: UTF-8
2
2
  =begin
3
- /***************************************************************************
4
- * 2023-2025, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
- * This program is free software; you can redistribute it and/or modify *
6
- * it under the terms of the WTFPL 2.0 or later, see *
7
- * http://www.wtfpl.net/about/ *
8
- * *
9
- * This program is distributed in the hope that it will be useful, *
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
12
- * *
13
- ***************************************************************************/
3
+ ***************************************************************************
4
+ 2023-2025, Michael Uplawski <michael.uplawski@uplawski.eu>
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the WTFPL 2.0 or later, see
7
+ http://www.wtfpl.net/about/
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+
13
+ ***************************************************************************
14
14
  =end
15
15
 
16
16
  PROGNAME = 'flnews_post_proc'
17
- PROGVERSION = "2.02"
17
+ PROGVERSION = "2.05"
18
18
  AUTHORS = "Michael Uplawski"
19
19
  EMAIL = "michael.uplawski@uplawski.eu"
20
20
  YEARS = "2023 - 2026"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flnews_post_proc
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.02'
4
+ version: '2.05'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Uplawski
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-08-04 00:00:00.000000000 Z
10
+ date: 2026-08-20 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: diffy
@@ -18,7 +18,7 @@ dependencies:
18
18
  version: '3.4'
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: 3.4.2
21
+ version: 3.4.4
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -28,27 +28,67 @@ dependencies:
28
28
  version: '3.4'
29
29
  - - ">="
30
30
  - !ruby/object:Gem::Version
31
- version: 3.4.2
31
+ version: 3.4.4
32
32
  - !ruby/object:Gem::Dependency
33
- name: ruby-filemagic
33
+ name: mimemagic
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  requirements:
36
36
  - - "~>"
37
37
  - !ruby/object:Gem::Version
38
- version: '0.7'
38
+ version: '0.4'
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: 0.7.3
41
+ version: 0.4.3
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '0.7'
48
+ version: '0.4'
49
49
  - - ">="
50
50
  - !ruby/object:Gem::Version
51
- version: 0.7.3
51
+ version: 0.4.3
52
+ - !ruby/object:Gem::Dependency
53
+ name: new_rfc_2047
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - "~>"
57
+ - !ruby/object:Gem::Version
58
+ version: '1.0'
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: 1.0.0
72
+ - !ruby/object:Gem::Dependency
73
+ name: io-console
74
+ requirement: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - "~>"
77
+ - !ruby/object:Gem::Version
78
+ version: '0.9'
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 0.9.2
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '0.9'
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: 0.9.2
52
92
  description: Post-processor for Usenet-articles created in flnews
53
93
  email: michael.uplawski@uplawski.eu
54
94
  executables:
@@ -79,7 +119,6 @@ files:
79
119
  - lib/override.rb
80
120
  - lib/ruby_dlg
81
121
  - lib/version.rb
82
- - lib/whiptail_dlg
83
122
  licenses:
84
123
  - WTFPL
85
124
  metadata:
@@ -100,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
139
  - !ruby/object:Gem::Version
101
140
  version: '0'
102
141
  requirements: []
103
- rubygems_version: 4.0.17
142
+ rubygems_version: 4.0.18
104
143
  specification_version: 4
105
144
  summary: Modify news posts, before flnews sends them.
106
145
  test_files: []
data/lib/whiptail_dlg DELETED
@@ -1,87 +0,0 @@
1
- #!/bin/bash
2
-
3
- #/**************************************************************************
4
- #* This program is free software; you can redistribute it and/or modify *
5
- #* it under the terms of the WTFPL 2.0 or later, see *
6
- #* http://www.wtfpl.net/about/ *
7
- #* *
8
- #* This program is distributed in the hope that it will be useful, *
9
- #* but WITHOUT ANY WARRANTY; without even the implied warranty of *
10
- #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
11
- #* *
12
- #***************************************************************************/
13
-
14
- # A dialog to override configuration options.
15
- # Whiptail is not as easily deployed here, as other dialogs.
16
- # The main difficulty arises from the fact that positive defaults
17
- # are negated, while a checklist wants to give positive results.
18
-
19
- if [ $# -eq 0 ]
20
- then
21
- echo "ERROR: file-argument missing"
22
- exit 1
23
- fi
24
- OUTFILE="$1"
25
-
26
- # empty the file
27
- truncate $OUTFILE -s0
28
-
29
- TITLE="Override post-processor configuration"
30
- CHECKTITLE="Deselect to disable. Esc or Cancel close the dialog and no changes will be applied."
31
-
32
- # These are the configuration variables which can be unset.
33
- VARS=(GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS VFY_URLS DEBUG_LOG)
34
-
35
- # Checklist options
36
- options=(GROUP_SIGS 'Signatures' ON CUSTOM_HEADERS "Custom headers" ON NO_ARCHIVE_GROUPS "No Archive" ON VFY_URLS "Correct URLs" ON DEBUG_LOG 'Log' ON)
37
-
38
- # show dialog and store results
39
- result=$(whiptail --title "$TITLE" --checklist "$CHECKTITLE" 13 55 6 "${options[@]}" 3>&1 1>&2 2>&3)
40
- # which button had been pushed?
41
- okcancel=$?
42
-
43
- # make an array
44
- read -ra opts <<< $result
45
-
46
- # comment out -------->
47
- echo "cancel/ok ? $okcancel"
48
- echo $result
49
- echo "${opts[@]}"
50
- echo "${#opts[@]}"
51
- echo "VARS: (${VARS[@]})"
52
- # <--------
53
-
54
- # Find deselected options which shall be written to the outfile.
55
- # Looks complicated.
56
- if [ "$okcancel" -eq 0 ]
57
- then
58
- disable_list=''
59
- enable_list=''
60
- # 1) check each of the configuration variables ...
61
- for c in ${OVARS[@]}
62
- do
63
- ignore=FALSE
64
- # ... against the result from the dialog
65
- for o in ${opts[@]}
66
- do
67
- if [ "$o" == "\"$c\"" ]
68
- then
69
- # ignore if a variable remained checked ...
70
- ignore=TRUE
71
- fi
72
- done
73
- if [ ! ignore ]
74
- then
75
- disable_list="$disable_list $c"
76
- fi
77
- done
78
-
79
-
80
- # Heureka.
81
- echo -e "$disable_list" > "$OUTFILE"
82
- echo -e "$enable_list" >> "$OUTFILE"
83
- else
84
- echo "exit" > "$OUTFILE"
85
- fi
86
-
87
- # Ω