Merge remote-tracking branch 'origin/dev_content_cpp' into dev_chatroom_list_subscription

This commit is contained in:
Benjamin Reis 2018-03-26 17:03:34 +02:00
commit 951ead79c2
4 changed files with 14 additions and 6 deletions

View file

@ -962,7 +962,7 @@ void linphone_friend_list_notify_presence_received(LinphoneFriendList *list, Lin
const char *subtype = linphone_content_get_subtype(body);
if ((strcmp(type, "multipart") != 0) || (strcmp(subtype, "related") != 0)) {
ms_warning("multipart presence notified but it is not 'multipart/related'");
ms_warning("multipart presence notified but it is not 'multipart/related', instead is '%s/%s'", type, subtype);
return;
}

View file

@ -741,7 +741,7 @@ void ChatMessagePrivate::send () {
auto msgOp = dynamic_cast<SalMessageOpInterface *>(op);
if (!externalBodyUrl.empty()) {
char *content_type = ms_strdup_printf("message/external-body; access-type=URL; URL=\"%s\"", externalBodyUrl.c_str());
char *content_type = ms_strdup_printf("message/external-body;access-type=URL;URL=\"%s\"", externalBodyUrl.c_str());
msgOp->send_message(content_type, NULL);
ms_free(content_type);
} else if (internalContent.getContentType().isValid()) {

View file

@ -80,7 +80,7 @@ ContentType::ContentType (const string &contentType) : Header(*new ContentTypePr
token = params.substr(0, posParam);
}
addParameter(HeaderParam(token));
params.erase(0, pos + 1);
params.erase(0, posParam + 1);
} while (posParam != std::string::npos);
}
}
@ -131,8 +131,7 @@ ContentType &ContentType::operator= (const ContentType &other) {
bool ContentType::operator== (const ContentType &other) const {
return getType() == other.getType() &&
getSubType() == other.getSubType() &&
getParameters() == other.getParameters();
getSubType() == other.getSubType();
}
bool ContentType::operator!= (const ContentType &other) const {

View file

@ -352,9 +352,18 @@ void list_to_multipart () {
BC_ASSERT_TRUE(originalStr == generatedStr);
}
static void content_type_parsing(void) {
const string type = "message/external-body;access-type=URL;URL=\"https://www.linphone.org/img/linphone-open-source-voip-projectX2.png\"";
ContentType contentType = ContentType(type);
BC_ASSERT_STRING_EQUAL("message", contentType.getType().c_str());
BC_ASSERT_STRING_EQUAL("external-body", contentType.getSubType().c_str());
BC_ASSERT_TRUE(type == contentType.asString());
}
test_t content_manager_tests[] = {
TEST_NO_TAG("Multipart to list", multipart_to_list),
TEST_NO_TAG("List to multipart", list_to_multipart)
TEST_NO_TAG("List to multipart", list_to_multipart),
TEST_NO_TAG("Content type parsing", content_type_parsing)
};
test_suite_t content_manager_test_suite = {