diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-05-06 21:34:30 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-05-06 21:34:30 +0200 |
commit | 461f2ffb16ebb877a1ab28e8815b07196e424a36 (patch) | |
tree | 6532617f4be9137d87077d0b49470ef2f47af8a0 /src/eu/siacs/conversations/ui/ConversationFragment.java | |
parent | f7033cb7e06740576d23e1f8fbf473db337e13fe (diff) |
basic pgp encrypted file transfer
Diffstat (limited to 'src/eu/siacs/conversations/ui/ConversationFragment.java')
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationFragment.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index c2373cf1..dab03552 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -269,7 +269,7 @@ public class ConversationFragment extends Fragment { String filesize = ""; - if (item.getType() == Message.TYPE_IMAGE) { + if ((item.getType() == Message.TYPE_IMAGE)&&((item.getEncryption() == Message.ENCRYPTION_DECRYPTED)||(item.getEncryption() == Message.ENCRYPTION_NONE))) { String[] fileParams = item.getBody().split(","); if ((fileParams.length>=1)&&(item.getStatus() != Message.STATUS_PREPARING)) { long size = Long.parseLong(fileParams[0]); @@ -510,7 +510,7 @@ public class ConversationFragment extends Fragment { ConversationActivity activity = (ConversationActivity) getActivity(); if (this.conversation != null) { for (Message message : this.conversation.getMessages()) { - if (message.getEncryption() == Message.ENCRYPTION_PGP) { + if ((message.getEncryption() == Message.ENCRYPTION_PGP)&&(message.getStatus() == Message.STATUS_RECIEVED)) { decryptMessage(message); break; } @@ -594,7 +594,7 @@ public class ConversationFragment extends Fragment { } protected void sendPgpMessage(final Message message) { - ConversationActivity activity = (ConversationActivity) getActivity(); + final ConversationActivity activity = (ConversationActivity) getActivity(); final XmppConnectionService xmppService = activity.xmppConnectionService; final Contact contact = message.getConversation().getContact(); final Account account = message.getConversation().getAccount(); @@ -604,7 +604,6 @@ public class ConversationFragment extends Fragment { @Override public void userInputRequried(PendingIntent pi) { - Log.d("xmppService","hasKey returned user input required"); try { getActivity().startIntentSenderForResult(pi.getIntentSender(), ConversationActivity.REQUEST_SEND_MESSAGE, null, 0, @@ -616,13 +615,12 @@ public class ConversationFragment extends Fragment { @Override public void success() { - Log.d("xmppService","hasKey returned success"); - xmppService.getPgpEngine().encrypt(account, contact.getPgpKeyId(), message,new OnPgpEngineResult() { + xmppService.getPgpEngine().encrypt(account, message,new OnPgpEngineResult() { @Override public void userInputRequried(PendingIntent pi) { try { - getActivity().startIntentSenderForResult(pi.getIntentSender(), + activity.startIntentSenderForResult(pi.getIntentSender(), ConversationActivity.REQUEST_SEND_MESSAGE, null, 0, 0, 0); } catch (SendIntentException e1) { |