- 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 == ""
|
||||
default[$1] += $2
|
||||
else
|
||||
for g in group.split
|
||||
for g in group.split('|')
|
||||
if config[g].has_key?($1)
|
||||
config[g][$1] += $2
|
||||
elsif default.has_key?($1)
|
||||
|
|
@ -119,20 +119,20 @@ def parse_config(default = {})
|
|||
if group == ""
|
||||
default[$1] = $2
|
||||
else
|
||||
for g in group.split
|
||||
for g in group.split('|')
|
||||
config[g][$1] = $2
|
||||
end
|
||||
end
|
||||
elsif line =~ /(.*?)\s*\{/
|
||||
group = $1
|
||||
for g in group.split
|
||||
for g in group.split('|')
|
||||
unless config.has_key?(g)
|
||||
config[g] = {}
|
||||
end
|
||||
end
|
||||
elsif line =~ /^}$/
|
||||
default.each_key{|x|
|
||||
for g in group.split
|
||||
for g in group.split('|')
|
||||
unless config[g].has_key?(x)
|
||||
config[g][x] = default[x]
|
||||
end
|
||||
|
|
@ -173,9 +173,6 @@ def check_config(config)
|
|||
unless config[i].has_key?("DATADIR")
|
||||
config[i]["DATADIR"] ="."
|
||||
end
|
||||
unless config[i].has_key?("NEWSRCNAME")
|
||||
config[i]["NEWSRCNAME"] = "~/.newsrc"
|
||||
end
|
||||
unless config[i].has_key?("PERMISSION")
|
||||
config[i]["PERMISSION"] = "0755"
|
||||
end
|
||||
|
|
@ -197,11 +194,11 @@ if Debuglevel > 2
|
|||
end
|
||||
|
||||
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"
|
||||
articles = Article.new(config[group]["NNTPSERVER"])
|
||||
articles.set_skip_ids(newsrc.marked_articles(group))
|
||||
articles.get_articles(group, config[group]["CACHEDIR"])
|
||||
articles = Article.new(config[group]["NNTPSERVER"], group, config[group]["NEWSRCNAME"])
|
||||
#articles.set_skip_ids(config[group]["NNTPSERVER"], newsrc.marked_articles(group))
|
||||
articles.get_articles(config[group]["CACHEDIR"])
|
||||
|
||||
unless FileTest.directory?("#{config[group]["DATADIR"]}/#{group}") or
|
||||
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
|
||||
i =~ /#{config[group]["-I"]}/
|
||||
print "Match: #{i}\n" if Debuglevel > 0
|
||||
if articles.group_complete(i)
|
||||
if articles.group_is_complete(i)
|
||||
print " Fetching: #{i}\n"
|
||||
if articles.group_singlepart(i)
|
||||
if articles.group_is_singlepart(i)
|
||||
print " Singlepart!\n"
|
||||
body = articles.get_group_body(i)
|
||||
if articles.is_uuencoded(body)
|
||||
|
|
@ -223,7 +220,7 @@ for group in config.keys.sort
|
|||
else
|
||||
print "Not UUencoded!\n"
|
||||
end
|
||||
elsif articles.group_multipart(i)
|
||||
elsif articles.group_is_multipart(i)
|
||||
print " Multipart!\n"
|
||||
if config[group]["TEMPDIR"] == nil or config[group]["TEMPDIR"] == ""
|
||||
body = articles.get_group_body(i)
|
||||
|
|
@ -260,9 +257,10 @@ for group in config.keys.sort
|
|||
save_file("#{config[group]["DATADIR"]}/#{group}", filename, body)
|
||||
end
|
||||
end
|
||||
marked = articles.get_group_ids(i)
|
||||
newsrc.mark_list(group, marked)
|
||||
newsrc.save unless config[group].has_key?("-T") and config[group]["-T"]
|
||||
#messids = articles.get_group_messids(i)
|
||||
articles.group_update_newsrc(i)
|
||||
#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"}
|
||||
else
|
||||
print " Not complete: #{i}\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue