diff --git a/gen/de/gultsch/chat/R.java b/gen/de/gultsch/chat/R.java
index 3562366f1..30d3a9eaf 100644
--- a/gen/de/gultsch/chat/R.java
+++ b/gen/de/gultsch/chat/R.java
@@ -44,24 +44,24 @@ public final class R {
}
public static final class id {
public static final int account_confirm_password_desc=0x7f0a001c;
- public static final int account_delete=0x7f0a0035;
- public static final int account_disable=0x7f0a0036;
- public static final int account_enable=0x7f0a0037;
+ public static final int account_delete=0x7f0a0037;
+ public static final int account_disable=0x7f0a0038;
+ public static final int account_enable=0x7f0a0039;
public static final int account_jid=0x7f0a0000;
- public static final int account_list=0x7f0a0027;
+ public static final int account_list=0x7f0a0029;
public static final int account_password=0x7f0a0019;
public static final int account_password_confirm2=0x7f0a001d;
public static final int account_status=0x7f0a0002;
public static final int account_usetls=0x7f0a001a;
- public static final int action_accounts=0x7f0a002f;
- public static final int action_add=0x7f0a002b;
- public static final int action_add_account=0x7f0a0034;
- public static final int action_archive=0x7f0a002e;
- public static final int action_details=0x7f0a002d;
- public static final int action_refresh_contacts=0x7f0a0039;
- public static final int action_security=0x7f0a002c;
- public static final int action_settings=0x7f0a0030;
- public static final int announce_pgp=0x7f0a0038;
+ public static final int action_accounts=0x7f0a0031;
+ public static final int action_add=0x7f0a002d;
+ public static final int action_add_account=0x7f0a0036;
+ public static final int action_archive=0x7f0a0030;
+ public static final int action_details=0x7f0a002f;
+ public static final int action_refresh_contacts=0x7f0a003b;
+ public static final int action_security=0x7f0a002e;
+ public static final int action_settings=0x7f0a0032;
+ public static final int announce_pgp=0x7f0a003a;
public static final int contactList=0x7f0a0006;
public static final int contact_display_name=0x7f0a0008;
public static final int contact_jid=0x7f0a0009;
@@ -79,20 +79,22 @@ public final class R {
public static final int details_receive_presence=0x7f0a0014;
public static final int details_send_presence=0x7f0a0013;
public static final int edit_account_register_new=0x7f0a001b;
- public static final int encryption_choice_none=0x7f0a0031;
- public static final int encryption_choice_otr=0x7f0a0032;
- public static final int encryption_choice_pgp=0x7f0a0033;
- public static final int list=0x7f0a0025;
- public static final int message_body=0x7f0a0029;
- public static final int message_photo=0x7f0a0028;
- public static final int message_time=0x7f0a002a;
+ public static final int encryption_choice_none=0x7f0a0033;
+ public static final int encryption_choice_otr=0x7f0a0034;
+ public static final int encryption_choice_pgp=0x7f0a0035;
+ public static final int info_box=0x7f0a0022;
+ public static final int list=0x7f0a0027;
+ public static final int message_body=0x7f0a002b;
+ public static final int message_photo=0x7f0a002a;
+ public static final int message_time=0x7f0a002c;
public static final int messages_view=0x7f0a0021;
public static final int new_conversation_search=0x7f0a0004;
- public static final int new_fingerprint=0x7f0a0022;
- public static final int otr_fingerprint=0x7f0a0023;
+ public static final int new_fingerprint=0x7f0a0023;
+ public static final int otr_fingerprint=0x7f0a0024;
+ public static final int pgp_keyentry=0x7f0a0025;
public static final int progressBar1=0x7f0a0003;
- public static final int selected_conversation=0x7f0a0026;
- public static final int slidingpanelayout=0x7f0a0024;
+ public static final int selected_conversation=0x7f0a0028;
+ public static final int slidingpanelayout=0x7f0a0026;
public static final int textSendButton=0x7f0a0020;
public static final int textView1=0x7f0a0018;
public static final int textView2=0x7f0a0001;
diff --git a/gen/org/sufficientlysecure/keychain/api/R.java b/gen/org/sufficientlysecure/keychain/api/R.java
new file mode 100644
index 000000000..bc32bf116
--- /dev/null
+++ b/gen/org/sufficientlysecure/keychain/api/R.java
@@ -0,0 +1,17 @@
+/* AUTO-GENERATED FILE. DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found. It
+ * should not be modified by hand.
+ */
+package org.sufficientlysecure.keychain.api;
+
+public final class R {
+ public static final class drawable {
+ public static final int ic_action_cancel_launchersize = 0x7f020003;
+ }
+ public static final class string {
+ public static final int openpgp_install_openkeychain_via = 0x7f050001;
+ public static final int openpgp_list_preference_none = 0x7f050000;
+ }
+}
diff --git a/res/layout/fragment_conversation.xml b/res/layout/fragment_conversation.xml
index 50b9ba3ba..22f783d3c 100644
--- a/res/layout/fragment_conversation.xml
+++ b/res/layout/fragment_conversation.xml
@@ -45,6 +45,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/textsend"
+ android:layout_below="@+id/info_box"
android:layout_alignParentLeft="true"
android:background="#e5e5e5"
tools:listitem="@layout/message_sent"
@@ -53,13 +54,17 @@
android:transcriptMode="alwaysScroll"
android:listSelector="@android:color/transparent">
+
@@ -77,11 +82,38 @@
android:layout_height="wrap_content"
android:id="@+id/otr_fingerprint"
android:textColor="#eee"
- android:text="2674D6A0 0B1421B1 BFC42AEC C56F3719 672437D8"
android:paddingLeft="8dp"
android:paddingBottom="8dp"
android:textSize="14sp"
android:typeface="monospace"/>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a545676e2..e4ccb8ba3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -13,5 +13,5 @@
just now
sending…
Renew PGP announcement
- This message is encrypted. Click to decrypt.
+ Decrypting message. please wait…
diff --git a/src/de/gultsch/chat/services/XmppConnectionService.java b/src/de/gultsch/chat/services/XmppConnectionService.java
index a2b85f624..4e75f7aa9 100644
--- a/src/de/gultsch/chat/services/XmppConnectionService.java
+++ b/src/de/gultsch/chat/services/XmppConnectionService.java
@@ -1,39 +1,21 @@
package de.gultsch.chat.services;
-import java.io.BufferedOutputStream;
-import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
import java.util.Date;
import java.util.Hashtable;
import java.util.List;
-import java.util.Set;
import org.json.JSONException;
-import org.openintents.openpgp.IOpenPgpService;
-import org.openintents.openpgp.OpenPgpSignatureResult;
import org.openintents.openpgp.util.OpenPgpApi;
import org.openintents.openpgp.util.OpenPgpServiceConnection;
-import org.openintents.openpgp.OpenPgpError;
import net.java.otr4j.OtrException;
import net.java.otr4j.session.Session;
-import net.java.otr4j.session.SessionImpl;
import net.java.otr4j.session.SessionStatus;
import de.gultsch.chat.crypto.PgpEngine;
import de.gultsch.chat.crypto.PgpEngine.OpenPgpException;
-import de.gultsch.chat.crypto.PgpEngine.UserInputRequiredException;
import de.gultsch.chat.entities.Account;
import de.gultsch.chat.entities.Contact;
import de.gultsch.chat.entities.Conversation;
@@ -67,9 +49,7 @@ import android.database.DatabaseUtils;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
-import android.os.ParcelFileDescriptor;
import android.os.PowerManager;
-import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.provider.ContactsContract;
import android.util.Log;
@@ -307,6 +287,11 @@ public class XmppConnectionService extends Service {
}
private void processRosterItems(Account account, Element elements) {
+ String version = elements.getAttribute("ver");
+ if (version != null) {
+ account.setRosterVersion(version);
+ databaseBackend.updateAccount(account);
+ }
for (Element item : elements.getChildren()) {
if (item.getName().equals("item")) {
String jid = item.getAttribute("jid");
@@ -549,7 +534,6 @@ public class XmppConnectionService extends Service {
IqPacket packet) {
Element roster = packet.findChild("query");
if (roster != null) {
- String version = roster.getAttribute("ver");
processRosterItems(account, roster);
StringBuilder mWhere = new StringBuilder();
mWhere.append("jid NOT IN(");
diff --git a/src/de/gultsch/chat/ui/ConversationActivity.java b/src/de/gultsch/chat/ui/ConversationActivity.java
index 7fbc432e3..88d30bc52 100644
--- a/src/de/gultsch/chat/ui/ConversationActivity.java
+++ b/src/de/gultsch/chat/ui/ConversationActivity.java
@@ -469,4 +469,16 @@ public class ConversationActivity extends XmppActivity {
}
}
}
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if (resultCode == RESULT_OK) {
+ if (requestCode == REQUEST_DECRYPT_PGP) {
+ ConversationFragment selectedFragment = (ConversationFragment) getFragmentManager().findFragmentByTag("conversation");
+ if (selectedFragment!=null) {
+ selectedFragment.hidePgpPassphraseBox();
+ }
+ }
+ }
+ }
}
diff --git a/src/de/gultsch/chat/ui/ConversationFragment.java b/src/de/gultsch/chat/ui/ConversationFragment.java
index 099f22537..af07fdbb8 100644
--- a/src/de/gultsch/chat/ui/ConversationFragment.java
+++ b/src/de/gultsch/chat/ui/ConversationFragment.java
@@ -43,7 +43,6 @@ import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ImageButton;
import android.widget.ImageView;
-import android.widget.ProgressBar;
import android.widget.TextView;
public class ConversationFragment extends Fragment {
@@ -95,6 +94,11 @@ public class ConversationFragment extends Fragment {
}
}
};
+ private LinearLayout pgpInfo;
+
+ public void hidePgpPassphraseBox() {
+ pgpInfo.setVisibility(View.GONE);
+ }
public void updateChatMsgHint() {
if (conversation.getMode() == Conversation.MODE_MULTI) {
@@ -132,6 +136,9 @@ public class ConversationFragment extends Fragment {
.findViewById(R.id.textSendButton);
sendButton.setOnClickListener(this.sendMsgListener);
+ pgpInfo = (LinearLayout) view.findViewById(R.id.pgp_keyentry);
+ pgpInfo.setOnClickListener(clickToDecryptListener);
+
messagesView = (ListView) view.findViewById(R.id.messages_view);
messageListAdapter = new ArrayAdapter(this.getActivity()
@@ -231,11 +238,11 @@ public class ConversationFragment extends Fragment {
if (item.getEncryption() == Message.ENCRYPTION_PGP) {
viewHolder.messageBody.setText(getString(R.string.encrypted_message));
viewHolder.messageBody.setTextColor(0xff33B5E5);
- viewHolder.messageBody.setOnClickListener(clickToDecryptListener);
+ viewHolder.messageBody.setTypeface(null,Typeface.ITALIC);
} else {
viewHolder.messageBody.setText(body.trim());
viewHolder.messageBody.setTextColor(0xff000000);
- viewHolder.messageBody.setOnClickListener(null);
+ viewHolder.messageBody.setTypeface(null, Typeface.NORMAL);
}
}
if (item.getStatus() == Message.STATUS_UNSEND) {
@@ -536,7 +543,7 @@ public class ConversationFragment extends Fragment {
@Override
protected Boolean doInBackground(Message... params) {
- XmppActivity activity = (XmppActivity) getActivity();
+ final ConversationActivity activity = (ConversationActivity) getActivity();
askForPassphraseIntent = null;
for(int i = 0; i < params.length; ++i) {
if (params[i].getEncryption() == Message.ENCRYPTION_PGP) {
@@ -550,6 +557,14 @@ public class ConversationFragment extends Fragment {
decrypted = activity.xmppConnectionService.getPgpEngine().decrypt(body);
} catch (UserInputRequiredException e) {
askForPassphraseIntent = e.getPendingIntent().getIntentSender();
+ activity.runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ pgpInfo.setVisibility(View.VISIBLE);
+ }
+ });
+
return false;
} catch (OpenPgpException e) {
@@ -570,6 +585,15 @@ public class ConversationFragment extends Fragment {
});
}
}
+ if (activity!=null) {
+ activity.runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ activity.updateConversationList();
+ }
+ });
+ }
}
return true;
}