flnews_post_proc 1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +381 -0
- data/bin/flnews_post_proc +128 -0
- data/doc/fr/html/flnews_post_proc.html +704 -0
- data/doc/fr/man/flnews_post_proc.1.gz +0 -0
- data/doc/fr/pdf/flnews_post_proc.pdf +0 -0
- data/doc/fr/rst/flnews_post_proc.rst +380 -0
- data/doc/html/flnews_post_proc.html +342 -0
- data/doc/license.txt +13 -0
- data/doc/man/flnews_post_proc.1.gz +0 -0
- data/doc/pdf/flnews_post_proc.pdf +0 -0
- data/doc/rst/flnews_post_proc.rst +336 -0
- data/lib/_quoting_style_regexp +2 -0
- data/lib/basic_logging.rb +202 -0
- data/lib/body.rb +364 -0
- data/lib/color_output.rb +65 -0
- data/lib/configuration.rb +143 -0
- data/lib/flnews_post_proc.conf +173 -0
- data/lib/flnews_post_proc.rb +72 -0
- data/lib/headers.rb +172 -0
- data/lib/newsgroups.rb +152 -0
- data/lib/override.rb +199 -0
- data/lib/ruby_dlg +139 -0
- data/lib/version.rb +22 -0
- data/lib/whiptail_dlg +84 -0
- data/lib/yad_dlg +53 -0
- data/lib/zenity_dlg +60 -0
- metadata +109 -0
data/lib/override.rb
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
#encoding: UTF-8
|
2
|
+
=begin
|
3
|
+
/***************************************************************************
|
4
|
+
* 2023-2024, 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
|
+
=end
|
15
|
+
|
16
|
+
# This class manages a dialog to alter the behavior of the
|
17
|
+
# post-processor on a “per article” basis. It can be displayed
|
18
|
+
# before posting, to do some “last minute” changes,
|
19
|
+
# notably to deactivate them.
|
20
|
+
#
|
21
|
+
# Post-processing CANNOT be deactivated completely in this dialog.
|
22
|
+
# I do not remember, why a previous comment stated the contrary.
|
23
|
+
|
24
|
+
require_relative 'basic_logging'
|
25
|
+
|
26
|
+
class OverrideDlg
|
27
|
+
|
28
|
+
include BasicLogging
|
29
|
+
|
30
|
+
XTERM = 'xterm'
|
31
|
+
# TERMINAL = 'x-terminal-emulator'
|
32
|
+
WHIPTAIL = 'whiptail'
|
33
|
+
YAD = 'yad'
|
34
|
+
ZENITY = 'zenity'
|
35
|
+
# The external programs which are supported for the time. They will be run in
|
36
|
+
# a new process (IO.popen() ). The first program from this array, which is
|
37
|
+
# found in the Path, will be used. Whiptail and a pure ruby dialog
|
38
|
+
# necessitate that xterm be found, too.
|
39
|
+
@@Executables = [YAD, ZENITY, WHIPTAIL, XTERM]
|
40
|
+
@@LIBDIR = File::dirname(__FILE__)
|
41
|
+
# The configuration variables that can be unset.
|
42
|
+
# This class instance variable is exposed via a getter.
|
43
|
+
@cvars = [:GROUP_SIGS, :CUSTOM_HEADERS, :NO_ARCHIVE_GROUPS, :VFY_URLS, :DEBUG_LOG]
|
44
|
+
|
45
|
+
# ... here
|
46
|
+
# For the record: this is rather cool.
|
47
|
+
# ... believe me! It is!
|
48
|
+
class << self
|
49
|
+
attr_reader :cvars
|
50
|
+
end
|
51
|
+
# Love it.
|
52
|
+
|
53
|
+
# Create the object
|
54
|
+
def initialize
|
55
|
+
@config = Configuration::instance
|
56
|
+
# find the supported programs
|
57
|
+
@executables = @@Executables.select do |ex_name|
|
58
|
+
program?(ex_name)
|
59
|
+
end
|
60
|
+
# As we are calling external programs anyway,
|
61
|
+
# why not continue with that ...
|
62
|
+
@xmsg = ENV['PATH'].split(':').any? {|d| Dir.children(d).include?('xmessage')}
|
63
|
+
# bof.
|
64
|
+
end
|
65
|
+
|
66
|
+
# display a dialog and return the new options.
|
67
|
+
def show
|
68
|
+
if(@executables && !@executables.empty?)
|
69
|
+
debug('found executables ' << @executables.join(', '))
|
70
|
+
opts = nil
|
71
|
+
begin
|
72
|
+
if has?(YAD)
|
73
|
+
return yad_dlg.split.collect {|o| o.to_s}.join(' ')
|
74
|
+
elsif has?(ZENITY)
|
75
|
+
return zenity_dlg.split.collect {|o| o.to_s}.join(' ')
|
76
|
+
elsif has? XTERM
|
77
|
+
if has?(WHIPTAIL)
|
78
|
+
return whiptail_dlg.split.collect {|o| o.to_s}.join(' ')
|
79
|
+
else
|
80
|
+
debug 'using naked xterm'
|
81
|
+
return ruby_dlg.split.collect {|o| o.to_s}.join(' ')
|
82
|
+
end
|
83
|
+
end
|
84
|
+
rescue SystemExit
|
85
|
+
msg = 'Process is cancelled (SystemExit)'
|
86
|
+
info msg
|
87
|
+
exit true
|
88
|
+
rescue Exception => ex
|
89
|
+
msg = 'Error upon showing dialog ' << ex.message
|
90
|
+
error(msg)
|
91
|
+
end
|
92
|
+
# no program to show the dialog
|
93
|
+
else
|
94
|
+
msg = "#{File.basename($0)}: No suitable executable found to display the dialog"
|
95
|
+
warn msg
|
96
|
+
# if xmessage is available, give the user a last chance.
|
97
|
+
if @xmsg
|
98
|
+
io = IO.popen('xmessage -buttons continue:0,abort:1 -default abort -print ' << msg)
|
99
|
+
Process.wait(io.pid)
|
100
|
+
# ATTN! read io only once!
|
101
|
+
exit if ('continue' != io.read.to_s.strip )
|
102
|
+
# ... but then again, we still have a log.
|
103
|
+
debug('continue with configured settings')
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
private
|
109
|
+
# I know what it does and that there is some
|
110
|
+
# redundancy with the following method, but I
|
111
|
+
# do not feel like sorting it out, now.
|
112
|
+
def program?(ex_name)
|
113
|
+
ENV['PATH'].split(':').each do |dir_name|
|
114
|
+
return true if Dir.entries(dir_name).include?(ex_name)
|
115
|
+
end
|
116
|
+
return false
|
117
|
+
end
|
118
|
+
|
119
|
+
# returns true if the executable ex_name is to be
|
120
|
+
# called for the dialog
|
121
|
+
def has?(ex_name)
|
122
|
+
@executables.include? ex_name
|
123
|
+
end
|
124
|
+
|
125
|
+
###### The following methods call a script, each, in an external process.
|
126
|
+
# There appears to be some Exception handling missing, but it does not
|
127
|
+
# hurt for the time being. Anyway, I do not care.
|
128
|
+
|
129
|
+
# creates a whiptail dialog in xterm.
|
130
|
+
def whiptail_dlg
|
131
|
+
debug('whiptail dialog')
|
132
|
+
tf = Tempfile.new
|
133
|
+
# dlg = @config.BINDIR << File::Separator << 'whiptail_dlg'
|
134
|
+
dlg = @@LIBDIR << File::Separator << 'whiptail_dlg'
|
135
|
+
dialog = XTERM.dup << ' -e ' << dlg << ' ' << tf.path
|
136
|
+
io = IO::popen(dialog)
|
137
|
+
Process.wait(io.pid )
|
138
|
+
nopts = tf.read
|
139
|
+
exit true if('exit' == nopts.strip)
|
140
|
+
tf.unlink
|
141
|
+
return nopts
|
142
|
+
end
|
143
|
+
|
144
|
+
# creates a textual dialog in xterm.
|
145
|
+
def ruby_dlg
|
146
|
+
debug('xterm dialog')
|
147
|
+
tf = Tempfile.new
|
148
|
+
# dlg = @config.BINDIR << File::Separator << 'ruby_dlg'
|
149
|
+
dlg = @@LIBDIR << File::Separator << 'ruby_dlg'
|
150
|
+
begin
|
151
|
+
dialog = XTERM.dup << ' -e ' << dlg << ' ' << tf.path
|
152
|
+
debug('dialog will be ' << dialog)
|
153
|
+
rescue Exception => ex
|
154
|
+
error ex.message
|
155
|
+
wait_for_user
|
156
|
+
exit false
|
157
|
+
end
|
158
|
+
io = IO::popen(dialog)
|
159
|
+
debug('wait for ' << io.pid.to_s)
|
160
|
+
Process.wait(io.pid )
|
161
|
+
nopts = tf.read
|
162
|
+
exit true if('exit' == nopts.strip)
|
163
|
+
tf.unlink
|
164
|
+
return nopts
|
165
|
+
end
|
166
|
+
|
167
|
+
# creates a Zenity dialog.
|
168
|
+
def zenity_dlg
|
169
|
+
debug('Zenity dialog')
|
170
|
+
# dialog = @config.BINDIR << File::Separator << 'zenity_dlg'
|
171
|
+
dialog = @@LIBDIR << File::Separator << 'zenity_dlg'
|
172
|
+
io = IO.popen(dialog)
|
173
|
+
Process::wait(io.pid)
|
174
|
+
rc = $?.exitstatus
|
175
|
+
|
176
|
+
exit true if rc != 0
|
177
|
+
|
178
|
+
nopts = io.read
|
179
|
+
return nopts
|
180
|
+
end
|
181
|
+
|
182
|
+
# creates a YAD dialog.
|
183
|
+
def yad_dlg
|
184
|
+
debug('yad dialog')
|
185
|
+
# dialog = @config.BINDIR << File::Separator << 'yad_dlg'
|
186
|
+
dialog = @@LIBDIR << File::Separator << 'yad_dlg'
|
187
|
+
debug('dialog will be ' << dialog)
|
188
|
+
io = IO::popen(dialog)
|
189
|
+
Process::wait(io.pid)
|
190
|
+
exit true if $?.exitstatus != 0
|
191
|
+
|
192
|
+
nopts = io.read
|
193
|
+
return nopts
|
194
|
+
end
|
195
|
+
|
196
|
+
end
|
197
|
+
|
198
|
+
# EOF
|
199
|
+
|
data/lib/ruby_dlg
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
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
|
+
***************************************************************************/
|
14
|
+
=end
|
15
|
+
|
16
|
+
require 'readline'
|
17
|
+
require_relative '../lib/color_output'
|
18
|
+
require 'io/wait'
|
19
|
+
require 'io/console'
|
20
|
+
|
21
|
+
def wait_for_user()
|
22
|
+
char = nil
|
23
|
+
# There is a difference which makes me prefer the below code from STDIN.raw(args)
|
24
|
+
# You can try
|
25
|
+
# char = STDIN.raw(&:getc)
|
26
|
+
# .., which does *not* work the same way and it won't for me.
|
27
|
+
|
28
|
+
STDIN.raw do
|
29
|
+
STDIN.noecho do
|
30
|
+
until (STDIN.ready?)
|
31
|
+
sleep(0.1)
|
32
|
+
end
|
33
|
+
char = (STDIN.read_nonblock(1).ord rescue nil)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
return char
|
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
|
50
|
+
|
51
|
+
opt_array = []
|
52
|
+
message = ''
|
53
|
+
menu ||= %=
|
54
|
+
1 Unset Signature GROUP_SIGS
|
55
|
+
2 Unset Custom headers CUSTOM_HEADERS
|
56
|
+
3 Unset No Archive NO_ARCHIVE_GROUPS
|
57
|
+
4 Do not correct URLs VFY_URLS
|
58
|
+
5 Disable log DEBUG_LOG
|
59
|
+
––––––––––––––––––––––––––––––––––––––––––––––
|
60
|
+
6 Summary
|
61
|
+
––––––––––––––––––––––––––––––––––––––––––––––
|
62
|
+
0 Okay, use settings.
|
63
|
+
––––––––––––––––––––––––––––––––––––––––––––––––
|
64
|
+
{bold("Esc, Ctrl+C and 'q'")} terminate the Post-processor
|
65
|
+
and no changes will be applied.
|
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
|
133
|
+
end
|
134
|
+
else # ARGV
|
135
|
+
puts red('missing file argument')
|
136
|
+
exit false
|
137
|
+
end
|
138
|
+
|
139
|
+
|
data/lib/version.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#encoding: UTF-8
|
2
|
+
=begin
|
3
|
+
/***************************************************************************
|
4
|
+
* 2023-2024, 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
|
+
=end
|
15
|
+
|
16
|
+
PROGNAME = 'flnews_post_proc'
|
17
|
+
PROGVERSION = "1.7"
|
18
|
+
AUTHORS = "Michael Uplawski"
|
19
|
+
EMAIL = "michael.uplawski@uplawski.eu"
|
20
|
+
YEARS = "2023 - 2024"
|
21
|
+
SUMMARY = "Reads random signature from file"
|
22
|
+
|
data/lib/whiptail_dlg
ADDED
@@ -0,0 +1,84 @@
|
|
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 5 "${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
|
+
# <--------
|
52
|
+
|
53
|
+
# Find deselected options which shall be written to the outfile.
|
54
|
+
# Looks complicated.
|
55
|
+
if [ "$okcancel" -eq 0 ]
|
56
|
+
then
|
57
|
+
list=''
|
58
|
+
# check each available variable ...
|
59
|
+
for c in ${VARS[@]}
|
60
|
+
do
|
61
|
+
deactivate=TRUE
|
62
|
+
# ... against the result from the dialog
|
63
|
+
for o in ${opts[@]}
|
64
|
+
do
|
65
|
+
if [ "$o" == "\"$c\"" ]
|
66
|
+
then
|
67
|
+
# ignore if a variable remained checked ...
|
68
|
+
deactivate=FALSE
|
69
|
+
fi
|
70
|
+
done
|
71
|
+
# ... else write it to the list.
|
72
|
+
if [ "$deactivate" == TRUE ]
|
73
|
+
then
|
74
|
+
|
75
|
+
list="$list $c"
|
76
|
+
fi
|
77
|
+
done
|
78
|
+
# Heureka.
|
79
|
+
echo "$list" > "$OUTFILE"
|
80
|
+
else
|
81
|
+
echo "exit" > "$OUTFILE"
|
82
|
+
fi
|
83
|
+
|
84
|
+
# Ω
|
data/lib/yad_dlg
ADDED
@@ -0,0 +1,53 @@
|
|
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
|
+
|
16
|
+
TITLE="Override post-processor configuration"
|
17
|
+
# These are the configuration variables which can be
|
18
|
+
# unset.
|
19
|
+
GROUP_SIGS=1
|
20
|
+
CUSTOM_HEADERS=2
|
21
|
+
NO_ARCHIVE_GROUPS=3
|
22
|
+
#VFY_URLS=4
|
23
|
+
DEBUG_LOG=4
|
24
|
+
|
25
|
+
CONF=$(yad --item-separator=" " --title "$TITLE" --image="" --window-icon="" --form \
|
26
|
+
--field="Uncheck to disable options\n<b>Esc and Cancel</b> terminate the post-processor.":LBL ""\
|
27
|
+
--field="Signature":CHK 'true' \
|
28
|
+
--field="Custom-headers":CHK 'true' \
|
29
|
+
--field="No Archive":CHK 'true' \
|
30
|
+
--field="URL Correction":CHK 'true' \
|
31
|
+
--field="Log":CHK 'true')
|
32
|
+
|
33
|
+
if [ $? == 0 ]
|
34
|
+
then
|
35
|
+
IFS="|"
|
36
|
+
read -ra C_ARR <<< $CONF
|
37
|
+
CONF=''
|
38
|
+
# ------------->
|
39
|
+
# echo ${C_ARR[@]}
|
40
|
+
# <-------------
|
41
|
+
|
42
|
+
for i in GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS VFY_URLS DEBUG_LOG
|
43
|
+
do
|
44
|
+
if [ 'FALSE' == "${C_ARR[$i]}" ]
|
45
|
+
then
|
46
|
+
CONF="$i $CONF"
|
47
|
+
fi
|
48
|
+
done
|
49
|
+
# signal the fields to disable (others will be ignored)
|
50
|
+
echo $CONF
|
51
|
+
else
|
52
|
+
exit 1
|
53
|
+
fi
|
data/lib/zenity_dlg
ADDED
@@ -0,0 +1,60 @@
|
|
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
|
+
|
16
|
+
TITLE="Override post-processor configuration"
|
17
|
+
# The options are the configuration variables which can be unset.
|
18
|
+
|
19
|
+
CONF=$(zenity --title "$TITLE" --text "Deselect options to disable.\n<b>Esc and Cancel</b> terminate the post-processor."\
|
20
|
+
--height 450 --list --checklist --column 'set' --column 'Option' --column '' \
|
21
|
+
TRUE GROUP_SIGS Signature\
|
22
|
+
TRUE CUSTOM_HEADERS "Custom Headers"\
|
23
|
+
TRUE NO_ARCHIVE_GROUPS "No Archive"\
|
24
|
+
TRUE VFY_URLS "Correct URLs"\
|
25
|
+
TRUE DEBUG_LOG Log)
|
26
|
+
|
27
|
+
if [ $? == 0 ]
|
28
|
+
then
|
29
|
+
IFS="|"
|
30
|
+
read -ra C_ARR <<< $CONF
|
31
|
+
CONF=''
|
32
|
+
# ------------->
|
33
|
+
# echo ${C_ARR[@]}
|
34
|
+
# <-------------
|
35
|
+
|
36
|
+
# for c in GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS VFY_URLS DEBUG_LOG
|
37
|
+
for c in GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS DEBUG_LOG
|
38
|
+
do
|
39
|
+
# disable only the options which are missing in
|
40
|
+
# the Zenity return value
|
41
|
+
disable=1
|
42
|
+
|
43
|
+
for o in "${C_ARR[@]}"
|
44
|
+
do
|
45
|
+
if [ "$o" == "$c" ]
|
46
|
+
then
|
47
|
+
disable=
|
48
|
+
fi
|
49
|
+
done
|
50
|
+
|
51
|
+
if [ $disable ]
|
52
|
+
then
|
53
|
+
CONF="$CONF $c"
|
54
|
+
fi
|
55
|
+
done
|
56
|
+
# signal the fields to disable (others will be ignored)
|
57
|
+
echo $CONF
|
58
|
+
else
|
59
|
+
exit 1
|
60
|
+
fi
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flnews_post_proc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.7'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Uplawski
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-12-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: diffy
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.4'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.4.2
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.4'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.4.2
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: ruby-filemagic
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0.7'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.7.3
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0.7'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 0.7.3
|
53
|
+
description: Post-processor for Usenet-articles created in flnews
|
54
|
+
email: michael.uplawski@uplawski.eu
|
55
|
+
executables:
|
56
|
+
- flnews_post_proc
|
57
|
+
extensions: []
|
58
|
+
extra_rdoc_files: []
|
59
|
+
files:
|
60
|
+
- README.md
|
61
|
+
- bin/flnews_post_proc
|
62
|
+
- doc/fr/html/flnews_post_proc.html
|
63
|
+
- doc/fr/man/flnews_post_proc.1.gz
|
64
|
+
- doc/fr/pdf/flnews_post_proc.pdf
|
65
|
+
- doc/fr/rst/flnews_post_proc.rst
|
66
|
+
- doc/html/flnews_post_proc.html
|
67
|
+
- doc/license.txt
|
68
|
+
- doc/man/flnews_post_proc.1.gz
|
69
|
+
- doc/pdf/flnews_post_proc.pdf
|
70
|
+
- doc/rst/flnews_post_proc.rst
|
71
|
+
- lib/_quoting_style_regexp
|
72
|
+
- lib/basic_logging.rb
|
73
|
+
- lib/body.rb
|
74
|
+
- lib/color_output.rb
|
75
|
+
- lib/configuration.rb
|
76
|
+
- lib/flnews_post_proc.conf
|
77
|
+
- lib/flnews_post_proc.rb
|
78
|
+
- lib/headers.rb
|
79
|
+
- lib/newsgroups.rb
|
80
|
+
- lib/override.rb
|
81
|
+
- lib/ruby_dlg
|
82
|
+
- lib/version.rb
|
83
|
+
- lib/whiptail_dlg
|
84
|
+
- lib/yad_dlg
|
85
|
+
- lib/zenity_dlg
|
86
|
+
homepage: https://rubygems.org
|
87
|
+
licenses:
|
88
|
+
- Nonstandard
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '3.0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubygems_version: 3.5.3
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: Reads random signature from file
|
109
|
+
test_files: []
|