@@ -1850,28 +1850,6 @@ def uid_sort(sort_keys, search_keys, charset)
1850
1850
return sort_internal ( "UID SORT" , sort_keys , search_keys , charset )
1851
1851
end
1852
1852
1853
- # Adds a response handler. For example, to detect when
1854
- # the server sends a new EXISTS response (which normally
1855
- # indicates new messages being added to the mailbox),
1856
- # add the following handler after selecting the
1857
- # mailbox:
1858
- #
1859
- # imap.add_response_handler { |resp|
1860
- # if resp.kind_of?(Net::IMAP::UntaggedResponse) and resp.name == "EXISTS"
1861
- # puts "Mailbox now has #{resp.data} messages"
1862
- # end
1863
- # }
1864
- #
1865
- def add_response_handler ( handler = nil , &block )
1866
- raise ArgumentError , "two Procs are passed" if handler && block
1867
- @response_handlers . push ( block || handler )
1868
- end
1869
-
1870
- # Removes the response handler.
1871
- def remove_response_handler ( handler )
1872
- @response_handlers . delete ( handler )
1873
- end
1874
-
1875
1853
# Sends a {THREAD command [RFC5256 §3]}[https://www.rfc-editor.org/rfc/rfc5256#section-3]
1876
1854
# to search a mailbox and return message sequence numbers in threaded
1877
1855
# format, as a ThreadMember tree. +search_keys+ are interpreted the same as
@@ -1975,6 +1953,28 @@ def idle_done
1975
1953
end
1976
1954
end
1977
1955
1956
+ # Adds a response handler. For example, to detect when
1957
+ # the server sends a new EXISTS response (which normally
1958
+ # indicates new messages being added to the mailbox),
1959
+ # add the following handler after selecting the
1960
+ # mailbox:
1961
+ #
1962
+ # imap.add_response_handler { |resp|
1963
+ # if resp.kind_of?(Net::IMAP::UntaggedResponse) and resp.name == "EXISTS"
1964
+ # puts "Mailbox now has #{resp.data} messages"
1965
+ # end
1966
+ # }
1967
+ #
1968
+ def add_response_handler ( handler = nil , &block )
1969
+ raise ArgumentError , "two Procs are passed" if handler && block
1970
+ @response_handlers . push ( block || handler )
1971
+ end
1972
+
1973
+ # Removes the response handler.
1974
+ def remove_response_handler ( handler )
1975
+ @response_handlers . delete ( handler )
1976
+ end
1977
+
1978
1978
private
1979
1979
1980
1980
CRLF = "\r \n " # :nodoc:
0 commit comments