]> git.cworth.org Git - sup/blob - lib/sup/modes/search-results-mode.rb
5502b3cdaff2f54a5b794b6527c76bc45228d230
[sup] / lib / sup / modes / search-results-mode.rb
1 module Redwood
2
3 class SearchResultsMode < ThreadIndexMode
4   def initialize qobj
5     @qobj = qobj
6     super
7   end
8
9   ## TODO: think about this
10   def is_relevant? m; super; end
11
12   def load_threads opts={}
13     n = opts[:num] || ThreadIndexMode::LOAD_MORE_THREAD_NUM
14     load_n_threads_background n, :qobj => @qobj,
15                                  :load_killed => true,
16                                  :load_spam => false,
17                                  :when_done =>(lambda do |num|
18       opts[:when_done].call if opts[:when_done]
19       if num > 0
20         BufferManager.flash "Found #{num} threads"
21       else
22         BufferManager.flash "No matches"
23       end
24     end)
25   end
26 end
27
28 end