Commit b1f48f57 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Fixed ChatMessage methods getContentType and getText when receiving a multipart

parent 0db6249a
......@@ -141,12 +141,21 @@ string ChatMessagePrivate::getSalCustomHeaderValue(const string& name) {
// -----------------------------------------------------------------------------
const ContentType& ChatMessagePrivate::getContentType() {
if (internalContent.getContentType().isValid()) {
cContentType = internalContent.getContentType();
} else {
if (direction == ChatMessage::Direction::Incoming) {
if (contents.size() > 0) {
Content content = contents.front();
cContentType = content.getContentType();
} else {
cContentType = internalContent.getContentType();
}
} else {
if (internalContent.getContentType().isValid()) {
cContentType = internalContent.getContentType();
} else {
if (contents.size() > 0) {
Content content = contents.front();
cContentType = content.getContentType();
}
}
}
return cContentType;
......@@ -157,12 +166,21 @@ void ChatMessagePrivate::setContentType(const ContentType &contentType) {
}
const string& ChatMessagePrivate::getText() {
if (!internalContent.isEmpty()) {
cText = internalContent.getBodyAsString();
} else {
if (direction == ChatMessage::Direction::Incoming) {
if (contents.size() > 0) {
Content content = contents.front();
cText = content.getBodyAsString();
} else {
cText = internalContent.getBodyAsString();
}
} else {
if (!internalContent.isEmpty()) {
cText = internalContent.getBodyAsString();
} else {
if (contents.size() > 0) {
Content content = contents.front();
cText = content.getBodyAsString();
}
}
}
return cText;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment