flnews_post_proc 1.40 → 1.41

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f76e4432bd460f49ef15abd469ac4f79e1c4887c99229620b0a79ec9cb8ad836
4
- data.tar.gz: a6416c6b5f53bdfb9995e1b64accadf97a18fbb2b2dc69b36f4aff86e38f35e3
3
+ metadata.gz: 6d1a635207d4ca4d8fa516c00b23716f0446fa015bd26527483686895a4d37a8
4
+ data.tar.gz: 99a27fa42f530982a3854fb783f69146fdf62a4910f0145dc7551a4e6d7ec4b2
5
5
  SHA512:
6
- metadata.gz: 4f331c0092c7ffeb7ac6b8ee485de68a8ad30534166b65b6be049d6b1d16a3a0a7754396da615dc397a6dd17ffdbf555363e4d41576a604963d09b21c4834031
7
- data.tar.gz: 057cf2f67069ac2708d8b2444a6339b4671415bd55e86662f23d2ced0d95e5a7e80b69c3514123dab71a1edceab3717f346de7c876119c7c68bb6f31179dc3bb
6
+ metadata.gz: ef0f0e4c3e3b04cb1c3c1b3213ec4ef2d7c5ec8909bd7d22d581269953c4a1283c5263680990d0ff5a085077f01ddbc8b2808f90b0052c8bbbb169bae8d9622a
7
+ data.tar.gz: 387191fb0c3bdc9c434c970ee2b72de669dbd9d66791eb8a65c987e7ef3b6d523e39d56ebbdf2c2471bcd9897060f151c3c710bd6d03f6eeb7694e621c03e1b6
@@ -86,13 +86,13 @@ GROUP_SIGS:
86
86
  CUSTOM_HEADERS:
87
87
  - "X-Post-Processor: flnews_post_proc"
88
88
 
89
- # XNAY_GROUPS:
89
+ # NO_ARCHIVE_GROUPS:
90
90
  # The newsgroups, where a header X-No-Archive: YES shall be set.
91
91
  # CONTENT: a dash and space, then a String, containing the name of the group
92
92
  # or a regexp.
93
93
  # DEFAULT: empty
94
94
  # EXAMPLE: - "alt.test"
95
- XNAY_GROUPS:
95
+ NO_ARCHIVE_GROUPS:
96
96
  - ".*.test"
97
97
 
98
98
  # DEBUG_LOG:
data/lib/headers.rb CHANGED
@@ -55,9 +55,13 @@ class Headers
55
55
  error ("Cannot match a header in line " << l << "(" << ex.message << ")")
56
56
  exit false;
57
57
  end
58
+ # Consider the two following fixes as preliminary until proven.
59
+ # Getting older, this kind of problem occupies me a lot more than
60
+ # it should.
61
+ #
58
62
  # value is all after the first colon
59
63
  # BUGGY: val = l.match(/:(.*)/)[1].strip
60
- # BUGFIX 3/2024
64
+ # BUGFIX 3/2024, use lstrip
61
65
  val = l.match(/:(.*)/)[1].lstrip
62
66
  else # start_with?(' ')
63
67
  # a wrapped value is not devided
@@ -95,14 +99,15 @@ class Headers
95
99
 
96
100
  # Modify headers, if need be.
97
101
  def update()
98
- xnay = @newsgroups.xnay
99
- debug('xnay should be set now : ' << xnay.to_s)
100
- if xnay
101
- @headers["X-No-Archive".to_sym] = xnay
102
+ no_archive = @newsgroups.no_archive
103
+ debug('no_archive should be set now : ' << no_archive.to_s)
104
+ if no_archive
105
+ @headers["X-No-Archive".to_sym] = no_archive
106
+ @headers["Archive".to_sym] = 'no'
102
107
  end
103
- ch = @@config.CUSTOM_HEADERS
104
- debug('setting custom headers : ' << ch.inspect)
105
108
  if @@config.CUSTOM_HEADERS
109
+ ch = @@config.CUSTOM_HEADERS
110
+ debug('setting custom headers : ' << ch.inspect)
106
111
  @@config.CUSTOM_HEADERS.each do |pair|
107
112
  ch = pair.split(':')
108
113
  hn = ch[0].strip
@@ -143,6 +148,6 @@ class Headers
143
148
  end
144
149
 
145
150
  attr_reader :lines, :newsgroups
146
-
151
+
147
152
  end
148
153
  # EOF
data/lib/newsgroups.rb CHANGED
@@ -26,18 +26,18 @@ class Newsgroups
26
26
 
27
27
  def initialize(groups)
28
28
  @groups = groups.split(',')
29
- debug('set signature, intro, xnay')
29
+ debug('set signature, intro, no_archive')
30
30
  # set details for this post
31
31
  if @groups.size == 1
32
32
  set_signature
33
33
  set_intro
34
- set_xnay
34
+ set_no_archive
35
35
  end
36
36
  end
37
37
 
38
- def xnay
39
- debug('returning ' <<( @xnay ? @xnay : ' nil ') )
40
- return @xnay ? @xnay : nil
38
+ def no_archive
39
+ debug('returning ' <<( @no_archive ? @no_archive : ' nil ') )
40
+ return @no_archive ? @no_archive : nil
41
41
  end
42
42
  attr_reader :signature, :intro, :groups
43
43
 
@@ -121,13 +121,13 @@ class Newsgroups
121
121
  end
122
122
  end
123
123
 
124
- # define the xnay header.
125
- def set_xnay
126
- @xnay = nil
127
- xgs = @@config.XNAY_GROUPS
124
+ # define the no_archive header.
125
+ def set_no_archive
126
+ @no_archive = nil
127
+ xgs = @@config.NO_ARCHIVE_GROUPS
128
128
  if xgs && !xgs.empty? && xgs.detect {|g| @groups[0].match(g) }
129
- debug("setting XNAY")
130
- @xnay = 'YES'
129
+ debug("setting no_archive")
130
+ @no_archive = 'yes'
131
131
  end
132
132
  end
133
133
  end
data/lib/override.rb CHANGED
@@ -40,7 +40,7 @@ class OverrideDlg
40
40
  @@LIBDIR = File::dirname(__FILE__)
41
41
  # The configuration variables that can be unset.
42
42
  # This class instance variable is exposed via a getter.
43
- @cvars = [:GROUP_SIGS, :CUSTOM_HEADERS, :XNAY_GROUPS, :VFY_URLS, :DEBUG_LOG]
43
+ @cvars = [:GROUP_SIGS, :CUSTOM_HEADERS, :NO_ARCHIVE_GROUPS, :VFY_URLS, :DEBUG_LOG]
44
44
 
45
45
  # ... here
46
46
  # For the record: this is rather cool.
@@ -66,7 +66,7 @@ class OverrideDlg
66
66
  # display a dialog and return the new options.
67
67
  def show
68
68
  if(@executables && !@executables.empty?)
69
- debug('found executables ' << @executables.join(', ') )
69
+ debug('found executables ' << @executables.join(', '))
70
70
  opts = nil
71
71
  begin
72
72
  if has?(YAD)
data/lib/ruby_dlg CHANGED
@@ -35,27 +35,25 @@ def wait_for_user()
35
35
  end
36
36
  return char
37
37
  end
38
+ if !ARGV.empty? && ARGV.length > 0
39
+ ofl = nil
40
+ begin
41
+ ofl = File.open(ARGV[0], 'w+')
42
+ puts 'writing to ' << ARGV[0]
43
+ rescue Exception => ex
44
+ puts red ('cannot open ' << ARGV[1])
45
+ puts ex.message
46
+ puts 'hit any key to exit'
47
+ wait_for_user
48
+ exit false
49
+ end
38
50
 
39
-
40
- ofl = nil
41
- begin
42
- ofl = File.open(ARGV[0], 'w+') if ARGV.length > 0
43
- puts 'writing to ' << ARGV[0]
44
- rescue Exception => ex
45
- puts red ('cannot open ' << ARGV[1])
46
- puts 'hit any key to exit'
47
- wait_for_user
48
- exit false
49
- end
50
-
51
-
52
-
53
- opt_array = []
54
- message = ''
55
- menu ||= %=
51
+ opt_array = []
52
+ message = ''
53
+ menu ||= %=
56
54
  1 Unset Signature GROUP_SIGS
57
55
  2 Unset Custom headers CUSTOM_HEADERS
58
- 3 Unset X-No-Archive XNAY_GROUPS
56
+ 3 Unset No Archive NO_ARCHIVE_GROUPS
59
57
  4 Do not correct URLs VFY_URLS
60
58
  5 Disable log DEBUG_LOG
61
59
  ––––––––––––––––––––––––––––––––––––––––––––––
@@ -65,72 +63,77 @@ menu ||= %=
65
63
  ––––––––––––––––––––––––––––––––––––––––––––––––
66
64
  #{bold("Esc, Ctrl+C and 'q'")} terminate the Post-processor
67
65
  and no changes will be applied.
68
- =
69
-
70
- loop do
71
- system 'clear'
72
- puts yellow(menu)
73
- puts cyan(message)
74
- option = wait_for_user - 48
75
- case option
76
- # Esc, Ctrl+C, 'q'
77
- when -21, -45, 65
78
- puts red('Aborting. Bye.')
79
- ofl.write 'exit'
80
- ofl.close
81
- exit true
82
- when 0
83
- puts green('Applying changes.') if !opt_array.empty?
84
- # write the list of variables to unset (others remain)
85
- ofl.write opt_array.join(' ')
86
- ofl.close
87
- exit true
88
-
89
- # toggle options
90
- # ADD option to the option array, if it should be *removed*
91
- # from the configuration, else remove it from the array.
92
- when 1
93
- active = !opt_array.include?(:GROUP_SIGS)
94
- opt_array << :GROUP_SIGS if active
95
- opt_array.delete(:GROUP_SIGS) if !active
96
-
97
- message = "Signature #{active ? 'unset' : 'as configured'}!"
98
- menu.sub!("Unset Signature", "Set Signature ") if active
99
- menu.sub!("Set Signature ", "Unset Signature") if !active
100
- when 2
101
- active = !opt_array.include?(:CUSTOM_HEADERS)
102
- opt_array << :CUSTOM_HEADERS if active
103
- opt_array.delete(:CUSTOM_HEADERS) if !active
104
-
105
- message = "Custom headers #{active ? 'removed' : 'are added'}!"
106
- menu.sub!("Unset Custom headers", "Add Custom headers ") if active
107
- menu.sub!("Add Custom headers ", "Unset Custom headers") if !active
108
- when 3
109
- active = !opt_array.include?(:XNAY_GROUPS)
110
- opt_array << :XNAY_GROUPS if active
111
- opt_array.delete(:XNAY_GROUPS) if !active
112
-
113
- message = "X-No-Archive #{active ? 'removed' : 'is added'}!"
114
- menu.sub!("Unset X-No-Archive", "Add X-No-Archive ") if active
115
- menu.sub!("Add X-No-Archive ", "Unset X-No-Archive") if !active
116
- when 4
117
- active = !opt_array.include?(:VFY_URLS)
118
- opt_array << :VFY_URLS if active
119
- opt_array.delete(:VFY_URLS) if !active
120
-
121
- message = "URLS will #{active ? 'not ' : ''}" << "be verified!"
122
- menu.sub!("Do not correct URLs", "Correct URLs ") if active
123
- menu.sub!("Correct URLs ", "Do not correct URLs") if !active
124
- when 5
125
- active = !opt_array.include?(:DEBUG_LOG)
126
- opt_array << :DEBUG_LOG if active
127
- opt_array.delete(:DEBUG_LOG) if !active
128
-
129
- message = "Log is #{ active ? 'not ' : ''} " << "written!"
130
- menu.sub!("Disable log", "Enable log ") if active
131
- menu.sub!("Enable log ", "Disable log") if !active
132
- when 6
133
- message = "Summary of " << bold('disabled') << " options: " << opt_array.join(' ')
66
+ =
67
+
68
+ loop do
69
+ system 'clear'
70
+ puts yellow(menu)
71
+ puts cyan(message)
72
+ option = wait_for_user - 48
73
+ case option
74
+ # Esc, Ctrl+C, 'q'
75
+ when -21, -45, 65
76
+ puts red('Aborting. Bye.')
77
+ ofl.write 'exit'
78
+ ofl.close
79
+ exit true
80
+ when 0
81
+ puts green('Applying changes.') if !opt_array.empty?
82
+ # write the list of variables to unset (others remain)
83
+ ofl.write opt_array.join(' ')
84
+ ofl.close
85
+ exit true
86
+
87
+ # toggle options
88
+ # ADD option to the option array, if it should be *removed*
89
+ # from the configuration, else remove it from the array.
90
+ when 1
91
+ active = !opt_array.include?(:GROUP_SIGS)
92
+ opt_array << :GROUP_SIGS if active
93
+ opt_array.delete(:GROUP_SIGS) if !active
94
+
95
+ message = "Signature #{active ? 'unset' : 'as configured'}!"
96
+ menu.sub!("Unset Signature", "Set Signature ") if active
97
+ menu.sub!("Set Signature ", "Unset Signature") if !active
98
+ when 2
99
+ active = !opt_array.include?(:CUSTOM_HEADERS)
100
+ opt_array << :CUSTOM_HEADERS if active
101
+ opt_array.delete(:CUSTOM_HEADERS) if !active
102
+
103
+ message = "Custom headers #{active ? 'removed' : 'are added'}!"
104
+ menu.sub!("Unset Custom headers", "Add Custom headers ") if active
105
+ menu.sub!("Add Custom headers ", "Unset Custom headers") if !active
106
+ when 3
107
+ active = !opt_array.include?(:NO_ARCHIVE_GROUPS)
108
+ opt_array << :NO_ARCHIVE_GROUPS if active
109
+ opt_array.delete(:NO_ARCHIVE_GROUPS) if !active
110
+
111
+ message = "X-No-Archive #{active ? 'removed' : 'is added'}!"
112
+ menu.sub!("Unset X-No-Archive", "Add X-No-Archive ") if active
113
+ menu.sub!("Add X-No-Archive ", "Unset X-No-Archive") if !active
114
+ when 4
115
+ active = !opt_array.include?(:VFY_URLS)
116
+ opt_array << :VFY_URLS if active
117
+ opt_array.delete(:VFY_URLS) if !active
118
+
119
+ message = "URLS will #{active ? 'not ' : ''}" << "be verified!"
120
+ menu.sub!("Do not correct URLs", "Correct URLs ") if active
121
+ menu.sub!("Correct URLs ", "Do not correct URLs") if !active
122
+ when 5
123
+ active = !opt_array.include?(:DEBUG_LOG)
124
+ opt_array << :DEBUG_LOG if active
125
+ opt_array.delete(:DEBUG_LOG) if !active
126
+
127
+ message = "Log is #{ active ? 'not ' : ''} " << "written!"
128
+ menu.sub!("Disable log", "Enable log ") if active
129
+ menu.sub!("Enable log ", "Disable log") if !active
130
+ when 6
131
+ message = "Summary of " << bold('disabled') << " options: " << opt_array.join(' ')
132
+ end
134
133
  end
