1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
* lib/net/imap.rb: don't upcase the value of ATOM token.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2000-10-16 09:11:10 +00:00
parent 84fbb64d7a
commit 525836d683

View file

@ -381,7 +381,7 @@ module Net
@sock = TCPSocket.open(host, port) @sock = TCPSocket.open(host, port)
@responses = Hash.new([].freeze) @responses = Hash.new([].freeze)
@greeting = get_response @greeting = get_response
if @greeting.name == "BYE" if /\ABYE\z/ni =~ @greeting.name
@sock.close @sock.close
raise ByeResponseError, resp[0] raise ByeResponseError, resp[0]
end end
@ -423,21 +423,21 @@ module Net
end end
if resp.prefix == tag if resp.prefix == tag
case resp.name case resp.name
when "NO" when /\ANO\z/ni
raise NoResponseError, resp[0] raise NoResponseError, resp[0]
when "BAD" when /\ABAD\z/ni
raise BadResponseError, resp[0] raise BadResponseError, resp[0]
else else
return resp return resp
end end
else else
if resp.prefix == "*" if resp.prefix == "*"
if resp.name == "BYE" && if /\ABYE\z/ni =~ resp.name &&
cmd != "LOGOUT" cmd != "LOGOUT"
raise ByeResponseError, resp[0] raise ByeResponseError, resp[0]
end end
record_response(resp.name, resp.data) record_response(resp.name, resp.data)
if /\A(OK|NO|BAD)\z/n =~ resp.name && if /\A(OK|NO|BAD)\z/ni =~ resp.name &&
resp[0].instance_of?(Array) resp[0].instance_of?(Array)
record_response(resp[0][0], resp[0][1..-1]) record_response(resp[0][0], resp[0][1..-1])
end end
@ -468,6 +468,7 @@ module Net
end end
def record_response(name, data) def record_response(name, data)
name = name.upcase
unless @responses.has_key?(name) unless @responses.has_key?(name)
@responses[name] = [] @responses[name] = []
end end
@ -898,7 +899,7 @@ module Net
@token.value = $+.to_i @token.value = $+.to_i
@token.symbol = T_NUMBER @token.symbol = T_NUMBER
elsif $3 elsif $3
@token.value = $+.upcase @token.value = $+
@token.symbol = T_ATOM @token.symbol = T_ATOM
elsif $4 elsif $4
@token.value = $+.gsub(/\\(["\\])/n, "\\1") @token.value = $+.gsub(/\\(["\\])/n, "\\1")
@ -952,7 +953,7 @@ module Net
@token.value = $+.to_i @token.value = $+.to_i
@token.symbol = T_NUMBER @token.symbol = T_NUMBER
elsif $2 elsif $2
@token.value = $+.upcase @token.value = $+
@token.symbol = T_ATOM @token.symbol = T_ATOM
elsif $3 elsif $3
@token.value = $+[1..-1].capitalize.intern @token.value = $+[1..-1].capitalize.intern