mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-18 03:28:07 +00:00
feat(ChatRoom): add a chat room identifier object
This commit is contained in:
parent
e43d58fb2b
commit
098660726f
3 changed files with 116 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
67
src/chat/chat-room/chat-room-id.cpp
Normal file
67
src/chat/chat-room/chat-room-id.cpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* 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
|
||||
47
src/chat/chat-room/chat-room-id.h
Normal file
47
src/chat/chat-room/chat-room-id.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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_
|
||||
Loading…
Add table
Reference in a new issue