diff --git a/trunk/ripnews/news/article.rb b/trunk/ripnews/news/article.rb index 262068f..c3e814a 100644 --- a/trunk/ripnews/news/article.rb +++ b/trunk/ripnews/news/article.rb @@ -72,12 +72,18 @@ end def get_articles(cachedir=false) for server in @connections.keys first, last = get_group_info(server) - @connections[server]["first"] = first ? first : 0 - @connections[server]["last"] = last ? last : 0 + if first + @connections[server]["first"] = first ? first : 0 + @connections[server]["last"] = last ? last : 0 + else + print "Error selecting @group on server #{server}, removing from server list...\n" + @connections.delete(server) + @serverlist.delete(server) + end end read_cache(cachedir) for server in @connections.keys - print "reading articles from server: #{server}\n" + print " reading articles from server: #{server}\n" if @connections[server]["first"] > @connections[server]["last"] print " First article has higher number that last article on server #{server}.\n" print " Skipping...\n" @@ -135,6 +141,7 @@ def get_group_info(server) resp, count, first, last, name = @connections[server]["nntp"].group(@group) rescue Net::NNTP::RuntimeError print "Couldn't open group: #{@group}\n" + print "Error: #{$!}\n" return false rescue Errno::EPIPE, Errno::ECONNRESET print "Caught Errno::EPIPE reading from server #{server}\n" @@ -492,18 +499,18 @@ def uudecode(data, outfile=nil) case data.type.to_s when "Array" print "Calling _uudecode_array\n" if Debuglevel>0 - mode, file, body = _uudecode_array(data) + mode, filename, body = _uudecode_array(data) when "File", "Tempfile" unless outfile print "uudecode: need outfile\n" exit end print "Calling _uudecode_file\n" if Debuglevel>0 - mode, file, body = _uudecode_file(data, outfile) + mode, filename, body = _uudecode_file(data, outfile) else print "Funny stuff in uudecode. Data of type \"#{data.type.to_s}\"\n" end - return mode, file, body + return mode, filename, body end def _uudecode_file(file, outfile) @@ -571,9 +578,8 @@ end # toch maar een keer aparte class van maken... def _uudecode_array(data) decode = [] -# begun = false mode = 0600 - file = "unknown" + filename = "unknown" c = 0 lines = data.length percent = 0 @@ -586,10 +592,10 @@ def _uudecode_array(data) print "beginning matched; rest: #{m}\n" if Debuglevel > 0 if m =~ /^(\s+(\d+))?(\s+(.*?\S))?\s*\Z/ mode = $2 - file = $4 + filename = $4 print "found beginning\n" if Debuglevel > 0 else - print "mode, file set to defaults: #{m}\n" + print "mode, filename set to defaults: #{m}\n" end break end @@ -615,7 +621,7 @@ def _uudecode_array(data) end line = data[i] i += 1 - return mode, file, decode if line =~ /^end/ + return mode, filename, decode if line =~ /^end/ next if line =~ /[a-z]/ next if line == nil next unless ((((line[0] - 32) & 077) + 2) / 3).to_i == @@ -624,7 +630,6 @@ def _uudecode_array(data) end print "No \"end\" found!!!\n" - #return mode, file, decode return false end @@ -665,18 +670,18 @@ def ydecode(data, outfile=nil) case data.type.to_s when "Array" print "Calling _ydecode_array\n" if Debuglevel>0 - mode, file, body = _ydecode_array(data) + mode, filename, body = _ydecode_array(data) when "File", "Tempfile" unless outfile print "ydecode: need outfile\n" exit end print "Calling _ydecode_file\n" if Debuglevel>0 - mode, file, body = _ydecode_file(data, outfile) + mode, filename, body = _ydecode_file(data, outfile) else print "Funny stuff in ydecode. Data of type \"#{data.type.to_s}\"\n" end - return mode, file, body + return mode, filename, body end def _ydecode_file(file, outfile) @@ -794,7 +799,7 @@ def _ydecode_file(file, outfile) end print "No \"=yend\" found!!!\n" - return mode, file, outfile + return mode, filename, outfile end # toch maar een keer aparte class van maken... geld ook voor dit geneuzel