diff options
14 files changed, 103 insertions, 53 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f9e9056c5..d2fedf64d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ###Changelog +####Version 1.12.3 +* show offline members in conferences +* various bug fixes + ####Version 1.12.2 * make omemo default when all resources support it * show presence of other resources as template diff --git a/build.gradle b/build.gradle index 356cdb7ff..3374f3604 100644 --- a/build.gradle +++ b/build.gradle @@ -65,8 +65,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 23 - versionCode 143 - versionName "1.12.2" + versionCode 144 + versionName "1.12.3" archivesBaseName += "-$versionName" applicationId "eu.siacs.conversations" diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 5b3b2f9df..eebeb54f1 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -87,7 +87,7 @@ public final class Config { public static final boolean DISABLE_HTTP_UPLOAD = false; public static final boolean DISABLE_STRING_PREP = false; // setting to true might increase startup performance public static final boolean EXTENDED_SM_LOGGING = false; // log stanza counts - public static final boolean BACKGROUND_STANZA_LOGGING = true; + public static final boolean BACKGROUND_STANZA_LOGGING = false; public static final boolean RESET_ATTEMPT_COUNT_ON_NETWORK_CHANGE = true; //setting to true might increase power consumption public static final boolean ENCRYPT_ON_HTTP_UPLOADED = false; diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index e29ebb52c..518152356 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -97,6 +97,21 @@ public class Conversation extends AbstractEntity implements Blockable { this.messagesLeftOnServer = value; } + + public Message getFirstUnreadMessage() { + Message first = null; + synchronized (this.messages) { + for (int i = messages.size() - 1; i >= 0; --i) { + if (messages.get(i).isRead()) { + return first; + } else { + first = messages.get(i); + } + } + } + return first; + } + public Message findUnsentMessageWithUuid(String uuid) { synchronized(this.messages) { for (final Message message : this.messages) { diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index cd1c55986..aac8ee45a 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -574,6 +574,9 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece +conversation.getJid().toBareJid()); if (!user.realJidMatchesAccount()) { conversation.getMucOptions().addUser(user); + mXmppConnectionService.getAvatarService().clear(conversation); + mXmppConnectionService.updateMucRosterUi(); + mXmppConnectionService.updateConversationUi(); } } } diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 5d1f87fb6..942ce2cc2 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1903,6 +1903,9 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa MucOptions.User user = AbstractParser.parseItem(conversation,child); if (!user.realJidMatchesAccount()) { conversation.getMucOptions().addUser(user); + getAvatarService().clear(conversation); + updateMucRosterUi(); + updateConversationUi(); } } } diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index ee6d9417c..808f6e7f9 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -253,6 +253,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers @Override public void onClick(View v) { quickEdit(mConversation.getMucOptions().getActualNick(), + 0, new OnValueEdited() { @Override @@ -279,7 +280,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers break; case R.id.action_edit_subject: if (mConversation != null) { - quickEdit(mConversation.getName(),this.onSubjectEdited); + quickEdit(mConversation.getMucOptions().getSubject(), + R.string.action_edit_subject, + this.onSubjectEdited); } break; case R.id.action_share: diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index ce2de75a5..8fa0c6296 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -259,7 +259,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd break; case R.id.action_edit_contact: if (contact.getSystemAccount() == null) { - quickEdit(contact.getDisplayName(), new OnValueEdited() { + quickEdit(contact.getDisplayName(), 0, new OnValueEdited() { @Override public void onValueEdited(String value) { diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 04c3d82df..014fedd39 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -123,27 +123,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } - private int getIndexOf(String uuid, List<Message> messages) { - if (uuid == null) { - return messages.size() - 1; - } - for(int i = 0; i < messages.size(); ++i) { - if (uuid.equals(messages.get(i).getUuid())) { - return i; - } else { - Message next = messages.get(i); - while(next != null && next.wasMergedIntoPrevious()) { - if (uuid.equals(next.getUuid())) { - return i; - } - next = next.next(); - } - - } - } - return 0; - } - @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { @@ -212,6 +191,28 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } } }; + + private int getIndexOf(String uuid, List<Message> messages) { + if (uuid == null) { + return messages.size() - 1; + } + for(int i = 0; i < messages.size(); ++i) { + if (uuid.equals(messages.get(i).getUuid())) { + return i; + } else { + Message next = messages.get(i); + while(next != null && next.wasMergedIntoPrevious()) { + if (uuid.equals(next.getUuid())) { + return i; + } + next = next.next(); + } + + } + } + return 0; + } + private final int KEYCHAIN_UNLOCK_NOT_REQUIRED = 0; private final int KEYCHAIN_UNLOCK_REQUIRED = 1; private final int KEYCHAIN_UNLOCK_PENDING = 2; @@ -807,9 +808,15 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa this.messagesView.setAdapter(messageListAdapter); updateMessages(); this.messagesLoaded = true; - int size = this.messageList.size(); - if (size > 0) { - messagesView.setSelection(size - 1); + synchronized (this.messageList) { + final Message first = conversation.getFirstUnreadMessage(); + final int pos; + if (first == null) { + pos = Math.max(0,this.messageList.size() - 1); + } else { + pos = getIndexOf(first.getUuid(), this.messageList); + } + messagesView.setSelection(pos); } } diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index 0618fd460..d582ba592 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -670,18 +670,19 @@ public abstract class XmppActivity extends Activity { builder.create().show(); } - protected void quickEdit(String previousValue, OnValueEdited callback) { - quickEdit(previousValue, callback, false); + protected void quickEdit(String previousValue, int hint, OnValueEdited callback) { + quickEdit(previousValue, callback, hint, false); } - protected void quickPasswordEdit(String previousValue, - OnValueEdited callback) { - quickEdit(previousValue, callback, true); + protected void quickPasswordEdit(String previousValue, OnValueEdited callback) { + quickEdit(previousValue, callback, R.string.password, true); } @SuppressLint("InflateParams") private void quickEdit(final String previousValue, - final OnValueEdited callback, boolean password) { + final OnValueEdited callback, + final int hint, + boolean password) { AlertDialog.Builder builder = new AlertDialog.Builder(this); View view = getLayoutInflater().inflate(R.layout.quickedit, null); final EditText editor = (EditText) view.findViewById(R.id.editor); @@ -690,7 +691,7 @@ public abstract class XmppActivity extends Activity { @Override public void onClick(DialogInterface dialog, int which) { String value = editor.getText().toString(); - if (!previousValue.equals(value) && value.trim().length() > 0) { + if (!value.equals(previousValue) && value.trim().length() > 0) { callback.onValueEdited(value); } } @@ -698,13 +699,18 @@ public abstract class XmppActivity extends Activity { if (password) { editor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); - editor.setHint(R.string.password); builder.setPositiveButton(R.string.accept, mClickListener); } else { builder.setPositiveButton(R.string.edit, mClickListener); } + if (hint != 0) { + editor.setHint(hint); + } editor.requestFocus(); - editor.setText(previousValue); + editor.setText(""); + if (previousValue != null) { + editor.getText().append(previousValue); + } builder.setView(view); builder.setNegativeButton(R.string.cancel, null); builder.create().show(); diff --git a/src/main/java/eu/siacs/conversations/utils/DNSHelper.java b/src/main/java/eu/siacs/conversations/utils/DNSHelper.java index 2f588f492..ac64cf2e8 100644 --- a/src/main/java/eu/siacs/conversations/utils/DNSHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/DNSHelper.java @@ -47,7 +47,10 @@ public class DNSHelper { protected static Client client = new Client(); + protected static Context context; + public static Bundle getSRVRecord(final Jid jid, Context context) throws IOException { + DNSHelper.context = context; final String host = jid.getDomainpart(); final List<InetAddress> servers = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? getDnsServers(context) : getDnsServersPreLollipop(); Bundle b = new Bundle(); diff --git a/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java index 4e3ec2366..efc83bcb2 100644 --- a/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java +++ b/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java @@ -27,19 +27,7 @@ public class ExceptionHandler implements UncaughtExceptionHandler { ex.printStackTrace(printWriter); String stacktrace = result.toString(); printWriter.close(); - try { - OutputStream os = context.openFileOutput("stacktrace.txt", - Context.MODE_PRIVATE); - os.write(stacktrace.getBytes()); - os.flush(); - os.close(); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + ExceptionHelper.writeToStacktraceFile(context, stacktrace); this.defaultHandler.uncaughtException(thread, ex); } diff --git a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java index e9f67cf0b..12140bde3 100644 --- a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java @@ -14,8 +14,10 @@ import android.util.Log; import java.io.BufferedReader; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; +import java.io.OutputStream; import java.util.List; import eu.siacs.conversations.Config; @@ -119,4 +121,14 @@ public class ExceptionHelper { return false; } } + + public static void writeToStacktraceFile(Context context, String msg) { + try { + OutputStream os = context.openFileOutput("stacktrace.txt", Context.MODE_PRIVATE); + os.write(msg.getBytes()); + os.flush(); + os.close(); + } catch (IOException ignored) { + } + } } diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index 1959b9cb5..a696d05b5 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -155,6 +155,9 @@ <string name="mgmt_account_delete">Löschen</string> <string name="mgmt_account_publish_avatar">Profilbild veröffentlichen</string> <string name="mgmt_account_publish_pgp">Öffentlichen OpenPGP-Schlüssel veröffentlichen</string> + <string name="openpgp_has_been_published">Öffentlicher OpenPGP Schlüssel wurde veröffentlicht.</string> + <string name="republish_pgp_keys">Deine öffentliche OpenPGP Schlüssel müssen veröffentlicht werden!</string> + <string name="mgmt_account_enable">Konto aktivieren </string> <string name="mgmt_account_are_you_sure">Bist du dir sicher?</string> <string name="mgmt_account_delete_confirm_text">Wenn du dein Profil löschst, gehen alle Gesprächsverläufe verloren</string> <string name="attach_record_voice">Sprache aufzeichnen</string> @@ -367,7 +370,7 @@ <string name="password_should_not_be_empty">Das Passwort darf nicht leer sein</string> <string name="perform_action_with">Aktion durchführen mit</string> <string name="no_affiliation">Keine Zugehörigkeit</string> - <string name="no_role">Keine Rolle</string> + <string name="no_role">Offline</string> <string name="outcast">Ausgeschlossen</string> <string name="member">Mitglied</string> <string name="advanced_mode">Erweiterter Modus</string> @@ -467,6 +470,8 @@ <string name="download_started">Download gestartet</string> <string name="no_update_available">Kein Update verfügbar</string> <string name="account_status_tor_unavailable">Tor-Netzwerk nicht verfügbar</string> + <string name="account_status_bind_failure">Bindungsfehler</string> + <string name="account_status_host_unknown">Host unbekannt</string> <string name="server_info_broken">Fehlerhaft</string> <string name="update_info">Pix-Art Messenger prüft auf eine neuere Version. Wenn ein Update verfügbar ist, wirst du gefragt, ob du deine Version aktualisieren möchtest. Der Update Dienst lädt und installiert die neue Version automatisch.\n\nBitte warten…</string> <string name="pref_presence_settings">Status</string> @@ -485,7 +490,7 @@ <string name="fetching_mam_prefs">Archivierungseinstellungen werden abgerufen. Bitte warten …</string> <string name="unable_to_fetch_mam_prefs">Archivierungseinstellungen konnten nicht abgerufen werden</string> <string name="captcha_required">Captcha erforderlich</string> - <string name="captcha_hint">Text aus Captcha eintragen</string> + <string name="captcha_hint">Gib den Text vom obigen Bild ein</string> <string name="certificate_chain_is_not_trusted">Zertifikat wird nicht vertraut</string> <string name="jid_does_not_match_certificate">Jabber-ID stimmt nicht dem Zertifikat überein</string> <string name="action_renew_certificate">Zertifikat erneuern</string> @@ -598,4 +603,5 @@ <string name="action_end_conversation_muc">Konferenz verlassen</string> <string name="default_resource"></string> <string name="leave_conference_warning">Willst du die Konferenz wirklich verlassen? Du wirst keine neuen Nachrichten mehr bekommen, bis du der Konferenz erneut beitrittst.</string> + <string name="show_password">Passwort anzeigen</string> </resources> |