better generation of the notify body

This commit is contained in:
Benjamin Reis 2018-03-16 20:38:26 +01:00
parent cb720429fa
commit 477e5f698c
4 changed files with 11 additions and 11 deletions

View file

@ -184,7 +184,8 @@ string LocalConferenceEventHandlerPrivate::createNotifyMultipart (int notifyId)
}
if (contents.empty())
return "";
return Utils::getEmptyConstRefObject<string>();
return ContentManager::contentListToMultipart(contents).getBodyAsString();
}

View file

@ -35,7 +35,7 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
namespace {
constexpr const char MultipartBoundary[] = "---------------------------14737809831412343453453";
constexpr const char MultipartBoundaryListEventHandler[] = "---------------------------14737809831412343453453";
}
// -----------------------------------------------------------------------------
@ -82,7 +82,7 @@ void LocalConferenceListEventHandler::subscribeReceived (const string &xmlBody)
}
contents.push_front(rlmiContent);
Content multipart = ContentManager::contentListToMultipart(contents);
Content multipart = ContentManager::contentListToMultipart(contents, MultipartBoundaryListEventHandler);
(void) multipart;
}

View file

@ -29,10 +29,6 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
namespace {
constexpr const char MultipartBoundary[] = "---------------------------14737809831466499882746641449";
}
// -----------------------------------------------------------------------------
list<Content> ContentManager::multipartToContentList (const Content &content) {
@ -69,9 +65,9 @@ list<Content> ContentManager::multipartToContentList (const Content &content) {
return contents;
}
Content ContentManager::contentListToMultipart (const list<Content> &contents) {
Content ContentManager::contentListToMultipart (const list<Content> &contents, const string &boundary) {
belle_sip_multipart_body_handler_t *mpbh = belle_sip_multipart_body_handler_new(
nullptr, nullptr, nullptr, MultipartBoundary
nullptr, nullptr, nullptr, boundary.c_str()
);
belle_sip_object_ref(mpbh);
@ -110,7 +106,7 @@ Content ContentManager::contentListToMultipart (const list<Content> &contents) {
belle_sip_object_unref(mpbh);
ContentType contentType = ContentType::Multipart;
contentType.setParameter("boundary=" + string(MultipartBoundary));
contentType.setParameter("boundary=" + boundary);
content.setContentType(contentType);
return content;

View file

@ -30,9 +30,12 @@ LINPHONE_BEGIN_NAMESPACE
class Content;
namespace {
constexpr const char MultipartBoundary[] = "---------------------------14737809831466499882746641449";
}
namespace ContentManager {
std::list<Content> multipartToContentList (const Content &content);
Content contentListToMultipart (const std::list<Content> &contents);
Content contentListToMultipart (const std::list<Content> &contents, const std::string &boundary = MultipartBoundary);
}
LINPHONE_END_NAMESPACE