flnews_post_proc 1.71 → 1.73

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: 7cede40b08799a20bef9bb5b631371f5837269f17d16f4401190f73b953ea748
4
- data.tar.gz: 682eea779a029ed1078ef6ce5cb09d5aa877b8bb0d62c3df238e26db5dbf3ba1
3
+ metadata.gz: 2dc06bd3fe25834f7366d0165349d8d00c5f1678e5ca0551b21a6c64a05de131
4
+ data.tar.gz: 69f83400debeae671fddf69d0c151d0dbead9b06f1c132a85aff36a8c6196ad4
5
5
  SHA512:
6
- metadata.gz: caca97eb88abfe09b7fae35da0389c0f7a3a0a336b59ac83432f8cdb958fbc98076ede8b52fa095044d51a04f4178c9227b6d2d596deb9e1504d51fb336a6bbd
7
- data.tar.gz: bfe1dc4048ff44e1f712fdd98eeab6512b6f60d95c122279d80e4d4d7a2f8a2f29078dc3ecee22ff1bcde7caf2412169a8e2645c86ddfa6b53311b3c183704aa
6
+ metadata.gz: a4694d0f990232d43c55a2eda2f352edbbeedb5a2fab3def80b285b9bc9feb26bb7d71fabc0de60ef3268d011efc4e637c982bb71d4189bbaaae5087b4c01c58
7
+ data.tar.gz: 76214a9427048497785a5f0ea2758117adb1a518dbcddf3d1e7b0c3add53edd64443ed9c55ec33cf672c761818cae19ffce8b80a9f124d0ed0c625708d73d8b4
data/README.md CHANGED
@@ -121,10 +121,12 @@ some users may not always agree with the result and for arbitrary reasons:
121
121
 
122
122
  Dialog to override settings
123
123
  ---------------------------
124
+ ATTN! As of version 1.72, YAD and Zenity are no longer used for the dialog.
125
+
124
126
  You can have a dialog displayed just before the post-processor is invoked, to
125
- **disable** some configuration options. Provided that either YAD, Zenity,
126
- Whiptail or only xterm are available on your computer, you can choose from
127
- the following options. You **cannot** use the dialog to enable options which
127
+ **disable** some configuration options. Provided that Whiptail or only xterm
128
+ are available on your computer, you can choose from the following options.
129
+ You **cannot** use the dialog to enable options which
128
130
  have not yet been set in the configuration.
129
131
 
130
132
  * Signatures, as set in the configuration **can be ignored**. Either
@@ -281,7 +283,7 @@ the original message-body contains text marked for use as such a footnote. See
281
283
 
282
284
  **REFERENCES_DELIMITER**
283
285
  A symbol or sequence of symbols marking the beginning of a text which will
284
- serve as footnote (or reference). The **reversed sequence** musst be used to
286
+ serve as footnote (or reference). The **reversed sequence** must be used to
285
287
  mark the end of the text. The presence of this sequence or symbol in the
286
288
  original message body will cause the enclosed text to be moved below the
287
289
  message body.
@@ -138,12 +138,14 @@ l'objet plus précisement=% »</p>
138
138
  </div>
139
139
  <div class="section" id="dialogue-pour-desactiver-des-options">
140
140
  <h2>Dialogue pour désactiver des options</h2>
141
+ <p>ATTN! Depuis la version 1.72, YAD et Zenity ne sont plus utilisés pour le
142
+ dialogue.</p>
141
143
  <p>Juste avant d'entrer en action, flnews_post_proc peut afficher un dialogue, qui
142
144
  vous laisse <strong>désactiver</strong> des options fixées dans la configuration. Sous
