[前][次][番号順一覧][スレッド一覧]

ruby-changes:36330

From: shugo <ko1@a...>
Date: Fri, 14 Nov 2014 01:32:37 +0900 (JST)
Subject: [ruby-changes:36330] shugo:r48411 (trunk): * lib/net/imap.rb (search_response): parse MODSEQ in SEARCH

shugo	2014-11-14 01:32:15 +0900 (Fri, 14 Nov 2014)

  New Revision: 48411

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48411

  Log:
    * lib/net/imap.rb (search_response): parse MODSEQ in SEARCH
      responses properly.  [ruby-core:64203] [Bug #10112]

  Modified files:
    trunk/ChangeLog
    trunk/lib/net/imap.rb
    trunk/test/net/imap/test_imap_response_parser.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48410)
+++ ChangeLog	(revision 48411)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Nov 14 01:26:47 2014  Shugo Maeda  <shugo@r...>
+
+	* lib/net/imap.rb (search_response): parse MODSEQ in SEARCH
+	  responses properly.  [ruby-core:64203] [Bug #10112]
+
 Fri Nov 14 01:03:17 2014  Tanaka Akira  <akr@f...>
 
 	* test/lib/envutil.rb: Moved from test/ruby/.
Index: lib/net/imap.rb
===================================================================
--- lib/net/imap.rb	(revision 48410)
+++ lib/net/imap.rb	(revision 48411)
@@ -2865,8 +2865,15 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L2865
               break
             when T_SPACE
               shift_token
-            else
+            when T_NUMBER
               data.push(number)
+            when T_LPAR
+              # TODO: include the MODSEQ value in a response 
+              shift_token
+              match(T_ATOM)
+              match(T_SPACE)
+              match(T_NUMBER)
+              match(T_RPAR)
             end
           end
         else
Index: test/net/imap/test_imap_response_parser.rb
===================================================================
--- test/net/imap/test_imap_response_parser.rb	(revision 48410)
+++ test/net/imap/test_imap_response_parser.rb	(revision 48411)
@@ -268,4 +268,12 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/imap/test_imap_response_parser.rb#L268
     assert_equal(empty_part.body.subtype, 'MIXED')
     assert_equal(empty_part.body.param['BOUNDARY'], '000e0cd29212e3e06a0486590ae2')
   end
+
+  # [Bug #10112]
+  def test_search_modseq
+    parser = Net::IMAP::ResponseParser.new
+    response = parser.parse("* SEARCH 87216 87221 (MODSEQ 7667567)\r\n")
+    assert_equal("SEARCH", response.name)
+    assert_equal([87216, 87221], response.data)
+  end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]