diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-12-07 10:04:25 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-12-07 10:04:25 +0000 |
commit | a20863ff41b0493da0d16597b693e88b54731c03 (patch) | |
tree | 372d570d1bca168621914790fdb617deec97580a /lib/net/pop.rb | |
parent | 4ed1344bd7a2527e54002e4ecb59833b99f30b43 (diff) | |
download | ruby-a20863ff41b0493da0d16597b693e88b54731c03.tar.gz |
aamine
* lib/net/smtp.rb: SMTP.new requires at least one arg.
* lib/net/pop.rb: POP.new requires at least one arg.
* lib/net/pop.rb: uses "raise *Error.new" instead of simple raise.
* lib/net/http.rb: HTTP.new requires at least one arg.
* lib/net/http.rb: changes implicit start algolithm.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/pop.rb')
-rw-r--r-- | lib/net/pop.rb | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/lib/net/pop.rb b/lib/net/pop.rb index e55da89c10..925dfce147 100644 --- a/lib/net/pop.rb +++ b/lib/net/pop.rb @@ -10,9 +10,8 @@ This program is free software. You can re-distribute and/or modify this program under the same terms as Ruby itself, Ruby Distribute License or GNU General Public License. -NOTE: You can get Japanese version of this document from -Ruby Documentation Project (RDP): -((<URL:http://www.ruby-lang.org/~rubikitch/RDP.cgi>)) +NOTE: You can find Japanese version of this document in +the doc/net directory of the standard ruby interpreter package. == What is This Module? @@ -422,14 +421,15 @@ module Net "#<#{type} #{@num}#{@deleted ? ' deleted' : ''}>" end - def all( dest = '' ) - if block_given? then - dest = NetPrivate::ReadAdapter.new( Proc.new ) + def pop( dest = '', &block ) + if block then + dest = NetPrivate::ReadAdapter.new( block ) end @command.retr( @num, dest ) end - alias pop all - alias mail all + + alias all pop + alias mail pop def top( lines, dest = '' ) @command.top( @num, lines, dest ) @@ -440,7 +440,7 @@ module Net end def delete - @command.dele( @num ) + @command.dele @num @deleted = true end @@ -470,9 +470,9 @@ module Net } end - def auth( acnt, pass ) + def auth( account, pass ) critical { - @socket.writeline 'USER ' + acnt + @socket.writeline 'USER ' + account check_reply_auth @socket.writeline 'PASS ' + pass @@ -537,21 +537,19 @@ module Net def check_reply_auth begin - cod = check_reply( SuccessCode ) - rescue ProtocolError - raise ProtoAuthError, 'Fail to POP authentication' + return check_reply( SuccessCode ) + rescue ProtocolError => err + raise ProtoAuthError.new( 'Fail to POP authentication', err.response ) end - - return cod end def get_reply str = @socket.readline if /\A\+/ === str then - return Response.new( SuccessCode, str[0,3], str[3, str.size - 3].strip ) + Response.new( SuccessCode, str[0,3], str[3, str.size - 3].strip ) else - return Response.new( ErrorCode, str[0,4], str[4, str.size - 4].strip ) + Response.new( ErrorCode, str[0,4], str[4, str.size - 4].strip ) end end @@ -564,7 +562,7 @@ module Net rep = super( sock ) m = /<.+>/.match( rep.msg ) or - raise ProtoAuthError, "not APOP server: cannot login" + raise ProtoAuthError.new( "not APOP server: cannot login", nil ) @stamp = m[0] end |