- allow multiple servers
- change group seperator to '|' instead of whitespace
This commit is contained in:
parent
5ca723bfc0
commit
6f01b486db
1 changed files with 15 additions and 17 deletions
|
|
@ -105,7 +105,7 @@ def parse_config(default = {})
|
||||||
if group == ""
|
if group == ""
|
||||||
default[$1] += $2
|
default[$1] += $2
|
||||||
else
|
else
|
||||||
for g in group.split
|
for g in group.split('|')
|
||||||
if config[g].has_key?($1)
|
if config[g].has_key?($1)
|
||||||
config[g][$1] += $2
|
config[g][$1] += $2
|
||||||
elsif default.has_key?($1)
|
elsif default.has_key?($1)
|
||||||
|
|
@ -119,20 +119,20 @@ def parse_config(default = {})
|
||||||
if group == ""
|
if group == ""
|
||||||
default[$1] = $2
|
default[$1] = $2
|
||||||
else
|
else
|
||||||
for g in group.split
|
for g in group.split('|')
|
||||||
config[g][$1] = $2
|
config[g][$1] = $2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif line =~ /(.*?)\s*\{/
|
elsif line =~ /(.*?)\s*\{/
|
||||||
group = $1
|
group = $1
|
||||||
for g in group.split
|
for g in group.split('|')
|
||||||
unless config.has_key?(g)
|
unless config.has_key?(g)
|
||||||
config[g] = {}
|
config[g] = {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif line =~ /^}$/
|
elsif line =~ /^}$/
|
||||||
default.each_key{|x|
|
default.each_key{|x|
|
||||||
for g in group.split
|
for g in group.split('|')
|
||||||
unless config[g].has_key?(x)
|
unless config[g].has_key?(x)
|
||||||
config[g][x] = default[x]
|
config[g][x] = default[x]
|
||||||
end
|
end
|
||||||
|
|
@ -173,9 +173,6 @@ def check_config(config)
|
||||||
unless config[i].has_key?("DATADIR")
|
unless config[i].has_key?("DATADIR")
|
||||||
config[i]["DATADIR"] ="."
|
config[i]["DATADIR"] ="."
|
||||||
end
|
end
|
||||||
unless config[i].has_key?("NEWSRCNAME")
|
|
||||||
config[i]["NEWSRCNAME"] = "~/.newsrc"
|
|
||||||
end
|
|
||||||
unless config[i].has_key?("PERMISSION")
|
unless config[i].has_key?("PERMISSION")
|
||||||
config[i]["PERMISSION"] = "0755"
|
config[i]["PERMISSION"] = "0755"
|
||||||
end
|
end
|
||||||
|
|
@ -197,11 +194,11 @@ if Debuglevel > 2
|
||||||
end
|
end
|
||||||
|
|
||||||
for group in config.keys.sort
|
for group in config.keys.sort
|
||||||
newsrc = News::Newsrc.new(config[group]["NEWSRCNAME"])
|
#newsrc = News::Newsrc.new(config[group]["NEWSRCNAME"])
|
||||||
print "Getting articles for #{group}\n"
|
print "Getting articles for #{group}\n"
|
||||||
articles = Article.new(config[group]["NNTPSERVER"])
|
articles = Article.new(config[group]["NNTPSERVER"], group, config[group]["NEWSRCNAME"])
|
||||||
articles.set_skip_ids(newsrc.marked_articles(group))
|
#articles.set_skip_ids(config[group]["NNTPSERVER"], newsrc.marked_articles(group))
|
||||||
articles.get_articles(group, config[group]["CACHEDIR"])
|
articles.get_articles(config[group]["CACHEDIR"])
|
||||||
|
|
||||||
unless FileTest.directory?("#{config[group]["DATADIR"]}/#{group}") or
|
unless FileTest.directory?("#{config[group]["DATADIR"]}/#{group}") or
|
||||||
Dir.mkdir("#{config[group]["DATADIR"]}/#{group}", config[group]["PERMISSION"].oct)
|
Dir.mkdir("#{config[group]["DATADIR"]}/#{group}", config[group]["PERMISSION"].oct)
|
||||||
|
|
@ -213,9 +210,9 @@ for group in config.keys.sort
|
||||||
if !(config[group].has_key?("-X") and i =~ /#{config[group]["-X"]}/) and
|
if !(config[group].has_key?("-X") and i =~ /#{config[group]["-X"]}/) and
|
||||||
i =~ /#{config[group]["-I"]}/
|
i =~ /#{config[group]["-I"]}/
|
||||||
print "Match: #{i}\n" if Debuglevel > 0
|
print "Match: #{i}\n" if Debuglevel > 0
|
||||||
if articles.group_complete(i)
|
if articles.group_is_complete(i)
|
||||||
print " Fetching: #{i}\n"
|
print " Fetching: #{i}\n"
|
||||||
if articles.group_singlepart(i)
|
if articles.group_is_singlepart(i)
|
||||||
print " Singlepart!\n"
|
print " Singlepart!\n"
|
||||||
body = articles.get_group_body(i)
|
body = articles.get_group_body(i)
|
||||||
if articles.is_uuencoded(body)
|
if articles.is_uuencoded(body)
|
||||||
|
|
@ -223,7 +220,7 @@ for group in config.keys.sort
|
||||||
else
|
else
|
||||||
print "Not UUencoded!\n"
|
print "Not UUencoded!\n"
|
||||||
end
|
end
|
||||||
elsif articles.group_multipart(i)
|
elsif articles.group_is_multipart(i)
|
||||||
print " Multipart!\n"
|
print " Multipart!\n"
|
||||||
if config[group]["TEMPDIR"] == nil or config[group]["TEMPDIR"] == ""
|
if config[group]["TEMPDIR"] == nil or config[group]["TEMPDIR"] == ""
|
||||||
body = articles.get_group_body(i)
|
body = articles.get_group_body(i)
|
||||||
|
|
@ -260,9 +257,10 @@ for group in config.keys.sort
|
||||||
save_file("#{config[group]["DATADIR"]}/#{group}", filename, body)
|
save_file("#{config[group]["DATADIR"]}/#{group}", filename, body)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
marked = articles.get_group_ids(i)
|
#messids = articles.get_group_messids(i)
|
||||||
newsrc.mark_list(group, marked)
|
articles.group_update_newsrc(i)
|
||||||
newsrc.save unless config[group].has_key?("-T") and config[group]["-T"]
|
#newsrc.mark_list(group, marked)
|
||||||
|
articles.save_newsrc unless config[group].has_key?("-T") and config[group]["-T"]
|
||||||
#marked.collect!{|x| print "marked: #{x}\n"}
|
#marked.collect!{|x| print "marked: #{x}\n"}
|
||||||
else
|
else
|
||||||
print " Not complete: #{i}\n"
|
print " Not complete: #{i}\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue