mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-29 09:09:21 +00:00
Adding a last item in magic search searching when we have a proxy config
This commit is contained in:
parent
a38031e182
commit
b5ed8c1f77
3 changed files with 13 additions and 0 deletions
|
|
@ -120,6 +120,7 @@ LINPHONE_PUBLIC void linphone_magic_search_reset_search_cache(LinphoneMagicSearc
|
|||
/**
|
||||
* Create a sorted list of SearchResult from SipUri, Contact name,
|
||||
* Contact displayname, Contact phone number, which match with a filter word
|
||||
* The last item list will be an address formed with "filter" if a proxy config exist
|
||||
* During the first search, a cache is created and used for the next search and so on
|
||||
* Use linphone_magic_search_reset_search_cache() to begin a new search
|
||||
* @param[in] filter word we search
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ void MagicSearch::resetSearchCache() {
|
|||
|
||||
list<SearchResult> MagicSearch::getContactListFromFilter(const string &filter, const string &withDomain) {
|
||||
list<SearchResult> *resultList;
|
||||
LinphoneProxyConfig *proxy = nullptr;
|
||||
|
||||
if (filter.empty()) return list<SearchResult>();
|
||||
|
||||
|
|
@ -132,6 +133,16 @@ list<SearchResult> MagicSearch::getContactListFromFilter(const string &filter, c
|
|||
return lsr >= rsr;
|
||||
});
|
||||
|
||||
proxy = linphone_core_get_default_proxy_config(this->getCore()->getCCore());
|
||||
// Adding last item if proxy exist
|
||||
if (proxy) {
|
||||
const char *domain = linphone_proxy_config_get_domain(proxy);
|
||||
if (domain) {
|
||||
string filterAddress = "sip:" + filter + "@" + domain;
|
||||
LinphoneAddress *lastResult = linphone_core_create_address(this->getCore()->getCCore(), filterAddress.c_str());
|
||||
if (lastResult) resultList->push_back(SearchResult(0, lastResult, nullptr));
|
||||
}
|
||||
}
|
||||
setSearchCache(resultList);
|
||||
|
||||
return *resultList;
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ public:
|
|||
/**
|
||||
* Create a sorted list of SearchResult from SipUri, Contact name,
|
||||
* Contact displayname, Contact phone number, which match with a filter word
|
||||
* The last item list will be an address formed with "filter" if a proxy config exist
|
||||
* During the first search, a cache is created and used for the next search and so on
|
||||
* Use resetSearchCache() to begin a new search
|
||||
* @param[in] filter word we search
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue