bunch o fixes
This commit is contained in:
parent
5590a47f21
commit
06fee68135
1 changed files with 30 additions and 34 deletions
|
|
@ -185,11 +185,11 @@ def check_config
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_single(articles, subj)
|
def get_single(subj)
|
||||||
print " Singlepart!\n"
|
print " Singlepart!\n"
|
||||||
body = articles.get_group_body(subj)
|
body = @articles.get_group_body(subj)
|
||||||
if articles.is_uuencoded(body)
|
if @articles.is_uuencoded(body)
|
||||||
mode, filename, body = articles.uudecode(body)
|
mode, filename, body = @articles.uudecode(body)
|
||||||
else
|
else
|
||||||
print "Not UUencoded!\n"
|
print "Not UUencoded!\n"
|
||||||
return false
|
return false
|
||||||
|
|
@ -197,25 +197,25 @@ def get_single(articles, subj)
|
||||||
return mode, filename, body
|
return mode, filename, body
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_multi(articles, subj, group)
|
def get_multi(subj, group)
|
||||||
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(subj)
|
body = @articles.get_group_body(subj)
|
||||||
if articles.is_uuencoded(body)
|
if @articles.is_uuencoded(body)
|
||||||
mode, filename, body = articles.uudecode(body)
|
mode, filename, body = @articles.uudecode(body)
|
||||||
else
|
else
|
||||||
print "Multipart article not UUencoded!\n"
|
print "Multipart article not UUencoded!\n"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
body = articles.get_group_body_first(subj)
|
body = @articles.get_group_body_first(subj)
|
||||||
next if body == false
|
next if body == false
|
||||||
if articles.is_uuencoded(body)
|
if @articles.is_uuencoded(body)
|
||||||
file = Tempfile.new("riptmp", @config[group]["TEMPDIR"])
|
file = Tempfile.new("riptmp", @config[group]["TEMPDIR"])
|
||||||
body.collect{|x| file.print "#{x}\n"}
|
body.collect{|x| file.print "#{x}\n"}
|
||||||
next unless articles.get_group_body_rest(subj, file)
|
next unless @articles.get_group_body_rest(subj, file)
|
||||||
fileout = Tempfile.new("riptmp", @config[group]["TEMPDIR"])
|
fileout = Tempfile.new("riptmp", @config[group]["TEMPDIR"])
|
||||||
mode, filename, body = articles.uudecode(file, fileout)
|
mode, filename, body = @articles.uudecode(file, fileout)
|
||||||
body = fileout.path
|
body = fileout.path
|
||||||
file.close
|
file.close
|
||||||
fileout.close
|
fileout.close
|
||||||
|
|
@ -224,35 +224,31 @@ def get_multi(articles, subj, group)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return -mode, filename, body
|
return mode, filename, body
|
||||||
end
|
end
|
||||||
|
|
||||||
def output_data(mode, filename="", body="")
|
def output_data(subject, mode, filename="", body="")
|
||||||
if mode
|
if mode
|
||||||
|
group = @articles.get_groupname
|
||||||
print " mode: #{mode}\n" if Debuglevel > 0
|
print " mode: #{mode}\n" if Debuglevel > 0
|
||||||
print " Filename: '#{filename}'\n" if Debuglevel > 0
|
print " Filename: '#{filename}'\n" if Debuglevel > 0
|
||||||
if @config[group].has_key?("-L") and @config[group]["-L"]
|
if @config[group].has_key?("-L") and @config[group]["-L"]
|
||||||
print "longname\n" if Debuglevel > 1
|
print "longname\n" if Debuglevel > 1
|
||||||
if save_file("#{@config[group]["DATADIR"]}/#{group}", i, body)
|
if save_file("#{@config[group]["DATADIR"]}/#{group}", subject, body)
|
||||||
articles.group_update_newsrc(i)
|
@articles.group_update_newsrc(subject)
|
||||||
articles.save_newsrc unless @config[group].has_key?("-T") and @config[group]["-T"]
|
@articles.save_newsrc unless @config[group].has_key?("-T") and @config[group]["-T"]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print "shortname\n" if Debuglevel > 1
|
print "shortname\n" if Debuglevel > 1
|
||||||
if save_file("#{@config[group]["DATADIR"]}/#{group}", filename, body)
|
if save_file("#{@config[group]["DATADIR"]}/#{group}", filename, body)
|
||||||
articles.group_update_newsrc(i)
|
@articles.group_update_newsrc(subject)
|
||||||
articles.save_newsrc unless @config[group].has_key?("-T") and @config[group]["-T"]
|
@articles.save_newsrc unless @config[group].has_key?("-T") and @config[group]["-T"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
#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"}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#############################################################################################
|
#############################################################################################
|
||||||
|
|
@ -273,31 +269,31 @@ end
|
||||||
|
|
||||||
for group in @config.keys.sort
|
for group in @config.keys.sort
|
||||||
print "Getting articles for #{group}\n"
|
print "Getting articles for #{group}\n"
|
||||||
articles = Article.new(@config[group]["NNTPSERVER"], group, @config[group]["NEWSRCNAME"])
|
@articles = Article.new(@config[group]["NNTPSERVER"], group, @config[group]["NEWSRCNAME"])
|
||||||
articles.get_articles(@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)
|
||||||
print "eeeps, couldn't create dir\n"
|
print "eeeps, couldn't create dir\n"
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
for i in articles.get_group_subjects
|
for i in @articles.get_group_subjects
|
||||||
print "#{i}\n" if Debuglevel > 2
|
print "#{i}\n" if Debuglevel > 2
|
||||||
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_is_complete(i)
|
if @articles.group_is_complete(i)
|
||||||
print " Fetching: #{i}\n"
|
print " Fetching: #{i}\n"
|
||||||
if articles.group_is_singlepart(i)
|
if @articles.group_is_singlepart(i)
|
||||||
mode, filename, body = get_single(articles, i)
|
mode, filename, body = get_single(i)
|
||||||
elsif articles.group_is_multipart(i)
|
elsif @articles.group_is_multipart(i)
|
||||||
mode, filename, body = get_multi(articles, i, group)
|
mode, filename, body = get_multi(i, group)
|
||||||
end
|
end
|
||||||
output_data(mode, filename, body)
|
output_data(i, mode, filename, body)
|
||||||
else
|
else
|
||||||
print " Not complete: #{i}\n"
|
print " Not complete: #{i}\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
articles.quit
|
@articles.quit
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue