diff --git a/include/linphone/api/c-event-log.h b/include/linphone/api/c-event-log.h index 714d7ddeee00aca2814360d6325212d9d967431a..5b6d76ec2f53a7eca5b4a5710c42ed4aae763a03 100644 --- a/include/linphone/api/c-event-log.h +++ b/include/linphone/api/c-event-log.h @@ -165,9 +165,9 @@ LINPHONE_PUBLIC LinphoneSecurityEventType linphone_event_log_get_security_event_ /** * Returns the faulty device address of a conference security event. * @param event_log A #LinphoneEventLog object. @notnil - * @return The #LinphoneAddress of the faulty device. @maybenil @tobefreed + * @return The #LinphoneAddress of the faulty device. @maybenil */ -LINPHONE_PUBLIC LinphoneAddress * +LINPHONE_PUBLIC const LinphoneAddress * linphone_event_log_get_security_event_faulty_device_address(const LinphoneEventLog *event_log); // ----------------------------------------------------------------------------- diff --git a/src/c-wrapper/api/c-event-log.cpp b/src/c-wrapper/api/c-event-log.cpp index 59bb56b9babf545f69c6c6bab7da2426b5f2cf90..8452a71c707addd05cfc1366d157d4de3ff62c45 100644 --- a/src/c-wrapper/api/c-event-log.cpp +++ b/src/c-wrapper/api/c-event-log.cpp @@ -325,7 +325,7 @@ linphone_event_log_get_security_event_type(const LinphoneEventLog *event_log) { return static_cast<LinphoneSecurityEventType>(securityEvent->getSecurityEventType()); } -LINPHONE_PUBLIC LinphoneAddress * +LINPHONE_PUBLIC const LinphoneAddress * linphone_event_log_get_security_event_faulty_device_address(const LinphoneEventLog *event_log) { if (!isConferenceSecurityType(linphone_event_log_get_type(event_log))) return nullptr; diff --git a/src/chat/chat-room/client-group-chat-room.cpp b/src/chat/chat-room/client-group-chat-room.cpp index d8e7385e687c624797442ff04988e1c105456696..5c52cc648b71fca100997c3eb74a8a12ee97cf40 100644 --- a/src/chat/chat-room/client-group-chat-room.cpp +++ b/src/chat/chat-room/client-group-chat-room.cpp @@ -1160,7 +1160,7 @@ void ClientGroupChatRoom::onSecurityEvent(const shared_ptr<ConferenceSecurityEve shared_ptr<ConferenceSecurityEvent> cleanEvent = nullptr; // Remove faulty device if its address is invalid - std::shared_ptr<Address> faultyDevice = event->getFaultyDeviceAddress(); + auto faultyDevice = event->getFaultyDeviceAddress(); if (!faultyDevice || !faultyDevice->isValid()) { cleanEvent = make_shared<ConferenceSecurityEvent>(event->getCreationTime(), event->getConferenceId(), event->getSecurityEventType()); diff --git a/src/event-log/conference/conference-security-event.cpp b/src/event-log/conference/conference-security-event.cpp index de8e89464d4302e71a703030842864b37e848171..db9fa973ed391621881d938a2fd8f5e5aefc2cc5 100644 --- a/src/event-log/conference/conference-security-event.cpp +++ b/src/event-log/conference/conference-security-event.cpp @@ -60,7 +60,7 @@ ConferenceSecurityEvent::SecurityEventType ConferenceSecurityEvent::getSecurityE return d->securityEventType; } -const std::shared_ptr<Address> &ConferenceSecurityEvent::getFaultyDeviceAddress() const { +std::shared_ptr<const Address> ConferenceSecurityEvent::getFaultyDeviceAddress() const { L_D(); return d->faultyDevice; } diff --git a/src/event-log/conference/conference-security-event.h b/src/event-log/conference/conference-security-event.h index af4e2b5595851ada5e105198223139a8d4517a5b..6c9a2deeea25ff05dbb5bdc20bc5cdd79a6224c1 100644 --- a/src/event-log/conference/conference-security-event.h +++ b/src/event-log/conference/conference-security-event.h @@ -61,7 +61,7 @@ public: ConferenceSecurityEvent(time_t creationTime, const ConferenceId &conferenceId, SecurityEventType securityEventType); SecurityEventType getSecurityEventType() const; - const std::shared_ptr<Address> &getFaultyDeviceAddress() const; + std::shared_ptr<const Address> getFaultyDeviceAddress() const; private: L_DECLARE_PRIVATE(ConferenceSecurityEvent); diff --git a/src/push-notification-message/push-notification-message.cpp b/src/push-notification-message/push-notification-message.cpp index 2e48eccf7614e9efc7aca5f123180a2989c75a14..29ca164ca72f499650c90887ad080364898284ad 100644 --- a/src/push-notification-message/push-notification-message.cpp +++ b/src/push-notification-message/push-notification-message.cpp @@ -55,9 +55,9 @@ void PushNotificationMessage::init(const std::string &callId, mIsText = isText; mTextContent = textContent; mSubject = subject; - mFromAddr = fromAddr; - mLocalAddr = localAddr; - mPeerAddr = peerAddr; + mFromAddr = (new Address(fromAddr))->toSharedPtr(); + mLocalAddr = (new Address(localAddr))->toSharedPtr(); + mPeerAddr = (new Address(peerAddr))->toSharedPtr(); mIsIcalendar = isIcalendar; mIsConferenceInvitationNew = isConferenceInvitationNew; mIsConferenceInvitationUpdate = isConferenceInvitationUpdate; @@ -80,15 +80,15 @@ const string &PushNotificationMessage::getSubject() const { return mSubject; } -shared_ptr<Address> PushNotificationMessage::getFromAddr() const { - return make_shared<Address>(mFromAddr); +shared_ptr<const Address> PushNotificationMessage::getFromAddr() const { + return mFromAddr; } -shared_ptr<Address> PushNotificationMessage::getLocalAddr() const { - return make_shared<Address>(mLocalAddr); +shared_ptr<const Address> PushNotificationMessage::getLocalAddr() const { + return mLocalAddr; } -shared_ptr<Address> PushNotificationMessage::getPeerAddr() const { - return make_shared<Address>(mPeerAddr); +shared_ptr<const Address> PushNotificationMessage::getPeerAddr() const { + return mPeerAddr; } bool PushNotificationMessage::isIcalendar() const { diff --git a/src/push-notification-message/push-notification-message.h b/src/push-notification-message/push-notification-message.h index 524d8be62536b13d1411923c3d86a6396c965209..b512afa6427cd7e88d53ed41c49c88f2fa51950c 100644 --- a/src/push-notification-message/push-notification-message.h +++ b/src/push-notification-message/push-notification-message.h @@ -57,9 +57,9 @@ public: bool isText() const; const std::string &getTextContent() const; const std::string &getSubject() const; - std::shared_ptr<Address> getFromAddr() const; - std::shared_ptr<Address> getLocalAddr() const; - std::shared_ptr<Address> getPeerAddr() const; + std::shared_ptr<const Address> getFromAddr() const; + std::shared_ptr<const Address> getLocalAddr() const; + std::shared_ptr<const Address> getPeerAddr() const; bool isIcalendar() const; bool isConferenceInvitationNew() const; bool isConferenceInvitationUpdate() const; @@ -69,16 +69,16 @@ public: private: std::string mCallId; - bool mIsText; + bool mIsText = false; std::string mTextContent; std::string mSubject; - std::string mFromAddr; - std::string mLocalAddr; - std::string mPeerAddr; - bool mIsIcalendar; - bool mIsConferenceInvitationNew; - bool mIsConferenceInvitationUpdate; - bool mIsConferenceInvitationCancellation; + std::shared_ptr<Address> mFromAddr; + std::shared_ptr<Address> mLocalAddr; + std::shared_ptr<Address> mPeerAddr; + bool mIsIcalendar = false; + bool mIsConferenceInvitationNew = false; + bool mIsConferenceInvitationUpdate = false; + bool mIsConferenceInvitationCancellation = false; }; LINPHONE_END_NAMESPACE