/**
  * Hook inbox delivery setup so search subscribers receive all
  * notices with that search in their inbox.
  *
  * Currently makes no distinction between local messages and
  * remote ones which happen to come in to the system. Remote
  * notices that don't come in at all won't ever reach this.
  *
  * @param Notice $notice
  * @param array $ni in/out map of profile IDs to inbox constants
  * @return boolean hook result
  */
 function onStartNoticeWhoGets(Notice $notice, array &$ni)
 {
     // Warning: this is potentially very slow
     // with a lot of searches!
     $sub = new SearchSub();
     $sub->groupBy('search');
     $sub->find();
     while ($sub->fetch()) {
         $search = $sub->search;
         if ($this->matchSearch($notice, $search)) {
             // Match? Find all those who subscribed to this
             // search term and get our delivery on...
             $searchsub = new SearchSub();
             $searchsub->search = $search;
             $searchsub->find();
             while ($searchsub->fetch()) {
                 // These constants are currently not actually used, iirc
                 $ni[$searchsub->profile_id] = NOTICE_INBOX_SOURCE_SUB;
             }
         }
     }
     return true;
 }