mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-30 01:39:20 +00:00
fix(setup-tester): clean a lot of leaks in Setup
This commit is contained in:
parent
8f014cb061
commit
4b54286a72
10 changed files with 124 additions and 124 deletions
|
|
@ -1779,11 +1779,13 @@ const char * linphone_friend_phone_number_to_sip_uri(LinphoneFriend *lf, const c
|
|||
if(strcmp(normalized_number, phone_number) != 0) {
|
||||
char *old_uri = ms_strdup_printf("sip:%s@%s;user=phone", phone_number, linphone_proxy_config_get_domain(proxy_config));
|
||||
bctbx_iterator_t *it = bctbx_map_cchar_find_key(lf->friend_list->friends_map_uri, old_uri);
|
||||
if (!bctbx_iterator_cchar_equals(it, bctbx_map_cchar_end(lf->friend_list->friends_map_uri))){
|
||||
bctbx_iterator_t *end = bctbx_map_cchar_end(lf->friend_list->friends_map_uri);
|
||||
if (!bctbx_iterator_cchar_equals(it, end)){
|
||||
linphone_friend_unref((LinphoneFriend*)bctbx_pair_cchar_get_second(bctbx_iterator_cchar_get_pair(it)));
|
||||
bctbx_map_cchar_erase(lf->friend_list->friends_map_uri, it);
|
||||
}
|
||||
bctbx_iterator_cchar_delete(it);
|
||||
bctbx_iterator_cchar_delete(end);
|
||||
ms_free(old_uri);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -577,6 +577,7 @@ LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *
|
|||
}
|
||||
iterator = bctbx_list_next(iterator);
|
||||
}
|
||||
bctbx_list_free(phone_numbers);
|
||||
|
||||
addresses = linphone_friend_get_addresses(lf);
|
||||
iterator = (bctbx_list_t *)addresses;
|
||||
|
|
|
|||
|
|
@ -357,6 +357,7 @@ LinphoneStatus linphone_presence_model_set_contact(LinphonePresenceModel *model,
|
|||
service = linphone_presence_service_new(NULL, LinphonePresenceBasicStatusClosed, NULL);
|
||||
if (service == NULL) return -1;
|
||||
linphone_presence_model_add_service(model, service);
|
||||
linphone_presence_service_unref(service);
|
||||
}
|
||||
return linphone_presence_service_set_contact(service, contact);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,6 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
|||
sal/sal.h
|
||||
search/magic-search-p.h
|
||||
search/magic-search.h
|
||||
search/search-result-p.h
|
||||
search/search-result.h
|
||||
utils/background-task.h
|
||||
utils/payload-type-handler.h
|
||||
|
|
|
|||
|
|
@ -999,7 +999,7 @@ void FileTransferChatMessageModifier::cancelFileTransfer () {
|
|||
? L_C_TO_STRING(linphone_core_get_file_transfer_server(message->getCore()->getCCore()))
|
||||
: currentFileContentToTransfer->getFilePath().c_str()
|
||||
);
|
||||
|
||||
|
||||
} else {
|
||||
lInfo() << "Warning: http request still running for ORPHAN msg: this is a memory leak";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,6 +191,8 @@ list<SearchResult> *MagicSearch::beginNewSearch(const string &filter, const stri
|
|||
if (addr) {
|
||||
unsigned int weight = searchInAddress(addr, filter, withDomain);
|
||||
if (weight > getMinWeight()) {
|
||||
// FIXME: Ugly temporary workaround to solve weak. Remove me later.
|
||||
linphone_address_ref(const_cast<LinphoneAddress *>(addr));
|
||||
resultList->push_back(SearchResult(weight, addr, nullptr));
|
||||
}
|
||||
}
|
||||
|
|
@ -234,17 +236,21 @@ SearchResult MagicSearch::searchInFriend(const LinphoneFriend *lFriend, const st
|
|||
// PHONE NUMBER
|
||||
bctbx_list_t *begin, *phoneNumbers = linphone_friend_get_phone_numbers(lFriend);
|
||||
begin = phoneNumbers;
|
||||
while (phoneNumbers != nullptr && phoneNumbers->data != nullptr) {
|
||||
while (phoneNumbers && phoneNumbers->data) {
|
||||
string number = static_cast<const char*>(phoneNumbers->data);
|
||||
const LinphonePresenceModel *presence = linphone_friend_get_presence_model_for_uri_or_tel(lFriend, number.c_str());
|
||||
weight += getWeight(number, filter);
|
||||
if (presence != nullptr) {
|
||||
weight += getWeight(linphone_presence_model_get_contact(presence), filter) * 2;
|
||||
if (presence) {
|
||||
char *contact = linphone_presence_model_get_contact(presence);
|
||||
weight += getWeight(contact, filter) * 2;
|
||||
bctbx_free(contact);
|
||||
}
|
||||
phoneNumbers = phoneNumbers->next;
|
||||
}
|
||||
if (begin) bctbx_list_free(begin);
|
||||
|
||||
// FIXME: Ugly temporary workaround to solve weak. Remove me later.
|
||||
if (lAddress) linphone_address_ref(const_cast<LinphoneAddress *>(lAddress));
|
||||
return SearchResult(weight, lAddress, lFriend);
|
||||
}
|
||||
|
||||
|
|
@ -298,22 +304,29 @@ unsigned int MagicSearch::getWeight(const string &stringWords, const string &fil
|
|||
return (weight != string::npos) ? (unsigned int)(weight) : getMinWeight();
|
||||
}
|
||||
|
||||
bool MagicSearch::checkDomain(const LinphoneFriend *lFriend, const LinphoneAddress *lAddress, const string &withDomain) const {
|
||||
bool MagicSearch::checkDomain (const LinphoneFriend *lFriend, const LinphoneAddress *lAddress, const string &withDomain) const {
|
||||
bool onlySipUri = !withDomain.empty() && withDomain.compare("*") != 0;
|
||||
const LinphonePresenceModel *presenceModel = (lFriend) ? linphone_friend_get_presence_model(lFriend) : nullptr;
|
||||
const char *contactPresence = (presenceModel) ? linphone_presence_model_get_contact(presenceModel) : nullptr;
|
||||
const LinphoneAddress *addrPresence = (contactPresence) ?
|
||||
linphone_core_create_address(this->getCore()->getCCore(), contactPresence) : nullptr;
|
||||
const LinphonePresenceModel *presenceModel = lFriend ? linphone_friend_get_presence_model(lFriend) : nullptr;
|
||||
char *contactPresence = presenceModel ? linphone_presence_model_get_contact(presenceModel) : nullptr;
|
||||
|
||||
return (
|
||||
LinphoneAddress *addrPresence = nullptr;
|
||||
if (contactPresence) {
|
||||
addrPresence = linphone_core_create_address(this->getCore()->getCCore(), contactPresence);
|
||||
bctbx_free(contactPresence);
|
||||
}
|
||||
|
||||
bool soFarSoGood =
|
||||
// If we don't want Sip URI only or Address or Presence model
|
||||
(!onlySipUri || lAddress != nullptr || presenceModel != nullptr) &&
|
||||
(!onlySipUri || lAddress || presenceModel) &&
|
||||
// And If we don't want Sip URI only or Address match or Address presence match
|
||||
(!onlySipUri ||
|
||||
(lAddress != nullptr && withDomain.compare(linphone_address_get_domain(lAddress)) == 0) ||
|
||||
(addrPresence != nullptr && withDomain.compare(linphone_address_get_domain(addrPresence)) == 0)
|
||||
)
|
||||
);
|
||||
(lAddress && withDomain.compare(linphone_address_get_domain(lAddress)) == 0) ||
|
||||
(addrPresence && withDomain.compare(linphone_address_get_domain(addrPresence)) == 0)
|
||||
);
|
||||
|
||||
if (addrPresence) linphone_address_unref(addrPresence);
|
||||
|
||||
return soFarSoGood;
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* search-result-p.h
|
||||
* Copyright (C) 2010-2018 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _L_SEARCH_RESULT_P_H_
|
||||
#define _L_SEARCH_RESULT_P_H_
|
||||
|
||||
#include "search-result.h"
|
||||
#include "object/clonable-object-p.h"
|
||||
|
||||
#include "linphone/types.h"
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class SearchResultPrivate : public ClonableObjectPrivate {
|
||||
private:
|
||||
const LinphoneFriend *mFriend;
|
||||
const LinphoneAddress *mAddress;
|
||||
unsigned int mWeight;
|
||||
|
||||
L_DECLARE_PUBLIC(SearchResult);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif //_L_SEARCH_RESULT_P_H_
|
||||
|
||||
|
|
@ -17,56 +17,72 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "search-result-p.h"
|
||||
#include "linphone/utils/utils.h"
|
||||
#include "linphone/api/c-address.h"
|
||||
|
||||
using namespace LinphonePrivate;
|
||||
#include "object/clonable-object-p.h"
|
||||
#include "search-result.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
SearchResult::SearchResult(const unsigned int weight, const LinphoneAddress *a, const LinphoneFriend *f) : ClonableObject(*new SearchResultPrivate) {
|
||||
class SearchResultPrivate : public ClonableObjectPrivate {
|
||||
private:
|
||||
const LinphoneFriend *mFriend;
|
||||
const LinphoneAddress *mAddress;
|
||||
unsigned int mWeight;
|
||||
|
||||
L_DECLARE_PUBLIC(SearchResult);
|
||||
};
|
||||
|
||||
SearchResult::SearchResult (const unsigned int weight, const LinphoneAddress *a, const LinphoneFriend *f) : ClonableObject(*new SearchResultPrivate) {
|
||||
L_D();
|
||||
d->mWeight = weight;
|
||||
d->mAddress = a;
|
||||
d->mFriend = f;
|
||||
}
|
||||
|
||||
SearchResult::SearchResult(const SearchResult &sr) : ClonableObject(*new SearchResultPrivate) {
|
||||
SearchResult::SearchResult (const SearchResult &sr) : ClonableObject(*new SearchResultPrivate) {
|
||||
L_D();
|
||||
d->mWeight = sr.getWeight();
|
||||
d->mAddress = sr.getAddress();
|
||||
if (d->mAddress) linphone_address_ref(const_cast<LinphoneAddress *>(d->mAddress));
|
||||
d->mFriend = sr.getFriend();
|
||||
}
|
||||
|
||||
SearchResult::~SearchResult() {};
|
||||
SearchResult::~SearchResult () {
|
||||
L_D();
|
||||
// FIXME: Ugly temporary workaround to solve weak. Remove me later.
|
||||
if (d->mAddress) linphone_address_unref(const_cast<LinphoneAddress *>(d->mAddress));
|
||||
};
|
||||
|
||||
bool SearchResult::operator<(const SearchResult& rsr) const{
|
||||
return this->getWeight() < rsr.getWeight();
|
||||
bool SearchResult::operator< (const SearchResult &other) const {
|
||||
return getWeight() < other.getWeight();
|
||||
}
|
||||
|
||||
bool SearchResult::operator>(const SearchResult& rsr) const{
|
||||
return this->getWeight() > rsr.getWeight();
|
||||
bool SearchResult::operator> (const SearchResult &other) const {
|
||||
return getWeight() > other.getWeight();
|
||||
}
|
||||
|
||||
bool SearchResult::operator>=(const SearchResult& rsr) const{
|
||||
return this->getWeight() >= rsr.getWeight();
|
||||
bool SearchResult::operator>= (const SearchResult &other) const {
|
||||
return getWeight() >= other.getWeight();
|
||||
}
|
||||
|
||||
bool SearchResult::operator=(const SearchResult& rsr) const{
|
||||
return this->getWeight() == rsr.getWeight();
|
||||
bool SearchResult::operator= (const SearchResult &other) const {
|
||||
return getWeight() == other.getWeight();
|
||||
}
|
||||
|
||||
const LinphoneFriend* SearchResult::getFriend() const {
|
||||
const LinphoneFriend *SearchResult::getFriend () const {
|
||||
L_D();
|
||||
return d->mFriend;
|
||||
}
|
||||
|
||||
const LinphoneAddress *SearchResult::getAddress() const {
|
||||
const LinphoneAddress *SearchResult::getAddress () const {
|
||||
L_D();
|
||||
return d->mAddress;
|
||||
}
|
||||
|
||||
unsigned int SearchResult::getWeight() const {
|
||||
unsigned int SearchResult::getWeight () const {
|
||||
L_D();
|
||||
return d->mWeight;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,12 @@
|
|||
#ifndef _L_SEARCH_RESULT_H_
|
||||
#define _L_SEARCH_RESULT_H_
|
||||
|
||||
#include "object/clonable-object.h"
|
||||
#include "linphone/utils/general.h"
|
||||
#include "linphone/types.h"
|
||||
#include "private.h"
|
||||
|
||||
#include "object/clonable-object.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -31,30 +33,30 @@ class SearchResultPrivate;
|
|||
|
||||
class LINPHONE_PUBLIC SearchResult : public ClonableObject {
|
||||
public:
|
||||
SearchResult() = delete;
|
||||
SearchResult(const unsigned int weight, const LinphoneAddress *a, const LinphoneFriend *f = nullptr);
|
||||
SearchResult(const SearchResult &sr);
|
||||
~SearchResult();
|
||||
// TODO: Use C++ Address! Not LinphoneAddress.
|
||||
SearchResult (const unsigned int weight, const LinphoneAddress *a, const LinphoneFriend *f = nullptr);
|
||||
SearchResult (const SearchResult &other);
|
||||
~SearchResult ();
|
||||
|
||||
bool operator<(const SearchResult& rsr) const;
|
||||
bool operator>(const SearchResult& rsr) const;
|
||||
bool operator>=(const SearchResult& rsr) const;
|
||||
bool operator=(const SearchResult& rsr) const;
|
||||
bool operator< (const SearchResult &other) const;
|
||||
bool operator> (const SearchResult &other) const;
|
||||
bool operator>= (const SearchResult &other) const;
|
||||
bool operator= (const SearchResult &other) const;
|
||||
|
||||
/**
|
||||
* @return LinphoneFriend associed
|
||||
**/
|
||||
const LinphoneFriend* getFriend() const;
|
||||
const LinphoneFriend *getFriend() const;
|
||||
|
||||
/**
|
||||
* @return LinphoneAddress associed
|
||||
**/
|
||||
const LinphoneAddress* getAddress() const;
|
||||
const LinphoneAddress *getAddress () const;
|
||||
|
||||
/**
|
||||
* @return the result weight
|
||||
**/
|
||||
unsigned int getWeight() const;
|
||||
unsigned int getWeight () const;
|
||||
|
||||
private:
|
||||
L_DECLARE_PRIVATE(SearchResult);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,10 @@ static void _remove_friends_from_list(LinphoneFriendList *list, const char *frie
|
|||
unsigned int i;
|
||||
for (i = 0 ; i < size ; i++) {
|
||||
LinphoneFriend *fr = linphone_friend_list_find_friend_by_uri(list, friends[i]);
|
||||
if (fr) linphone_friend_list_remove_friend(list, fr);
|
||||
if (fr) {
|
||||
linphone_friend_list_remove_friend(list, fr);
|
||||
linphone_friend_unref(fr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -91,9 +94,10 @@ static void _check_friend_result_list(LinphoneCore *lc, const bctbx_list_t *resu
|
|||
if (addr) {
|
||||
char *addrUri = linphone_address_as_string_uri_only(addr);
|
||||
if (addrUri && strcmp(addrUri, uri) == 0) {
|
||||
bctbx_free(addrUri);
|
||||
return;
|
||||
}
|
||||
if (addrUri) free(addrUri);
|
||||
if (addrUri) bctbx_free(addrUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -102,7 +106,9 @@ static void _check_friend_result_list(LinphoneCore *lc, const bctbx_list_t *resu
|
|||
}
|
||||
|
||||
static void _create_call_log(LinphoneCore *lc, LinphoneAddress *addrFrom, LinphoneAddress *addrTo) {
|
||||
linphone_core_create_call_log(lc, addrFrom, addrTo, LinphoneCallOutgoing, 100, time(NULL), time(NULL), LinphoneCallSuccess, FALSE, 1.0);
|
||||
linphone_call_log_unref(
|
||||
linphone_core_create_call_log(lc, addrFrom, addrTo, LinphoneCallOutgoing, 100, time(NULL), time(NULL), LinphoneCallSuccess, FALSE, 1.0)
|
||||
);
|
||||
}
|
||||
|
||||
static void linphone_version_test(void){
|
||||
|
|
@ -492,7 +498,7 @@ static void search_friend_all_domains(void) {
|
|||
_check_friend_result_list(manager->lc, resultList, 0, sFriends[2], NULL);//"sip:allo@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 1, sFriends[3], NULL);//"sip:hello@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 2, sFriends[4], NULL);//"sip:hello@sip.test.org"
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
_remove_friends_from_list(lfl, sFriends, sSizeFriend);
|
||||
|
|
@ -517,7 +523,7 @@ static void search_friend_one_domain(void) {
|
|||
BC_ASSERT_EQUAL(bctbx_list_size(resultList), 2, int, "%d");
|
||||
_check_friend_result_list(manager->lc, resultList, 0, sFriends[2], NULL);//"sip:allo@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 1, sFriends[3], NULL);//"sip:hello@sip.example.org"
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
_remove_friends_from_list(lfl, sFriends, sSizeFriend);
|
||||
|
|
@ -547,7 +553,7 @@ static void search_friend_research_estate(void) {
|
|||
_check_friend_result_list(manager->lc, resultList, 4, sFriends[2], NULL);//"sip:allo@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 5, sFriends[3], NULL);//"sip:hello@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 6, sFriends[4], NULL);//"sip:hello@sip.test.org"
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
resultList = linphone_magic_search_get_contact_list_from_filter(magicSearch, "la", "");
|
||||
|
|
@ -556,7 +562,7 @@ static void search_friend_research_estate(void) {
|
|||
BC_ASSERT_EQUAL(bctbx_list_size(resultList), 2, int, "%d");
|
||||
_check_friend_result_list(manager->lc, resultList, 0, sFriends[8], NULL);//"sip:laure@sip.test.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 1, sFriends[6], NULL);//"sip:laura@sip.example.org"
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
_remove_friends_from_list(lfl, sFriends, sSizeFriend);
|
||||
|
|
@ -581,7 +587,7 @@ static void search_friend_research_estate_reset(void) {
|
|||
BC_ASSERT_EQUAL(bctbx_list_size(resultList), 2, int, "%d");
|
||||
_check_friend_result_list(manager->lc, resultList, 0, sFriends[6], NULL);//"sip:laura@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 1, sFriends[8], NULL);//"sip:laure@sip.test.org"
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
linphone_magic_search_reset_search_cache(magicSearch);
|
||||
|
|
@ -597,7 +603,7 @@ static void search_friend_research_estate_reset(void) {
|
|||
_check_friend_result_list(manager->lc, resultList, 4, sFriends[2], NULL);//"sip:allo@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 5, sFriends[3], NULL);//"sip:hello@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 6, sFriends[4], NULL);//"sip:hello@sip.test.org"
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
_remove_friends_from_list(lfl, sFriends, sSizeFriend);
|
||||
|
|
@ -626,7 +632,7 @@ static void search_friend_with_phone_number(void) {
|
|||
_check_friend_result_list(manager->lc, resultList, 0, sFriends[11], NULL);//"sip:+111223344@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 1, sFriends[10], NULL);//"sip:+33655667788@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 2, sFriends[5], NULL);//"sip:marie@sip.example.org"
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
_remove_friends_from_list(lfl, sFriends, sSizeFriend);
|
||||
|
|
@ -640,8 +646,8 @@ static void search_friend_with_presence(void) {
|
|||
bctbx_list_t *resultList = NULL;
|
||||
LinphoneCoreManager* manager = linphone_core_manager_create("marie_rc");
|
||||
LinphoneFriendList *lfl = linphone_core_get_default_friend_list(manager->lc);
|
||||
const char* chloeSipUri = {"sip:chloe@sip.example.org"};
|
||||
const char* chloePhoneNumber = {"0633556644"};
|
||||
const char *chloeSipUri = "sip:chloe@sip.example.org";
|
||||
const char *chloePhoneNumber = "0633556644";
|
||||
LinphoneFriend *chloeFriend = linphone_core_create_friend(manager->lc);
|
||||
LinphonePresenceModel *chloePresence = linphone_core_create_presence_model(manager->lc);
|
||||
LinphoneProxyConfig *proxy = linphone_core_get_default_proxy_config(manager->lc);
|
||||
|
|
@ -667,7 +673,7 @@ static void search_friend_with_presence(void) {
|
|||
_check_friend_result_list(manager->lc, resultList, 0, sFriends[11], NULL);//"sip:+111223344@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 1, chloeSipUri, chloePhoneNumber);//"sip:chloe@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 2, sFriends[10], NULL);//"sip:+33655667788@sip.example.org"
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
linphone_magic_search_reset_search_cache(magicSearch);
|
||||
|
|
@ -678,15 +684,15 @@ static void search_friend_with_presence(void) {
|
|||
// 1 + last address from filter "sip:chloe@sip.example.org"
|
||||
BC_ASSERT_EQUAL(bctbx_list_size(resultList), 2, int, "%d");
|
||||
_check_friend_result_list(manager->lc, resultList, 0, chloeSipUri, chloePhoneNumber);//"sip:chloe@sip.example.org"
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
_remove_friends_from_list(lfl, sFriends, sSizeFriend);
|
||||
{
|
||||
LinphoneFriend *fr = linphone_friend_list_find_friend_by_uri(lfl, chloeSipUri);
|
||||
if (fr != NULL) linphone_friend_list_remove_friend(lfl, fr);
|
||||
if (chloeFriend) linphone_friend_unref(chloeFriend);
|
||||
}
|
||||
|
||||
LinphoneFriend *fr = linphone_friend_list_find_friend_by_uri(lfl, chloeSipUri);
|
||||
linphone_friend_list_remove_friend(lfl, fr);
|
||||
|
||||
if (chloeFriend) linphone_friend_unref(chloeFriend);
|
||||
|
||||
linphone_magic_search_unref(magicSearch);
|
||||
linphone_core_manager_destroy(manager);
|
||||
|
|
@ -722,7 +728,7 @@ static void search_friend_in_call_log(void) {
|
|||
_check_friend_result_list(manager->lc, resultList, 1, sFriends[1], NULL);//"sip:charette@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 2, chloeSipUri, NULL);//"sip:chloe@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 3, charlesSipUri, NULL);//"sip:charles@sip.test.org"
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
linphone_magic_search_reset_search_cache(magicSearch);
|
||||
|
|
@ -733,7 +739,7 @@ static void search_friend_in_call_log(void) {
|
|||
BC_ASSERT_EQUAL(bctbx_list_size(resultList), 2, int, "%d");
|
||||
_check_friend_result_list(manager->lc, resultList, 0, sFriends[0], NULL);//"sip:charu@sip.test.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 1, charlesSipUri, NULL);//"sip:charles@sip.test.org"
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
_remove_friends_from_list(lfl, sFriends, sSizeFriend);
|
||||
|
|
@ -768,9 +774,11 @@ static void search_friend_last_item_is_filter(void) {
|
|||
BC_ASSERT_STRING_EQUAL(linphone_address_get_username(srAddress), "newaddress");
|
||||
}
|
||||
}
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
_remove_friends_from_list(lfl, sFriends, sSizeFriend);
|
||||
|
||||
linphone_magic_search_unref(magicSearch);
|
||||
linphone_core_manager_destroy(manager);
|
||||
}
|
||||
|
|
@ -811,7 +819,7 @@ static void search_friend_with_name(void) {
|
|||
BC_ASSERT_EQUAL(bctbx_list_size(resultList), 2, int, "%d");
|
||||
_check_friend_result_list(manager->lc, resultList, 0, stephanie1SipUri, NULL);//"sip:toto@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 1, stephanie2SipUri, NULL);//"sip:stephanie@sip.example.org"
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
linphone_magic_search_reset_search_cache(magicSearch);
|
||||
|
|
@ -822,7 +830,7 @@ static void search_friend_with_name(void) {
|
|||
BC_ASSERT_EQUAL(bctbx_list_size(resultList), 2, int, "%d");
|
||||
_check_friend_result_list(manager->lc, resultList, 0, stephanie2SipUri, NULL);//"sip:stephanie@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 1, stephanie1SipUri, NULL);//"sip:toto@sip.example.org"
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
_remove_friends_from_list(lfl, sFriends, sSizeFriend);
|
||||
|
|
@ -862,7 +870,7 @@ static void search_friend_large_database(void) {
|
|||
|
||||
if (BC_ASSERT_PTR_NOT_NULL(resultList)) ms_message("List size: %zu", bctbx_list_size(resultList));
|
||||
|
||||
bctbx_list_free(resultList);
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -888,16 +896,16 @@ test_t setup_tests[] = {
|
|||
TEST_NO_TAG("Codec usability", codec_usability_test),
|
||||
TEST_NO_TAG("Codec setup", codec_setup),
|
||||
TEST_NO_TAG("Custom tones setup", custom_tones_setup),
|
||||
TEST_TWO_TAGS("Search friend from all domains", search_friend_all_domains, "MagicSearch", "LeaksMemory"),
|
||||
TEST_TWO_TAGS("Search friend from one domain", search_friend_one_domain, "MagicSearch", "LeaksMemory"),
|
||||
TEST_TWO_TAGS("Multiple looking for friends with the same cache", search_friend_research_estate, "MagicSearch", "LeaksMemory"),
|
||||
TEST_TWO_TAGS("Multiple looking for friends with cache resetting", search_friend_research_estate_reset, "MagicSearch", "LeaksMemory"),
|
||||
TEST_TWO_TAGS("Search friend with phone number", search_friend_with_phone_number, "MagicSearch", "LeaksMemory"),
|
||||
TEST_TWO_TAGS("Search friend and find it with its presence", search_friend_with_presence, "MagicSearch", "LeaksMemory"),
|
||||
TEST_TWO_TAGS("Search friend in call log", search_friend_in_call_log, "MagicSearch", "LeaksMemory"),
|
||||
TEST_TWO_TAGS("Search friend last item is the filter", search_friend_last_item_is_filter, "MagicSearch", "LeaksMemory"),
|
||||
TEST_TWO_TAGS("Search friend with name", search_friend_with_name, "MagicSearch", "LeaksMemory"),
|
||||
TEST_TWO_TAGS("Search friend in large friends database", search_friend_large_database, "MagicSearch", "LeaksMemory")
|
||||
TEST_ONE_TAG("Search friend from all domains", search_friend_all_domains, "MagicSearch"),
|
||||
TEST_ONE_TAG("Search friend from one domain", search_friend_one_domain, "MagicSearch"),
|
||||
TEST_ONE_TAG("Multiple looking for friends with the same cache", search_friend_research_estate, "MagicSearch"),
|
||||
TEST_ONE_TAG("Multiple looking for friends with cache resetting", search_friend_research_estate_reset, "MagicSearch"),
|
||||
TEST_ONE_TAG("Search friend with phone number", search_friend_with_phone_number, "MagicSearch"),
|
||||
TEST_ONE_TAG("Search friend and find it with its presence", search_friend_with_presence, "MagicSearch"),
|
||||
TEST_ONE_TAG("Search friend in call log", search_friend_in_call_log, "MagicSearch"),
|
||||
TEST_ONE_TAG("Search friend last item is the filter", search_friend_last_item_is_filter, "MagicSearch"),
|
||||
TEST_ONE_TAG("Search friend with name", search_friend_with_name, "MagicSearch"),
|
||||
TEST_ONE_TAG("Search friend in large friends database", search_friend_large_database, "MagicSearch")
|
||||
};
|
||||
|
||||
test_suite_t setup_test_suite = {"Setup", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue