Merge SimpleAddress and GruuAddress classes into a single IdentityAddress class.

This commit is contained in:
Ghislain MARY 2017-11-16 16:05:18 +01:00
parent f117ff958c
commit 902cb50104
35 changed files with 167 additions and 381 deletions

View file

@ -129,7 +129,7 @@ static void call_received(SalCallOp *h) {
linphone_address_unref(toAddr);
linphone_address_unref(fromAddr);
shared_ptr<ChatRoom> 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<ServerGroupChatRoom>(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> 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> participant = chatRoom->findParticipant(SimpleAddress(op->get_from()));
std::shared_ptr<Participant> participant = chatRoom->findParticipant(IdentityAddress(op->get_from()));
if (!participant || !participant->isAdmin()) {
static_cast<SalReferOp *>(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();

View file

@ -121,7 +121,7 @@ int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op,
}
shared_ptr<LinphonePrivate::ChatRoom> chatRoom = lc->cppCore->findChatRoom(
LinphonePrivate::ChatRoomId(LinphonePrivate::SimpleAddress(peerAddress), LinphonePrivate::SimpleAddress(localAddress))
LinphonePrivate::ChatRoomId(LinphonePrivate::IdentityAddress(peerAddress), LinphonePrivate::IdentityAddress(localAddress))
);
if (chatRoom)

View file

@ -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> 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> 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);

View file

@ -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> 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)

View file

@ -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

View file

@ -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";
}
}

View file

@ -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);

View file

@ -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_

View file

@ -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

View file

@ -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_

View file

@ -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_

View file

@ -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

View file

@ -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_

View file

@ -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> chatRoom;
ChatRoomId chatRoomId;
SimpleAddress fromAddress;
SimpleAddress toAddress;
IdentityAddress fromAddress;
IdentityAddress toAddress;
ChatMessage::State state = ChatMessage::State::Idle;
ChatMessage::Direction direction = ChatMessage::Direction::Incoming;

View file

@ -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;
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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);

View file

@ -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
);

View file

@ -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;

View file

