Search Class Reference

`#include <search.h>`

Inheritance diagram for Search:
[legend]

## Public Member Functions

| Search (ClientBase *parent)
| ~Search ()
void | fetchSearchFields (const JID &directory, SearchHandler *sh)
void | search (const JID &directory, DataForm *form, SearchHandler *sh)
void | search (const JID &directory, int fields, const SearchFieldStruct &values, SearchHandler *sh)
virtual bool | handleIq (const IQ &iq)
virtual void | handleIqID (const IQ &iq, int context)
Public Member Functions inherited from IqHandler
virtual | ~IqHandler ()

## Detailed Description

An implementation of XEP-0055 (Jabber Search).

To perform a search in a directory (e.g., a User Directory):

- Inherit from SearchHandler and implement the virtual functions.
- Create a new Search object.
- Ask the directory for the supported fields using fetchSearchFields(). Depending on the directory, the result can be either an integer (bit-wise ORed supported fields) or a DataForm.
- Search by either using a DataForm or the SearchFieldStruct.
- The results can be either a (empty) list of SearchFieldStructs or a DataForm.

Author
  Jakob Schröter js@ca.nosp@m.maya.nosp@m..net

Since
  0.8.5

Definition at line 49 of file search.h.

## Constructor & Destructor Documentation

## Search()

Search | ( | ClientBase * | parent | ) |

Creates a new Search object.

Parameters

  parent | The ClientBase to use.

Definition at line 112 of file search.cpp.

## ~Search()

~Search | ( |  | ) |

Virtual Destructor.

Definition at line 119 of file search.cpp.

## Member Function Documentation

## fetchSearchFields()

void fetchSearchFields | ( | const JID & | directory,
|  | SearchHandler * | sh )

Use this function to check which fields the directory supports.

Parameters

  directory | The (user) directory to fetch the available/searchable fields from.
  sh | The SearchHandler to notify about the results.

Definition at line 128 of file search.cpp.

## handleIq()

virtual bool handleIq | ( | const IQ & | iq | ) |

inline virtual

Reimplement this function if you want to be notified about incoming IQs.

Parameters

  iq | The complete IQ stanza.

Returns
  Indicates whether a request of type 'get' or 'set' has been handled. This includes the obligatory 'result' answer. If you return false, an 'error' will be sent back.

Since
  1.0

Implements IqHandler.

Definition at line 93 of file search.h.

## handleIqID()

void handleIqID | ( | const IQ & | iq,
|  | int | context )

virtual

Reimplement this function if you want to be notified about incoming IQs with a specific value of the `id` attribute. You have to enable tracking of those IDs using Client::trackID(). This is usually useful for IDs that generate a empty positive reply, i.e. <iq type='result' id='reg'/> where a namespace filter wouldn't work.

Parameters

  iq | The complete IQ stanza.
  context | A value to restore context, stored with ClientBase::trackID().

Note
  Only IQ stanzas of type 'result' or 'error' can arrive here.

Since
  1.0

Implements IqHandler.

Definition at line 167 of file search.cpp.

## search() [1/2]

void search | ( | const JID & | directory,
|  | DataForm * | form,
|  | SearchHandler * | sh )

Initiates a search on the given directory, with the given data form. The given SearchHandler is notified about the results.

Parameters

  directory | The (user) directory to search.
  form | The DataForm contains the phrases the user wishes to search for. Search will delete the form eventually.
  sh | The SearchHandler to notify about the results.

Definition at line 140 of file search.cpp.

## search() [2/2]

void search | ( | const JID & | directory,
|  | int | fields,
|  | const SearchFieldStruct & | values,
|  | SearchHandler * | sh )

Initiates a search on the given directory, with the given phrases. The given SearchHandler is notified about the results.

Parameters

  directory | The (user) directory to search.
  fields | Bit-wise ORed FieldEnum values describing the valid (i.e., set) fields in the values parameter.
  values | Contains the phrases to search for.
  sh | The SearchHandler to notify about the results.

Definition at line 153 of file search.cpp.

The documentation for this class was generated from the following files:

- search.h
- search.cpp