From 249b7c0ee9d7fbbb2c4fc88a1ca22e30c48f52ec Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Tue, 17 Oct 2017 15:59:31 +0200 Subject: [PATCH] feat(ConferenceEvent): supports notifyId parameter --- src/CMakeLists.txt | 2 +- .../conference/conference-notified-event-p.h | 39 ++++++++++ .../conference/conference-notified-event.cpp | 75 +++++++++++++++++++ .../conference/conference-notified-event.h | 15 ++-- .../conference-participant-device-event.cpp | 3 + .../conference-participant-device-event.h | 1 + .../conference-participant-event-p.h | 4 +- .../conference-participant-event.cpp | 7 +- .../conference/conference-participant-event.h | 6 +- .../conference/conference-subject-event.cpp | 17 +++-- .../conference/conference-subject-event.h | 11 ++- tester/events-db-tester.cpp | 2 + 12 files changed, 162 insertions(+), 20 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 89f5eda14..f45dce5c3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,8 +52,8 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES chat/modifier/encryption-chat-message-modifier.h chat/modifier/multipart-chat-message-modifier.h chat/notification/imdn.h - chat/notification/is-composing.h chat/notification/is-composing-listener.h + chat/notification/is-composing.h conference/conference-listener.h conference/conference-p.h conference/conference.h diff --git a/src/event-log/conference/conference-notified-event-p.h b/src/event-log/conference/conference-notified-event-p.h index e69de29bb..af5855334 100644 --- a/src/event-log/conference/conference-notified-event-p.h +++ b/src/event-log/conference/conference-notified-event-p.h @@ -0,0 +1,39 @@ +/* + * conference-notified-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_NOTIFIED_EVENT_P_H_ +#define _CONFERENCE_NOTIFIED_EVENT_P_H_ + +#include "conference-event-p.h" +#include "conference-notified-event.h" + +// ============================================================================= + +LINPHONE_BEGIN_NAMESPACE + +class ConferenceNotifiedEventPrivate : public ConferenceEventPrivate { +private: + unsigned int notifyId = 0; + + L_DECLARE_PUBLIC(ConferenceNotifiedEvent); +}; + +LINPHONE_END_NAMESPACE + +#endif // ifndef _CONFERENCE_NOTIFIED_EVENT_P_H_ diff --git a/src/event-log/conference/conference-notified-event.cpp b/src/event-log/conference/conference-notified-event.cpp index e69de29bb..cca45750e 100644 --- a/src/event-log/conference/conference-notified-event.cpp +++ b/src/event-log/conference/conference-notified-event.cpp @@ -0,0 +1,75 @@ +/* + * conference-notified-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-notified-event-p.h" + +// ============================================================================= + +using namespace std; + +LINPHONE_BEGIN_NAMESPACE + +// ----------------------------------------------------------------------------- + +ConferenceNotifiedEvent::ConferenceNotifiedEvent ( + Type type, + time_t time, + const Address &conferenceAddress, + unsigned int notifyId +) : ConferenceEvent(*new ConferenceNotifiedEventPrivate, type, time, conferenceAddress) { + L_D(); + d->notifyId = notifyId; +} + +ConferenceNotifiedEvent::ConferenceNotifiedEvent ( + const ConferenceNotifiedEvent &src +) : ConferenceNotifiedEvent( + src.getType(), + src.getTime(), + src.getConferenceAddress(), + src.getNotifyId() +) {} + +ConferenceNotifiedEvent::ConferenceNotifiedEvent ( + ConferenceNotifiedEventPrivate &p, + Type type, + time_t time, + const Address &conferenceAddress, + unsigned int notifyId +) : ConferenceEvent(p, type, time, conferenceAddress) { + L_D(); + d->notifyId = notifyId; +} + +ConferenceNotifiedEvent &ConferenceNotifiedEvent::operator= (const ConferenceNotifiedEvent &src) { + L_D(); + if (this != &src) { + ConferenceEvent::operator=(src); + d->notifyId = src.getPrivate()->notifyId; + } + + return *this; +} + +unsigned int ConferenceNotifiedEvent::getNotifyId () const { + L_D(); + return d->notifyId; +} + +LINPHONE_END_NAMESPACE diff --git a/src/event-log/conference/conference-notified-event.h b/src/event-log/conference/conference-notified-event.h index 5e87cf8bb..2f3c8f860 100644 --- a/src/event-log/conference/conference-notified-event.h +++ b/src/event-log/conference/conference-notified-event.h @@ -26,20 +26,25 @@ LINPHONE_BEGIN_NAMESPACE -class Address; class ConferenceNotifiedEventPrivate; -class LINPHONE_PUBLIC ConferenceNotifiedEvent : public EventLog { +class LINPHONE_PUBLIC ConferenceNotifiedEvent : public ConferenceEvent { public: - ConferenceNotifiedEvent (Type type, std::time_t time, const Address &conferenceAddress); + ConferenceNotifiedEvent (Type type, std::time_t time, const Address &conferenceAddress, unsigned int notifiyId); ConferenceNotifiedEvent (const ConferenceNotifiedEvent &src); ConferenceNotifiedEvent &operator= (const ConferenceNotifiedEvent &src); - const Address &getConferenceAddress () const; + unsigned int getNotifyId () const; protected: - ConferenceNotifiedEvent (ConferenceNotifiedEventPrivate &p, Type type, std::time_t time, const Address &conferenceAddress); + ConferenceNotifiedEvent ( + ConferenceNotifiedEventPrivate &p, + Type type, + std::time_t time, + const Address &conferenceAddress, + unsigned int notifyId + ); private: L_DECLARE_PRIVATE(ConferenceNotifiedEvent); diff --git a/src/event-log/conference/conference-participant-device-event.cpp b/src/event-log/conference/conference-participant-device-event.cpp index fd090f1df..83cc88398 100644 --- a/src/event-log/conference/conference-participant-device-event.cpp +++ b/src/event-log/conference/conference-participant-device-event.cpp @@ -37,6 +37,7 @@ ConferenceParticipantDeviceEvent::ConferenceParticipantDeviceEvent ( Type type, time_t time, const Address &conferenceAddress, + unsigned int notifyId, const Address &participantAddress, const Address &gruuAddress ) : ConferenceParticipantEvent( @@ -44,6 +45,7 @@ ConferenceParticipantDeviceEvent::ConferenceParticipantDeviceEvent ( type, time, conferenceAddress, + notifyId, participantAddress ) { L_D(); @@ -59,6 +61,7 @@ ConferenceParticipantDeviceEvent::ConferenceParticipantDeviceEvent (const Confer src.getType(), src.getTime(), src.getConferenceAddress(), + src.getNotifyId(), src.getParticipantAddress(), src.getGruuAddress() ) {} diff --git a/src/event-log/conference/conference-participant-device-event.h b/src/event-log/conference/conference-participant-device-event.h index d70d08549..3ee2b9a95 100644 --- a/src/event-log/conference/conference-participant-device-event.h +++ b/src/event-log/conference/conference-participant-device-event.h @@ -34,6 +34,7 @@ public: Type type, std::time_t time, const Address &conferenceAddress, + unsigned int notifyId, const Address &participantAddress, const Address &gruuAddress ); diff --git a/src/event-log/conference/conference-participant-event-p.h b/src/event-log/conference/conference-participant-event-p.h index 6aab2eb72..77210c562 100644 --- a/src/event-log/conference/conference-participant-event-p.h +++ b/src/event-log/conference/conference-participant-event-p.h @@ -20,14 +20,14 @@ #ifndef _CONFERENCE_PARTICIPANT_EVENT_P_H_ #define _CONFERENCE_PARTICIPANT_EVENT_P_H_ -#include "conference-event-p.h" +#include "conference-notified-event-p.h" #include "conference-participant-event.h" // ============================================================================= LINPHONE_BEGIN_NAMESPACE -class ConferenceParticipantEventPrivate : public ConferenceEventPrivate { +class ConferenceParticipantEventPrivate : public ConferenceNotifiedEventPrivate { private: Address participantAddress; diff --git a/src/event-log/conference/conference-participant-event.cpp b/src/event-log/conference/conference-participant-event.cpp index 3f6e560fd..b64e886b2 100644 --- a/src/event-log/conference/conference-participant-event.cpp +++ b/src/event-log/conference/conference-participant-event.cpp @@ -31,8 +31,9 @@ ConferenceParticipantEvent::ConferenceParticipantEvent ( Type type, time_t time, const Address &conferenceAddress, + unsigned int notifyId, const Address &participantAddress -) : ConferenceEvent(*new ConferenceParticipantEventPrivate, type, time, conferenceAddress) { +) : ConferenceNotifiedEvent(*new ConferenceParticipantEventPrivate, type, time, conferenceAddress, notifyId) { L_D(); L_ASSERT( type == Type::ConferenceParticipantAdded || @@ -49,6 +50,7 @@ ConferenceParticipantEvent::ConferenceParticipantEvent ( src.getType(), src.getTime(), src.getConferenceAddress(), + src.getNotifyId(), src.getParticipantAddress() ) {} @@ -57,8 +59,9 @@ ConferenceParticipantEvent::ConferenceParticipantEvent ( Type type, time_t time, const Address &conferenceAddress, + unsigned int notifyId, const Address &participantAddress -) : ConferenceEvent(p, type, time, conferenceAddress) { +) : ConferenceNotifiedEvent(p, type, time, conferenceAddress, notifyId) { L_D(); d->participantAddress = participantAddress; } diff --git a/src/event-log/conference/conference-participant-event.h b/src/event-log/conference/conference-participant-event.h index 5b69d84cb..d5127459a 100644 --- a/src/event-log/conference/conference-participant-event.h +++ b/src/event-log/conference/conference-participant-event.h @@ -20,7 +20,7 @@ #ifndef _CONFERENCE_PARTICIPANT_EVENT_H_ #define _CONFERENCE_PARTICIPANT_EVENT_H_ -#include "conference-event.h" +#include "conference-notified-event.h" // ============================================================================= @@ -28,12 +28,13 @@ LINPHONE_BEGIN_NAMESPACE class ConferenceParticipantEventPrivate; -class LINPHONE_PUBLIC ConferenceParticipantEvent : public ConferenceEvent { +class LINPHONE_PUBLIC ConferenceParticipantEvent : public ConferenceNotifiedEvent { public: ConferenceParticipantEvent ( Type type, std::time_t time, const Address &conferenceAddress, + unsigned int notifyId, const Address &participantAddress ); ConferenceParticipantEvent (const ConferenceParticipantEvent &src); @@ -48,6 +49,7 @@ protected: Type type, std::time_t time, const Address &conferenceAddress, + unsigned int notifyId, const Address &participantAddress ); diff --git a/src/event-log/conference/conference-subject-event.cpp b/src/event-log/conference/conference-subject-event.cpp index dc1073506..1dcd45a0b 100644 --- a/src/event-log/conference/conference-subject-event.cpp +++ b/src/event-log/conference/conference-subject-event.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "conference-event-p.h" +#include "conference-notified-event-p.h" #include "conference-subject-event.h" // ============================================================================= @@ -26,7 +26,7 @@ using namespace std; LINPHONE_BEGIN_NAMESPACE -class ConferenceSubjectEventPrivate : public ConferenceEventPrivate { +class ConferenceSubjectEventPrivate : public ConferenceNotifiedEventPrivate { public: string subject; }; @@ -35,15 +35,22 @@ public: ConferenceSubjectEvent::ConferenceSubjectEvent ( time_t time, - const Address &address, + const Address &conferenceAddress, + unsigned int notifyId, const string &subject -) : ConferenceEvent(*new ConferenceSubjectEventPrivate, Type::ConferenceSubjectChanged, time, address) { +) : ConferenceNotifiedEvent( + *new ConferenceSubjectEventPrivate, + Type::ConferenceSubjectChanged, + time, + conferenceAddress, + notifyId +) { L_D(); d->subject = subject; } ConferenceSubjectEvent::ConferenceSubjectEvent (const ConferenceSubjectEvent &src) : - ConferenceSubjectEvent(src.getTime(), src.getConferenceAddress(), src.getSubject()) {} + ConferenceSubjectEvent(src.getTime(), src.getConferenceAddress(), src.getNotifyId(), src.getSubject()) {} ConferenceSubjectEvent &ConferenceSubjectEvent::operator= (const ConferenceSubjectEvent &src) { L_D(); diff --git a/src/event-log/conference/conference-subject-event.h b/src/event-log/conference/conference-subject-event.h index 144fb8e48..20f5fe982 100644 --- a/src/event-log/conference/conference-subject-event.h +++ b/src/event-log/conference/conference-subject-event.h @@ -20,7 +20,7 @@ #ifndef _CONFERENCE_SUBJECT_EVENT_H_ #define _CONFERENCE_SUBJECT_EVENT_H_ -#include "conference-event.h" +#include "conference-notified-event.h" // ============================================================================= @@ -28,9 +28,14 @@ LINPHONE_BEGIN_NAMESPACE class ConferenceSubjectEventPrivate; -class LINPHONE_PUBLIC ConferenceSubjectEvent : public ConferenceEvent { +class LINPHONE_PUBLIC ConferenceSubjectEvent : public ConferenceNotifiedEvent { public: - ConferenceSubjectEvent (std::time_t time, const Address &conferenceAddress, const std::string &subject); + ConferenceSubjectEvent ( + std::time_t time, + const Address &conferenceAddress, + unsigned int notifyId, + const std::string &subject + ); ConferenceSubjectEvent (const ConferenceSubjectEvent &src); ConferenceSubjectEvent &operator= (const ConferenceSubjectEvent &src); diff --git a/tester/events-db-tester.cpp b/tester/events-db-tester.cpp index 159244c28..15f69aedf 100644 --- a/tester/events-db-tester.cpp +++ b/tester/events-db-tester.cpp @@ -38,6 +38,8 @@ static const string getDatabasePath () { static void open_database () { MainDb eventsDb; BC_ASSERT_TRUE(eventsDb.connect(MainDb::Sqlite3, getDatabasePath())); + + eventsDb.import(AbstractDb::Backend::Sqlite3, "/home/rabhamon/.local/share/linphone/message-history.db"); } static void get_events_count () {