diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index ea5d232cd..0e1a5644e 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -763,7 +763,9 @@ void linphone_friend_list_synchronize_friends_from_server(LinphoneFriendList *li LinphoneFriend * linphone_friend_list_find_friend_by_address(const LinphoneFriendList *list, const LinphoneAddress *address) { LinphoneAddress *clean_addr = linphone_address_clone(address); LinphoneFriend *lf; - linphone_address_set_uri_param(clean_addr, "gr", NULL); // Remove any gruu param + if (linphone_address_has_param(clean_addr, "gr")) { + linphone_address_remove_uri_param(clean_addr, "gr"); + } lf = linphone_friend_list_find_friend_by_uri(list, linphone_address_as_string_uri_only(clean_addr)); linphone_address_unref(clean_addr); return lf; diff --git a/include/linphone/api/c-address.h b/include/linphone/api/c-address.h index f5ad85981..63fb4f3e7 100644 --- a/include/linphone/api/c-address.h +++ b/include/linphone/api/c-address.h @@ -254,6 +254,13 @@ LINPHONE_PUBLIC void linphone_address_set_uri_param (LinphoneAddress *address, c LINPHONE_PUBLIC void linphone_address_set_uri_params (LinphoneAddress *address, const char *params); +/** + * Removes the value of a parameter of the URI of the address + * @param[in] address LinphoneAddress object + * @param[in] uri_param_name The name of the parameter + */ +LINPHONE_PUBLIC void linphone_address_remove_uri_param (LinphoneAddress *address, const char *uri_param_name); + /** * Destroys a LinphoneAddress object (actually calls linphone_address_unref()). * @deprecated Use linphone_address_unref() instead diff --git a/src/address/address.cpp b/src/address/address.cpp index 273fe0a20..5f8c30e34 100644 --- a/src/address/address.cpp +++ b/src/address/address.cpp @@ -403,4 +403,14 @@ bool Address::setUriParams (const string &uriParams) { return true; } +bool Address::removeUriParam(const string &uriParamName) { + L_D(); + + if (!d->internalAddress) + return false; + + sal_address_remove_uri_param(d->internalAddress, L_STRING_TO_C(uriParamName)); + return true; +} + LINPHONE_END_NAMESPACE diff --git a/src/address/address.h b/src/address/address.h index a34a0081a..5ce007018 100644 --- a/src/address/address.h +++ b/src/address/address.h @@ -101,6 +101,7 @@ public: const std::string &getUriParamValue (const std::string &uriParamName) const; bool setUriParam (const std::string &uriParamName, const std::string &uriParamValue = ""); bool setUriParams (const std::string &uriParams); + bool removeUriParam(const std::string &uriParamName); private: L_DECLARE_PRIVATE(Address); diff --git a/src/c-wrapper/api/c-address.cpp b/src/c-wrapper/api/c-address.cpp index 98e51434a..9a3147157 100644 --- a/src/c-wrapper/api/c-address.cpp +++ b/src/c-wrapper/api/c-address.cpp @@ -186,6 +186,10 @@ void linphone_address_set_uri_params (LinphoneAddress *address, const char *para L_GET_CPP_PTR_FROM_C_OBJECT(address)->setUriParams(L_C_TO_STRING(params)); } +void linphone_address_remove_uri_param (LinphoneAddress *address, const char *uri_param_name) { + L_GET_CPP_PTR_FROM_C_OBJECT(address)->removeUriParam(L_C_TO_STRING(uri_param_name)); +} + void linphone_address_destroy (LinphoneAddress *address) { belle_sip_object_unref(address); }