1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/net/pop.rb: Improve documentation. Patch by Vincent Batts.

[Ruby 1.9 - Bug #4711]
	* lib/net/telnet.rb:  ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2011-05-16 22:09:23 +00:00
parent 3257aa8f8f
commit a13b23973a
3 changed files with 28 additions and 0 deletions

View file

@ -1,3 +1,9 @@
Tue May 17 07:09:01 2011 Eric Hodel <drbrain@segment7.net>
* lib/net/pop.rb: Improve documentation. Patch by Vincent Batts.
[Ruby 1.9 - Bug #4711]
* lib/net/telnet.rb: ditto
Tue May 17 07:00:41 2011 Eric Hodel <drbrain@segment7.net> Tue May 17 07:00:41 2011 Eric Hodel <drbrain@segment7.net>
* lib/net/http.rb: Fix nodoc for Net::HTTP::version_1_1?. Patch by * lib/net/http.rb: Fix nodoc for Net::HTTP::version_1_1?. Patch by

View file

@ -196,12 +196,14 @@ module Net
# #
class POP3 < Protocol class POP3 < Protocol
# svn revision of this library
Revision = %q$Revision$.split[1] Revision = %q$Revision$.split[1]
# #
# Class Parameters # Class Parameters
# #
# returns the port for POP3
def POP3.default_port def POP3.default_port
default_pop3_port() default_pop3_port()
end end
@ -333,6 +335,7 @@ module Net
@ssl_params = create_ssl_params(*args) @ssl_params = create_ssl_params(*args)
end end
# Constructs proper parameters from arguments
def POP3.create_ssl_params(verify_or_params = {}, certs = nil) def POP3.create_ssl_params(verify_or_params = {}, certs = nil)
begin begin
params = verify_or_params.to_hash params = verify_or_params.to_hash
@ -355,18 +358,24 @@ module Net
@ssl_params = nil @ssl_params = nil
end end
# returns the SSL Parameters
#
# see also POP3.enable_ssl
def POP3.ssl_params def POP3.ssl_params
return @ssl_params return @ssl_params
end end
# returns +true+ if POP3.ssl_params is set
def POP3.use_ssl? def POP3.use_ssl?
return !@ssl_params.nil? return !@ssl_params.nil?
end end
# returns whether verify_mode is enable from POP3.ssl_params
def POP3.verify def POP3.verify
return @ssl_params[:verify_mode] return @ssl_params[:verify_mode]
end end
# returns the :ca_file or :ca_path from POP3.ssh_params
def POP3.certs def POP3.certs
return @ssl_params[:ca_file] || @ssl_params[:ca_path] return @ssl_params[:ca_file] || @ssl_params[:ca_path]
end end
@ -452,6 +461,7 @@ module Net
end end
end end
# Disable SSL for all new instances.
def disable_ssl def disable_ssl
@ssl_params = nil @ssl_params = nil
end end
@ -530,6 +540,7 @@ module Net
end end
end end
# internal method for Net::POP3.start
def do_start(account, password) def do_start(account, password)
s = timeout(@open_timeout) { TCPSocket.open(@address, port) } s = timeout(@open_timeout) { TCPSocket.open(@address, port) }
if use_ssl? if use_ssl?
@ -565,6 +576,7 @@ module Net
end end
private :do_start private :do_start
# Does nothing
def on_connect def on_connect
end end
private :on_connect private :on_connect
@ -575,6 +587,11 @@ module Net
do_finish do_finish
end end
# nil's out the:
# - mails
# - number counter for mails
# - number counter for bytes
# - quits the current command, if any
def do_finish def do_finish
@mails = nil @mails = nil
@n_mails = nil @n_mails = nil
@ -588,6 +605,9 @@ module Net
end end
private :do_finish private :do_finish
# Returns the current command.
#
# Raises IOError if there is no active socket
def command def command
raise IOError, 'POP session not opened yet' \ raise IOError, 'POP session not opened yet' \
if not @socket or @socket.closed? if not @socket or @socket.closed?
@ -687,6 +707,7 @@ module Net
@mails.each {|m| m.uid = uidl[m.number] } @mails.each {|m| m.uid = uidl[m.number] }
end end
# deguging output for +msg+
def logging(msg) def logging(msg)
@debug_output << msg + "\n" if @debug_output @debug_output << msg + "\n" if @debug_output
end end

View file

@ -754,6 +754,7 @@ module Net
line line
end end
# Closes the connection
def close def close
@sock.close @sock.close
end end