summaryrefslogtreecommitdiff
path: root/lib/net/pop.rb
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-13 19:15:21 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-13 19:15:21 +0000
commit39c0252e048e56aa4a8f0429b95ac236b0f7856c (patch)
tree1ee74610e4f490aac904718929b215ae14619598 /lib/net/pop.rb
parentd8c75ddad376abf83a4d6dd9d4c8eb1736db497c (diff)
aamine
* lib/net/pop.rb: new method Net::POP3.APOP * lib/net/http.rb: set default Content-Type to x-www-form-urlencoded (causes warning) * lib/net/protocol.rb: remove Net::NetPrivate module. * lib/net/smtp.rb: ditto. * lib/net/pop.rb: ditto. * lib/net/http.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/pop.rb')
-rw-r--r--lib/net/pop.rb63
1 files changed, 34 insertions, 29 deletions
diff --git a/lib/net/pop.rb b/lib/net/pop.rb
index eca7c60949..02729ca259 100644
--- a/lib/net/pop.rb
+++ b/lib/net/pop.rb
@@ -1,6 +1,6 @@
=begin
-= net/pop.rb version 1.2.3
+= net/pop.rb
Copyright (c) 1999-2001 Yukihiro Matsumoto
@@ -13,6 +13,8 @@ Ruby Distribute License or GNU General Public License.
NOTE: You can find Japanese version of this document in
the doc/net directory of the standard ruby interpreter package.
+$Id$
+
== What is This Module?
This module provides your program the functions to retrieve
@@ -123,26 +125,19 @@ This example does not create such one.
=== Using APOP
-net/pop also supports APOP authentication. There's two way to use APOP:
-(1) using APOP class instead of POP3
-(2) passing true for fifth argument of POP3.start
+The net/pop library supports APOP authentication.
+To use APOP, use Net::APOP class instead of Net::POP3 class.
+You can use utility method, Net::POP3.APOP(). Example:
- # (1)
require 'net/pop'
- Net::APOP.start( 'apop.server.address', 110,
- 'YourAccount', 'YourPassword' ) {|pop|
- # Rest code is same.
- }
- # (2)
- require 'net/pop'
- Net::POP3.start( 'apop.server.address', 110,
- 'YourAccount', 'YourPassword',
- true ####
- ) {|pop|
+ # use APOP authentication if $isapop == true
+ pop = Net::POP3.APOP($isapop).new( 'apop.server.address', 110 )
+ pop.start( YourAccount', 'YourPassword' ) {|pop|
# Rest code is same.
}
+
== Net::POP3 class
=== Class Methods
@@ -162,6 +157,19 @@ net/pop also supports APOP authentication. There's two way to use APOP:
end
}
+: APOP( is_apop )
+ returns Net::APOP class object if IS_APOP is true.
+ returns Net::POP3 class object if false.
+ Use this method like:
+
+ # example 1
+ pop = Net::POP3::APOP($isapop).new( addr, port )
+
+ # example 2
+ Net::POP3::APOP($isapop).start( addr, port ) {|pop|
+ ....
+ }
+
: foreach( address, port = 110, account, password ) {|mail| .... }
starts POP3 protocol and iterates for each POPMail object.
This method equals to
@@ -326,14 +334,17 @@ module Net
class POP3 < Protocol
- protocol_param :port, '110'
- protocol_param :command_type, '::Net::NetPrivate::POP3Command'
- protocol_param :apop_command_type, '::Net::NetPrivate::APOPCommand'
-
- protocol_param :mail_type, '::Net::POPMail'
+ protocol_param :port, '110'
+ protocol_param :command_type, '::Net::POP3Command'
+ protocol_param :apop_command_type, '::Net::APOPCommand'
+ protocol_param :mail_type, '::Net::POPMail'
class << self
+ def APOP( bool )
+ bool ? APOP : POP3
+ end
+
def foreach( address, port = nil,
account = nil, password = nil, &block )
start( address, port, account, password ) do |pop|
@@ -366,7 +377,7 @@ module Net
begin
connect
@active = true
- @command.auth address, port
+ @command.auth address(), port()
@command.quit
ensure
@active = false
@@ -431,7 +442,7 @@ module Net
class APOP < POP3
- protocol_param :command_type, 'Net::NetPrivate::APOPCommand'
+ protocol_param :command_type, '::Net::APOPCommand'
end
APOPSession = APOP
@@ -455,7 +466,7 @@ module Net
def pop( dest = '', &block )
if block then
- dest = NetPrivate::ReadAdapter.new( block )
+ dest = ReadAdapter.new( block )
end
@command.retr( @num, dest )
end
@@ -490,9 +501,6 @@ module Net
- module NetPrivate
-
-
class POP3Command < Command
def initialize( sock )
@@ -609,7 +617,4 @@ module Net
end
-
- end # module Net::NetPrivate
-
end # module Net