retrlines(cmd)
public
Puts the connection into ASCII (text) mode, issues the given command, and
passes the resulting data, one line at a time, to the associated block. If
no block is given, prints the lines. Note that cmd is a server
command (such as “RETR myfile”).
Show source
def retrlines(cmd)
synchronize do
with_binary(false) do
begin
conn = transfercmd(cmd)
loop do
line = conn.gets
break if line == nil
yield(line.sub(/\r?\n\z/, ""), !line.match(/\n\z/).nil?)
end
conn.shutdown(Socket::SHUT_WR)
conn.read_timeout = 1
conn.read
ensure
conn.close if conn
end
voidresp
end
end
end