diff --git a/src/conference/local-conference-event-handler-p.h b/src/conference/local-conference-event-handler-p.h index b50af3ed7..0fffe1c55 100644 --- a/src/conference/local-conference-event-handler-p.h +++ b/src/conference/local-conference-event-handler-p.h @@ -24,6 +24,7 @@ #include "local-conference-event-handler.h" #include "object/object-p.h" +#include "xml/conference-info.h" LINPHONE_BEGIN_NAMESPACE @@ -32,6 +33,7 @@ public: void notifyFullState (const std::string ¬ify, LinphoneEvent *lev); void notifyAllExcept (const std::string ¬ify, const Address &addr); void notifyAll (const std::string ¬ify); + std::string createNotify (Xsd::ConferenceInfo::ConferenceType confInfo); std::string createNotifyFullState (); std::string createNotifyParticipantAdded (const Address &addr); std::string createNotifyParticipantRemoved (const Address &addr); @@ -40,10 +42,13 @@ public: std::string createNotifyParticipantDeviceAdded (const Address &addr, const Address &gruu); std::string createNotifyParticipantDeviceRemoved (const Address &addr, const Address &gruu); + inline unsigned int getLastNotify () const { return lastNotify; }; + private: LinphoneCore *core = nullptr; LocalConference *conf = nullptr; - + unsigned int lastNotify = 0; + 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 4c01fb859..fef59f0ef 100644 --- a/src/conference/local-conference-event-handler.cpp +++ b/src/conference/local-conference-event-handler.cpp @@ -21,11 +21,8 @@ #include "conference/participant-p.h" #include "local-conference-event-handler-p.h" #include "object/object-p.h" - #include "private.h" -#include "xml/conference-info.h" - // ============================================================================= using namespace std; @@ -44,14 +41,6 @@ static void doNotify (const string ¬ify, LinphoneEvent *lev) { linphone_event_unref(lev); } -static string createNotify (ConferenceType confInfo) { - stringstream notify; - Xsd::XmlSchema::NamespaceInfomap map; - map[""].name = "urn:ietf:params:xml:ns:conference-info"; - serializeConferenceInfo(notify, confInfo, map); - return notify.str(); -} - // ----------------------------------------------------------------------------- void LocalConferenceEventHandlerPrivate::notifyFullState (const string ¬ify, LinphoneEvent *lev) { @@ -76,6 +65,18 @@ void LocalConferenceEventHandlerPrivate::notifyAll (const string ¬ify) { } } +string LocalConferenceEventHandlerPrivate::createNotify (ConferenceType confInfo) { + if (confInfo.getVersion().present()) { + lastNotify = confInfo.getVersion().get() + 1; + confInfo.setVersion(lastNotify); + } + stringstream notify; + Xsd::XmlSchema::NamespaceInfomap map; + map[""].name = "urn:ietf:params:xml:ns:conference-info"; + serializeConferenceInfo(notify, confInfo, map); + return notify.str(); +} + string LocalConferenceEventHandlerPrivate::createNotifyFullState () { string entity = conf->getConferenceAddress()->asStringUriOnly(); string subject = conf->getSubject(); @@ -248,6 +249,7 @@ LocalConferenceEventHandler::LocalConferenceEventHandler (LinphoneCore *core, Lo xercesc::XMLPlatformUtils::Initialize(); d->conf = localConf; d->core = core; + //init d->lastNotify = last notify } LocalConferenceEventHandler::~LocalConferenceEventHandler () { diff --git a/src/conference/remote-conference-event-handler-p.h b/src/conference/remote-conference-event-handler-p.h index 71c342c42..e89c454c1 100644 --- a/src/conference/remote-conference-event-handler-p.h +++ b/src/conference/remote-conference-event-handler-p.h @@ -26,11 +26,15 @@ LINPHONE_BEGIN_NAMESPACE class RemoteConferenceEventHandlerPrivate : public ObjectPrivate { +public: + inline unsigned int getLastNotify () const { return lastNotify; }; + private: LinphoneCore *core = nullptr; ConferenceListener *listener = nullptr; Address confAddress; LinphoneEvent *lev = nullptr; + unsigned int lastNotify = 0; L_DECLARE_PUBLIC(RemoteConferenceEventHandler); }; diff --git a/src/conference/remote-conference-event-handler.cpp b/src/conference/remote-conference-event-handler.cpp index 6f23d31f8..749cd5bed 100644 --- a/src/conference/remote-conference-event-handler.cpp +++ b/src/conference/remote-conference-event-handler.cpp @@ -38,6 +38,7 @@ RemoteConferenceEventHandler::RemoteConferenceEventHandler (LinphoneCore *core, xercesc::XMLPlatformUtils::Initialize(); d->core = core; d->listener = listener; + // TODO : d->lastNotify = lastNotify } RemoteConferenceEventHandler::~RemoteConferenceEventHandler () { @@ -48,6 +49,7 @@ RemoteConferenceEventHandler::~RemoteConferenceEventHandler () { void RemoteConferenceEventHandler::subscribe (const Address &addr) { L_D(); + // TODO : add last notify d->confAddress = addr; LinphoneAddress *lAddr = linphone_address_new(d->confAddress.asString().c_str()); d->lev = linphone_core_create_subscribe(d->core, lAddr, "conference", 600); @@ -76,6 +78,9 @@ void RemoteConferenceEventHandler::notifyReceived (string xmlBody) { if (confInfo->getConferenceDescription().present() && confInfo->getConferenceDescription().get().getSubject().present()) d->listener->onSubjectChanged(confInfo->getConferenceDescription().get().getSubject().get()); + if (confInfo->getVersion().present()) + d->lastNotify = confInfo->getVersion().get(); + if (!confInfo->getUsers().present()) return;