From ba7278f5b526b24f68779287c9c7d44e3ccbf079 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Fri, 23 Mar 2018 15:03:08 +0100 Subject: [PATCH] better managament of content --- .../local-conference-list-event-handler.cpp | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/conference/handlers/local-conference-list-event-handler.cpp b/src/conference/handlers/local-conference-list-event-handler.cpp index 1b1e68154..eb83c3109 100644 --- a/src/conference/handlers/local-conference-list-event-handler.cpp +++ b/src/conference/handlers/local-conference-list-event-handler.cpp @@ -74,8 +74,8 @@ void LocalConferenceListEventHandler::subscribeReceived (LinphoneEvent *lev, con bctbx_free(deviceAddrStr); list contents; - Content rlmiContent; - rlmiContent.setContentType(ContentType::Rlmi); + Content *rlmiContent = new Content(); + rlmiContent->setContentType(ContentType::Rlmi); // Create Rlmi body Xsd::Rlmi::List::ResourceSequence resources; @@ -122,19 +122,19 @@ void LocalConferenceListEventHandler::subscribeReceived (LinphoneEvent *lev, con device->setConferenceSubscribeEvent((subscriptionState == LinphoneSubscriptionIncomingReceived) ? lev : nullptr); noContent = false; - Content content; + Content *content = new Content(); if (notifyId > 0) { ContentType contentType(ContentType::Multipart); contentType.addParameter("boundary", string(MultipartBoundary)); - content.setContentType(contentType); + content->setContentType(contentType); } else - content.setContentType(ContentType::ConferenceInfo); + content->setContentType(ContentType::ConferenceInfo); - content.setBody(notifyBody); + content->setBody(notifyBody); char token[17]; belle_sip_random_token(token, sizeof(token)); - content.addHeader("Content-Id", token); - contents.push_back(&content); + content->addHeader("Content-Id", token); + contents.push_back(content); // Add entry into the Rlmi content of the notify body Xsd::Rlmi::Resource resource(addr.asStringUriOnly()); @@ -157,13 +157,14 @@ void LocalConferenceListEventHandler::subscribeReceived (LinphoneEvent *lev, con Xsd::XmlSchema::NamespaceInfomap map; stringstream rlmiBody; Xsd::Rlmi::serializeList(rlmiBody, list, map); - rlmiContent.setBody(rlmiBody.str()); + rlmiContent->setBody(rlmiBody.str()); - contents.push_front(&rlmiContent); + contents.push_front(rlmiContent); Content multipart = ContentManager::contentListToMultipart(contents, MultipartBoundaryListEventHandler); LinphoneContent *cContent = L_GET_C_BACK_PTR(&multipart); linphone_event_notify(lev, cContent); linphone_content_unref(cContent); + contents.clear(); } // -----------------------------------------------------------------------------