diff --git a/src/chat/chat-room/client-group-chat-room.cpp b/src/chat/chat-room/client-group-chat-room.cpp index 1d039086e..d24b398ac 100644 --- a/src/chat/chat-room/client-group-chat-room.cpp +++ b/src/chat/chat-room/client-group-chat-room.cpp @@ -263,7 +263,7 @@ void ClientGroupChatRoom::onConferenceTerminated (const Address &addr) { d->setState(ChatRoom::State::Terminated); } -void ClientGroupChatRoom::onParticipantAdded (time_t tm, const Address &addr) { +void ClientGroupChatRoom::onParticipantAdded (time_t tm, bool isFullState, const Address &addr) { L_D_T(RemoteConference, dConference); if (isMe(addr)) @@ -293,7 +293,7 @@ void ClientGroupChatRoom::onParticipantAdded (time_t tm, const Address &addr) { cb(cr, L_GET_C_BACK_PTR(event)); } -void ClientGroupChatRoom::onParticipantRemoved (time_t tm, const Address &addr) { +void ClientGroupChatRoom::onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) { L_D_T(RemoteConference, dConference); shared_ptr participant = findParticipant(addr); @@ -320,7 +320,7 @@ void ClientGroupChatRoom::onParticipantRemoved (time_t tm, const Address &addr) dConference->participants.remove(participant); } -void ClientGroupChatRoom::onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) { +void ClientGroupChatRoom::onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) { L_D_T(RemoteConference, dConference); shared_ptr participant; if (isMe(addr)) @@ -349,7 +349,7 @@ void ClientGroupChatRoom::onParticipantSetAdmin (time_t tm, const Address &addr, cb(cr, L_GET_C_BACK_PTR(event)); } -void ClientGroupChatRoom::onSubjectChanged (time_t tm, const std::string &subject) { +void ClientGroupChatRoom::onSubjectChanged (time_t tm, bool isFullState, const std::string &subject) { L_D_T(RemoteConference, dConference); RemoteConference::setSubject(subject); LinphoneChatRoom *cr = L_GET_C_BACK_PTR(this); @@ -367,7 +367,7 @@ void ClientGroupChatRoom::onSubjectChanged (time_t tm, const std::string &subjec cb(cr, L_GET_C_BACK_PTR(event)); } -void ClientGroupChatRoom::onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) { +void ClientGroupChatRoom::onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) { L_D_T(RemoteConference, dConference); shared_ptr participant; if (isMe(addr)) @@ -396,7 +396,7 @@ void ClientGroupChatRoom::onParticipantDeviceAdded (time_t tm, const Address &ad cb(cr, L_GET_C_BACK_PTR(event)); } -void ClientGroupChatRoom::onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) { +void ClientGroupChatRoom::onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) { L_D_T(RemoteConference, dConference); shared_ptr participant; if (isMe(addr)) diff --git a/src/chat/chat-room/client-group-chat-room.h b/src/chat/chat-room/client-group-chat-room.h index 7ff063a27..e938fcfd5 100644 --- a/src/chat/chat-room/client-group-chat-room.h +++ b/src/chat/chat-room/client-group-chat-room.h @@ -64,12 +64,12 @@ private: /* ConferenceListener */ void onConferenceCreated (const Address &addr) override; void onConferenceTerminated (const Address &addr) override; - void onParticipantAdded (time_t tm, const Address &addr) override; - void onParticipantRemoved (time_t tm, const Address &addr) override; - void onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) override; - void onSubjectChanged (time_t tm, const std::string &subject) override; - void onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) override; - void onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) override; + void onParticipantAdded (time_t tm, bool isFullState, const Address &addr) override; + void onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) override; + void onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) override; + void onSubjectChanged (time_t tm, bool isFullState, const std::string &subject) override; + void onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) override; + void onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) override; private: /* CallSessionListener */ diff --git a/src/conference/conference-listener.h b/src/conference/conference-listener.h index 248052fb6..4bad04c11 100644 --- a/src/conference/conference-listener.h +++ b/src/conference/conference-listener.h @@ -35,12 +35,12 @@ class ConferenceListener { public: virtual void onConferenceCreated (const Address &addr) = 0; virtual void onConferenceTerminated (const Address &addr) = 0; - virtual void onParticipantAdded (time_t tm, const Address &addr) = 0; - virtual void onParticipantRemoved (time_t tm, const Address &addr) = 0; - virtual void onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) = 0; - virtual void onSubjectChanged (time_t tm, const std::string &subject) = 0; - virtual void onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) = 0; - virtual void onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) = 0; + virtual void onParticipantAdded (time_t tm, bool isFullState, const Address &addr) = 0; + virtual void onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) = 0; + virtual void onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) = 0; + virtual void onSubjectChanged (time_t tm, bool isFullState, const std::string &subject) = 0; + virtual void onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) = 0; + virtual void onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) = 0; }; LINPHONE_END_NAMESPACE diff --git a/src/conference/local-conference-event-handler-p.h b/src/conference/local-conference-event-handler-p.h index b194d65c4..88e851bd3 100644 --- a/src/conference/local-conference-event-handler-p.h +++ b/src/conference/local-conference-event-handler-p.h @@ -49,7 +49,7 @@ private: LocalConference *conf = nullptr; unsigned int lastNotify = 0; - std::string createNotify (Xsd::ConferenceInfo::ConferenceType confInfo, int notifyId = -1); + std::string createNotify (Xsd::ConferenceInfo::ConferenceType confInfo, int notifyId = -1, bool isFullState = FALSE); void sendNotify (const std::string ¬ify, const Address &addr); L_DECLARE_PUBLIC(LocalConferenceEventHandler); diff --git a/src/conference/local-conference-event-handler.cpp b/src/conference/local-conference-event-handler.cpp index 0eb844d3d..1bf56b528 100644 --- a/src/conference/local-conference-event-handler.cpp +++ b/src/conference/local-conference-event-handler.cpp @@ -76,14 +76,14 @@ void LocalConferenceEventHandlerPrivate::notifyParticipant (const string ¬ify sendNotify(notify, participant->getAddress()); } -string LocalConferenceEventHandlerPrivate::createNotify (ConferenceType confInfo, int notifyId) { +string LocalConferenceEventHandlerPrivate::createNotify (ConferenceType confInfo, int notifyId, bool isFullState) { if (notifyId == -1) { lastNotify = lastNotify + 1; confInfo.setVersion(lastNotify); } else { confInfo.setVersion(static_cast(notifyId)); } - + confInfo.setState(isFullState ? "full" : "optional"); if (!confInfo.getConferenceDescription()) { ConferenceDescriptionType description = ConferenceDescriptionType(); confInfo.setConferenceDescription(description); @@ -130,7 +130,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyFullState (int notifyId) confInfo.getUsers()->getUser().push_back(user); } - return createNotify(confInfo, notifyId); + return createNotify(confInfo, notifyId, TRUE); } string LocalConferenceEventHandlerPrivate::createNotifyParticipantAdded (const Address &addr, int notifyId) { diff --git a/src/conference/remote-conference-event-handler.cpp b/src/conference/remote-conference-event-handler.cpp index 8c83664bd..21c2f5a7b 100644 --- a/src/conference/remote-conference-event-handler.cpp +++ b/src/conference/remote-conference-event-handler.cpp @@ -77,6 +77,7 @@ void RemoteConferenceEventHandler::notifyReceived (const string &xmlBody) { if (confInfo->getConferenceDescription()->getFreeText().present()) tm = static_cast(Utils::stoll(confInfo->getConferenceDescription()->getFreeText().get())); + bool isFullState = (confInfo->getState() == "full"); Address cleanedConfAddress = d->confAddress; cleanedConfAddress.clean(); cleanedConfAddress.setPort(0); @@ -92,7 +93,7 @@ void RemoteConferenceEventHandler::notifyReceived (const string &xmlBody) { confInfo->getConferenceDescription().present() && confInfo->getConferenceDescription().get().getSubject().present() ) - d->listener->onSubjectChanged(tm, confInfo->getConferenceDescription().get().getSubject().get()); + d->listener->onSubjectChanged(tm, isFullState, confInfo->getConferenceDescription().get().getSubject().get()); if (confInfo->getVersion().present()) d->lastNotify = confInfo->getVersion().get(); @@ -106,7 +107,7 @@ void RemoteConferenceEventHandler::notifyReceived (const string &xmlBody) { Address addr(cAddrStr); bctbx_free(cAddrStr); if (user.getState() == "deleted") - d->listener->onParticipantRemoved(tm, addr); + d->listener->onParticipantRemoved(tm, isFullState, addr); else { bool isAdmin = false; if (user.getRoles()) { @@ -118,17 +119,17 @@ void RemoteConferenceEventHandler::notifyReceived (const string &xmlBody) { } } if (user.getState() == "full") - d->listener->onParticipantAdded(tm, addr); - d->listener->onParticipantSetAdmin(tm, addr, isAdmin); + d->listener->onParticipantAdded(tm, isFullState, addr); + d->listener->onParticipantSetAdmin(tm, isFullState, addr, isAdmin); for (const auto &endpoint : user.getEndpoint()) { if (!endpoint.getEntity().present()) break; Address gruu(endpoint.getEntity().get()); if (endpoint.getState() == "deleted") - d->listener->onParticipantDeviceRemoved(tm, addr, gruu); + d->listener->onParticipantDeviceRemoved(tm, isFullState, addr, gruu); else if (endpoint.getState() == "full") - d->listener->onParticipantDeviceAdded(tm, addr, gruu); + d->listener->onParticipantDeviceAdded(tm, isFullState, addr, gruu); } } diff --git a/src/conference/remote-conference.cpp b/src/conference/remote-conference.cpp index d746a495f..ff27f5f00 100644 --- a/src/conference/remote-conference.cpp +++ b/src/conference/remote-conference.cpp @@ -89,16 +89,16 @@ void RemoteConference::onConferenceTerminated (const Address &addr) { d->eventHandler->unsubscribe(); } -void RemoteConference::onParticipantAdded (time_t tm, const Address &addr) {} +void RemoteConference::onParticipantAdded (time_t tm, bool isFullState, const Address &addr) {} -void RemoteConference::onParticipantRemoved (time_t tm, const Address &addr) {} +void RemoteConference::onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) {} -void RemoteConference::onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) {} +void RemoteConference::onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) {} -void RemoteConference::onSubjectChanged (time_t tm, const std::string &subject) {} +void RemoteConference::onSubjectChanged (time_t tm, bool isFullState, const std::string &subject) {} -void RemoteConference::onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) {} +void RemoteConference::onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) {} -void RemoteConference::onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) {} +void RemoteConference::onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) {} LINPHONE_END_NAMESPACE diff --git a/src/conference/remote-conference.h b/src/conference/remote-conference.h index f1898f10c..5487170f3 100644 --- a/src/conference/remote-conference.h +++ b/src/conference/remote-conference.h @@ -46,12 +46,12 @@ protected: /* ConferenceListener */ void onConferenceCreated (const Address &addr) override; void onConferenceTerminated (const Address &addr) override; - void onParticipantAdded (time_t tm, const Address &addr) override; - void onParticipantRemoved (time_t tm, const Address &addr) override; - void onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) override; - void onSubjectChanged (time_t tm, const std::string &subject) override; - void onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) override; - void onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) override; + void onParticipantAdded (time_t tm, bool isFullState, const Address &addr) override; + void onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) override; + void onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) override; + void onSubjectChanged (time_t tm, bool isFullState, const std::string &subject) override; + void onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) override; + void onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) override; private: L_DECLARE_PRIVATE(RemoteConference); diff --git a/tester/conference-event-tester.cpp b/tester/conference-event-tester.cpp index 437a60387..2d003586a 100644 --- a/tester/conference-event-tester.cpp +++ b/tester/conference-event-tester.cpp @@ -447,12 +447,12 @@ public: private: void onConferenceCreated (const Address &addr) override; void onConferenceTerminated (const Address &addr) override; - void onParticipantAdded (time_t tm, const Address &addr) override; - void onParticipantRemoved (time_t tm, const Address &addr) override; - void onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) override; - void onSubjectChanged (time_t tm, const string &subject) override; - void onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) override; - void onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) override; + void onParticipantAdded (time_t tm, bool isFullState, const Address &addr) override; + void onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) override; + void onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) override; + void onSubjectChanged (time_t tm, bool isFullState, const string &subject) override; + void onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) override; + void onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) override; public: RemoteConferenceEventHandler *handler; @@ -473,33 +473,33 @@ void ConferenceEventTester::onConferenceCreated (const Address &addr) {} void ConferenceEventTester::onConferenceTerminated (const Address &addr) {} -void ConferenceEventTester::onParticipantAdded (time_t tm, const Address &addr) { +void ConferenceEventTester::onParticipantAdded (time_t tm, bool isFullState, const Address &addr) { participants.insert(pair(addr.asString(), FALSE)); participantDevices.insert(pair(addr.asString(), 0)); } -void ConferenceEventTester::onParticipantRemoved (time_t tm, const Address &addr) { +void ConferenceEventTester::onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) { participants.erase(addr.asString()); participantDevices.erase(addr.asString()); } -void ConferenceEventTester::onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) { +void ConferenceEventTester::onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) { auto it = participants.find(addr.asString()); if (it != participants.end()) it->second = isAdmin; } -void ConferenceEventTester::onSubjectChanged(time_t tm, const string &subject) { +void ConferenceEventTester::onSubjectChanged(time_t tm, bool isFullState, const string &subject) { confSubject = subject; } -void ConferenceEventTester::onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) { +void ConferenceEventTester::onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) { auto it = participantDevices.find(addr.asString()); if (it != participantDevices.end()) it->second++; } -void ConferenceEventTester::onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) { +void ConferenceEventTester::onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) { auto it = participantDevices.find(addr.asString()); if (it != participantDevices.end() && it->second > 0) it->second--;