diff options
Diffstat (limited to 'src/main/java/eu/siacs/conversations/generator')
3 files changed, 17 insertions, 8 deletions
diff --git a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java index 5741af53..c30ae5d8 100644 --- a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java @@ -15,6 +15,8 @@ import java.util.TimeZone; import eu.siacs.conversations.crypto.axolotl.AxolotlService; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.utils.PhoneHelper; +import de.thedevstack.conversationsplus.ConversationsPlusApplication; +import de.tzur.conversations.Settings; public abstract class AbstractGenerator { private final String[] FEATURES = { @@ -61,7 +63,7 @@ public abstract class AbstractGenerator { public String getCapHash() { StringBuilder s = new StringBuilder(); - s.append("client/" + IDENTITY_TYPE + "//" + getIdentityName() + "<"); + s.append("client/" + IDENTITY_TYPE + "//" + ConversationsPlusApplication.getNameAndVersion() + "<"); MessageDigest md; try { md = MessageDigest.getInstance("SHA-1"); @@ -73,7 +75,7 @@ public abstract class AbstractGenerator { s.append(feature + "<"); } byte[] sha1 = md.digest(s.toString().getBytes()); - return new String(Base64.encode(sha1, Base64.DEFAULT)).trim(); + return new String(Base64.encode(sha1, Base64.DEFAULT)); } public static String getTimestamp(long time) { @@ -84,7 +86,7 @@ public abstract class AbstractGenerator { public List<String> getFeatures() { ArrayList<String> features = new ArrayList<>(); features.addAll(Arrays.asList(FEATURES)); - if (mXmppConnectionService.confirmMessages()) { + if (Settings.CONFIRM_MESSAGE_RECEIVED) { features.addAll(Arrays.asList(MESSAGE_CONFIRMATION_FEATURES)); } Collections.sort(features); diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java index 345f68ae..6bc1f0fc 100644 --- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -15,6 +15,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; +import de.thedevstack.conversationsplus.ConversationsPlusApplication; + import eu.siacs.conversations.Config; import eu.siacs.conversations.crypto.axolotl.AxolotlService; import eu.siacs.conversations.entities.Account; @@ -45,7 +47,7 @@ public class IqGenerator extends AbstractGenerator { final Element identity = query.addChild("identity"); identity.setAttribute("category", "client"); identity.setAttribute("type", IDENTITY_TYPE); - identity.setAttribute("name", getIdentityName()); + identity.setAttribute("name", ConversationsPlusApplication.getNameAndVersion()); for (final String feature : getFeatures()) { query.addChild("feature").setAttribute("var", feature); } @@ -55,8 +57,8 @@ public class IqGenerator extends AbstractGenerator { public IqPacket versionResponse(final IqPacket request) { final IqPacket packet = request.generateResponse(IqPacket.TYPE.RESULT); Element query = packet.query("jabber:iq:version"); - query.addChild("name").setContent(IDENTITY_NAME); - query.addChild("version").setContent(getIdentityVersion()); + query.addChild("name").setContent(ConversationsPlusApplication.getName()); + query.addChild("version").setContent(ConversationsPlusApplication.getVersion()); return packet; } diff --git a/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java b/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java index b849f56f..9b5dabb0 100644 --- a/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java @@ -9,6 +9,11 @@ import java.util.Date; import java.util.Locale; import java.util.TimeZone; +import net.java.otr4j.OtrException; +import net.java.otr4j.session.Session; + +import de.thedevstack.conversationsplus.ConversationsPlusPreferences; + import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Conversation; @@ -32,13 +37,13 @@ public class MessageGenerator extends AbstractGenerator { packet.setTo(message.getCounterpart()); packet.setType(MessagePacket.TYPE_CHAT); packet.addChild("markable", "urn:xmpp:chat-markers:0"); - if (this.mXmppConnectionService.indicateReceived()) { + if (ConversationsPlusPreferences.indicateReceived()) { packet.addChild("request", "urn:xmpp:receipts"); } } else if (message.getType() == Message.TYPE_PRIVATE) { packet.setTo(message.getCounterpart()); packet.setType(MessagePacket.TYPE_CHAT); - if (this.mXmppConnectionService.indicateReceived()) { + if (ConversationsPlusPreferences.indicateReceived()) { packet.addChild("request", "urn:xmpp:receipts"); } } else { |