Fix rake bug.(Move functions inside namespace)

This commit is contained in:
BoHung Chiu 2021-10-06 11:50:38 +08:00
parent 27deea2610
commit 80e1362ab6
1 changed files with 74 additions and 73 deletions

View File

@ -64,8 +64,7 @@ namespace :epaper do
paper.save
end
end
end
def verify_email(from_addr,check_emails,tls) #true if check_email is ok
def verify_email(from_addr,check_emails,tls) #true if check_email is ok
s = Timeout.timeout(@open_timeout, Net::OpenTimeout) do
TCPSocket.open(@address, @port)
end
@ -92,15 +91,15 @@ def verify_email(from_addr,check_emails,tls) #true if check_email is ok
end
s.close
invalid_emails
end
def get_response(reqline)
end
def get_response(reqline)
res = critical {
@socket.writeline reqline
recv_response()
}
return res
end
def recv_response
end
def recv_response
buf = ''
while true
line = @socket.readline
@ -108,8 +107,8 @@ def recv_response
break unless line[3,1] == '-' # "210-PIPELINING"
end
Net::SMTP::Response.parse(buf)
end
def critical
end
def critical
return Net::SMTP::Response.parse('200 dummy reply code') if @error_occurred
begin
return yield()
@ -117,11 +116,11 @@ def critical
@error_occurred = true
raise
end
end
def ssl_socket(socket, context)
end
def ssl_socket(socket, context)
OpenSSL::SSL::SSLSocket.new socket, context
end
def tlsconnect(s)
end
def tlsconnect(s)
verified = false
s = ssl_socket(s, @ssl_context)
s.sync_close = true
@ -133,10 +132,12 @@ def tlsconnect(s)
s
ensure
s.close unless verified
end
def new_internet_message_io(s)
end
def new_internet_message_io(s)
io = Net::InternetMessageIO.new(s)
io.read_timeout = @read_timeout
io.debug_output = @debug_output
io
end
end