134
+ else # ARGV
135
+ puts red('missing file argument')
136
+ exit false
135
137
  end
136
138
 
139
+
data/lib/version.rb CHANGED
@@ -14,8 +14,8 @@
14
14
  =end
15
15
 
16
16
  PROGNAME = 'flnews_post_proc'
17
- PROGVERSION = "1.40"
17
+ PROGVERSION = "1.41"
18
18
  AUTHORS = "Michael Uplawski"
19
19
  EMAIL = "michael.uplawski@uplawski.eu"
20
20
  YEARS = "2023 - 2024"
21
- SUMMARY = "Moved the override-dialog scripts from the executables directory to lib"
21
+ SUMMARY = "Additional Header 'Archive: no', when No Archive is chosen."
data/lib/whiptail_dlg CHANGED
@@ -16,6 +16,11 @@
16
16
  # The main difficulty arises from the fact that positive defaults
17
17
  # are negated, while a checklist wants to give positive results.
18
18
 
19
+ if [ $# -eq 0 ]
20
+ then
21
+ echo "ERROR: file-argument missing"
22
+ exit 1
23
+ fi
19
24
  OUTFILE="$1"
20
25
 
21
26
  # empty the file
@@ -25,10 +30,10 @@ TITLE="Override post-processor configuration"
25
30
  CHECKTITLE="Deselect to disable. Esc or Cancel close the dialog and no changes will be applied."
26
31
 
27
32
  # These are the configuration variables which can be unset.
28
- VARS=(GROUP_SIGS CUSTOM_HEADERS XNAY_GROUPS VFY_URLS DEBUG_LOG)
33
+ VARS=(GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS VFY_URLS DEBUG_LOG)
29
34
 
30
35
  # Checklist options
31
- options=(GROUP_SIGS 'Signatures' ON CUSTOM_HEADERS 'Custom headers' ON XNAY_GROUPS 'X-No-Archive' ON VFY_URLS 'Correct URLs' ON DEBUG_LOG 'Log' ON)
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)
32
37
 
33
38
  # show dialog and store results
34
39
  result=$(whiptail --title "$TITLE" --checklist "$CHECKTITLE" 13 55 5 "${options[@]}" 3>&1 1>&2 2>&3)
data/lib/yad_dlg CHANGED
@@ -18,16 +18,16 @@ TITLE="Override post-processor configuration"
18
18
  # unset.
19
19
  GROUP_SIGS=1
20
20
  CUSTOM_HEADERS=2
21
- XNAY_GROUPS=3
21
+ NO_ARCHIVE_GROUPS=3
22
22
  VFY_URLS=4
23
23
  DEBUG_LOG=5
24
- CONF=($(yad --item-separator=" " --title "$TITLE" --image="" --window-icon="" --form \
24
+ CONF=$(yad --item-separator=" " --title "$TITLE" --image="" --window-icon="" --form \
25
25
  --field="Uncheck to disable options\n<b>Esc and Cancel</b> terminate the post-processor.":LBL ""\
26
26
  --field="Signature":CHK 'true' \
27
27
  --field="Custom-headers":CHK 'true' \
28
- --field="XNAY":CHK 'true' \
28
+ --field="No Archive":CHK 'true' \
29
29
  --field="URL Correction":CHK 'true' \
30
- --field="Log":CHK 'true'))
30
+ --field="Log":CHK 'true')
31
31
 
32
32
  if [ $? == 0 ]
33
33
  then
@@ -38,7 +38,7 @@ then
38
38
  # echo ${C_ARR[@]}
39
39
  # <-------------
40
40
 
41
- for i in GROUP_SIGS CUSTOM_HEADERS XNAY_GROUPS VFY_URLS DEBUG_LOG
41
+ for i in GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS VFY_URLS DEBUG_LOG
42
42
  do
43
43
  if [ 'FALSE' == "${C_ARR[$i]}" ]
44
44
  then
data/lib/zenity_dlg CHANGED
@@ -20,7 +20,7 @@ CONF=$(zenity --title "$TITLE" --text "Deselect options to disable.\n<b>Esc and
20
20
  --height 450 --list --checklist --column 'set' --column 'Option' --column '' \
21
21
  TRUE GROUP_SIGS Signature\
22
22
  TRUE CUSTOM_HEADERS "Custom Headers"\
23
- TRUE XNAY_GROUPS "X-No-Archive"\
23
+ TRUE NO_ARCHIVE_GROUPS "No Archive"\
24
24
  TRUE VFY_URLS "Correct URLs"\
25
25
  TRUE DEBUG_LOG Log)
26
26
 
@@ -33,7 +33,7 @@ then
33
33
  # echo ${C_ARR[@]}
34
34
  # <-------------
35
35
 
36
- for c in GROUP_SIGS CUSTOM_HEADERS XNAY_GROUPS VFY_URLS DEBUG_LOG
36
+ for c in GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS VFY_URLS DEBUG_LOG
37
37
  do
38
38
  # disable only the options which are missing in
39
39
  # the Zenity return value
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flnews_post_proc
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.40'
4
+ version: '1.41'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Uplawski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-07 00:00:00.000000000 Z
11
+ date: 2024-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diffy
@@ -84,5 +84,5 @@ requirements: []
84
84
  rubygems_version: 3.4.20
85
85
  signing_key:
86
86
  specification_version: 4
87
- summary: Moved the override-dialog scripts from the executables directory to lib
87
+ summary: 'Additional Header ''Archive: no'', when No Archive is chosen.'
88
88
  test_files: []