Do not display <xml in chat list when last received messaged is an attechement

This commit is contained in:
Christophe Deschamps 2024-09-17 18:27:23 +02:00
parent 41dbeae626
commit 3ae70487c2

View file

@ -140,14 +140,16 @@
const char *url = linphone_chat_message_get_external_body_url(message);
const LinphoneContent *last_content = linphone_chat_message_get_file_transfer_information(message);
// Last message was a file transfer (image) so display a picture...
if ((url || last_content) && message) {
if (linphone_chat_message_get_utf8_text(message))
return [NSString stringWithUTF8String:linphone_chat_message_get_utf8_text(message)];
return @"🗻";
} else {
const char *text = linphone_chat_message_get_utf8_text(message) ?: "";
if (url || last_content) {
if (linphone_chat_message_has_text_content(message) && linphone_chat_message_get_utf8_text(message) && !strstr(linphone_chat_message_get_utf8_text(message),"<?xml version"))
return [NSString stringWithUTF8String:linphone_chat_message_get_utf8_text(message)];
return @"📎";
} else if (linphone_chat_message_has_text_content(message)){
const char *text = linphone_chat_message_get_utf8_text(message) ?: "";
return [NSString stringWithUTF8String:text] ?: [NSString stringWithCString:text encoding:NSASCIIStringEncoding]
?: NSLocalizedString(@"(invalid string)", nil);
} else {
return @"📎";
}
}