use same method to add message hints to otr message everywhere it is needed
This commit is contained in:
parent
74cf8320bc
commit
91b0605bc2
|
@ -29,6 +29,7 @@ import java.security.spec.InvalidKeySpecException;
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
|
import eu.siacs.conversations.generator.MessageGenerator;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
import eu.siacs.conversations.xmpp.chatstate.ChatState;
|
import eu.siacs.conversations.xmpp.chatstate.ChatState;
|
||||||
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
||||||
|
@ -179,10 +180,7 @@ public class OtrService extends OtrCryptoEngineImpl implements OtrEngineHost {
|
||||||
packet.setAttribute("to", session.getAccountID() + "/" + session.getUserID());
|
packet.setAttribute("to", session.getAccountID() + "/" + session.getUserID());
|
||||||
}
|
}
|
||||||
packet.setBody(body);
|
packet.setBody(body);
|
||||||
packet.addChild("private", "urn:xmpp:carbons:2");
|
MessageGenerator.addMessageHints(packet);
|
||||||
packet.addChild("no-copy", "urn:xmpp:hints");
|
|
||||||
packet.addChild("no-permanent-store", "urn:xmpp:hints");
|
|
||||||
packet.addChild("no-permanent-storage", "urn:xmpp:hints");
|
|
||||||
try {
|
try {
|
||||||
Jid jid = Jid.fromSessionID(session);
|
Jid jid = Jid.fromSessionID(session);
|
||||||
Conversation conversation = mXmppConnectionService.find(account,jid);
|
Conversation conversation = mXmppConnectionService.find(account,jid);
|
||||||
|
|
|
@ -64,20 +64,24 @@ public class MessageGenerator extends AbstractGenerator {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
packet.setAxolotlMessage(axolotlMessage.toElement());
|
packet.setAxolotlMessage(axolotlMessage.toElement());
|
||||||
packet.addChild("pretty-please-store","urn:xmpp:hints");
|
packet.addChild("pretty-please-store", "urn:xmpp:hints");
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addMessageHints(MessagePacket packet) {
|
||||||
|
packet.addChild("private", "urn:xmpp:carbons:2");
|
||||||
|
packet.addChild("no-copy", "urn:xmpp:hints");
|
||||||
|
packet.addChild("no-permanent-store", "urn:xmpp:hints");
|
||||||
|
packet.addChild("no-permanent-storage", "urn:xmpp:hints"); //do not copy this. this is wrong. it is *store*
|
||||||
|
}
|
||||||
|
|
||||||
public MessagePacket generateOtrChat(Message message) {
|
public MessagePacket generateOtrChat(Message message) {
|
||||||
Session otrSession = message.getConversation().getOtrSession();
|
Session otrSession = message.getConversation().getOtrSession();
|
||||||
if (otrSession == null) {
|
if (otrSession == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
MessagePacket packet = preparePacket(message);
|
MessagePacket packet = preparePacket(message);
|
||||||
packet.addChild("private", "urn:xmpp:carbons:2");
|
addMessageHints(packet);
|
||||||
packet.addChild("no-copy", "urn:xmpp:hints");
|
|
||||||
packet.addChild("no-permanent-store", "urn:xmpp:hints");
|
|
||||||
packet.addChild("no-permanent-storage", "urn:xmpp:hints");
|
|
||||||
try {
|
try {
|
||||||
String content;
|
String content;
|
||||||
if (message.hasFileOnRemoteHost()) {
|
if (message.hasFileOnRemoteHost()) {
|
||||||
|
|
Loading…
Reference in New Issue