use type=chat more often to go along with new, simple carbon and mam rules

* change chat states to type=chat and chat markers to type=chat
* use same type as requesting stanza for delivery receipts (which should make them type=chat most of the time)
This commit is contained in:
Daniel Gultsch 2015-07-22 14:15:00 +02:00
parent a1e63944a2
commit 63206e6d4a
2 changed files with 15 additions and 12 deletions

View File

@ -115,6 +115,7 @@ public class MessageGenerator extends AbstractGenerator {
public MessagePacket generateChatState(Conversation conversation) {
final Account account = conversation.getAccount();
MessagePacket packet = new MessagePacket();
packet.setType(MessagePacket.TYPE_CHAT);
packet.setTo(conversation.getJid().toBareJid());
packet.setFrom(account.getJid());
packet.addChild(ChatState.toElement(conversation.getOutgoingChatState()));
@ -123,7 +124,7 @@ public class MessageGenerator extends AbstractGenerator {
public MessagePacket confirm(final Account account, final Jid to, final String id) {
MessagePacket packet = new MessagePacket();
packet.setType(MessagePacket.TYPE_NORMAL);
packet.setType(MessagePacket.TYPE_CHAT);
packet.setTo(to);
packet.setFrom(account.getJid());
Element received = packet.addChild("displayed","urn:xmpp:chat-markers:0");
@ -131,8 +132,7 @@ public class MessageGenerator extends AbstractGenerator {
return packet;
}
public MessagePacket conferenceSubject(Conversation conversation,
String subject) {
public MessagePacket conferenceSubject(Conversation conversation,String subject) {
MessagePacket packet = new MessagePacket();
packet.setType(MessagePacket.TYPE_GROUPCHAT);
packet.setTo(conversation.getJid().toBareJid());
@ -166,10 +166,9 @@ public class MessageGenerator extends AbstractGenerator {
return packet;
}
public MessagePacket received(Account account,
MessagePacket originalMessage, String namespace) {
public MessagePacket received(Account account, MessagePacket originalMessage, String namespace, int type) {
MessagePacket receivedPacket = new MessagePacket();
receivedPacket.setType(MessagePacket.TYPE_NORMAL);
receivedPacket.setType(type);
receivedPacket.setTo(originalMessage.getFrom());
receivedPacket.setFrom(account.getJid());
Element received = receivedPacket.addChild("received", namespace);

View File

@ -263,7 +263,7 @@ public class MessageParser extends AbstractParser implements
timestamp = AbstractParser.getTimestamp(packet, System.currentTimeMillis());
}
final String body = packet.getBody();
final Element mucUserElement = packet.findChild("x","http://jabber.org/protocol/muc#user");
final Element mucUserElement = packet.findChild("x", "http://jabber.org/protocol/muc#user");
final String pgpEncrypted = packet.findChildContent("x", "jabber:x:encrypted");
final Element axolotlEncrypted = packet.findChild("axolotl_message", AxolotlService.PEP_PREFIX);
int status;
@ -369,15 +369,19 @@ public class MessageParser extends AbstractParser implements
mXmppConnectionService.updateConversationUi();
}
if (mXmppConnectionService.confirmMessages() && remoteMsgId != null && !isForwarded) {
if (mXmppConnectionService.confirmMessages() && remoteMsgId != null && !isForwarded && !isTypeGroupChat) {
if (packet.hasChild("markable", "urn:xmpp:chat-markers:0")) {
MessagePacket receipt = mXmppConnectionService
.getMessageGenerator().received(account, packet, "urn:xmpp:chat-markers:0");
MessagePacket receipt = mXmppConnectionService.getMessageGenerator().received(account,
packet,
"urn:xmpp:chat-markers:0",
MessagePacket.TYPE_CHAT);
mXmppConnectionService.sendMessagePacket(account, receipt);
}
if (packet.hasChild("request", "urn:xmpp:receipts")) {
MessagePacket receipt = mXmppConnectionService
.getMessageGenerator().received(account, packet, "urn:xmpp:receipts");
MessagePacket receipt = mXmppConnectionService.getMessageGenerator().received(account,
packet,
"urn:xmpp:receipts",
packet.getType());
mXmppConnectionService.sendMessagePacket(account, receipt);
}
}