Commit 09866072 authored by Ronan's avatar Ronan

feat(ChatRoom): add a chat room identifier object

parent e43d58fb
......@@ -35,6 +35,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
chat/chat-message/chat-message.h
chat/chat-room/basic-chat-room-p.h
chat/chat-room/basic-chat-room.h
chat/chat-room/chat-room-id.h
chat/chat-room/chat-room-p.h
chat/chat-room/chat-room.h
chat/chat-room/client-group-chat-room-p.h
......@@ -159,6 +160,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
call/call.cpp
chat/chat-message/chat-message.cpp
chat/chat-room/basic-chat-room.cpp
chat/chat-room/chat-room-id.cpp
chat/chat-room/chat-room.cpp
chat/chat-room/client-group-chat-room.cpp
chat/chat-room/real-time-text-chat-room.cpp
......
/*
* chat-room-id.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 "object/clonable-object-p.h"
#include "chat-room-id.h"
// =============================================================================
using namespace std;
LINPHONE_BEGIN_NAMESPACE
class ChatRoomIdPrivate : public ClonableObjectPrivate {
public:
SimpleAddress peerAddress;
SimpleAddress localAddress;
};
// -----------------------------------------------------------------------------
ChatRoomId::ChatRoomId (
const SimpleAddress &peerAddress,
const SimpleAddress &localAddress
) : ClonableObject(*new ChatRoomIdPrivate) {
L_D();
d->peerAddress = peerAddress;
d->localAddress = localAddress;
}
bool ChatRoomId::operator== (const ChatRoomId &chatRoomId) const {
L_D();
const ChatRoomIdPrivate *dChatRoomId = chatRoomId.getPrivate();
return d->peerAddress == dChatRoomId->peerAddress && d->localAddress == dChatRoomId->localAddress;
}
bool ChatRoomId::operator!= (const ChatRoomId &chatRoomId) const {
return !(*this == chatRoomId);
}
const SimpleAddress &ChatRoomId::getPeerAddress () const {
L_D();
return d->peerAddress;
}
const SimpleAddress &ChatRoomId::getLocalAddress () const {
L_D();
return d->localAddress;
}
LINPHONE_END_NAMESPACE
/*
* chat-room-id.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 _CHAT_ROOM_ID_H_
#define _CHAT_ROOM_ID_H_
#include "address/simple-address.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class ChatRoomIdPrivate;
class LINPHONE_PUBLIC ChatRoomId : public ClonableObject {
public:
ChatRoomId (const SimpleAddress &peerAddress, const SimpleAddress &localAddress);
bool operator== (const ChatRoomId &chatRoomId) const;
bool operator!= (const ChatRoomId &chatRoomId) const;
const SimpleAddress &getPeerAddress () const;
const SimpleAddress &getLocalAddress () const;
private:
L_DECLARE_PRIVATE(ChatRoomId);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _CHAT_ROOM_ID_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment