try to fetch subjects in order

This commit is contained in:
Ward Wouts 2003-06-15 22:01:43 +00:00
parent fbaec7ca2e
commit effbba7f70

View file

@ -1,6 +1,6 @@
#!/usr/local/bin/ruby -w #!/usr/local/bin/ruby -w
# $Dwarf: ripnews.rb,v 1.62 2003/05/26 19:35:04 ward Exp $ # $Dwarf: ripnews.rb,v 1.63 2003/05/27 19:12:46 ward Exp $
# $Source$ # $Source$
require 'date' require 'date'
@ -425,6 +425,24 @@ def get_max_file_length(tempdir=".")
return name.length - 14 return name.length - 14
end end
def ward_sort(a, b)
c = a.to_s.split(/([0-9]+)/)
d = b.to_s.split(/([0-9]+)/)
c.collect{|x|
y = d.shift
r = ((x.to_s =~ /^[0-9]+$/) && (y.to_s =~ /^[0-9]+$/)) ?
(x.to_i <=> y.to_i) :
(x.to_s <=> y.to_s)
if r != 0
return r
end
}
return -1 if (d != [])
return 0
end
############################################################################################# #############################################################################################
$stdout.sync=true # line buffered output $stdout.sync=true # line buffered output
@ -466,7 +484,7 @@ for group in @config.keys.sort
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.sort{|a, b| ward_sort(a, b)}
print "#{i}\n" if Debuglevel > 2 print "#{i}\n" if Debuglevel > 2
if @config[group].has_key?("-MR") and i =~ /#{@config[group]["-MR"]}/ if @config[group].has_key?("-MR") and i =~ /#{@config[group]["-MR"]}/
print "Marking '#{i}' as read\n" print "Marking '#{i}' as read\n"