143
- condition qu'un des outils YAD, Zenity, Whiptail ou seulement xterm est
144
- disponible, vous pouvez choisir dans les options suivantes, ceux que vous
145
- voulez ignorer pour l'article en préparation. Vous <strong>ne pouvez pas</strong> activer
146
- des options, qui ne l'ont pas été auparavant :</p>
145
+ condition que Whiptail ou seulement xterm est disponible, vous pouvez choisir
146
+ dans les options suivantes, ceux que vous voulez ignorer pour l'article en
147
+ préparation.
148
+ Vous <strong>ne pouvez pas</strong> activer des options, qui ne l'ont pas été auparavant :</p>
147
149
  <ul class="simple">
148
150
  <li>Signatures, comme définis dans la configuration <strong>peuvent être ignorées</strong>.
149
151
  Soit une signature par défaut sera appliquée, si prévue, ou aucune.</li>
@@ -224,9 +226,14 @@ dans l'introduction resultant.</p>
224
226
  </dd>
225
227
  <dt><strong>GROUP_SIGS</strong></dt>
226
228
  <dd><p class="first">Une signature par newsgroup ou expression ou le chemin d'accès d'un fichier,
227
- contenant plusieurs signatures, séparé par une ligne vide.</p>
228
- <p>ATTN! Vous devez noter \r\n pour les sautes de lignes, si une signature
229
- s'étend sur plusieurs lignes.</p>
229
+ contenant plusieurs signatures, séparé par une ligne vide. Vous pouvez inclure
230
+ (“source”) le contenu d'autres fichiers dans la liste des signatures, en
231
+ indiquant dans le fichier d'origine le nom de l'autre fichier après un point
232
+ et un espace, comme dans:
233
+ . /home/user/.plus_de_signatures
234
+ Ceci ne fonctionne que dans le fichier indiqué dans la configuration, pas dans
235
+ les fichiers inclus. Prenez soin d'insérer une ligne vide entre chaque ligne
236
+ qui inclut un fichier et la suivante.</p>
230
237
  <p>CONTENU : un newsgroup ou expression par ligne, suivi de deux poins, un espace
231
238
  et une chaîne de caractères.</p>
232
239
  <p>PAR DÉFAUT : Comme configuré dans flnews.</p>
Binary file
Binary file
@@ -105,12 +105,15 @@ et ce pour des raisons arbitraires :
105
105
 
106
106
  Dialogue pour désactiver des options
107
107
  ------------------------------------
108
+ ATTN! Depuis la version 1.72, YAD et Zenity ne sont plus utilisés pour le
109
+ dialogue.
110
+
108
111
  Juste avant d'entrer en action, flnews_post_proc peut afficher un dialogue, qui
109
112
  vous laisse **désactiver** des options fixées dans la configuration. Sous
110
- condition qu'un des outils YAD, Zenity, Whiptail ou seulement xterm est
111
- disponible, vous pouvez choisir dans les options suivantes, ceux que vous
112
- voulez ignorer pour l'article en préparation. Vous **ne pouvez pas** activer
113
- des options, qui ne l'ont pas été auparavant :
113
+ condition que Whiptail ou seulement xterm est disponible, vous pouvez choisir
114
+ dans les options suivantes, ceux que vous voulez ignorer pour l'article en
115
+ préparation.
116
+ Vous **ne pouvez pas** activer des options, qui ne l'ont pas été auparavant :
114
117
 
115
118
  * Signatures, comme définis dans la configuration **peuvent être ignorées**.
116
119
  Soit une signature par défaut sera appliquée, si prévue, ou aucune.
@@ -201,10 +204,14 @@ variables définis dans ce fichier peuvent être classées en deux catégories :
201
204
 
202
205
  **GROUP_SIGS**
203
206
  Une signature par newsgroup ou expression ou le chemin d'accès d'un fichier,
204
- contenant plusieurs signatures, séparé par une ligne vide.
205
-
206
- ATTN! Vous devez noter \\r\\n pour les sautes de lignes, si une signature
207
- s'étend sur plusieurs lignes.
207
+ contenant plusieurs signatures, séparé par une ligne vide. Vous pouvez inclure
208
+ (“source”) le contenu d'autres fichiers dans la liste des signatures, en
209
+ indiquant dans le fichier d'origine le nom de l'autre fichier après un point
210
+ et un espace, comme dans:
211
+ . /home/user/.plus_de_signatures
212
+ Ceci ne fonctionne que dans le fichier indiqué dans la configuration, pas dans
213
+ les fichiers inclus. Prenez soin d'insérer une ligne vide entre chaque ligne
214
+ qui inclut un fichier et la suivante.
208
215
 
209
216
  CONTENU : un newsgroup ou expression par ligne, suivi de deux poins, un espace
210
217
  et une chaîne de caractères.
@@ -125,11 +125,12 @@ further=%</p>
125
125
  </div>
126
126
  <div class="section" id="dialog-to-override-settings">
127
127
  <h2>Dialog to override settings</h2>
128
+ <p>ATTN! As of version 1.72, YAD or Zenity cannot be used for the dialog.</p>
128
129
  <p>You can have a dialog displayed just before the post-processor is invoked, to
129
- <strong>disable</strong> some configuration options. Provided that either YAD, Zenity,
130
- Whiptail or only xterm are available on your computer, you can choose from
131
- the following options. You <strong>cannot</strong> use the dialog to enable options which
132
- have not yet been set in the configuration.</p>
130
+ <strong>disable</strong> some configuration options. Provided that Whiptail or only xterm
131
+ are available on your computer, you can choose from the following options. You
132
+ <strong>cannot</strong> use the dialog to enable options which have not yet been set in the
133
+ configuration.</p>
133
134
  <ul class="simple">
134
135
  <li>Signatures, as set in the configuration <strong>can be ignored</strong>. Either
135
136
  a default signature will appear as set in flnews or none.</li>
@@ -197,8 +198,13 @@ introductory string.</p>
197
198
  <dt><strong>GROUP_SIGS</strong></dt>
198
199
  <dd><p class="first">A signature line per Newsgroup or a file path. The file should contain signatures,
199
200
  already formatted and separated by 1 empty line. The program will randomly pick
200
- one signature from the list.</p>
201
- <p>ATTN! In multi line signatures, you have to use \r\n for line breaks.</p>
201
+ one signature from the list. You can source another file inside the original
202
+ signature file: a line starting with a point and a space will indicate that
203
+ additional signatures should be picked from the named file, like in:
204
+ . /home/user/.other_signature_file
205
+ This works only in the file named in the configuration, not in the sourced files.
206
+ Remember to separate lines sourcing a file by an empty line, also separate several
207
+ such lines by an empty line between them.</p>
202
208
  <p>CONTENT: A newsgroup or regexp per line, followed by a colon, a space and a String.</p>
203
209
  <p>DEFAULT: As configured in flnews</p>
204
210
  <p>EXAMPLE: alt.test: &quot;Signature for alt.test\r\nsecond line&quot;</p>
Binary file
Binary file
@@ -84,11 +84,13 @@ some users may not always agree with the result and for arbitrary reasons:
84
84
 
85
85
  Dialog to override settings
86
86
  ---------------------------
87
+ ATTN! As of version 1.72, YAD or Zenity cannot be used for the dialog.
88
+
87
89
  You can have a dialog displayed just before the post-processor is invoked, to
88
- **disable** some configuration options. Provided that either YAD, Zenity,
89
- Whiptail or only xterm are available on your computer, you can choose from
90
- the following options. You **cannot** use the dialog to enable options which
91
- have not yet been set in the configuration.
90
+ **disable** some configuration options. Provided that Whiptail or only xterm
91
+ are available on your computer, you can choose from the following options. You
92
+ **cannot** use the dialog to enable options which have not yet been set in the
93
+ configuration.
92
94
 
93
95
  * Signatures, as set in the configuration **can be ignored**. Either
94
96
  a default signature will appear as set in flnews or none.
@@ -170,9 +172,13 @@ categories:
170
172
  **GROUP_SIGS**
171
173
  A signature line per Newsgroup or a file path. The file should contain signatures,
