From 4ee2312949eba161ffdcc262f53e9d967db13d73 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 16 Oct 2017 15:25:01 +0200 Subject: [PATCH] feat(EventLog): add new ConferenceParticipantDevice event --- include/linphone/enums/event-log-enums.h | 4 +- src/CMakeLists.txt | 3 + src/chat/chat-room/chat-room-p.h | 2 +- src/db/main-db.cpp | 2 + .../conference-participant-device-event.cpp | 80 +++++++++++++++++++ .../conference-participant-device-event.h | 51 ++++++++++++ .../conference-participant-event-p.h | 39 +++++++++ .../conference-participant-event.cpp | 19 +++-- src/event-log/conference-participant-event.h | 8 ++ 9 files changed, 198 insertions(+), 10 deletions(-) create mode 100644 src/event-log/conference-participant-device-event.cpp create mode 100644 src/event-log/conference-participant-device-event.h create mode 100644 src/event-log/conference-participant-event-p.h diff --git a/include/linphone/enums/event-log-enums.h b/include/linphone/enums/event-log-enums.h index b854d5cbf..22c3d3d34 100644 --- a/include/linphone/enums/event-log-enums.h +++ b/include/linphone/enums/event-log-enums.h @@ -32,6 +32,8 @@ F(ConferenceParticipantAdded) \ F(ConferenceParticipantRemoved) \ F(ConferenceParticipantSetAdmin) \ - F(ConferenceParticipantUnsetAdmin) + F(ConferenceParticipantUnsetAdmin) \ + F(ConferenceParticipantDeviceAdded) \ + F(ConferenceParticipantDeviceRemoved) #endif // ifndef _EVENT_LOG_ENUMS_H_ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8b9d33bae..4711b9625 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -94,6 +94,8 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES event-log/chat-message-event.h event-log/conference-event-p.h event-log/conference-event.h + event-log/conference-participant-device-event.h + event-log/conference-participant-event-p.h event-log/conference-participant-event.h event-log/event-log-p.h event-log/event-log.h @@ -170,6 +172,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES event-log/call-event.cpp event-log/chat-message-event.cpp event-log/conference-event.cpp + event-log/conference-participant-device-event.cpp event-log/conference-participant-event.cpp event-log/event-log.cpp hacks/hacks.cpp diff --git a/src/chat/chat-room/chat-room-p.h b/src/chat/chat-room/chat-room-p.h index c434b0bcc..069814e53 100644 --- a/src/chat/chat-room/chat-room-p.h +++ b/src/chat/chat-room/chat-room-p.h @@ -101,7 +101,7 @@ public: std::list> messages; std::list> transientMessages; std::list> weakMessages; - std::shared_ptr pendingMessage = nullptr; + std::shared_ptr pendingMessage; IsComposing isComposingHandler; private: diff --git a/src/db/main-db.cpp b/src/db/main-db.cpp index 4e2ef9570..c5f9bb523 100644 --- a/src/db/main-db.cpp +++ b/src/db/main-db.cpp @@ -453,6 +453,8 @@ MainDb::MainDb () : AbstractDb(*new MainDbPrivate) {} case EventLog::Type::ConferenceParticipantRemoved: case EventLog::Type::ConferenceParticipantSetAdmin: case EventLog::Type::ConferenceParticipantUnsetAdmin: + case EventLog::Type::ConferenceParticipantDeviceAdded: + case EventLog::Type::ConferenceParticipantDeviceRemoved: break; } diff --git a/src/event-log/conference-participant-device-event.cpp b/src/event-log/conference-participant-device-event.cpp new file mode 100644 index 000000000..716a08131 --- /dev/null +++ b/src/event-log/conference-participant-device-event.cpp @@ -0,0 +1,80 @@ +/* + * conference-participant-device-event.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 "conference-participant-device-event.h" +#include "conference-participant-event-p.h" + +// ============================================================================= + +using namespace std; + +LINPHONE_BEGIN_NAMESPACE + +class ConferenceParticipantDeviceEventPrivate : public ConferenceParticipantEventPrivate { +public: + Address gruuAddress; +}; + +// ----------------------------------------------------------------------------- + +ConferenceParticipantDeviceEvent::ConferenceParticipantDeviceEvent ( + Type type, + const Address &conferenceAddress, + const Address &participantAddress, + const Address &gruuAddress +) : ConferenceParticipantEvent( + *new ConferenceParticipantDeviceEventPrivate, + type, + conferenceAddress, + participantAddress +) { + L_D(); + L_ASSERT( + type == Type::ConferenceParticipantDeviceAdded || + type == Type::ConferenceParticipantDeviceRemoved + ); + d->gruuAddress = gruuAddress; +} + +ConferenceParticipantDeviceEvent::ConferenceParticipantDeviceEvent (const ConferenceParticipantDeviceEvent &src) : + ConferenceParticipantDeviceEvent( + src.getType(), + src.getAddress(), + src.getParticipantAddress(), + src.getGruuAddress() + ) {} + +ConferenceParticipantDeviceEvent &ConferenceParticipantDeviceEvent::operator= ( + const ConferenceParticipantDeviceEvent &src +) { + L_D(); + if (this != &src) { + ConferenceParticipantEvent::operator=(src); + d->gruuAddress = src.getPrivate()->gruuAddress; + } + + return *this; +} + +const Address &ConferenceParticipantDeviceEvent::getGruuAddress () const { + L_D(); + return d->gruuAddress; +} + +LINPHONE_END_NAMESPACE diff --git a/src/event-log/conference-participant-device-event.h b/src/event-log/conference-participant-device-event.h new file mode 100644 index 000000000..b30f86903 --- /dev/null +++ b/src/event-log/conference-participant-device-event.h @@ -0,0 +1,51 @@ +/* + * conference-participant-device-event.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 _CONFERENCE_PARTICIPANT_DEVICE_EVENT_H_ +#define _CONFERENCE_PARTICIPANT_DEVICE_EVENT_H_ + +#include "conference-participant-event.h" + +// ============================================================================= + +LINPHONE_BEGIN_NAMESPACE + +class ConferenceParticipantDeviceEventPrivate; + +class LINPHONE_PUBLIC ConferenceParticipantDeviceEvent : public ConferenceParticipantEvent { +public: + ConferenceParticipantDeviceEvent ( + Type type, + const Address &conferenceAddress, + const Address &participantAddress, + const Address &gruuAddress + ); + ConferenceParticipantDeviceEvent (const ConferenceParticipantDeviceEvent &src); + + ConferenceParticipantDeviceEvent &operator= (const ConferenceParticipantDeviceEvent &src); + + const Address &getGruuAddress () const; + +private: + L_DECLARE_PRIVATE(ConferenceParticipantDeviceEvent); +}; + +LINPHONE_END_NAMESPACE + +#endif // ifndef _CONFERENCE_PARTICIPANT_DEVICE_EVENT_H_ diff --git a/src/event-log/conference-participant-event-p.h b/src/event-log/conference-participant-event-p.h new file mode 100644 index 000000000..6aab2eb72 --- /dev/null +++ b/src/event-log/conference-participant-event-p.h @@ -0,0 +1,39 @@ +/* + * conference-participant-event-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 _CONFERENCE_PARTICIPANT_EVENT_P_H_ +#define _CONFERENCE_PARTICIPANT_EVENT_P_H_ + +#include "conference-event-p.h" +#include "conference-participant-event.h" + +// ============================================================================= + +LINPHONE_BEGIN_NAMESPACE + +class ConferenceParticipantEventPrivate : public ConferenceEventPrivate { +private: + Address participantAddress; + + L_DECLARE_PUBLIC(ConferenceParticipantEvent); +}; + +LINPHONE_END_NAMESPACE + +#endif // ifndef _CONFERENCE_PARTICIPANT_EVENT_P_H_ diff --git a/src/event-log/conference-participant-event.cpp b/src/event-log/conference-participant-event.cpp index b6ba46c17..71ff78c82 100644 --- a/src/event-log/conference-participant-event.cpp +++ b/src/event-log/conference-participant-event.cpp @@ -17,9 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "address/address.h" -#include "conference-event-p.h" -#include "conference-participant-event.h" +#include "conference-participant-event-p.h" // ============================================================================= @@ -27,11 +25,6 @@ using namespace std; LINPHONE_BEGIN_NAMESPACE -class ConferenceParticipantEventPrivate : public ConferenceEventPrivate { -public: - Address participantAddress; -}; - // ----------------------------------------------------------------------------- ConferenceParticipantEvent::ConferenceParticipantEvent ( @@ -52,6 +45,16 @@ ConferenceParticipantEvent::ConferenceParticipantEvent ( ConferenceParticipantEvent::ConferenceParticipantEvent (const ConferenceParticipantEvent &src) : ConferenceParticipantEvent(src.getType(), src.getAddress(), src.getParticipantAddress()) {} +ConferenceParticipantEvent::ConferenceParticipantEvent ( + ConferenceParticipantEventPrivate &p, + Type type, + const Address &conferenceAddress, + const Address &participantAddress +) : ConferenceEvent(p, type, conferenceAddress) { + L_D(); + d->participantAddress = participantAddress; +} + ConferenceParticipantEvent &ConferenceParticipantEvent::operator= (const ConferenceParticipantEvent &src) { L_D(); if (this != &src) { diff --git a/src/event-log/conference-participant-event.h b/src/event-log/conference-participant-event.h index 7732b75de..97f7e2eb0 100644 --- a/src/event-log/conference-participant-event.h +++ b/src/event-log/conference-participant-event.h @@ -41,6 +41,14 @@ public: const Address &getParticipantAddress () const; +protected: + ConferenceParticipantEvent ( + ConferenceParticipantEventPrivate &p, + Type type, + const Address &conferenceAddress, + const Address &participantAddress + ); + private: L_DECLARE_PRIVATE(ConferenceParticipantEvent); };