summaryrefslogtreecommitdiffstats
path: root/lib/net/pop.rb
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-02-21 15:25:37 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-02-21 15:25:37 +0000
commit70ecef24296dc5737f957fa4b1d620b6dcd9af33 (patch)
treef899e8e8b7b726b98a43d3edbfd7e5bdbd6cf8ad /lib/net/pop.rb
parent35301f1941dc92a46f45884380e7cc30081d5b95 (diff)
downloadruby-70ecef24296dc5737f957fa4b1d620b6dcd9af33.tar.gz
ruby-70ecef24296dc5737f957fa4b1d620b6dcd9af33.tar.xz
ruby-70ecef24296dc5737f957fa4b1d620b6dcd9af33.zip
o session.rb -> protocol.rb
o write, write_pendstr takes block o smtp.ready o popmail.pop takes block git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/pop.rb')
-rw-r--r--lib/net/pop.rb35
1 files changed, 31 insertions, 4 deletions
diff --git a/lib/net/pop.rb b/lib/net/pop.rb
index 0ec248155..440f894f5 100644
--- a/lib/net/pop.rb
+++ b/lib/net/pop.rb
@@ -10,7 +10,7 @@ You can freely distribute/modify this library.
=end
-require 'net/session'
+require 'net/protocol'
require 'md5'
@@ -101,10 +101,33 @@ Object
=== Method
-: all
+: all( dest = '' )
: pop
: mail
- This method fetches a mail and return it.
+ This method fetches a mail and write to 'dest' using '<<' method.
+
+ # usage example
+
+ mailarr = []
+ POP3.start( 'localhost', 110 ) do |pop|
+ pop.each do |popm|
+ mailarr.push popm.pop # all() returns 'dest' (this time, string)
+ # or, you can also
+ # popm.pop( $stdout ) # write mail to stdout
+ end
+ end
+
+: all {|str| .... }
+ You can use all/pop/mail as the iterator.
+ argument 'str' is a read string (a part of mail).
+
+ # usage example
+
+ POP3.start( 'localhost', 110 ) do |pop|
+ pop.mails[0].pop do |str| # pop only first mail...
+ _do_anything_( str )
+ end
+ end
: header
This method fetches only mail header.
@@ -138,6 +161,9 @@ Object
attr :size
def all( dest = '' )
+ if iterator? then
+ dest = ReadAdapter.new( Proc.new )
+ end
@command.retr( @num, dest )
end
alias pop all
@@ -172,7 +198,8 @@ Object
== Net::APOP
-This class has no new methods. Only way of authetication is changed.
+This class defines no new methods.
+Only difference from POP3 is using APOP authentification.
=== Super Class