modify boyy on muc reflection
This commit is contained in:
parent
b34f6e0720
commit
e947a3f808
|
@ -488,13 +488,11 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
||||||
if (conversation.getMucOptions().isSelf(counterpart)) {
|
if (conversation.getMucOptions().isSelf(counterpart)) {
|
||||||
status = Message.STATUS_SEND_RECEIVED;
|
status = Message.STATUS_SEND_RECEIVED;
|
||||||
isCarbon = true; //not really carbon but received from another resource
|
isCarbon = true; //not really carbon but received from another resource
|
||||||
//TODO this would be the place to change the body after something like mod_pastebin
|
if (mXmppConnectionService.markMessage(conversation, remoteMsgId, status, serverMsgId, body)) {
|
||||||
if (mXmppConnectionService.markMessage(conversation, remoteMsgId, status, serverMsgId)) {
|
|
||||||
return;
|
return;
|
||||||
} else if (remoteMsgId == null || Config.IGNORE_ID_REWRITE_IN_MUC) {
|
} else if (remoteMsgId == null || Config.IGNORE_ID_REWRITE_IN_MUC) {
|
||||||
LocalizedContent localizedBody = packet.getBody();
|
if (body != null) {
|
||||||
if (localizedBody != null) {
|
Message message = conversation.findSentMessageWithBody(body.content);
|
||||||
Message message = conversation.findSentMessageWithBody(localizedBody.content);
|
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
mXmppConnectionService.markMessage(message, status);
|
mXmppConnectionService.markMessage(message, status);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -136,6 +136,7 @@ import eu.siacs.conversations.utils.TorServiceUtils;
|
||||||
import eu.siacs.conversations.utils.WakeLockHelper;
|
import eu.siacs.conversations.utils.WakeLockHelper;
|
||||||
import eu.siacs.conversations.utils.XmppUri;
|
import eu.siacs.conversations.utils.XmppUri;
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
|
import eu.siacs.conversations.xml.LocalizedContent;
|
||||||
import eu.siacs.conversations.xml.Namespace;
|
import eu.siacs.conversations.xml.Namespace;
|
||||||
import eu.siacs.conversations.xmpp.Jid;
|
import eu.siacs.conversations.xmpp.Jid;
|
||||||
import eu.siacs.conversations.xmpp.OnBindListener;
|
import eu.siacs.conversations.xmpp.OnBindListener;
|
||||||
|
@ -3950,16 +3951,28 @@ public class XmppConnectionService extends Service {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean markMessage(Conversation conversation, String uuid, int status, String serverMessageId) {
|
public boolean markMessage(final Conversation conversation, final String uuid, final int status, final String serverMessageId) {
|
||||||
|
return markMessage(conversation, uuid, status, serverMessageId, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean markMessage(final Conversation conversation, final String uuid, final int status, final String serverMessageId, final LocalizedContent body) {
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
Message message = conversation.findSentMessageWithUuid(uuid);
|
final Message message = conversation.findSentMessageWithUuid(uuid);
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
if (message.getServerMsgId() == null) {
|
if (message.getServerMsgId() == null) {
|
||||||
message.setServerMsgId(serverMessageId);
|
message.setServerMsgId(serverMessageId);
|
||||||
}
|
}
|
||||||
|
if (body != null && body.content != null && !body.content.equals(message.getBody())) {
|
||||||
|
message.setBody(body.content);
|
||||||
|
if (body.count > 1) {
|
||||||
|
message.setBodyLanguage(body.language);
|
||||||
|
}
|
||||||
|
markMessage(message, status, null, true);
|
||||||
|
} else {
|
||||||
markMessage(message, status);
|
markMessage(message, status);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -3973,6 +3986,10 @@ public class XmppConnectionService extends Service {
|
||||||
|
|
||||||
|
|
||||||
public void markMessage(final Message message, final int status, final String errorMessage) {
|
public void markMessage(final Message message, final int status, final String errorMessage) {
|
||||||
|
markMessage(message, status, errorMessage, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void markMessage(final Message message, final int status, final String errorMessage, final boolean includeBody) {
|
||||||
final int oldStatus = message.getStatus();
|
final int oldStatus = message.getStatus();
|
||||||
if (status == Message.STATUS_SEND_FAILED && (oldStatus == Message.STATUS_SEND_RECEIVED || oldStatus == Message.STATUS_SEND_DISPLAYED)) {
|
if (status == Message.STATUS_SEND_FAILED && (oldStatus == Message.STATUS_SEND_RECEIVED || oldStatus == Message.STATUS_SEND_DISPLAYED)) {
|
||||||
return;
|
return;
|
||||||
|
@ -3982,7 +3999,7 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
message.setErrorMessage(errorMessage);
|
message.setErrorMessage(errorMessage);
|
||||||
message.setStatus(status);
|
message.setStatus(status);
|
||||||
databaseBackend.updateMessage(message, false);
|
databaseBackend.updateMessage(message, includeBody);
|
||||||
updateConversationUi();
|
updateConversationUi();
|
||||||
if (oldStatus != status && status == Message.STATUS_SEND_FAILED) {
|
if (oldStatus != status && status == Message.STATUS_SEND_FAILED) {
|
||||||
mNotificationService.pushFailedDelivery(message);
|
mNotificationService.pushFailedDelivery(message);
|
||||||
|
|
Loading…
Reference in New Issue