fix some filename stuff
This commit is contained in:
parent
1a0f06d86f
commit
9de4376d2d
1 changed files with 21 additions and 16 deletions
|
|
@ -72,8 +72,14 @@ end
|
||||||
def get_articles(cachedir=false)
|
def get_articles(cachedir=false)
|
||||||
for server in @connections.keys
|
for server in @connections.keys
|
||||||
first, last = get_group_info(server)
|
first, last = get_group_info(server)
|
||||||
|
if first
|
||||||
@connections[server]["first"] = first ? first : 0
|
@connections[server]["first"] = first ? first : 0
|
||||||
@connections[server]["last"] = last ? last : 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
|
end
|
||||||
read_cache(cachedir)
|
read_cache(cachedir)
|
||||||
for server in @connections.keys
|
for server in @connections.keys
|
||||||
|
|
@ -135,6 +141,7 @@ def get_group_info(server)
|
||||||
resp, count, first, last, name = @connections[server]["nntp"].group(@group)
|
resp, count, first, last, name = @connections[server]["nntp"].group(@group)
|
||||||
rescue Net::NNTP::RuntimeError
|
rescue Net::NNTP::RuntimeError
|
||||||
print "Couldn't open group: #{@group}\n"
|
print "Couldn't open group: #{@group}\n"
|
||||||
|
print "Error: #{$!}\n"
|
||||||
return false
|
return false
|
||||||
rescue Errno::EPIPE, Errno::ECONNRESET
|
rescue Errno::EPIPE, Errno::ECONNRESET
|
||||||
print "Caught Errno::EPIPE reading from server #{server}\n"
|
print "Caught Errno::EPIPE reading from server #{server}\n"
|
||||||
|
|
@ -492,18 +499,18 @@ def uudecode(data, outfile=nil)
|
||||||
case data.type.to_s
|
case data.type.to_s
|
||||||
when "Array"
|
when "Array"
|
||||||
print "Calling _uudecode_array\n" if Debuglevel>0
|
print "Calling _uudecode_array\n" if Debuglevel>0
|
||||||
mode, file, body = _uudecode_array(data)
|
mode, filename, body = _uudecode_array(data)
|
||||||
when "File", "Tempfile"
|
when "File", "Tempfile"
|
||||||
unless outfile
|
unless outfile
|
||||||
print "uudecode: need outfile\n"
|
print "uudecode: need outfile\n"
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
print "Calling _uudecode_file\n" if Debuglevel>0
|
print "Calling _uudecode_file\n" if Debuglevel>0
|
||||||
mode, file, body = _uudecode_file(data, outfile)
|
mode, filename, body = _uudecode_file(data, outfile)
|
||||||
else
|
else
|
||||||
print "Funny stuff in uudecode. Data of type \"#{data.type.to_s}\"\n"
|
print "Funny stuff in uudecode. Data of type \"#{data.type.to_s}\"\n"
|
||||||
end
|
end
|
||||||
return mode, file, body
|
return mode, filename, body
|
||||||
end
|
end
|
||||||
|
|
||||||
def _uudecode_file(file, outfile)
|
def _uudecode_file(file, outfile)
|
||||||
|
|
@ -571,9 +578,8 @@ end
|
||||||
# toch maar een keer aparte class van maken...
|
# toch maar een keer aparte class van maken...
|
||||||
def _uudecode_array(data)
|
def _uudecode_array(data)
|
||||||
decode = []
|
decode = []
|
||||||
# begun = false
|
|
||||||
mode = 0600
|
mode = 0600
|
||||||
file = "unknown"
|
filename = "unknown"
|
||||||
c = 0
|
c = 0
|
||||||
lines = data.length
|
lines = data.length
|
||||||
percent = 0
|
percent = 0
|
||||||
|
|
@ -586,10 +592,10 @@ def _uudecode_array(data)
|
||||||
print "beginning matched; rest: #{m}\n" if Debuglevel > 0
|
print "beginning matched; rest: #{m}\n" if Debuglevel > 0
|
||||||
if m =~ /^(\s+(\d+))?(\s+(.*?\S))?\s*\Z/
|
if m =~ /^(\s+(\d+))?(\s+(.*?\S))?\s*\Z/
|
||||||
mode = $2
|
mode = $2
|
||||||
file = $4
|
filename = $4
|
||||||
print "found beginning\n" if Debuglevel > 0
|
print "found beginning\n" if Debuglevel > 0
|
||||||
else
|
else
|
||||||
print "mode, file set to defaults: #{m}\n"
|
print "mode, filename set to defaults: #{m}\n"
|
||||||
end
|
end
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
@ -615,7 +621,7 @@ def _uudecode_array(data)
|
||||||
end
|
end
|
||||||
line = data[i]
|
line = data[i]
|
||||||
i += 1
|
i += 1
|
||||||
return mode, file, decode if line =~ /^end/
|
return mode, filename, decode if line =~ /^end/
|
||||||
next if line =~ /[a-z]/
|
next if line =~ /[a-z]/
|
||||||
next if line == nil
|
next if line == nil
|
||||||
next unless ((((line[0] - 32) & 077) + 2) / 3).to_i ==
|
next unless ((((line[0] - 32) & 077) + 2) / 3).to_i ==
|
||||||
|
|
@ -624,7 +630,6 @@ def _uudecode_array(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
print "No \"end\" found!!!\n"
|
print "No \"end\" found!!!\n"
|
||||||
#return mode, file, decode
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -665,18 +670,18 @@ def ydecode(data, outfile=nil)
|
||||||
case data.type.to_s
|
case data.type.to_s
|
||||||
when "Array"
|
when "Array"
|
||||||
print "Calling _ydecode_array\n" if Debuglevel>0
|
print "Calling _ydecode_array\n" if Debuglevel>0
|
||||||
mode, file, body = _ydecode_array(data)
|
mode, filename, body = _ydecode_array(data)
|
||||||
when "File", "Tempfile"
|
when "File", "Tempfile"
|
||||||
unless outfile
|
unless outfile
|
||||||
print "ydecode: need outfile\n"
|
print "ydecode: need outfile\n"
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
print "Calling _ydecode_file\n" if Debuglevel>0
|
print "Calling _ydecode_file\n" if Debuglevel>0
|
||||||
mode, file, body = _ydecode_file(data, outfile)
|
mode, filename, body = _ydecode_file(data, outfile)
|
||||||
else
|
else
|
||||||
print "Funny stuff in ydecode. Data of type \"#{data.type.to_s}\"\n"
|
print "Funny stuff in ydecode. Data of type \"#{data.type.to_s}\"\n"
|
||||||
end
|
end
|
||||||
return mode, file, body
|
return mode, filename, body
|
||||||
end
|
end
|
||||||
|
|
||||||
def _ydecode_file(file, outfile)
|
def _ydecode_file(file, outfile)
|
||||||
|
|
@ -794,7 +799,7 @@ def _ydecode_file(file, outfile)
|
||||||
end
|
end
|
||||||
|
|
||||||
print "No \"=yend\" found!!!\n"
|
print "No \"=yend\" found!!!\n"
|
||||||
return mode, file, outfile
|
return mode, filename, outfile
|
||||||
end
|
end
|
||||||
|
|
||||||
# toch maar een keer aparte class van maken... geld ook voor dit geneuzel
|
# toch maar een keer aparte class van maken... geld ook voor dit geneuzel
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue