diff --git a/app/src/main/java/org/kontalk/service/msgcenter/MessageCenterService.java b/app/src/main/java/org/kontalk/service/msgcenter/MessageCenterService.java index 54b21bca1..0096ea6a4 100644 --- a/app/src/main/java/org/kontalk/service/msgcenter/MessageCenterService.java +++ b/app/src/main/java/org/kontalk/service/msgcenter/MessageCenterService.java @@ -20,8 +20,6 @@ import java.io.File; import java.io.IOException; -import java.io.Reader; -import java.io.Writer; import java.lang.ref.WeakReference; import java.security.GeneralSecurityException; import java.util.Collection; @@ -99,13 +97,13 @@ import org.kontalk.client.E2EEncryption; import org.kontalk.client.EndpointServer; import org.kontalk.client.KontalkConnection; +import org.kontalk.client.PublicKeyPresence; import org.kontalk.client.PublicKeyPublish; import org.kontalk.client.RosterMatch; import org.kontalk.client.OutOfBandData; import org.kontalk.client.PushRegistration; import org.kontalk.client.RawPacket; import org.kontalk.client.ServerlistCommand; -import org.kontalk.client.SubscribePublicKey; import org.kontalk.client.UploadInfo; import org.kontalk.client.VCard4; import org.kontalk.crypto.Coder; @@ -485,7 +483,7 @@ private void configure() { ProviderManager.addIQProvider(ServerlistCommand.ELEMENT_NAME, ServerlistCommand.NAMESPACE, new ServerlistCommand.ResultProvider()); ProviderManager.addExtensionProvider(OutOfBandData.ELEMENT_NAME, OutOfBandData.NAMESPACE, new OutOfBandData.Provider()); ProviderManager.addExtensionProvider(BitsOfBinary.ELEMENT_NAME, BitsOfBinary.NAMESPACE, new BitsOfBinary.Provider()); - ProviderManager.addExtensionProvider(SubscribePublicKey.ELEMENT_NAME, SubscribePublicKey.NAMESPACE, new SubscribePublicKey.Provider()); + ProviderManager.addExtensionProvider(PublicKeyPresence.ELEMENT_NAME, PublicKeyPresence.NAMESPACE, new PublicKeyPresence.Provider()); ProviderManager.addExtensionProvider(E2EEncryption.ELEMENT_NAME, E2EEncryption.NAMESPACE, new E2EEncryption.Provider()); // we want to manually handle roster stuff Roster.setDefaultSubscriptionMode(SubscriptionMode.manual); diff --git a/app/src/main/java/org/kontalk/service/msgcenter/PresenceListener.java b/app/src/main/java/org/kontalk/service/msgcenter/PresenceListener.java index 53caf6656..2d042aa0b 100644 --- a/app/src/main/java/org/kontalk/service/msgcenter/PresenceListener.java +++ b/app/src/main/java/org/kontalk/service/msgcenter/PresenceListener.java @@ -21,7 +21,6 @@ import java.io.IOException; import org.jivesoftware.smack.SmackException.NotConnectedException; -import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Packet; import org.jivesoftware.smack.packet.PacketExtension; import org.jivesoftware.smack.packet.Presence; @@ -37,9 +36,8 @@ import android.content.Intent; import android.util.Log; +import org.kontalk.client.PublicKeyPresence; import org.kontalk.client.PublicKeyPublish; -import org.kontalk.client.SubscribePublicKey; -import org.kontalk.client.VCard4; import org.kontalk.crypto.PGP; import org.kontalk.data.Contact; import org.kontalk.provider.MyMessages.CommonColumns; @@ -74,12 +72,12 @@ public PresenceListener(MessageCenterService instance) { } private Packet createSubscribe(Presence p) { - PacketExtension _pkey = p.getExtension(SubscribePublicKey.ELEMENT_NAME, SubscribePublicKey.NAMESPACE); + PacketExtension _pkey = p.getExtension(PublicKeyPresence.ELEMENT_NAME, PublicKeyPresence.NAMESPACE); try { - if (_pkey instanceof SubscribePublicKey) { - SubscribePublicKey pkey = (SubscribePublicKey) _pkey; + if (_pkey instanceof PublicKeyPresence) { + PublicKeyPresence pkey = (PublicKeyPresence) _pkey; PGPPublicKeyRing pubRing = PGP.readPublicKeyring(pkey.getKey()); PGPPublicKey publicKey = PGP.getMasterKey(pubRing); @@ -169,9 +167,9 @@ private void handleSubscribe(Presence p) // extract public key String name = null, fingerprint = null; byte[] publicKey = null; - PacketExtension _pkey = p.getExtension(SubscribePublicKey.ELEMENT_NAME, SubscribePublicKey.NAMESPACE); - if (_pkey instanceof SubscribePublicKey) { - SubscribePublicKey pkey = (SubscribePublicKey) _pkey; + PacketExtension _pkey = p.getExtension(PublicKeyPresence.ELEMENT_NAME, PublicKeyPresence.NAMESPACE); + if (_pkey instanceof PublicKeyPresence) { + PublicKeyPresence pkey = (PublicKeyPresence) _pkey; byte[] _publicKey = pkey.getKey(); // extract the name from the uid PGPPublicKeyRing ring = PGP.readPublicKeyring(_publicKey); @@ -274,10 +272,10 @@ public static Intent createIntent(Context ctx, Presence p) { i.putExtra(EXTRA_STAMP, timestamp); // public key extension (for fingerprint) - PacketExtension _pkey = p.getExtension(SubscribePublicKey.ELEMENT_NAME, SubscribePublicKey.NAMESPACE); + PacketExtension _pkey = p.getExtension(PublicKeyPresence.ELEMENT_NAME, PublicKeyPresence.NAMESPACE); - if (_pkey instanceof SubscribePublicKey) { - SubscribePublicKey pkey = (SubscribePublicKey) _pkey; + if (_pkey instanceof PublicKeyPresence) { + PublicKeyPresence pkey = (PublicKeyPresence) _pkey; String fingerprint = pkey.getFingerprint(); if (fingerprint != null) { @@ -312,7 +310,7 @@ private int updateUsersDatabase(Presence p) { values.put(Users.LAST_SEEN, timestamp); // public key extension (for fingerprint) - SubscribePublicKey pkey = p.getExtension(SubscribePublicKey.ELEMENT_NAME, SubscribePublicKey.NAMESPACE); + PublicKeyPresence pkey = p.getExtension(PublicKeyPresence.ELEMENT_NAME, PublicKeyPresence.NAMESPACE); if (pkey != null) { String fingerprint = pkey.getFingerprint(); if (fingerprint != null) diff --git a/client-common-java b/client-common-java index e8d42c670..ce3371082 160000 --- a/client-common-java +++ b/client-common-java @@ -1 +1 @@ -Subproject commit e8d42c670ef8c648d9a0bb0197c9e68b03219eea +Subproject commit ce33710827e719a1347c8e0187b5dedf8144eb02