summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-04 13:33:14 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-04 13:33:14 +0000
commit26f73a5117cd4ddba5121203f91f9d853f4dea4d (patch)
tree69bdc26cf9ec27cc497eccb76b723ede755eb5e0
parent60c8455253682cbda20a90950be3777f2d819ead (diff)
* lib/net/imap.rb (default_port, default_imap_port,
default_tls_port, default_ssl_port, default_imaps_port): added methods for consistency with Net::POP. based on the patch by art lussos. [ruby-core:38997] [Bug #5198] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--lib/net/imap.rb16
-rw-r--r--test/net/imap/test_imap.rb8
3 files changed, 31 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b74c03de4e8..78c44c88815 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sun Sep 4 22:28:50 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (default_port, default_imap_port,
+ default_tls_port, default_ssl_port, default_imaps_port):
+ added methods for consistency with Net::POP.
+ based on the patch by art lussos. [ruby-core:38997] [Bug #5198]
+
Sun Sep 4 21:19:19 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
* Change encoding from EUC-JP to UTF-8. [Feature #5128]
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index eacf0e4cc4d..a683ea388b4 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -295,6 +295,22 @@ module Net
@@authenticators[auth_type] = authenticator
end
+ # The default port for IMAP connections, port 143
+ def self.default_port
+ return PORT
+ end
+
+ # The default port for IMAPS connections, port 993
+ def self.default_tls_port
+ return SSL_PORT
+ end
+
+ class << self
+ alias default_imap_port default_port
+ alias default_imaps_port default_tls_port
+ alias default_ssl_port default_tls_port
+ end
+
# Disconnects from the server.
def disconnect
begin
diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb
index c67886fed40..cf179c85d83 100644
--- a/test/net/imap/test_imap.rb
+++ b/test/net/imap/test_imap.rb
@@ -418,6 +418,14 @@ class IMAPTest < Test::Unit::TestCase
end
end
+ def test_default_port
+ assert_equal(143, Net::IMAP.default_port)
+ assert_equal(143, Net::IMAP.default_imap_port)
+ assert_equal(993, Net::IMAP.default_tls_port)
+ assert_equal(993, Net::IMAP.default_ssl_port)
+ assert_equal(993, Net::IMAP.default_imaps_port)
+ end
+
private
def imaps_test