[RCD] Help trying to do a search with only the framework.

Thomas Bruederli thomas at roundcube.net
Fri Apr 17 10:00:04 CEST 2015

On Tue, Apr 14, 2015 at 9:45 PM, Rodrigo Santellan <rsantellan at gmail.com> wrote:
> Hi,

Hello Rodrigo
> I'm trying to do a search with only the framework framework. I has been
> trying to separate the component so they can be used on another framework,
> I'm using it now in Symonfony2 but planing to use in another ones.
> So far I identified the class rcube_imap_search that will do the search.

Please note that this class is only a helper class for internal use.
> I created a helper with static methods that I'm rewriting to not use
> globals.
> On the file RouncubeHelper I create a connection to the IMAP server. My
> problem is that when I try to do the actual search with the method search it
> always come empty.
> What I'm missing? If I'm using only one folder is a good practice to call
> to:
> $searchRcube = new \rcube_imap_search(array('skip_deleted' => true),
> $this->rcube->get_storage()->conn);
> $data = $searchRcube->exec(array($folder), $criteria, null, 'date');
> Like that?

In order to execute a search (or any other IMAP operation), you should
use the methods of the rcube_imap instance you get via
rcube::get_storage(). For searching that would be rcube_imap::search()
[1]. See an example how to execute the search in the Roundcube webmail
code [2].

Kind regards,

[1] https://github.com/roundcube/roundcubemail/blob/master/program/lib/Roundcube/rcube_imap.php#L1513
[2] https://github.com/roundcube/roundcubemail/blob/master/program/steps/mail/search.inc#L121

More information about the dev mailing list