Liblinphone  5.4.0
Public Types | Public Member Functions | List of all members
linphone::MagicSearch Class Reference

A MagicSearch is used to search for contacts from various sources: More...

#include <magic_search.hh>

Inheritance diagram for linphone::MagicSearch:

Public Types

enum  Aggregation {
  Aggregation::None = 0,
  Aggregation::Friend = 1
}
 Enum describing how to merge SearchResult from MagicSearch. More...
 
enum  Source {
  Source::None = 0,
  Source::Friends = 1<<0,
  Source::CallLogs = 1<<1,
  Source::LdapServers = 1<<2,
  Source::ChatRooms = 1<<3,
  Source::Request = 1<<4,
  Source::FavoriteFriends = 1<<5,
  Source::ConferencesInfo = 1<<6,
  Source::RemoteCardDAV = 1<<7,
  Source::All = -1
}
 Enum describing the search categories for Magic Search. More...
 

Public Member Functions

LINPHONECXX_PUBLIC MagicSearch (void *ptr, bool takeRef=true)
 
LINPHONECXX_PUBLIC _LinphoneMagicSearch * cPtr ()
 
LINPHONECXX_PUBLIC void addListener (const std::shared_ptr< MagicSearchListener > &listener)
 Add an application listener to the MagicSearch instance. More...
 
LINPHONECXX_PUBLIC void removeListener (const std::shared_ptr< MagicSearchListener > &listener)
 Remove a previously added listener from the MagicSearch instance. More...
 
LINPHONECXX_PUBLIC std::string getDelimiter () const
 Get the delimiter used for the search. More...
 
LINPHONECXX_PUBLIC void setDelimiter (const std::string &delimiter)
 Set the delimiter used to find matched filter word. More...
 
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::SearchResult > > getLastSearch () const
 
LINPHONECXX_PUBLIC bool getLimitedSearch () const
 Returns whether or not the search is limited or not. More...
 
LINPHONECXX_PUBLIC void setLimitedSearch (bool limited)
 Enables or disables the limited search. More...
 
LINPHONECXX_PUBLIC unsigned int getMaxWeight () const
 Get the maximum value used to calculate the weight in search. More...
 
LINPHONECXX_PUBLIC void setMaxWeight (unsigned int weight)
 Set the maximum value used to calculate the weight in search. More...
 
LINPHONECXX_PUBLIC unsigned int getMinWeight () const
 Get the minimum value used to calculate the weight in search. More...
 
LINPHONECXX_PUBLIC void setMinWeight (unsigned int weight)
 Set the minimum value used to calculate the weight in search. More...
 
LINPHONECXX_PUBLIC unsigned int getSearchLimit () const
 Gets the number of maximum search result the search will return. More...
 
LINPHONECXX_PUBLIC void setSearchLimit (unsigned int limit)
 Sets the number of the maximum SearchResult which will be returned, if the magic search isn't configured as unlimited with setLimitedSearch(). More...
 
LINPHONECXX_PUBLIC bool getUseDelimiter ()
 Returns whether the delimiter is being used for the search. More...
 
LINPHONECXX_PUBLIC void setUseDelimiter (bool enable)
 Enable or disable the delimiter in search. More...
 
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::SearchResult > > getContactsList (const std::string &filter, const std::string &domain, int sourceFlags, Aggregation aggregation)
 Create a sorted list of SearchResult which match with a filter word, from SipUri in this order : Contact's display name, address username, address domain and phone number. More...
 
LINPHONECXX_PUBLIC void getContactsListAsync (const std::string &filter, const std::string &domain, int sourceFlags, Aggregation aggregation)
 This is the asynchronous version of linphone_magic_search_get_contacts(). More...
 
LINPHONECXX_PUBLIC void resetSearchCache ()
 Reset the cache to begin a new search.
 

Detailed Description

A MagicSearch is used to search for contacts from various sources:

Member Enumeration Documentation

◆ Aggregation

Enum describing how to merge SearchResult from MagicSearch.

Enumerator
None 

No aggregation is done, you can have multiple SearchResult with the same Friend.

Friend 

Aggregation is done by friend, you will have at most a SearchResult per Friend.

◆ Source

Enum describing the search categories for Magic Search.

Enumerator
None 

no Source specified.

Friends 

Search in friends only.

CallLogs 

Search in Call Logs.

LdapServers 

Search in LDAP servers.

ChatRooms 

Search in Chat rooms participants.

Request 

Search from request : it is usually an address built from the request.

FavoriteFriends 

Search in "starred" friends only.

ConferencesInfo 

Search in conferences info (organizer and participants)

RemoteCardDAV 

Search in remote CardDAV servers (not locally synched ones) if any.

All 

Search in all sources.

Member Function Documentation

◆ addListener()

LINPHONECXX_PUBLIC void linphone::MagicSearch::addListener ( const std::shared_ptr< MagicSearchListener > &  listener)

Add an application listener to the MagicSearch instance.

Parameters
listenerthe application listener

◆ getContactsList()

LINPHONECXX_PUBLIC std::list<std::shared_ptr<linphone::SearchResult> > linphone::MagicSearch::getContactsList ( const std::string &  filter,
const std::string &  domain,
int  sourceFlags,
Aggregation  aggregation 
)

Create a sorted list of SearchResult which match with a filter word, from SipUri in this order : Contact's display name, address username, address domain and phone number.

The last item list will be an address formed with "filter" if a proxy config exist and requested in sourceFlags During the first search, a cache is created and used for the next search Use resetSearchCache() to begin a new search

Parameters
filterword we search
domaindomain which we want to search only
sourceFlagsFlags that specify where to search : Source
aggregationa Aggregation mode to indicate how to merge results
Returns
sorted list of

◆ getContactsListAsync()

LINPHONECXX_PUBLIC void linphone::MagicSearch::getContactsListAsync ( const std::string &  filter,
const std::string &  domain,
int  sourceFlags,
Aggregation  aggregation 
)

This is the asynchronous version of linphone_magic_search_get_contacts().

Create a sorted list of SearchResult which match with a filter word, from SipUri in this order : Contact's display name, address username, address domain and phone number. The last item list will be an address formed with "filter" if a proxy config exist and requested in sourceFlags During the first search, a cache is created and used for the next search Use resetSearchCache() to begin a new search

Parameters
filterword we search
domaindomain which we want to search only
sourceFlagsFlags that specify where to search : Source
aggregationa Aggregation mode to indicate how to merge results

◆ getDelimiter()

LINPHONECXX_PUBLIC std::string linphone::MagicSearch::getDelimiter ( ) const

Get the delimiter used for the search.

Returns
the delimiter used to find matched filter word

◆ getLastSearch()

LINPHONECXX_PUBLIC std::list<std::shared_ptr<linphone::SearchResult> > linphone::MagicSearch::getLastSearch ( ) const
Returns
sorted list of

◆ getLimitedSearch()

LINPHONECXX_PUBLIC bool linphone::MagicSearch::getLimitedSearch ( ) const

Returns whether or not the search is limited or not.

If not limited, the getSearchLimit() won't be applied.

Returns
true if the search is limited, false otherwise

◆ getMaxWeight()

LINPHONECXX_PUBLIC unsigned int linphone::MagicSearch::getMaxWeight ( ) const

Get the maximum value used to calculate the weight in search.

Returns
the maximum value used to calculate the weight in search

◆ getMinWeight()

LINPHONECXX_PUBLIC unsigned int linphone::MagicSearch::getMinWeight ( ) const

Get the minimum value used to calculate the weight in search.

Returns
the minimum value used to calculate the weight in search

◆ getSearchLimit()

LINPHONECXX_PUBLIC unsigned int linphone::MagicSearch::getSearchLimit ( ) const

Gets the number of maximum search result the search will return.

The returned value doesn't take into account the "limited search" mode, so make sure to check getLimitedSearch() result as well.

Returns
the number of the maximum SearchResult which will be returned if magic search is in limited mode.

◆ getUseDelimiter()

LINPHONECXX_PUBLIC bool linphone::MagicSearch::getUseDelimiter ( )

Returns whether the delimiter is being used for the search.

Returns
if the delimiter search is used

◆ removeListener()

LINPHONECXX_PUBLIC void linphone::MagicSearch::removeListener ( const std::shared_ptr< MagicSearchListener > &  listener)

Remove a previously added listener from the MagicSearch instance.

Parameters
listenerthe application listener

◆ setDelimiter()

LINPHONECXX_PUBLIC void linphone::MagicSearch::setDelimiter ( const std::string &  delimiter)

Set the delimiter used to find matched filter word.

Parameters
delimiterdelimiter (example "-_.,")

◆ setLimitedSearch()

LINPHONECXX_PUBLIC void linphone::MagicSearch::setLimitedSearch ( bool  limited)

Enables or disables the limited search.

Even if configured as unlimited, the LDAP maxResults configuration parameter still applies.

Parameters
limitedtrue to limit the search, false otherwise

◆ setMaxWeight()

LINPHONECXX_PUBLIC void linphone::MagicSearch::setMaxWeight ( unsigned int  weight)

Set the maximum value used to calculate the weight in search.

Parameters
weightmaximum weight

◆ setMinWeight()

LINPHONECXX_PUBLIC void linphone::MagicSearch::setMinWeight ( unsigned int  weight)

Set the minimum value used to calculate the weight in search.

Parameters
weightminimum weight

◆ setSearchLimit()

LINPHONECXX_PUBLIC void linphone::MagicSearch::setSearchLimit ( unsigned int  limit)

Sets the number of the maximum SearchResult which will be returned, if the magic search isn't configured as unlimited with setLimitedSearch().

Parameters
limitthe maximum number of SearchResult the search will return if magic search is in limited mode.

◆ setUseDelimiter()

LINPHONECXX_PUBLIC void linphone::MagicSearch::setUseDelimiter ( bool  enable)

Enable or disable the delimiter in search.

Parameters
enabletrue to use the delimiter, false otherwise

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