diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-05-08 14:40:03 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-05-08 14:40:03 +0200 |
commit | 1b2ce1a309785de08cbb51e3bd8c3e811da359d0 (patch) | |
tree | 344a2ab5fabaa8923655d502ce74327c61e31907 /src/eu/siacs/conversations/ui/XmppActivity.java | |
parent | fa81beac3d5a83498b3973d1ae64cf03bd16ab08 (diff) | |
parent | 99a56a2bde1af0e260f795a4c6fbdae63b7d5453 (diff) |
Merge pull request #1 from siacs/development
pull
Diffstat (limited to 'src/eu/siacs/conversations/ui/XmppActivity.java')
-rw-r--r-- | src/eu/siacs/conversations/ui/XmppActivity.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java index 70c4614d5..70b2e24eb 100644 --- a/src/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/eu/siacs/conversations/ui/XmppActivity.java @@ -1,28 +1,37 @@ package eu.siacs.conversations.ui; +import org.openintents.openpgp.OpenPgpError; + import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.OnPgpEngineResult; +import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService.XmppConnectionBinder; import eu.siacs.conversations.utils.ExceptionHelper; import android.app.Activity; import android.app.AlertDialog; +import android.app.PendingIntent; import android.app.AlertDialog.Builder; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; +import android.content.IntentSender.SendIntentException; import android.content.Intent; import android.content.ServiceConnection; import android.net.Uri; import android.os.Bundle; import android.os.IBinder; +import android.util.Log; import android.view.MenuItem; import android.view.View; import android.view.inputmethod.InputMethodManager; public abstract class XmppActivity extends Activity { + public static final int REQUEST_ANNOUNCE_PGP = 0x73731; + protected final static String LOGTAG = "xmppService"; public XmppConnectionService xmppConnectionService; @@ -152,4 +161,30 @@ public abstract class XmppActivity extends Activity { | Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(viewConversationIntent); } + + protected void announcePgp(final Account account) { + xmppConnectionService.getPgpEngine().generateSignature(account, "online", new OnPgpEngineResult() { + + @Override + public void userInputRequried(PendingIntent pi) { + try { + startIntentSenderForResult(pi.getIntentSender(), REQUEST_ANNOUNCE_PGP, null, 0, 0, 0); + } catch (SendIntentException e) { + Log.d("xmppService","coulnd start intent for pgp anncouncment"); + } + } + + @Override + public void success() { + xmppConnectionService.databaseBackend.updateAccount(account); + xmppConnectionService.sendPgpPresence(account, account.getPgpSignature()); + } + + @Override + public void error(OpenPgpError openPgpError) { + // TODO Auto-generated method stub + + } + }); + } } |