Skip to content

Commit

Permalink
Fix upgrade from legacy version
Browse files Browse the repository at this point in the history
Signed-off-by: Daniele Ricci <[email protected]>
  • Loading branch information
daniele-athome committed Mar 22, 2015
1 parent a6e6e61 commit 5daa9b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public void run() throws CertificateException, SignatureException,
// not calling super
revokeCurrentKey();

configure();
setupKeyPairReceiver();

// begin key pair generation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.jivesoftware.smackx.xdata.FormField;
import org.jivesoftware.smackx.xdata.packet.DataForm;
import org.kontalk.authenticator.Authenticator;
import org.kontalk.client.SmackInitializer;
import org.kontalk.crypto.PGP.PGPKeyPairRing;
import org.kontalk.crypto.PersonalKey;
import org.kontalk.crypto.X509Bridge;
Expand Down Expand Up @@ -68,9 +69,18 @@ public PGPKeyPairRing getKeyPair() {
return mKeyRing;
}

protected void configure() {
SmackInitializer.initializeRegistration();
}

protected void unconfigure() {
SmackInitializer.deinitializeRegistration();
}

public void run() throws CertificateException, SignatureException,
PGPException, IOException, NoSuchProviderException {
revokeCurrentKey();
configure();
setupConnectedReceiver();
}

Expand All @@ -79,6 +89,7 @@ public void abort() {
unregisterReceiver(mConnReceiver);
mConnReceiver = null;
}
unconfigure();
}

private Stanza prepareKeyPacket() {
Expand Down Expand Up @@ -212,6 +223,7 @@ public void processPacket(Stanza packet) {
// invalidate cached personal key
getApplication().invalidatePersonalKey();

unconfigure();
finish();

// restart message center
Expand Down

0 comments on commit 5daa9b5

Please sign in to comment.