@ -45,7 +45,7 @@ list<Address> ClientGroupChatRoomPrivate::cleanAddressesList (const list<Address
cleanedList.sort();
cleanedList.unique();
for (auto it = cleanedList.begin(); it != cleanedList.end();) {
if (q->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> &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<Participant>(Address(factoryUri));

View file

@ -35,7 +35,7 @@ public:
ClientGroupChatRoom (
const std::shared_ptr<Core> &core,
const std::string &factoryUri,
const SimpleAddress &me,
const IdentityAddress &me,
const std::string &subject
);

View file

@ -74,7 +74,7 @@ bool ServerGroupChatRoomPrivate::isAdminLeft () const {
// =============================================================================
ServerGroupChatRoom::ServerGroupChatRoom (const shared_ptr<Core> &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 {

View file

@ -212,7 +212,7 @@ void Conference::onResetFirstVideoFrameDecoded (const shared_ptr<const CallSessi
shared_ptr<Participant> 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<Participant> Conference::findParticipant (const shared_ptr<const Call
bool Conference::isMe (const Address &addr) const {
L_D();
SimpleAddress simpleAddr(addr);
IdentityAddress simpleAddr(addr);
return d->me->getAddress() == simpleAddr;
}

View file

@ -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<ParticipantDevice> device = participant->getPrivate()->addDevice(gruu);
if (linphone_event_get_subscription_state(lev) == LinphoneSubscriptionActive) {

View file

@ -29,7 +29,7 @@ LINPHONE_BEGIN_NAMESPACE
ParticipantDevice::ParticipantDevice () {}
ParticipantDevice::ParticipantDevice (const GruuAddress &gruu) {
ParticipantDevice::ParticipantDevice (const IdentityAddress &gruu) {
mGruu = gruu;
}

View file

@ -23,7 +23,7 @@
#include <memory>
#include <string>
#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<CallSession> getSession () const { return mSession; }
inline void setSession (std::shared_ptr<CallSession> session) { mSession = session; }
@ -52,7 +52,7 @@ public:
bool isValid () const { return mGruu.isValid(); }
private:
GruuAddress mGruu;
IdentityAddress mGruu;
std::shared_ptr<CallSession> mSession;
LinphoneEvent *mConferenceSubscribeEvent = nullptr;
};

View file

@ -38,17 +38,17 @@ public:
std::shared_ptr<CallSession> createSession (const Conference &conference, const CallSessionParams *params, bool hasMedia, CallSessionListener *listener);
inline std::shared_ptr<CallSession> 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<ParticipantDevice> findDevice (const GruuAddress &gruu) const;
std::shared_ptr<ParticipantDevice> findDevice (const IdentityAddress &gruu) const;
std::shared_ptr<ParticipantDevice> findDevice (const std::shared_ptr<const CallSession> &session);
const std::list<std::shared_ptr<ParticipantDevice>> &getDevices () const;
std::shared_ptr<ParticipantDevice> addDevice (const GruuAddress &gruu);
void removeDevice (const GruuAddress &gruu);
std::shared_ptr<ParticipantDevice> addDevice (const IdentityAddress &gruu);
void removeDevice (const IdentityAddress &gruu);
private:
SimpleAddress addr;
IdentityAddress addr;
Address contactAddr;
bool isAdmin = false;
std::shared_ptr<CallSession> session;

View file

@ -45,7 +45,7 @@ shared_ptr<CallSession> ParticipantPrivate::createSession (
// -----------------------------------------------------------------------------
shared_ptr<ParticipantDevice> ParticipantPrivate::findDevice (const GruuAddress &gruu) const {
shared_ptr<ParticipantDevice> ParticipantPrivate::findDevice (const IdentityAddress &gruu) const {
for (const auto &device : devices) {
if (device->getGruu() == gruu)
return device;
@ -65,7 +65,7 @@ const list<shared_ptr<ParticipantDevice>> &ParticipantPrivate::getDevices () con
return devices;
}
shared_ptr<ParticipantDevice> ParticipantPrivate::addDevice (const GruuAddress &gruu) {
shared_ptr<ParticipantDevice> ParticipantPrivate::addDevice (const IdentityAddress &gruu) {
shared_ptr<ParticipantDevice> device = findDevice(gruu);
if (device)
return device;
@ -74,7 +74,7 @@ shared_ptr<ParticipantDevice> 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;
}

View file

@ -23,7 +23,7 @@
#include <list>
#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;

View file

@ -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<time_t>(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 (

View file

@ -19,7 +19,7 @@
#include <algorithm>
#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> &core, const SimpleAddress &peerAddress) {
static IdentityAddress getDefaultLocalAddress (const shared_ptr<Core> &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<ChatRoom> Core::findChatRoom (const ChatRoomId &chatRoomId) const {
return it == d->chatRoomsById.cend() ? shared_ptr<ChatRoom>() : it->second;
}
list<shared_ptr<ChatRoom>> Core::findChatRooms (const SimpleAddress &peerAddress) const {
list<shared_ptr<ChatRoom>> Core::findChatRooms (const IdentityAddress &peerAddress) const {
// TODO: DEV GROUP CHAT.
return list<shared_ptr<ChatRoom>>();
}
@ -199,7 +199,7 @@ shared_ptr<ChatRoom> Core::getOrCreateBasicChatRoom (const ChatRoomId &chatRoomI
return chatRoom;
}
shared_ptr<ChatRoom> Core::getOrCreateBasicChatRoom (const SimpleAddress &peerAddress, bool isRtt) {
shared_ptr<ChatRoom> Core::getOrCreateBasicChatRoom (const IdentityAddress &peerAddress, bool isRtt) {
L_D();
list<shared_ptr<ChatRoom>> chatRooms = findChatRooms(peerAddress);

View file

@ -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<std::shared_ptr<ChatRoom>> &getChatRooms () const;
std::shared_ptr<ChatRoom> findChatRoom (const ChatRoomId &chatRoomId) const;
std::list<std::shared_ptr<ChatRoom>> findChatRooms (const SimpleAddress &peerAddress) const;
std::list<std::shared_ptr<ChatRoom>> findChatRooms (const IdentityAddress &peerAddress) const;
std::shared_ptr<ChatRoom> createClientGroupChatRoom (const std::string &subject);
std::shared_ptr<ChatRoom> createClientGroupChatRoom (const std::string &subject, const SimpleAddress &localAddress);
std::shared_ptr<ChatRoom> createClientGroupChatRoom (const std::string &subject, const IdentityAddress &localAddress);
std::shared_ptr<ChatRoom> getOrCreateBasicChatRoom (const ChatRoomId &chatRoomId, bool isRtt = false);
std::shared_ptr<ChatRoom> getOrCreateBasicChatRoom (const SimpleAddress &peerAddress, bool isRtt = false);
std::shared_ptr<ChatRoom> getOrCreateBasicChatRoom (const IdentityAddress &peerAddress, bool isRtt = false);
std::shared_ptr<ChatRoom> getOrCreateBasicChatRoomFromUri (const std::string &uri, bool isRtt = false);

View file

@ -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<ChatRoom> marieRoom = marie->lc->cppCore->getOrCreateBasicChatRoom(paulineAddress);
shared_ptr<ChatMessage> marieMessage = marieRoom->createMessage("Hello CPIM");

View file

@ -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<ChatRoom> marieRoom = pauline->lc->cppCore->getOrCreateBasicChatRoom(paulineAddress);
shared_ptr<ChatMessage> marieMessage = marieRoom->createMessage();