172
174
  already formatted and separated by 1 empty line. The program will randomly pick
173
- one signature from the list.
174
-
175
- ATTN! In multi line signatures, you have to use \\r\\n for line breaks.
175
+ one signature from the list. You can source another file inside the original
176
+ signature file: a line starting with a point and a space will indicate that
177
+ additional signatures should be picked from the named file, like in:
178
+ . /home/user/.other_signature_file
179
+ This works only in the file named in the configuration, not in the sourced files.
180
+ Remember to separate lines sourcing a file by an empty line, also separate several
181
+ such lines by an empty line between them.
176
182
 
177
183
  CONTENT: A newsgroup or regexp per line, followed by a colon, a space and a String.
178
184
 
data/lib/body.rb CHANGED
@@ -15,7 +15,7 @@
15
15
  =end
16
16
 
17
17
  require_relative 'basic_logging'
18
- require_relative 'configuration'
18
+ require_relative 'configuration'
19
19
 
20
20
  WRAP_LENGTH = 65
21
21
  # Endow the String class with a wrap function.
data/lib/newsgroups.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #encoding: UTF-8
2
2
  =begin
3
3
  /***************************************************************************
4
- * 2023-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
4
+ * 2023-2025, 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/ *
@@ -127,6 +127,50 @@ class Newsgroups
127
127
  end
128
128
  end
129
129
 
130
+ def pick_sig(sigfile)
131
+ # finds sourced files
132
+ srcregex = /^\.\s(.*)/
133
+ # delimiter for signature blocks in the file
134
+ delim = "\n\n"
135
+
136
+ if File.exist?(sigfile) && File.readable?(sigfile)
137
+ debug 'found sourced signature file ' << sigfile
138
+ ssigs = Array.new
139
+ all_sigs = Array.new
140
+ File::read(sigfile).split(delim).collect do |item|
141
+ item.strip!
142
+ # find a sourced file
143
+ psrc = item.match(srcregex)
144
+ if(psrc )
145
+ psrc = psrc[1]
146
+ if File.exist?(psrc) && File.readable?(psrc)
147
+ ssigs = File.read(psrc).split(delim)
148
+ else
149
+ warn 'cannot find or read sourced signature file: ' << psrc
150
+ end
151
+ else
152
+ # else take the block, as is
153
+ all_sigs << item
154
+ end
155
+ end
156
+
157
+ # add sourced signatures
158
+ all_sigs.concat(ssigs) if !ssigs.empty?
159
+ numSigs = all_sigs.length
160
+
161
+ # get that signature, already!
162
+
163
+ # srand(Time.now.nsec)
164
+ srand()
165
+ return all_sigs[rand(numSigs)]
166
+ else
167
+ warn 'cannot find or read signature file: ' << sigfile
168
+ end
169
+ end
170
+
171
+ =begin
172
+ # VERSION without sourced files
173
+ #
130
174
  # pick a random signature, if a list is available.
131
175
  def pick_sig(sigfile)
132
176
  debug 'picking signature from ' << sigfile.to_s
@@ -136,20 +180,24 @@ class Newsgroups
136
180
  File.open(sigfile, 'r') do |sfile|
137
181
  allSigs = sfile.read.split("\n\n")
138
182
  numSigs = allSigs.length
139
- srand(Time.now.nsec)
183
+ # srand(Time.now.nsec)
184
+ # use /dev/urandom
185
+ srand()
140
186
  sig = allSigs[rand(numSigs)]
141
187
  end
142
188
  # improve hazard for the next time.
143
- rearrange_sigs(sigfile, allSigs)
189
+ # rearrange_sigs(sigfile, allSigs)
144
190
  else
145
191
  error 'Cannot read signature from file ' << sigfile
146
192
  nil
147
193
  end
148
194
  return sig
149
195
  end
196
+ =end
150
197
 
151
198
  # write a new rearranged version of the signature file for
152
199
  # better hazard.
200
+ # EXPERIMENTAL
153
201
  def rearrange_sigs(sigfile, all_sigs)
154
202
  if File.writable?(sigfile)
155
203
  new_sigs = Array.new(all_sigs.length)
data/lib/override.rb CHANGED
@@ -35,7 +35,8 @@ class OverrideDlg
35
35
  # a new process (IO.popen() ). The first program from this array, which is
36
36
  # found in the Path, will be used. Whiptail and a pure ruby dialog
37
37
  # necessitate that xterm be found, too.
38
- @@Executables = [YAD, ZENITY, WHIPTAIL, XTERM]
38
+ # @@Executables = [YAD, ZENITY, WHIPTAIL, XTERM]
39
+ @@Executables = [WHIPTAIL, XTERM]
39
40
  @@LIBDIR = File::dirname(__FILE__)
40
41
  # The configuration variables that can be unset.
41
42
  # This class instance variable is exposed via a getter.
@@ -68,11 +69,14 @@ class OverrideDlg
68
69
  debug('found executables ' << @executables.join(', '))
69
70
  opts = nil
70
71
  begin
72
+ =begin unresolved issues with YAD and Zenity
71
73
  if has?(YAD)
72
74
  return yad_dlg.split.collect {|o| o.to_s}.join(' ')
73
75
  elsif has?(ZENITY)
74
76
  return zenity_dlg.split.collect {|o| o.to_s}.join(' ')
75
77
  elsif has? XTERM
78
+ =end
79
+ if has? XTERM
76
80
  if has?(WHIPTAIL)
77
81
  return whiptail_dlg.split.collect {|o| o.to_s}.join(' ')
78
82
  else
data/lib/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #encoding: UTF-8
2
2
  =begin
3
3
  /***************************************************************************
4
- * 2023-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
4
+ * 2023-2025, 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/ *
@@ -14,9 +14,9 @@
14
14
  =end
15
15
 
16
16
  PROGNAME = 'flnews_post_proc'
17
- PROGVERSION = "1.71"
17
+ PROGVERSION = "1.73"
18
18
  AUTHORS = "Michael Uplawski"
19
19
  EMAIL = "michael.uplawski@uplawski.eu"
20
20
  YEARS = "2023 - 2025"
21
- SUMMARY = "Improve randomness of signatures, if need be."
21
+ SUMMARY = "files with random signatures can source other such files"
22
22
 
data/lib/yad_dlg CHANGED
@@ -28,12 +28,14 @@ CONF=$(yad --item-separator=" " --title "$TITLE" --image="" --window-icon="" --f
28
28
  --field="Custom-headers":CHK 'true' \
29
29
  --field="No Archive":CHK 'true' \
30
30
  --field="URL Correction":CHK 'true' \
31
- --field="Log":CHK 'true')
31
+ --field="Log":CHK 'true' )
32
+
32
33
 
33
34
  if [ $? == 0 ]
34
35
  then
35
36
  IFS="|"
36
37
  read -ra C_ARR <<< $CONF
38
+ echo "$C_ARR"
37
39
  CONF=''
38
40
  # ------------->
39
41
  # echo ${C_ARR[@]}
@@ -41,6 +43,8 @@ then
41
43
 
42
44
  for i in GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS VFY_URLS DEBUG_LOG
43
45
  do
46
+ echo -e "$i: ${C_ARR[$i]}"
47
+ echo -e "\n"
44
48
  if [ 'FALSE' == "${C_ARR[$i]}" ]
45
49
  then
46
50
  CONF="$i $CONF"
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: '1.71'
4
+ version: '1.73'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Uplawski
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-09 00:00:00.000000000 Z
10
+ date: 2025-07-05 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: diffy
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 3.6.3
103
+ rubygems_version: 3.6.7
104
104
  specification_version: 4
105
- summary: Improve randomness of signatures, if need be.
105
+ summary: files with random signatures can source other such files
106
106
  test_files: []