From 902cb5010433689d4a9515a8113062de3ee7f706 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 16 Nov 2017 16:05:18 +0100 Subject: [PATCH] Merge SimpleAddress and GruuAddress classes into a single IdentityAddress class. --- coreapi/callbacks.c | 12 +- coreapi/chat.c | 2 +- coreapi/linphonecore.c | 8 +- coreapi/tester_utils.cpp | 4 +- src/CMakeLists.txt | 9 +- src/address/address.cpp | 24 +--- src/address/address.h | 8 +- src/address/gruu-address-p.h | 40 ------- src/address/gruu-address.cpp | 107 ------------------ src/address/gruu-address.h | 59 ---------- ...imple-address-p.h => identity-address-p.h} | 16 +-- ...imple-address.cpp => identity-address.cpp} | 73 +++++++----- .../{simple-address.h => identity-address.h} | 40 ++++--- src/chat/chat-message/chat-message-p.h | 8 +- src/chat/chat-message/chat-message.cpp | 8 +- src/chat/chat-message/chat-message.h | 10 +- src/chat/chat-room/chat-room-id.cpp | 12 +- src/chat/chat-room/chat-room-id.h | 8 +- src/chat/chat-room/chat-room.cpp | 6 +- src/chat/chat-room/chat-room.h | 4 +- src/chat/chat-room/client-group-chat-room.cpp | 6 +- src/chat/chat-room/client-group-chat-room.h | 2 +- .../chat-room/server-group-chat-room-stub.cpp | 2 +- src/conference/conference.cpp | 4 +- .../local-conference-event-handler.cpp | 2 +- src/conference/participant-device.cpp | 2 +- src/conference/participant-device.h | 8 +- src/conference/participant-p.h | 10 +- src/conference/participant.cpp | 12 +- src/conference/participant.h | 4 +- .../remote-conference-event-handler.cpp | 8 +- src/core/core-chat-room.cpp | 18 +-- src/core/core.h | 8 +- tester/cpim-tester.cpp | 2 +- tester/multipart-tester.cpp | 2 +- 35 files changed, 167 insertions(+), 381 deletions(-) delete mode 100644 src/address/gruu-address-p.h delete mode 100644 src/address/gruu-address.cpp delete mode 100644 src/address/gruu-address.h rename src/address/{simple-address-p.h => identity-address-p.h} (78%) rename src/address/{simple-address.cpp => identity-address.cpp} (54%) rename src/address/{simple-address.h => identity-address.h} (60%) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 8d497bd97..2c1d6a8c9 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -129,7 +129,7 @@ static void call_received(SalCallOp *h) { linphone_address_unref(toAddr); linphone_address_unref(fromAddr); shared_ptr chatRoom = lc->cppCore->findChatRoom( - ChatRoomId(SimpleAddress(h->get_to()), SimpleAddress(h->get_to())) + ChatRoomId(IdentityAddress(h->get_to()), IdentityAddress(h->get_to())) ); if (chatRoom) { L_GET_PRIVATE(static_pointer_cast(chatRoom))->confirmJoining(h); @@ -753,10 +753,10 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){ if (linphone_core_conference_server_enabled(lc)) { // Removal of a participant at the server side shared_ptr chatRoom = lc->cppCore->findChatRoom( - ChatRoomId(SimpleAddress(op->get_to()), SimpleAddress(op->get_to())) + ChatRoomId(IdentityAddress(op->get_to()), IdentityAddress(op->get_to())) ); if (chatRoom) { - std::shared_ptr participant = chatRoom->findParticipant(SimpleAddress(op->get_from())); + std::shared_ptr participant = chatRoom->findParticipant(IdentityAddress(op->get_from())); if (!participant || !participant->isAdmin()) { static_cast(op)->reply(SalReasonDeclined); return; @@ -770,7 +770,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){ } else { // The server asks a participant to leave a chat room LinphoneChatRoom *cr = L_GET_C_BACK_PTR( - lc->cppCore->findChatRoom(ChatRoomId(addr, SimpleAddress(op->get_to()))) + lc->cppCore->findChatRoom(ChatRoomId(addr, IdentityAddress(op->get_to()))) ); if (cr) { L_GET_CPP_PTR_FROM_C_OBJECT(cr)->leave(); @@ -781,7 +781,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){ } } else if (addr.hasParam("admin")) { LinphoneChatRoom *cr = L_GET_C_BACK_PTR(lc->cppCore->findChatRoom( - ChatRoomId(SimpleAddress(op->get_to()), SimpleAddress(op->get_to())) + ChatRoomId(IdentityAddress(op->get_to()), IdentityAddress(op->get_to())) )); if (cr) { Address fromAddr(op->get_from()); @@ -799,7 +799,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){ return; } } else { - LinphoneChatRoom *cr = L_GET_C_BACK_PTR(lc->cppCore->findChatRoom(ChatRoomId(addr, SimpleAddress(op->get_to())))); + LinphoneChatRoom *cr = L_GET_C_BACK_PTR(lc->cppCore->findChatRoom(ChatRoomId(addr, IdentityAddress(op->get_to())))); if (!cr) cr = _linphone_client_group_chat_room_new(lc, addr.asString().c_str(), nullptr); L_GET_CPP_PTR_FROM_C_OBJECT(cr)->join(); diff --git a/coreapi/chat.c b/coreapi/chat.c index 8a0900a67..0ebe80b6e 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -121,7 +121,7 @@ int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, } shared_ptr chatRoom = lc->cppCore->findChatRoom( - LinphonePrivate::ChatRoomId(LinphonePrivate::SimpleAddress(peerAddress), LinphonePrivate::SimpleAddress(localAddress)) + LinphonePrivate::ChatRoomId(LinphonePrivate::IdentityAddress(peerAddress), LinphonePrivate::IdentityAddress(localAddress)) ); if (chatRoom) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 8d280a322..bc5be81cd 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2138,8 +2138,8 @@ static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEve const LinphoneAddress *from = linphone_event_get_from(lev); shared_ptr chatRoom = lc->cppCore->findChatRoom(LinphonePrivate::ChatRoomId( - SimpleAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(resource)), - SimpleAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(from)) + IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(resource)), + IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(from)) )); if (chatRoom) @@ -2156,8 +2156,8 @@ static void _linphone_core_conference_subscription_state_changed(LinphoneCore *l ) { const LinphoneAddress *resource = linphone_event_get_resource(lev); shared_ptr chatRoom = lc->cppCore->findChatRoom(LinphonePrivate::ChatRoomId( - SimpleAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(resource)), - SimpleAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(resource)) + IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(resource)), + IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(resource)) )); if (chatRoom) { linphone_event_accept_subscription(lev); diff --git a/coreapi/tester_utils.cpp b/coreapi/tester_utils.cpp index b166d2947..f5d50e8e3 100644 --- a/coreapi/tester_utils.cpp +++ b/coreapi/tester_utils.cpp @@ -58,8 +58,8 @@ bctbx_list_t **linphone_core_get_call_logs_attribute(LinphoneCore *lc) { LinphoneChatRoom * linphone_core_find_chat_room (const LinphoneCore *lc, const LinphoneAddress *peerAddr, const LinphoneAddress *localAddr) { shared_ptr chatRoom = lc->cppCore->findChatRoom(ChatRoomId( - SimpleAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(peerAddr)), - SimpleAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(localAddr)) + IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(peerAddr)), + IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(localAddr)) )); if (chatRoom) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2ad611b2e..2df1a80a2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,10 +23,8 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES address/address-p.h address/address.h - address/gruu-address-p.h - address/gruu-address.h - address/simple-address-p.h - address/simple-address.h + address/identity-address-p.h + address/identity-address.h c-wrapper/c-wrapper.h c-wrapper/internal/c-sal.h c-wrapper/internal/c-tools.h @@ -145,8 +143,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES set(LINPHONE_CXX_OBJECTS_SOURCE_FILES address/address.cpp - address/gruu-address.cpp - address/simple-address.cpp + address/identity-address.cpp c-wrapper/api/c-address.cpp c-wrapper/api/c-call-cbs.cpp c-wrapper/api/c-call-params.cpp diff --git a/src/address/address.cpp b/src/address/address.cpp index 924eb9ad0..75d38cab3 100644 --- a/src/address/address.cpp +++ b/src/address/address.cpp @@ -22,8 +22,7 @@ #include "address-p.h" #include "c-wrapper/c-wrapper.h" #include "logger/logger.h" -#include "address/gruu-address.h" -#include "address/simple-address.h" +#include "address/identity-address.h" // ============================================================================= @@ -47,28 +46,17 @@ Address::Address (const Address &src) : ClonableObject(*new AddressPrivate) { d->internalAddress = sal_address_clone(salAddress); } -Address::Address (const GruuAddress &src) : ClonableObject(*new AddressPrivate) { +Address::Address (const IdentityAddress &src) : ClonableObject(*new AddressPrivate) { L_D(); - string uri = src.getScheme() + ":" + src.getUsername() + "@"; + string uri = "sip:" + src.getUsername() + "@"; if (src.getDomain().find(':') != string::npos) uri += "[" + src.getDomain() + "]"; else uri += src.getDomain(); - uri += "?gr=" + src.getUrn(); + if (src.hasGruu()) + uri += "?gr=" + src.getGruu(); if (!(d->internalAddress = sal_address_new(L_STRING_TO_C(uri)))) { - lWarning() << "Cannot create Address, bad GruuAddress source"; - } -} - -Address::Address (const SimpleAddress &src) : ClonableObject(*new AddressPrivate) { - L_D(); - string uri = src.getScheme() + ":" + src.getUsername() + "@"; - if (src.getDomain().find(':') != string::npos) - uri += "[" + src.getDomain() + "]"; - else - uri += src.getDomain(); - if (!(d->internalAddress = sal_address_new(L_STRING_TO_C(uri)))) { - lWarning() << "Cannot create Address, bad SimpleAddress source"; + lWarning() << "Cannot create Address, bad IdentityAddress source"; } } diff --git a/src/address/address.h b/src/address/address.h index e3c5f7ef4..718273731 100644 --- a/src/address/address.h +++ b/src/address/address.h @@ -28,8 +28,7 @@ LINPHONE_BEGIN_NAMESPACE class AddressPrivate; -class GruuAddress; -class SimpleAddress; +class IdentityAddress; class LINPHONE_PUBLIC Address : public ClonableObject { // TODO: Remove me later. @@ -38,13 +37,12 @@ class LINPHONE_PUBLIC Address : public ClonableObject { friend class ClientGroupChatRoomPrivate; friend class ServerGroupChatRoom; friend class ServerGroupChatRoomPrivate; - friend class SimpleAddress; + friend class IdentityAddress; public: explicit Address (const std::string &address = ""); Address (const Address &src); - Address (const GruuAddress &src); - Address (const SimpleAddress &src); + Address (const IdentityAddress &src); ~Address (); Address &operator= (const Address &src); diff --git a/src/address/gruu-address-p.h b/src/address/gruu-address-p.h deleted file mode 100644 index 116707db5..000000000 --- a/src/address/gruu-address-p.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * gruu-address-p.h - * Copyright (C) 2010-2017 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 _GRUU_ADDRESS_P_H_ -#define _GRUU_ADDRESS_P_H_ - -#include "gruu-address.h" -#include "address/simple-address-p.h" - -// ============================================================================= - -LINPHONE_BEGIN_NAMESPACE - -class GruuAddressPrivate : public SimpleAddressPrivate { -private: - std::string urn; - bool valid = false; - - L_DECLARE_PUBLIC(GruuAddress); -}; - -LINPHONE_END_NAMESPACE - -#endif // ifndef _GRUU_ADDRESS_P_H_ diff --git a/src/address/gruu-address.cpp b/src/address/gruu-address.cpp deleted file mode 100644 index 636e8d929..000000000 --- a/src/address/gruu-address.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * gruu-address.cpp - * Copyright (C) 2010-2017 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. - */ - -#include "linphone/utils/utils.h" - -#include "gruu-address-p.h" -#include "c-wrapper/c-wrapper.h" -#include "logger/logger.h" - -// ============================================================================= - -using namespace std; - -LINPHONE_BEGIN_NAMESPACE - -// ----------------------------------------------------------------------------- - -GruuAddress::GruuAddress (const string &address) : SimpleAddress(*new GruuAddressPrivate) { - L_D(); - Address tmpAddress(address); - if (tmpAddress.isValid()) { - if (!tmpAddress.hasUriParam("gr")) - return; - SimpleAddress base(address); - SimpleAddress::clone(base); - d->urn = tmpAddress.getUriParamValue("gr"); - d->valid = true; - } -} - -GruuAddress::GruuAddress (const GruuAddress &src) : SimpleAddress(*new GruuAddressPrivate) { - L_D(); - SimpleAddress::clone(src); - d->urn = src.getPrivate()->urn; - d->valid = src.getPrivate()->valid; -} - -GruuAddress::GruuAddress (const Address &src) : SimpleAddress(*new GruuAddressPrivate) { - L_D(); - if (src.isValid()) { - if (!src.hasUriParam("gr")) - return; - SimpleAddress::clone(SimpleAddress(src)); - d->urn = src.getUriParamValue("gr"); - d->valid = true; - } -} - -GruuAddress &GruuAddress::operator= (const GruuAddress &src) { - L_D(); - if (this != &src) { - SimpleAddress::operator=(src); - d->urn = src.getPrivate()->urn; - d->valid = src.getPrivate()->valid; - } - return *this; -} - -bool GruuAddress::operator== (const GruuAddress &address) const { - return asString() == address.asString(); -} - -bool GruuAddress::operator!= (const GruuAddress &address) const { - return !(*this == address); -} - -bool GruuAddress::operator< (const GruuAddress &address) const { - return asString() < address.asString(); -} - -bool GruuAddress::isValid () const { - L_D(); - return d->valid; -} - -string GruuAddress::getUrn () const { - L_D(); - return d->urn; -} - -void GruuAddress::setUrn (const string &urn) { - L_D(); - d->urn = urn; -} - -string GruuAddress::asString () const { - Address tmpAddress(*this); - return tmpAddress.asStringUriOnly(); -} - -LINPHONE_END_NAMESPACE diff --git a/src/address/gruu-address.h b/src/address/gruu-address.h deleted file mode 100644 index d9c5d269d..000000000 --- a/src/address/gruu-address.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * gruu-address.h - * Copyright (C) 2010-2017 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 _GRUU_ADDRESS_H_ -#define _GRUU_ADDRESS_H_ - -#include "address/simple-address.h" - -// ============================================================================= - -LINPHONE_BEGIN_NAMESPACE - -class Address; -class GruuAddressPrivate; - -class LINPHONE_PUBLIC GruuAddress : public SimpleAddress { -public: - explicit GruuAddress (const std::string &address = ""); - GruuAddress (const GruuAddress &src); - GruuAddress (const Address &src); - ~GruuAddress () = default; - - GruuAddress &operator= (const GruuAddress &src); - - bool operator== (const GruuAddress &address) const; - bool operator!= (const GruuAddress &address) const; - - bool operator< (const GruuAddress &address) const; - - bool isValid () const; - - std::string getUrn () const; - void setUrn (const std::string &urn); - - std::string asString () const override; - -private: - L_DECLARE_PRIVATE(GruuAddress); -}; - -LINPHONE_END_NAMESPACE - -#endif // ifndef _GRUU_ADDRESS_H_ diff --git a/src/address/simple-address-p.h b/src/address/identity-address-p.h similarity index 78% rename from src/address/simple-address-p.h rename to src/address/identity-address-p.h index 49ac82f7f..b570fccc9 100644 --- a/src/address/simple-address-p.h +++ b/src/address/identity-address-p.h @@ -1,5 +1,5 @@ /* - * simple-address-p.h + * identity-address-p.h * Copyright (C) 2010-2017 Belledonne Communications SARL * * This program is free software; you can redistribute it and/or @@ -17,25 +17,25 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef _SIMPLE_ADDRESS_P_H_ -#define _SIMPLE_ADDRESS_P_H_ +#ifndef _IDENTITY_ADDRESS_P_H_ +#define _IDENTITY_ADDRESS_P_H_ -#include "simple-address.h" +#include "identity-address.h" #include "object/clonable-object-p.h" // ============================================================================= LINPHONE_BEGIN_NAMESPACE -class SimpleAddressPrivate : public ClonableObjectPrivate { +class IdentityAddressPrivate : public ClonableObjectPrivate { private: - std::string scheme; std::string username; std::string domain; + std::string gruu; - L_DECLARE_PUBLIC(SimpleAddress); + L_DECLARE_PUBLIC(IdentityAddress); }; LINPHONE_END_NAMESPACE -#endif // ifndef _SIMPLE_ADDRESS_P_H_ +#endif // ifndef _IDENTITY_ADDRESS_P_H_ diff --git a/src/address/simple-address.cpp b/src/address/identity-address.cpp similarity index 54% rename from src/address/simple-address.cpp rename to src/address/identity-address.cpp index 09d539a42..8ce4b059b 100644 --- a/src/address/simple-address.cpp +++ b/src/address/identity-address.cpp @@ -1,5 +1,5 @@ /* - * simple-address.cpp + * identity-address.cpp * Copyright (C) 2010-2017 Belledonne Communications SARL * * This program is free software; you can redistribute it and/or @@ -19,7 +19,7 @@ #include "linphone/utils/utils.h" -#include "simple-address-p.h" +#include "identity-address-p.h" #include "c-wrapper/c-wrapper.h" #include "logger/logger.h" @@ -31,91 +31,102 @@ LINPHONE_BEGIN_NAMESPACE // ----------------------------------------------------------------------------- -SimpleAddress::SimpleAddress (const string &address) : ClonableObject(*new SimpleAddressPrivate) { +IdentityAddress::IdentityAddress (const string &address) : ClonableObject(*new IdentityAddressPrivate) { L_D(); Address tmpAddress(address); - if (tmpAddress.isValid()) { - d->scheme = tmpAddress.getScheme(); + if (tmpAddress.isValid() && (tmpAddress.getScheme() == "sip")) { d->username = tmpAddress.getUsername(); d->domain = tmpAddress.getDomain(); + if (tmpAddress.hasUriParam("gr")) { + d->gruu = tmpAddress.getUriParamValue("gr"); + } } } -SimpleAddress::SimpleAddress (const SimpleAddress &src) : ClonableObject(*new SimpleAddressPrivate) { +IdentityAddress::IdentityAddress (const IdentityAddress &src) : ClonableObject(*new IdentityAddressPrivate) { L_D(); - d->scheme = src.getScheme(); d->username = src.getUsername(); d->domain = src.getDomain(); + d->gruu = src.getGruu(); } -SimpleAddress::SimpleAddress (const Address &src) : ClonableObject(*new SimpleAddressPrivate) { +IdentityAddress::IdentityAddress (const Address &src) : ClonableObject(*new IdentityAddressPrivate) { L_D(); - d->scheme = src.getScheme(); d->username = src.getUsername(); d->domain = src.getDomain(); + if (src.hasUriParam("gr")) { + d->gruu = src.getUriParamValue("gr"); + } } -SimpleAddress::SimpleAddress (SimpleAddressPrivate &p) : ClonableObject(p) {} - -SimpleAddress &SimpleAddress::operator= (const SimpleAddress &src) { +IdentityAddress &IdentityAddress::operator= (const IdentityAddress &src) { L_D(); if (this != &src) { - d->scheme = src.getScheme(); d->username = src.getUsername(); d->domain = src.getDomain(); + d->gruu = src.getGruu(); } return *this; } -bool SimpleAddress::operator== (const SimpleAddress &address) const { +bool IdentityAddress::operator== (const IdentityAddress &address) const { return asString() == address.asString(); } -bool SimpleAddress::operator!= (const SimpleAddress &address) const { +bool IdentityAddress::operator!= (const IdentityAddress &address) const { return !(*this == address); } -bool SimpleAddress::operator< (const SimpleAddress &address) const { +bool IdentityAddress::operator< (const IdentityAddress &address) const { return asString() < address.asString(); } -const string &SimpleAddress::getScheme () const { - L_D(); - return d->scheme; +bool IdentityAddress::isValid () const { + Address tmpAddress(*this); + return tmpAddress.isValid(); } -const string &SimpleAddress::getUsername () const { +const string &IdentityAddress::getUsername () const { L_D(); return d->username; } -bool SimpleAddress::setUsername (const string &username) { +bool IdentityAddress::setUsername (const string &username) { L_D(); d->username = username; return true; } -const string &SimpleAddress::getDomain () const { +const string &IdentityAddress::getDomain () const { L_D(); return d->domain; } -bool SimpleAddress::setDomain (const string &domain) { +bool IdentityAddress::setDomain (const string &domain) { L_D(); d->domain = domain; return true; } -string SimpleAddress::asString () const { +bool IdentityAddress::hasGruu () const { + L_D(); + return !d->gruu.empty(); +} + +const string &IdentityAddress::getGruu () const { + L_D(); + return d->gruu; +} + +bool IdentityAddress::setGruu (const string &gruu) { + L_D(); + d->gruu = gruu; + return true; +} + +string IdentityAddress::asString () const { Address tmpAddress(*this); return tmpAddress.asStringUriOnly(); } -void SimpleAddress::clone (const SimpleAddress &src) { - L_D(); - d->scheme = src.getPrivate()->scheme; - d->username = src.getPrivate()->username; - d->domain = src.getPrivate()->domain; -} - LINPHONE_END_NAMESPACE diff --git a/src/address/simple-address.h b/src/address/identity-address.h similarity index 60% rename from src/address/simple-address.h rename to src/address/identity-address.h index fe01071b8..b99e03513 100644 --- a/src/address/simple-address.h +++ b/src/address/identity-address.h @@ -1,5 +1,5 @@ /* - * simple-address.h + * identity-address.h * Copyright (C) 2010-2017 Belledonne Communications SARL * * This program is free software; you can redistribute it and/or @@ -17,8 +17,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef _SIMPLE_ADDRESS_H_ -#define _SIMPLE_ADDRESS_H_ +#ifndef _IDENTITY_ADDRESS_H_ +#define _IDENTITY_ADDRESS_H_ #include "object/clonable-object.h" @@ -27,23 +27,23 @@ LINPHONE_BEGIN_NAMESPACE class Address; -class SimpleAddressPrivate; +class IdentityAddressPrivate; -class LINPHONE_PUBLIC SimpleAddress : public ClonableObject { +class LINPHONE_PUBLIC IdentityAddress : public ClonableObject { public: - explicit SimpleAddress (const std::string &address = ""); - SimpleAddress (const SimpleAddress &src); - SimpleAddress (const Address &src); - ~SimpleAddress () = default; + explicit IdentityAddress (const std::string &address = ""); + IdentityAddress (const IdentityAddress &src); + IdentityAddress (const Address &src); + ~IdentityAddress () = default; - SimpleAddress &operator= (const SimpleAddress &src); + IdentityAddress &operator= (const IdentityAddress &src); - bool operator== (const SimpleAddress &address) const; - bool operator!= (const SimpleAddress &address) const; + bool operator== (const IdentityAddress &address) const; + bool operator!= (const IdentityAddress &address) const; - bool operator< (const SimpleAddress &address) const; + bool operator< (const IdentityAddress &address) const; - const std::string &getScheme () const; + bool isValid () const; const std::string &getUsername () const; bool setUsername (const std::string &username); @@ -51,18 +51,16 @@ public: const std::string &getDomain () const; bool setDomain (const std::string &domain); - bool isSip () const; + bool hasGruu () const; + const std::string &getGruu () const; + bool setGruu (const std::string &gruu); virtual std::string asString () const; -protected: - explicit SimpleAddress (SimpleAddressPrivate &p); - void clone (const SimpleAddress &src); - private: - L_DECLARE_PRIVATE(SimpleAddress); + L_DECLARE_PRIVATE(IdentityAddress); }; LINPHONE_END_NAMESPACE -#endif // ifndef _SIMPLE_ADDRESS_H_ +#endif // ifndef _IDENTITY_ADDRESS_H_ diff --git a/src/chat/chat-message/chat-message-p.h b/src/chat/chat-message/chat-message-p.h index 82303a0b4..92e33a994 100644 --- a/src/chat/chat-message/chat-message-p.h +++ b/src/chat/chat-message/chat-message-p.h @@ -63,11 +63,11 @@ public: void setIsReadOnly(bool readOnly); - inline void forceFromAddress (const SimpleAddress &fromAddress) { + inline void forceFromAddress (const IdentityAddress &fromAddress) { this->fromAddress = fromAddress; } - inline void forceToAddress (const SimpleAddress &toAddress) { + inline void forceToAddress (const IdentityAddress &toAddress) { this->toAddress = toAddress; } @@ -152,8 +152,8 @@ private: std::weak_ptr chatRoom; ChatRoomId chatRoomId; - SimpleAddress fromAddress; - SimpleAddress toAddress; + IdentityAddress fromAddress; + IdentityAddress toAddress; ChatMessage::State state = ChatMessage::State::Idle; ChatMessage::Direction direction = ChatMessage::Direction::Incoming; diff --git a/src/chat/chat-message/chat-message.cpp b/src/chat/chat-message/chat-message.cpp index 181b9c53f..bf6b40df1 100644 --- a/src/chat/chat-message/chat-message.cpp +++ b/src/chat/chat-message/chat-message.cpp @@ -767,22 +767,22 @@ bool ChatMessage::isRead () const { return d->state == State::Delivered || d->state == State::Displayed || d->state == State::DeliveredToUser; } -const SimpleAddress &ChatMessage::getFromAddress () const { +const IdentityAddress &ChatMessage::getFromAddress () const { L_D(); return d->fromAddress; } -const SimpleAddress &ChatMessage::getToAddress () const { +const IdentityAddress &ChatMessage::getToAddress () const { L_D(); return d->toAddress; } -const SimpleAddress &ChatMessage::getLocalAddress () const { +const IdentityAddress &ChatMessage::getLocalAddress () const { L_D(); return d->chatRoomId.getLocalAddress(); } -const SimpleAddress &ChatMessage::getRemoteAddress () const { +const IdentityAddress &ChatMessage::getRemoteAddress () const { L_D(); return d->direction == Direction::Outgoing ? d->chatRoomId.getPeerAddress() : d->fromAddress; } diff --git a/src/chat/chat-message/chat-message.h b/src/chat/chat-message/chat-message.h index 8bca457ff..67988c153 100644 --- a/src/chat/chat-message/chat-message.h +++ b/src/chat/chat-message/chat-message.h @@ -26,7 +26,7 @@ #include "linphone/enums/chat-message-enums.h" // TODO: Remove me later? -#include "address/simple-address.h" +#include "address/identity-address.h" #include "core/core-accessor.h" #include "object/object.h" @@ -80,11 +80,11 @@ public: const std::string &getImdnMessageId () const; - const SimpleAddress &getFromAddress () const; - const SimpleAddress &getToAddress () const; + const IdentityAddress &getFromAddress () const; + const IdentityAddress &getToAddress () const; - const SimpleAddress &getLocalAddress () const; - const SimpleAddress &getRemoteAddress () const; + const IdentityAddress &getLocalAddress () const; + const IdentityAddress &getRemoteAddress () const; // TODO: Return a cpp reference. const LinphoneErrorInfo *getErrorInfo () const; diff --git a/src/chat/chat-room/chat-room-id.cpp b/src/chat/chat-room/chat-room-id.cpp index 73c907628..02bec15d9 100644 --- a/src/chat/chat-room/chat-room-id.cpp +++ b/src/chat/chat-room/chat-room-id.cpp @@ -29,8 +29,8 @@ LINPHONE_BEGIN_NAMESPACE class ChatRoomIdPrivate : public ClonableObjectPrivate { public: - SimpleAddress peerAddress; - SimpleAddress localAddress; + IdentityAddress peerAddress; + IdentityAddress localAddress; }; // ----------------------------------------------------------------------------- @@ -38,8 +38,8 @@ public: ChatRoomId::ChatRoomId () : ClonableObject(*new ChatRoomIdPrivate) {} ChatRoomId::ChatRoomId ( - const SimpleAddress &peerAddress, - const SimpleAddress &localAddress + const IdentityAddress &peerAddress, + const IdentityAddress &localAddress ) : ClonableObject(*new ChatRoomIdPrivate) { L_D(); d->peerAddress = peerAddress; @@ -64,12 +64,12 @@ bool ChatRoomId::operator< (const ChatRoomId &chatRoomId) const { return d->peerAddress < dChatRoomId->peerAddress || d->localAddress < dChatRoomId->localAddress; } -const SimpleAddress &ChatRoomId::getPeerAddress () const { +const IdentityAddress &ChatRoomId::getPeerAddress () const { L_D(); return d->peerAddress; } -const SimpleAddress &ChatRoomId::getLocalAddress () const { +const IdentityAddress &ChatRoomId::getLocalAddress () const { L_D(); return d->localAddress; } diff --git a/src/chat/chat-room/chat-room-id.h b/src/chat/chat-room/chat-room-id.h index d83926611..f0340d871 100644 --- a/src/chat/chat-room/chat-room-id.h +++ b/src/chat/chat-room/chat-room-id.h @@ -20,7 +20,7 @@ #ifndef _CHAT_ROOM_ID_H_ #define _CHAT_ROOM_ID_H_ -#include "address/simple-address.h" +#include "address/identity-address.h" // ============================================================================= @@ -31,7 +31,7 @@ class ChatRoomIdPrivate; class LINPHONE_PUBLIC ChatRoomId : public ClonableObject { public: ChatRoomId (); - ChatRoomId (const SimpleAddress &peerAddress, const SimpleAddress &localAddress); + ChatRoomId (const IdentityAddress &peerAddress, const IdentityAddress &localAddress); ChatRoomId (const ChatRoomId &src); ChatRoomId &operator= (const ChatRoomId &src); @@ -41,8 +41,8 @@ public: bool operator< (const ChatRoomId &chatRoomId) const; - const SimpleAddress &getPeerAddress () const; - const SimpleAddress &getLocalAddress () const; + const IdentityAddress &getPeerAddress () const; + const IdentityAddress &getLocalAddress () const; private: L_DECLARE_PRIVATE(ChatRoomId); diff --git a/src/chat/chat-room/chat-room.cpp b/src/chat/chat-room/chat-room.cpp index b4b29ead7..cc9b2e5b7 100644 --- a/src/chat/chat-room/chat-room.cpp +++ b/src/chat/chat-room/chat-room.cpp @@ -175,12 +175,12 @@ const ChatRoomId &ChatRoom::getChatRoomId () const { return d->chatRoomId; } -const SimpleAddress &ChatRoom::getPeerAddress () const { +const IdentityAddress &ChatRoom::getPeerAddress () const { L_D(); return d->chatRoomId.getPeerAddress(); } -const SimpleAddress &ChatRoom::getLocalAddress () const { +const IdentityAddress &ChatRoom::getLocalAddress () const { L_D(); return d->chatRoomId.getLocalAddress(); } @@ -281,7 +281,7 @@ LinphoneReason ChatRoomPrivate::messageReceived (SalOp *op, const SalMessage *sa LinphoneCore *cCore = core->getCCore(); msg = createChatMessage( - SimpleAddress(op->get_from()) == q->getLocalAddress() + IdentityAddress(op->get_from()) == q->getLocalAddress() ? ChatMessage::Direction::Outgoing : ChatMessage::Direction::Incoming ); diff --git a/src/chat/chat-room/chat-room.h b/src/chat/chat-room/chat-room.h index 113b754b3..b11d28d93 100644 --- a/src/chat/chat-room/chat-room.h +++ b/src/chat/chat-room/chat-room.h @@ -49,8 +49,8 @@ public: const ChatRoomId &getChatRoomId () const; - const SimpleAddress &getPeerAddress () const; - const SimpleAddress &getLocalAddress () const; + const IdentityAddress &getPeerAddress () const; + const IdentityAddress &getLocalAddress () const; virtual CapabilitiesMask getCapabilities () const = 0; diff --git a/src/chat/chat-room/client-group-chat-room.cpp b/src/chat/chat-room/client-group-chat-room.cpp index 4cf37f8f8..50fd91d5a 100644 --- a/src/chat/chat-room/client-group-chat-room.cpp +++ b/src/chat/chat-room/client-group-chat-room.cpp @@ -45,7 +45,7 @@ list
ClientGroupChatRoomPrivate::cleanAddressesList (const list
findParticipant(*it) || (q->getMe()->getAddress() == SimpleAddress(*it))) + if (q->findParticipant(*it) || (q->getMe()->getAddress() == IdentityAddress(*it))) it = cleanedList.erase(it); else it++; @@ -79,10 +79,10 @@ void ClientGroupChatRoomPrivate::notifyReceived (const string &body) { ClientGroupChatRoom::ClientGroupChatRoom ( const std::shared_ptr &core, const std::string &factoryUri, - const SimpleAddress &me, + const IdentityAddress &me, const std::string &subject ) : -ChatRoom(*new ClientGroupChatRoomPrivate, core, ChatRoomId(SimpleAddress(), me)), +ChatRoom(*new ClientGroupChatRoomPrivate, core, ChatRoomId(IdentityAddress(), me)), RemoteConference(core->getCCore(), me, nullptr) { L_D_T(RemoteConference, dConference); dConference->focus = make_shared(Address(factoryUri)); diff --git a/src/chat/chat-room/client-group-chat-room.h b/src/chat/chat-room/client-group-chat-room.h index 584d72601..6d63aa704 100644 --- a/src/chat/chat-room/client-group-chat-room.h +++ b/src/chat/chat-room/client-group-chat-room.h @@ -35,7 +35,7 @@ public: ClientGroupChatRoom ( const std::shared_ptr &core, const std::string &factoryUri, - const SimpleAddress &me, + const IdentityAddress &me, const std::string &subject ); diff --git a/src/chat/chat-room/server-group-chat-room-stub.cpp b/src/chat/chat-room/server-group-chat-room-stub.cpp index bc89f2ba1..9356180ec 100644 --- a/src/chat/chat-room/server-group-chat-room-stub.cpp +++ b/src/chat/chat-room/server-group-chat-room-stub.cpp @@ -74,7 +74,7 @@ bool ServerGroupChatRoomPrivate::isAdminLeft () const { // ============================================================================= ServerGroupChatRoom::ServerGroupChatRoom (const shared_ptr &core, SalCallOp *op) : - ChatRoom(*new ServerGroupChatRoomPrivate, core, ChatRoomId(SimpleAddress(op->get_to()), SimpleAddress())), + ChatRoom(*new ServerGroupChatRoomPrivate, core, ChatRoomId(IdentityAddress(op->get_to()), IdentityAddress(op->get_to()))), LocalConference(core->getCCore(), Address(op->get_to()), nullptr) {} int ServerGroupChatRoom::getCapabilities () const { diff --git a/src/conference/conference.cpp b/src/conference/conference.cpp index 3cbc5c93b..4af0f39f6 100644 --- a/src/conference/conference.cpp +++ b/src/conference/conference.cpp @@ -212,7 +212,7 @@ void Conference::onResetFirstVideoFrameDecoded (const shared_ptr Conference::findParticipant (const Address &addr) const { L_D(); - SimpleAddress simpleAddr(addr); + IdentityAddress simpleAddr(addr); for (const auto &participant : d->participants) { if (participant->getAddress() == simpleAddr) return participant; @@ -234,7 +234,7 @@ shared_ptr Conference::findParticipant (const shared_ptrme->getAddress() == simpleAddr; } diff --git a/src/conference/local-conference-event-handler.cpp b/src/conference/local-conference-event-handler.cpp index 27a57a1ef..c9854e1f4 100644 --- a/src/conference/local-conference-event-handler.cpp +++ b/src/conference/local-conference-event-handler.cpp @@ -274,7 +274,7 @@ void LocalConferenceEventHandler::subscribeReceived (LinphoneEvent *lev) { bctbx_free(contactAddrStr); if (contactAddr.getUriParamValue("gr").empty()) return; - GruuAddress gruu(contactAddr); + IdentityAddress gruu(contactAddr); shared_ptr device = participant->getPrivate()->addDevice(gruu); if (linphone_event_get_subscription_state(lev) == LinphoneSubscriptionActive) { diff --git a/src/conference/participant-device.cpp b/src/conference/participant-device.cpp index 7aefa714d..9e4695218 100644 --- a/src/conference/participant-device.cpp +++ b/src/conference/participant-device.cpp @@ -29,7 +29,7 @@ LINPHONE_BEGIN_NAMESPACE ParticipantDevice::ParticipantDevice () {} -ParticipantDevice::ParticipantDevice (const GruuAddress &gruu) { +ParticipantDevice::ParticipantDevice (const IdentityAddress &gruu) { mGruu = gruu; } diff --git a/src/conference/participant-device.h b/src/conference/participant-device.h index 890f8246e..d466df80f 100644 --- a/src/conference/participant-device.h +++ b/src/conference/participant-device.h @@ -23,7 +23,7 @@ #include #include -#include "address/gruu-address.h" +#include "address/identity-address.h" #include "linphone/types.h" #include "linphone/utils/general.h" @@ -36,12 +36,12 @@ class CallSession; class ParticipantDevice { public: ParticipantDevice (); - explicit ParticipantDevice (const GruuAddress &gruu); + explicit ParticipantDevice (const IdentityAddress &gruu); virtual ~ParticipantDevice (); bool operator== (const ParticipantDevice &device) const; - inline const GruuAddress &getGruu () const { return mGruu; } + inline const IdentityAddress &getGruu () const { return mGruu; } inline std::shared_ptr getSession () const { return mSession; } inline void setSession (std::shared_ptr session) { mSession = session; } @@ -52,7 +52,7 @@ public: bool isValid () const { return mGruu.isValid(); } private: - GruuAddress mGruu; + IdentityAddress mGruu; std::shared_ptr mSession; LinphoneEvent *mConferenceSubscribeEvent = nullptr; }; diff --git a/src/conference/participant-p.h b/src/conference/participant-p.h index 2db34d89e..aa754c2af 100644 --- a/src/conference/participant-p.h +++ b/src/conference/participant-p.h @@ -38,17 +38,17 @@ public: std::shared_ptr createSession (const Conference &conference, const CallSessionParams *params, bool hasMedia, CallSessionListener *listener); inline std::shared_ptr getSession () const { return session; } inline void removeSession () { session.reset(); } - inline void setAddress (const SimpleAddress &newAddr) { addr = newAddr; } + inline void setAddress (const IdentityAddress &newAddr) { addr = newAddr; } inline void setAdmin (bool isAdmin) { this->isAdmin = isAdmin; } inline void setContactAddress (const Address &contactAddr) { this->contactAddr = contactAddr; } - std::shared_ptr findDevice (const GruuAddress &gruu) const; + std::shared_ptr findDevice (const IdentityAddress &gruu) const; std::shared_ptr findDevice (const std::shared_ptr &session); const std::list> &getDevices () const; - std::shared_ptr addDevice (const GruuAddress &gruu); - void removeDevice (const GruuAddress &gruu); + std::shared_ptr addDevice (const IdentityAddress &gruu); + void removeDevice (const IdentityAddress &gruu); private: - SimpleAddress addr; + IdentityAddress addr; Address contactAddr; bool isAdmin = false; std::shared_ptr session; diff --git a/src/conference/participant.cpp b/src/conference/participant.cpp index d8be578b4..47aac4c06 100644 --- a/src/conference/participant.cpp +++ b/src/conference/participant.cpp @@ -45,7 +45,7 @@ shared_ptr ParticipantPrivate::createSession ( // ----------------------------------------------------------------------------- -shared_ptr ParticipantPrivate::findDevice (const GruuAddress &gruu) const { +shared_ptr ParticipantPrivate::findDevice (const IdentityAddress &gruu) const { for (const auto &device : devices) { if (device->getGruu() == gruu) return device; @@ -65,7 +65,7 @@ const list> &ParticipantPrivate::getDevices () con return devices; } -shared_ptr ParticipantPrivate::addDevice (const GruuAddress &gruu) { +shared_ptr ParticipantPrivate::addDevice (const IdentityAddress &gruu) { shared_ptr device = findDevice(gruu); if (device) return device; @@ -74,7 +74,7 @@ shared_ptr ParticipantPrivate::addDevice (const GruuAddress & return device; } -void ParticipantPrivate::removeDevice (const GruuAddress &gruu) { +void ParticipantPrivate::removeDevice (const IdentityAddress &gruu) { for (auto it = devices.begin(); it != devices.end(); it++) { if ((*it)->getGruu() == gruu) { devices.erase(it); @@ -88,18 +88,18 @@ void ParticipantPrivate::removeDevice (const GruuAddress &gruu) { Participant::Participant (const Address &address) : Object(*new ParticipantPrivate) { L_D(); d->contactAddr = address; - d->addr = SimpleAddress(address); + d->addr = IdentityAddress(address); } Participant::Participant (Address &&address) : Object(*new ParticipantPrivate) { L_D(); d->contactAddr = move(address); - d->addr = SimpleAddress(address); + d->addr = IdentityAddress(address); } // ----------------------------------------------------------------------------- -const SimpleAddress& Participant::getAddress () const { +const IdentityAddress& Participant::getAddress () const { L_D(); return d->addr; } diff --git a/src/conference/participant.h b/src/conference/participant.h index 41c0fab02..9b1b3b482 100644 --- a/src/conference/participant.h +++ b/src/conference/participant.h @@ -23,7 +23,7 @@ #include #include "address/address.h" -#include "address/simple-address.h" +#include "address/identity-address.h" #include "object/object.h" #include "conference/params/call-session-params.h" #include "conference/participant-device.h" @@ -53,7 +53,7 @@ public: explicit Participant (const Address &address); explicit Participant (Address &&address); - const SimpleAddress& getAddress () const; + const IdentityAddress& getAddress () const; const Address& getContactAddress () const; bool isAdmin () const; diff --git a/src/conference/remote-conference-event-handler.cpp b/src/conference/remote-conference-event-handler.cpp index 9daa6363b..01bd441a7 100644 --- a/src/conference/remote-conference-event-handler.cpp +++ b/src/conference/remote-conference-event-handler.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "address/simple-address.h" +#include "address/identity-address.h" #include "private.h" #include "logger/logger.h" #include "remote-conference-event-handler-p.h" @@ -79,10 +79,10 @@ void RemoteConferenceEventHandler::notifyReceived (const string &xmlBody) { tm = static_cast(Utils::stoll(confInfo->getConferenceDescription()->getFreeText().get())); bool isFullState = (confInfo->getState() == StateType::full); - SimpleAddress simpleConfAddress(d->confAddress); + IdentityAddress simpleConfAddress(d->confAddress); // Temporary workaround - SimpleAddress entityAddress(confInfo->getEntity().c_str()); - SimpleAddress simpleConfAddress2(simpleConfAddress); + IdentityAddress entityAddress(confInfo->getEntity().c_str()); + IdentityAddress simpleConfAddress2(simpleConfAddress); simpleConfAddress2.setDomain(entityAddress.getDomain()); if ((entityAddress == simpleConfAddress) || (entityAddress == simpleConfAddress2)) { if ( diff --git a/src/core/core-chat-room.cpp b/src/core/core-chat-room.cpp index 186748997..11cf7009f 100644 --- a/src/core/core-chat-room.cpp +++ b/src/core/core-chat-room.cpp @@ -19,7 +19,7 @@ #include -#include "address/simple-address.h" +#include "address/identity-address.h" #include "chat/chat-room/basic-chat-room.h" #include "chat/chat-room/chat-room-p.h" #include "chat/chat-room/real-time-text-chat-room.h" @@ -48,9 +48,9 @@ static inline ChatRoomId resolveWorkaroundClientGroupChatRoomId ( if (!uri) return ChatRoomId(); - SimpleAddress peerAddress = chatRoomId.getPeerAddress(); + IdentityAddress peerAddress = chatRoomId.getPeerAddress(); peerAddress.setDomain(Address(uri).getDomain()); - SimpleAddress localAddress = chatRoomId.getLocalAddress(); + IdentityAddress localAddress = chatRoomId.getLocalAddress(); localAddress.setDomain(Address(uri).getDomain()); return ChatRoomId(peerAddress, localAddress); } @@ -66,20 +66,20 @@ static inline ChatRoomId resolveWorkaroundClientGroupChatRoomId ( } // Return the better local address to talk with peer address. -static SimpleAddress getDefaultLocalAddress (const shared_ptr &core, const SimpleAddress &peerAddress) { +static IdentityAddress getDefaultLocalAddress (const shared_ptr &core, const IdentityAddress &peerAddress) { LinphoneCore *cCore = core->getCCore(); LinphoneAddress *cPeerAddress = linphone_address_new(peerAddress.asString().c_str()); LinphoneProxyConfig *proxy = linphone_core_lookup_known_proxy(cCore, cPeerAddress); linphone_address_unref(cPeerAddress); - SimpleAddress localAddress; + IdentityAddress localAddress; if (proxy) { char *identity = linphone_address_as_string(linphone_proxy_config_get_identity_address(proxy)); - localAddress = SimpleAddress(identity); + localAddress = IdentityAddress(identity); bctbx_free(identity); } else - localAddress = SimpleAddress(linphone_core_get_primary_contact(cCore)); + localAddress = IdentityAddress(linphone_core_get_primary_contact(cCore)); return localAddress; } @@ -169,7 +169,7 @@ shared_ptr Core::findChatRoom (const ChatRoomId &chatRoomId) const { return it == d->chatRoomsById.cend() ? shared_ptr() : it->second; } -list> Core::findChatRooms (const SimpleAddress &peerAddress) const { +list> Core::findChatRooms (const IdentityAddress &peerAddress) const { // TODO: DEV GROUP CHAT. return list>(); } @@ -199,7 +199,7 @@ shared_ptr Core::getOrCreateBasicChatRoom (const ChatRoomId &chatRoomI return chatRoom; } -shared_ptr Core::getOrCreateBasicChatRoom (const SimpleAddress &peerAddress, bool isRtt) { +shared_ptr Core::getOrCreateBasicChatRoom (const IdentityAddress &peerAddress, bool isRtt) { L_D(); list> chatRooms = findChatRooms(peerAddress); diff --git a/src/core/core.h b/src/core/core.h index 8ef97983d..635dca487 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -34,7 +34,7 @@ class Address; class ChatRoom; class ChatRoomId; class CorePrivate; -class SimpleAddress; +class IdentityAddress; class LINPHONE_PUBLIC Core : public Object { friend class ChatRoom; @@ -71,13 +71,13 @@ public: const std::list> &getChatRooms () const; std::shared_ptr findChatRoom (const ChatRoomId &chatRoomId) const; - std::list> findChatRooms (const SimpleAddress &peerAddress) const; + std::list> findChatRooms (const IdentityAddress &peerAddress) const; std::shared_ptr createClientGroupChatRoom (const std::string &subject); - std::shared_ptr createClientGroupChatRoom (const std::string &subject, const SimpleAddress &localAddress); + std::shared_ptr createClientGroupChatRoom (const std::string &subject, const IdentityAddress &localAddress); std::shared_ptr getOrCreateBasicChatRoom (const ChatRoomId &chatRoomId, bool isRtt = false); - std::shared_ptr getOrCreateBasicChatRoom (const SimpleAddress &peerAddress, bool isRtt = false); + std::shared_ptr getOrCreateBasicChatRoom (const IdentityAddress &peerAddress, bool isRtt = false); std::shared_ptr getOrCreateBasicChatRoomFromUri (const std::string &uri, bool isRtt = false); diff --git a/tester/cpim-tester.cpp b/tester/cpim-tester.cpp index cefca8260..5619f5336 100644 --- a/tester/cpim-tester.cpp +++ b/tester/cpim-tester.cpp @@ -394,7 +394,7 @@ static void cpim_chat_message_modifier_base(bool_t use_multipart) { LpConfig *config = linphone_core_get_config(marie->lc); lp_config_set_int(config, "sip", "use_cpim", 1); - SimpleAddress paulineAddress(linphone_address_as_string_uri_only(pauline->identity)); + IdentityAddress paulineAddress(linphone_address_as_string_uri_only(pauline->identity)); shared_ptr marieRoom = marie->lc->cppCore->getOrCreateBasicChatRoom(paulineAddress); shared_ptr marieMessage = marieRoom->createMessage("Hello CPIM"); diff --git a/tester/multipart-tester.cpp b/tester/multipart-tester.cpp index 4a104201f..dea0166f1 100644 --- a/tester/multipart-tester.cpp +++ b/tester/multipart-tester.cpp @@ -39,7 +39,7 @@ static void chat_message_multipart_modifier_base(bool first_file_transfer, bool LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_tcp_rc"); - SimpleAddress paulineAddress(linphone_address_as_string_uri_only(pauline->identity)); + IdentityAddress paulineAddress(linphone_address_as_string_uri_only(pauline->identity)); shared_ptr marieRoom = pauline->lc->cppCore->getOrCreateBasicChatRoom(paulineAddress); shared_ptr marieMessage = marieRoom->createMessage();