only overwrite body in text messages

This commit is contained in:
Daniel Gultsch 2021-03-19 19:51:13 +01:00
parent e217551a82
commit aaac8296b3
4 changed files with 10 additions and 2 deletions

View File

@ -890,6 +890,11 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable
return type == TYPE_FILE || type == TYPE_IMAGE || type == TYPE_PRIVATE_FILE; return type == TYPE_FILE || type == TYPE_IMAGE || type == TYPE_PRIVATE_FILE;
} }
public boolean isTypeText() {
return type == TYPE_TEXT || type == TYPE_PRIVATE;
}
public boolean hasFileOnRemoteHost() { public boolean hasFileOnRemoteHost() {
return isFileOrImage() && getFileParams().url != null; return isFileOrImage() && getFileParams().url != null;
} }

View File

@ -363,6 +363,7 @@ public class HttpDownloadConnection implements Transferable {
changeStatus(STATUS_OFFER); changeStatus(STATUS_OFFER);
} catch (final Exception e) { } catch (final Exception e) {
Log.d(Config.LOGTAG,"problem downloading",e); Log.d(Config.LOGTAG,"problem downloading",e);
//TODO do not show toast for cancelled stuff
if (interactive) { if (interactive) {
showToastForException(e); showToastForException(e);
} else { } else {

View File

@ -68,7 +68,7 @@ public class ChannelDiscoveryService {
} }
void discover(@NonNull final String query, Method method, OnChannelSearchResultsFound onChannelSearchResultsFound) { void discover(@NonNull final String query, Method method, OnChannelSearchResultsFound onChannelSearchResultsFound) {
List<Room> result = cache.getIfPresent(key(method, query)); final List<Room> result = cache.getIfPresent(key(method, query));
if (result != null) { if (result != null) {
onChannelSearchResultsFound.onChannelSearchResultsFound(result); onChannelSearchResultsFound.onChannelSearchResultsFound(result);
return; return;

View File

@ -3961,7 +3961,9 @@ public class XmppConnectionService extends Service {
if (message.getServerMsgId() == null) { if (message.getServerMsgId() == null) {
message.setServerMsgId(serverMessageId); message.setServerMsgId(serverMessageId);
} }
if (message.getEncryption() == Message.ENCRYPTION_NONE && isBodyModified(message, body)) { if (message.getEncryption() == Message.ENCRYPTION_NONE
&& message.isTypeText()
&& isBodyModified(message, body)) {
message.setBody(body.content); message.setBody(body.content);
if (body.count > 1) { if (body.count > 1) {
message.setBodyLanguage(body.language); message.setBodyLanguage(body.language);