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