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