diff --git a/src/c-wrapper/api/c-chat-message.cpp b/src/c-wrapper/api/c-chat-message.cpp index 0b0ead9b3..70a92d8ec 100644 --- a/src/c-wrapper/api/c-chat-message.cpp +++ b/src/c-wrapper/api/c-chat-message.cpp @@ -244,7 +244,7 @@ const char *linphone_chat_message_get_custom_header(LinphoneChatMessage *msg, co return L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getSalCustomHeaderValue(header_name).c_str(); } -const LinphoneErrorInfo *linphone_chat_message_get_error_info(LinphoneChatMessage *msg) { +const LinphoneErrorInfo *linphone_chat_message_get_error_info(const LinphoneChatMessage *msg) { return L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getErrorInfo(); } @@ -400,4 +400,4 @@ void linphone_chat_message_start_file_download(LinphoneChatMessage *msg, void linphone_chat_message_release(LinphoneChatMessage *msg) { linphone_chat_message_deactivate(msg); linphone_chat_message_unref(msg); -} \ No newline at end of file +} diff --git a/src/chat/chat-message-p.h b/src/chat/chat-message-p.h index 17da7bb79..754701f0e 100644 --- a/src/chat/chat-message-p.h +++ b/src/chat/chat-message-p.h @@ -54,7 +54,7 @@ private: std::shared_ptr internalContent; std::unordered_map customHeaders; std::shared_ptr eventsDb; - LinphoneErrorInfo * errorInfo; + mutable LinphoneErrorInfo * errorInfo; belle_http_request_t *httpRequest; SalOp *salOp; SalCustomHeader *salCustomHeaders; diff --git a/src/chat/chat-message.cpp b/src/chat/chat-message.cpp index 325fcce97..2deb16b91 100644 --- a/src/chat/chat-message.cpp +++ b/src/chat/chat-message.cpp @@ -307,8 +307,8 @@ string ChatMessage::getSalCustomHeaderValue(string name) { return sal_custom_header_find(d->salCustomHeaders, name.c_str()); } -const LinphoneErrorInfo * ChatMessage::getErrorInfo() { - L_D(ChatMessage); +const LinphoneErrorInfo * ChatMessage::getErrorInfo() const { + L_D(const ChatMessage); if (!d->errorInfo) d->errorInfo = linphone_error_info_new(); //let's do it mutable linphone_error_info_from_sal_op(d->errorInfo, d->salOp); return d->errorInfo; diff --git a/src/chat/chat-message.h b/src/chat/chat-message.h index 1c4ccc43f..1762ca5bb 100644 --- a/src/chat/chat-message.h +++ b/src/chat/chat-message.h @@ -120,7 +120,7 @@ public: bool isToBeStored() const; void setIsToBeStored(bool store); - const LinphoneErrorInfo * getErrorInfo (); + const LinphoneErrorInfo * getErrorInfo () const; bool isReadOnly () const;