diff --git a/include/linphone/api/c-account-params.h b/include/linphone/api/c-account-params.h index 1b8fddf83a94dbe81ad153f36a7c144c373c0464..195c83938db2f493112287d72eb26478d8bb8c60 100644 --- a/include/linphone/api/c-account-params.h +++ b/include/linphone/api/c-account-params.h @@ -829,6 +829,20 @@ LINPHONE_PUBLIC void linphone_account_params_set_lime_server_url(LinphoneAccount **/ LINPHONE_PUBLIC const char *linphone_account_params_get_lime_server_url(const LinphoneAccountParams *params); +/** + * Sets an URI for the account picture. + * @param params The #LinphoneAccountParams object. @notnil + * @param uri The account picture URI. @maybenil + **/ +LINPHONE_PUBLIC void linphone_account_params_set_picture_uri(LinphoneAccountParams *params, const char *uri); + +/** + * Gets the account picture URI if set, NULL otherwise. + * @param params The #LinphoneAccountParams object. @notnil + * @return The account picture URI. @maybenil + **/ +LINPHONE_PUBLIC const char *linphone_account_params_get_picture_uri(const LinphoneAccountParams *params); + /** * @} */ diff --git a/src/account/account-params.cpp b/src/account/account-params.cpp index 03913b46efe1f921fa18390a1d953267cae963cb..49cf60d010c58b9e4d6f40abbae5230e5f19835f 100644 --- a/src/account/account-params.cpp +++ b/src/account/account-params.cpp @@ -154,9 +154,12 @@ AccountParams::AccountParams(LinphoneCore *lc) { string limeServerUrl = lc ? linphone_config_get_default_string(lc->config, "proxy", "lime_server_url", "") : ""; setLimeServerUrl(limeServerUrl); + + string pictureUri = lc ? linphone_config_get_default_string(lc->config, "proxy", "picture_uri", "") : ""; + setPictureUri(pictureUri); } -AccountParams::AccountParams (LinphoneCore *lc, int index) : AccountParams(nullptr) { +AccountParams::AccountParams(LinphoneCore *lc, int index) : AccountParams(nullptr) { LpConfig *config = lc->config; char key[50]; @@ -257,9 +260,10 @@ AccountParams::AccountParams (LinphoneCore *lc, int index) : AccountParams(nullp setCustomContact(linphone_config_get_string(config, key, "custom_contact", "")); setLimeServerUrl(linphone_config_get_string(config, key, "lime_server_url", mLimeServerUrl.c_str())); - + setPictureUri(linphone_config_get_string(config, key, "picture_uri", mPictureUri.c_str())); + if (lc && lc->push_config) { - mPushNotificationConfig->unref();// Coming from constructor + mPushNotificationConfig->unref(); // Coming from constructor mPushNotificationConfig = PushNotificationConfig::toCpp(lc->push_config)->clone(); } @@ -329,6 +333,7 @@ AccountParams::AccountParams(const AccountParams &other) : HybridObject(other), mCustomContact = nullptr; } mLimeServerUrl = other.mLimeServerUrl; + mPictureUri = other.mPictureUri; } AccountParams::~AccountParams() { @@ -751,6 +756,14 @@ const std::string &AccountParams::getLimeServerUrl() const { return mLimeServerUrl; } +void AccountParams::setPictureUri(const std::string &uri) { + mPictureUri = uri; +} + +const std::string &AccountParams::getPictureUri() const { + return mPictureUri; +} + // ----------------------------------------------------------------------------- LinphoneStatus AccountParams::setServerAddress(const std::shared_ptr<Address> serverAddr) { @@ -896,6 +909,7 @@ void AccountParams::writeToConfigFile(LinphoneConfig *config, int index) { writeCustomParamsToConfigFile(config, key); linphone_config_set_string(config, key, "lime_server_url", mLimeServerUrl.c_str()); + linphone_config_set_string(config, key, "picture_uri", mPictureUri.c_str()); } LINPHONE_END_NAMESPACE diff --git a/src/account/account-params.h b/src/account/account-params.h index d71732f41907d8b216a80bd2f2449929f88b696b..1a7caf7b38042c3e8605765a09771dc4afc646b7 100644 --- a/src/account/account-params.h +++ b/src/account/account-params.h @@ -84,6 +84,7 @@ public: void enableRtpBundleAssumption(bool value); void setCustomContact(const std::shared_ptr<Address> contact); void setLimeServerUrl(const std::string &url); + void setPictureUri(const std::string &uri); // Getters int getExpires() const; @@ -128,6 +129,7 @@ public: bool rtpBundleAssumptionEnabled() const; const std::shared_ptr<Address> &getCustomContact() const; const std::string &getLimeServerUrl() const; + const std::string &getPictureUri() const; // Other LinphoneStatus setServerAddress(const std::shared_ptr<Address> serverAddr); @@ -176,6 +178,7 @@ private: std::string mFileTransferServer; std::string mLimeServerUrl; std::string mIdentity; + std::string mPictureUri; std::list<std::shared_ptr<Address>> mRoutes; diff --git a/src/c-wrapper/api/c-account-params.cpp b/src/c-wrapper/api/c-account-params.cpp index 4dd82e9c9a6e1123be88845827125a013c7f5c98..62f3ad9a08591098d24425c90a1bce6f9cc2defd 100644 --- a/src/c-wrapper/api/c-account-params.cpp +++ b/src/c-wrapper/api/c-account-params.cpp @@ -430,3 +430,11 @@ void linphone_account_params_set_lime_server_url(LinphoneAccountParams *params, const char *linphone_account_params_get_lime_server_url(const LinphoneAccountParams *params) { return L_STRING_TO_C(AccountParams::toCpp(params)->getLimeServerUrl()); } + +void linphone_account_params_set_picture_uri(LinphoneAccountParams *params, const char *uri) { + AccountParams::toCpp(params)->setPictureUri(L_C_TO_STRING(uri)); +} + +const char *linphone_account_params_get_picture_uri(const LinphoneAccountParams *params) { + return L_STRING_TO_C(AccountParams::toCpp(params)->getPictureUri()); +} \ No newline at end of file