From a0d0ed34ae38f2377fdb3ad2c661b74b85f2df28 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 22 Feb 2016 20:19:58 +0100 Subject: turned muc errors into enum. added error codes for service shutdown --- .../siacs/conversations/entities/MucOptions.java | 34 ++++++++++++---------- .../siacs/conversations/parser/PresenceParser.java | 22 ++++++++------ .../services/MessageArchiveService.java | 1 - .../services/XmppConnectionService.java | 4 ++- .../conversations/ui/ConversationFragment.java | 27 ++++++++++------- src/main/res/values/strings.xml | 5 ++-- 6 files changed, 54 insertions(+), 39 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index be9d790d..3567c14f 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -91,22 +91,26 @@ public class MucOptions { } } - public static final int ERROR_NO_ERROR = 0; - public static final int ERROR_NICK_IN_USE = 1; - public static final int ERROR_UNKNOWN = 2; - public static final int ERROR_PASSWORD_REQUIRED = 3; - public static final int ERROR_BANNED = 4; - public static final int ERROR_MEMBERS_ONLY = 5; - public static final int ERROR_NO_RESPONSE = 6; - - public static final int KICKED_FROM_ROOM = 9; + public enum Error { + NO_RESPONSE, + NONE, + NICK_IN_USE, + PASSWORD_REQUIRED, + BANNED, + MEMBERS_ONLY, + KICKED, + SHUTDOWN, + UNKNOWN + } public static final String STATUS_CODE_ROOM_CONFIG_CHANGED = "104"; public static final String STATUS_CODE_SELF_PRESENCE = "110"; public static final String STATUS_CODE_BANNED = "301"; public static final String STATUS_CODE_CHANGED_NICK = "303"; public static final String STATUS_CODE_KICKED = "307"; - public static final String STATUS_CODE_LOST_MEMBERSHIP = "321"; + public static final String STATUS_CODE_AFFILIATION_CHANGE = "321"; + public static final String STATUS_CODE_LOST_MEMBERSHIP = "322"; + public static final String STATUS_CODE_SHUTDOWN = "332"; private interface OnEventListener { void onSuccess(); @@ -245,7 +249,7 @@ public class MucOptions { private Data form = new Data(); private Conversation conversation; private boolean isOnline = false; - private int error = ERROR_NO_RESPONSE; + private Error error = Error.NONE; public OnRenameListener onRenameListener = null; private User self; private String subject = null; @@ -324,8 +328,8 @@ public class MucOptions { return findUser(name) != null; } - public void setError(int error) { - this.isOnline = isOnline && error == ERROR_NO_ERROR; + public void setError(Error error) { + this.isOnline = isOnline && error == Error.NONE; this.error = error; } @@ -379,7 +383,7 @@ public class MucOptions { return this.isOnline; } - public int getError() { + public Error getError() { return this.error; } @@ -389,7 +393,7 @@ public class MucOptions { public void setOffline() { this.users.clear(); - this.error = ERROR_NO_RESPONSE; + this.error = Error.NO_RESPONSE; this.isOnline = false; } diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java index dc02eda8..63d28c97 100644 --- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java @@ -63,7 +63,7 @@ public class PresenceParser extends AbstractParser implements if (x != null) { Element item = x.findChild("item"); if (item != null && !from.isBareJid()) { - mucOptions.setError(MucOptions.ERROR_NO_ERROR); + mucOptions.setError(MucOptions.Error.NONE); MucOptions.User user = new MucOptions.User(mucOptions,from); user.setAffiliation(item.getAttribute("affiliation")); user.setRole(item.getAttribute("role")); @@ -109,13 +109,17 @@ public class PresenceParser extends AbstractParser implements if (codes.contains(MucOptions.STATUS_CODE_CHANGED_NICK)) { mucOptions.mNickChangingInProgress = true; } else if (codes.contains(MucOptions.STATUS_CODE_KICKED)) { - mucOptions.setError(MucOptions.KICKED_FROM_ROOM); + mucOptions.setError(MucOptions.Error.KICKED); } else if (codes.contains(MucOptions.STATUS_CODE_BANNED)) { - mucOptions.setError(MucOptions.ERROR_BANNED); + mucOptions.setError(MucOptions.Error.BANNED); } else if (codes.contains(MucOptions.STATUS_CODE_LOST_MEMBERSHIP)) { - mucOptions.setError(MucOptions.ERROR_MEMBERS_ONLY); + mucOptions.setError(MucOptions.Error.MEMBERS_ONLY); + } else if (codes.contains(MucOptions.STATUS_CODE_AFFILIATION_CHANGE)) { + mucOptions.setError(MucOptions.Error.MEMBERS_ONLY); + } else if (codes.contains(MucOptions.STATUS_CODE_SHUTDOWN)) { + mucOptions.setError(MucOptions.Error.SHUTDOWN); } else { - mucOptions.setError(MucOptions.ERROR_UNKNOWN); + mucOptions.setError(MucOptions.Error.UNKNOWN); Log.d(Config.LOGTAG, "unknown error in conference: " + packet); } } else if (!from.isBareJid()){ @@ -132,14 +136,14 @@ public class PresenceParser extends AbstractParser implements mucOptions.onRenameListener.onFailure(); } } else { - mucOptions.setError(MucOptions.ERROR_NICK_IN_USE); + mucOptions.setError(MucOptions.Error.NICK_IN_USE); } } else if (error != null && error.hasChild("not-authorized")) { - mucOptions.setError(MucOptions.ERROR_PASSWORD_REQUIRED); + mucOptions.setError(MucOptions.Error.PASSWORD_REQUIRED); } else if (error != null && error.hasChild("forbidden")) { - mucOptions.setError(MucOptions.ERROR_BANNED); + mucOptions.setError(MucOptions.Error.BANNED); } else if (error != null && error.hasChild("registration-required")) { - mucOptions.setError(MucOptions.ERROR_MEMBERS_ONLY); + mucOptions.setError(MucOptions.Error.BANNED); } } } diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java index 59a37fe5..e8616bd8 100644 --- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java +++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java @@ -227,7 +227,6 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { this.execute(nextQuery); this.finalizeQuery(query, false); synchronized (this.queries) { - this.queries.remove(query); this.queries.add(nextQuery); } } diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index b836e780..24a728f7 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1824,9 +1824,11 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa fetchConferenceConfiguration(conversation); } }); - + updateConversationUi(); } else { account.pendingConferenceJoins.add(conversation); + conversation.resetMucOptions(); + updateConversationUi(); } } diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index ac06452a..c652c3c0 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -809,26 +809,29 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa && !conversation.getMucOptions().online() && account.getStatus() == Account.State.ONLINE) { switch (conversation.getMucOptions().getError()) { - case MucOptions.ERROR_NICK_IN_USE: + case NICK_IN_USE: showSnackbar(R.string.nick_in_use, R.string.edit, clickToMuc); break; - case MucOptions.ERROR_NO_RESPONSE: - showSnackbar(R.string.conference_not_found, R.string.leave, leaveMuc); + case NO_RESPONSE: + showSnackbar(R.string.joining_conference, 0, null); break; - case MucOptions.ERROR_PASSWORD_REQUIRED: + case PASSWORD_REQUIRED: showSnackbar(R.string.conference_requires_password, R.string.enter_password, enterPassword); break; - case MucOptions.ERROR_BANNED: + case BANNED: showSnackbar(R.string.conference_banned, R.string.leave, leaveMuc); break; - case MucOptions.ERROR_MEMBERS_ONLY: + case MEMBERS_ONLY: showSnackbar(R.string.conference_members_only, R.string.leave, leaveMuc); break; - case MucOptions.KICKED_FROM_ROOM: + case KICKED: showSnackbar(R.string.conference_kicked, R.string.join, joinMuc); break; - case MucOptions.ERROR_UNKNOWN: - showSnackbar(R.string.conference_unknown_error, R.string.try_again, joinMuc); + case UNKNOWN: + showSnackbar(R.string.conference_unknown_error, R.string.join, joinMuc); + break; + case SHUTDOWN: + showSnackbar(R.string.conference_shutdown, R.string.join, joinMuc); break; default: break; @@ -1091,8 +1094,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa snackbar.setOnClickListener(null); snackbarMessage.setText(message); snackbarMessage.setOnClickListener(null); - snackbarAction.setVisibility(View.VISIBLE); - snackbarAction.setText(action); + snackbarAction.setVisibility(clickListener == null ? View.GONE : View.VISIBLE); + if (action != 0) { + snackbarAction.setText(action); + } snackbarAction.setOnClickListener(clickListener); } diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index acaaf156..48c3de6c 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -241,8 +241,7 @@ This bookmark already exists You Edit conference subject - Conference not found - Unknown error received2 + Joining conference… Leave Contact added you to contact list Add back @@ -340,6 +339,8 @@ You are banned from this conference This conference is members only You have been kicked from this conference + The conference was shut down + You are no longer in this conference using account %s Checking %s on HTTP host You are not connected. Try again later -- cgit v1.2.3 From 689ded160718b5c73e118abe531530082b322636 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 22 Feb 2016 20:28:58 +0100 Subject: properly trigger show load more messages in mucs --- .../java/eu/siacs/conversations/ui/ConversationFragment.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index c652c3c0..d5c77490 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1083,12 +1083,20 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } private boolean showLoadMoreMessages(final Conversation c) { - final XmppConnection connection = c.getAccount().getXmppConnection(); - final boolean mam = connection != null && connection.getFeatures().mam(); + final boolean mam = hasMamSupport(c); final MessageArchiveService service = activity.xmppConnectionService.getMessageArchiveService(); return mam && (c.getLastClearHistory() != 0 || (c.countMessages() == 0 && c.hasMessagesLeftOnServer() && !service.queryInProgress(c))); } + private boolean hasMamSupport(final Conversation c) { + if (c.getMode() == Conversation.MODE_SINGLE) { + final XmppConnection connection = c.getAccount().getXmppConnection(); + return connection != null && connection.getFeatures().mam(); + } else { + return c.getMucOptions().mamSupport(); + } + } + protected void showSnackbar(final int message, final int action, final OnClickListener clickListener) { snackbar.setVisibility(View.VISIBLE); snackbar.setOnClickListener(null); -- cgit v1.2.3 From 5eb2d9af83fb2486848ee649961b0ebda1dcdf3b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 23 Feb 2016 09:07:47 +0100 Subject: update build instructions in readme --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4bc0d7b5..f98aac71 100644 --- a/README.md +++ b/README.md @@ -305,11 +305,13 @@ to sign up for the beta test. #### How do I build Conversations -Make sure to have ANDROID_HOME point to your Android SDK +Make sure to have ANDROID_HOME point to your Android SDK. Use the Android SDK Manager to install missing dependencies. git clone https://github.com/siacs/Conversations.git cd Conversations - ./gradlew build + ./gradlew assembleFreeRelease + +There are two build flavors available. *free* and *playstore*. Unless you know what you are doing you only need *free*. [![Build Status](https://travis-ci.org/siacs/Conversations.svg?branch=development)](https://travis-ci.org/siacs/Conversations) -- cgit v1.2.3 From 4a9753bebcbd966c9351379dfe4b886e41e8ac7a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 23 Feb 2016 09:29:18 +0100 Subject: tell travis to build free version --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0b3dd195..a055015e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,3 +15,5 @@ android: - extra-google-google_play_services licenses: - '.+' +scrpit: + - TERM=dumb./gradlew assembleFreeRelease -- cgit v1.2.3 From 9ae997cab81e65d746943141828c5b9e8615bded Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 23 Feb 2016 10:15:07 +0100 Subject: added remark that users don't need their own app server --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f98aac71..98433510 100644 --- a/README.md +++ b/README.md @@ -149,12 +149,14 @@ a login (SASL) mechanism that Conversations is able to handle. Conversations sup SCRAM-SHA1, PLAIN, EXTERNAL (client certs) and DIGEST-MD5. #### How do XEP-0357: Push Notifications work? -You need to be running the Play Store version of Conversations and your server needs to support push notifications. Because *Google Cloud Notifications (GCM)* are tied with an API key to a specific app your server can not initiate the push message directly. Instead your server will send the push notification to the Conversations App server (operated by us) which then acts as a proxy and initiates the push message for you. The push message sent from our App server through GCM doesn’t contain any personal information. It is just an empty message which will wake up your device and tell Conversations to reconnect to your server. The information send from your server to our App server depends on the configuration of your server but can be limited to your account name. (In any case the Conversations App server won't redirect any information through GCM even if your server sends this information.) +You need to be running the Play Store version of Conversations and your server needs to support push notifications.¹ Because *Google Cloud Notifications (GCM)* are tied with an API key to a specific app your server can not initiate the push message directly. Instead your server will send the push notification to the Conversations App server (operated by us) which then acts as a proxy and initiates the push message for you. The push message sent from our App server through GCM doesn’t contain any personal information. It is just an empty message which will wake up your device and tell Conversations to reconnect to your server. The information send from your server to our App server depends on the configuration of your server but can be limited to your account name. (In any case the Conversations App server won't redirect any information through GCM even if your server sends this information.) In summary Google will never get hold of any personal information besides that *something* happened. (Which doesn’t even have to be a message but can be some automated event as well.) We - as the operator of the App server - will just get hold of your account name (without being able to tie this to your specific device). If you don’t want this simply pick a server which does not offer Push Notifications or build Conversations yourself without support for push notifications. (This is available via a gradle build flavor.) Non-play store source of Conversations like the Amazon App store will also offer a version without push notifications. Conversations will just work as before and maintain its own TCP connection in the background. + ¹ Your server only needs to support the server side of [XEP-0357: Push Notifications](http://xmpp.org/extensions/xep-0357.html). If you use the Play Store version you do **not** need to run your own app server. The server modules are called *mod_cloud_notify* on Prosody and *mod_push* on ejabberd. + #### Conversations doesn't work for me. Where can I get help? You can join our conference room on `conversations@conference.siacs.eu`. -- cgit v1.2.3 From f1c947f0d6c729d13165814cfa10892d7b0787ee Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 23 Feb 2016 11:20:44 +0100 Subject: fixed formating in travis config --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a055015e..09f7c5ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,4 +16,4 @@ android: licenses: - '.+' scrpit: - - TERM=dumb./gradlew assembleFreeRelease + - ./gradlew assembleFreeRelease -- cgit v1.2.3 From 7f45e210af35bbabc9b5b26a41c984d3b0de2288 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 23 Feb 2016 13:54:24 +0100 Subject: fixed typo in travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 09f7c5ea..e26ccaa4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,5 +15,5 @@ android: - extra-google-google_play_services licenses: - '.+' -scrpit: +script: - ./gradlew assembleFreeRelease -- cgit v1.2.3 From beb216c300b7f34e17904742531a400ff33b9ac8 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 23 Feb 2016 14:25:01 +0100 Subject: made presences object final in contact --- src/main/java/eu/siacs/conversations/entities/Contact.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java index aba9a809..faafe78c 100644 --- a/src/main/java/eu/siacs/conversations/entities/Contact.java +++ b/src/main/java/eu/siacs/conversations/entities/Contact.java @@ -45,7 +45,7 @@ public class Contact implements ListItem, Blockable { protected String photoUri; protected JSONObject keys = new JSONObject(); protected JSONArray groups = new JSONArray(); - protected Presences presences = new Presences(); + protected final Presences presences = new Presences(); protected Account account; protected Avatar avatar; @@ -222,10 +222,6 @@ public class Contact implements ListItem, Blockable { return this.presences; } - public void setPresences(Presences pres) { - this.presences = pres; - } - public void updatePresence(final String resource, final Presence presence) { this.presences.updatePresence(resource, presence); } -- cgit v1.2.3 From ad063d00ccbfc4a9c72c707d11b13a2da0912d28 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 23 Feb 2016 14:25:13 +0100 Subject: disable predexing on travis --- .travis.yml | 2 +- build.gradle | 196 +++++++++++++++++++++++++++++++---------------------------- 2 files changed, 103 insertions(+), 95 deletions(-) diff --git a/.travis.yml b/.travis.yml index e26ccaa4..82531aa0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,4 +16,4 @@ android: licenses: - '.+' script: - - ./gradlew assembleFreeRelease + - ./gradlew assembleFreeRelease -PdisablePreDex diff --git a/build.gradle b/build.gradle index deaae0e2..7abae97c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,115 +1,123 @@ // Top-level build file where you can add configuration options common to all // sub-projects/modules. buildscript { - repositories { - jcenter() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:1.5.0' - } + repositories { + jcenter() + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.5.0' + } } allprojects { - repositories { - jcenter() - mavenCentral() - maven { - url 'http://lorenzo.villani.me/android-cropimage/' - } - } + repositories { + jcenter() + mavenCentral() + maven { + url 'http://lorenzo.villani.me/android-cropimage/' + } + } } apply plugin: 'com.android.application' repositories { - jcenter() - mavenCentral() + jcenter() + mavenCentral() } configurations { - playstoreCompile + playstoreCompile } dependencies { - compile project(':libs:MemorizingTrustManager') - compile 'org.sufficientlysecure:openpgp-api:10.0' - compile 'com.soundcloud.android:android-crop:1.0.1@aar' - compile 'com.android.support:support-v13:23.1.1' - compile 'org.bouncycastle:bcprov-jdk15on:1.52' - compile 'org.bouncycastle:bcmail-jdk15on:1.52' - compile 'org.jitsi:org.otr4j:0.22' - compile 'org.gnu.inet:libidn:1.15' - compile 'com.google.zxing:core:3.2.1' - compile 'com.google.zxing:android-integration:3.2.1' - compile 'de.measite.minidns:minidns:0.1.7' - compile 'de.timroes.android:EnhancedListView:0.3.4' - compile 'me.leolin:ShortcutBadger:1.1.3@aar' - compile 'com.kyleduo.switchbutton:library:1.2.8' - compile 'org.whispersystems:axolotl-android:1.3.4' - compile 'com.makeramen:roundedimageview:2.2.0' - playstoreCompile 'com.google.android.gms:play-services-gcm:8.3.0' + compile project(':libs:MemorizingTrustManager') + compile 'org.sufficientlysecure:openpgp-api:10.0' + compile 'com.soundcloud.android:android-crop:1.0.1@aar' + compile 'com.android.support:support-v13:23.1.1' + compile 'org.bouncycastle:bcprov-jdk15on:1.52' + compile 'org.bouncycastle:bcmail-jdk15on:1.52' + compile 'org.jitsi:org.otr4j:0.22' + compile 'org.gnu.inet:libidn:1.15' + compile 'com.google.zxing:core:3.2.1' + compile 'com.google.zxing:android-integration:3.2.1' + compile 'de.measite.minidns:minidns:0.1.7' + compile 'de.timroes.android:EnhancedListView:0.3.4' + compile 'me.leolin:ShortcutBadger:1.1.3@aar' + compile 'com.kyleduo.switchbutton:library:1.2.8' + compile 'org.whispersystems:axolotl-android:1.3.4' + compile 'com.makeramen:roundedimageview:2.2.0' + playstoreCompile 'com.google.android.gms:play-services-gcm:8.3.0' } android { - compileSdkVersion 23 - buildToolsVersion "23.0.2" - - defaultConfig { - minSdkVersion 14 - targetSdkVersion 23 - versionCode 127 - versionName "1.10.0" - archivesBaseName += "-$versionName" - applicationId "eu.siacs.conversations" - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - - productFlavors { - playstore - free - } - if (project.hasProperty('mStoreFile') && - project.hasProperty('mStorePassword') && - project.hasProperty('mKeyAlias') && - project.hasProperty('mKeyPassword')) { - signingConfigs { - release { - storeFile file(mStoreFile) - storePassword mStorePassword - keyAlias mKeyAlias - keyPassword mKeyPassword - } - } - buildTypes.release.signingConfig = signingConfigs.release - } else { - buildTypes.release.signingConfig = null - } - - lintOptions { - disable 'ExtraTranslation', 'MissingTranslation', 'InvalidPackage', 'MissingQuantity', 'AppCompatResource' - } - - subprojects { - - afterEvaluate { - if (getPlugins().hasPlugin('android') || - getPlugins().hasPlugin('android-library')) { - - configure(android.lintOptions) { - disable 'AndroidGradlePluginVersion', 'MissingTranslation' - } - } - - } - } - - packagingOptions { - exclude 'META-INF/BCKEY.DSA' - exclude 'META-INF/BCKEY.SF' - } + compileSdkVersion 23 + buildToolsVersion "23.0.2" + + defaultConfig { + minSdkVersion 14 + targetSdkVersion 23 + versionCode 127 + versionName "1.10.0" + archivesBaseName += "-$versionName" + applicationId "eu.siacs.conversations" + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + productFlavors { + playstore + free + } + if (project.hasProperty('mStoreFile') && + project.hasProperty('mStorePassword') && + project.hasProperty('mKeyAlias') && + project.hasProperty('mKeyPassword')) { + signingConfigs { + release { + storeFile file(mStoreFile) + storePassword mStorePassword + keyAlias mKeyAlias + keyPassword mKeyPassword + } + } + buildTypes.release.signingConfig = signingConfigs.release + } else { + buildTypes.release.signingConfig = null + } + + lintOptions { + disable 'ExtraTranslation', 'MissingTranslation', 'InvalidPackage', 'MissingQuantity', 'AppCompatResource' + } + + subprojects { + + afterEvaluate { + if (getPlugins().hasPlugin('android') || + getPlugins().hasPlugin('android-library')) { + + configure(android.lintOptions) { + disable 'AndroidGradlePluginVersion', 'MissingTranslation' + } + } + + } + + project.plugins.whenPluginAdded { plugin -> + if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) { + project.android.dexOptions.preDexLibraries = !project.hasProperty('disablePreDex') + } else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) { + project.android.dexOptions.preDexLibraries = !project.hasProperty('disablePreDex') + } + } + } + + packagingOptions { + exclude 'META-INF/BCKEY.DSA' + exclude 'META-INF/BCKEY.SF' + } } -- cgit v1.2.3 From 20eebe638be483d11f984fc53ed4b594c350a86f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 23 Feb 2016 14:33:03 +0100 Subject: Revert "disable predexing on travis" This reverts commit ad063d00ccbfc4a9c72c707d11b13a2da0912d28. --- .travis.yml | 2 +- build.gradle | 196 ++++++++++++++++++++++++++++------------------------------- 2 files changed, 95 insertions(+), 103 deletions(-) diff --git a/.travis.yml b/.travis.yml index 82531aa0..e26ccaa4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,4 +16,4 @@ android: licenses: - '.+' script: - - ./gradlew assembleFreeRelease -PdisablePreDex + - ./gradlew assembleFreeRelease diff --git a/build.gradle b/build.gradle index 7abae97c..deaae0e2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,123 +1,115 @@ // Top-level build file where you can add configuration options common to all // sub-projects/modules. buildscript { - repositories { - jcenter() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:1.5.0' - } + repositories { + jcenter() + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.5.0' + } } allprojects { - repositories { - jcenter() - mavenCentral() - maven { - url 'http://lorenzo.villani.me/android-cropimage/' - } - } + repositories { + jcenter() + mavenCentral() + maven { + url 'http://lorenzo.villani.me/android-cropimage/' + } + } } apply plugin: 'com.android.application' repositories { - jcenter() - mavenCentral() + jcenter() + mavenCentral() } configurations { - playstoreCompile + playstoreCompile } dependencies { - compile project(':libs:MemorizingTrustManager') - compile 'org.sufficientlysecure:openpgp-api:10.0' - compile 'com.soundcloud.android:android-crop:1.0.1@aar' - compile 'com.android.support:support-v13:23.1.1' - compile 'org.bouncycastle:bcprov-jdk15on:1.52' - compile 'org.bouncycastle:bcmail-jdk15on:1.52' - compile 'org.jitsi:org.otr4j:0.22' - compile 'org.gnu.inet:libidn:1.15' - compile 'com.google.zxing:core:3.2.1' - compile 'com.google.zxing:android-integration:3.2.1' - compile 'de.measite.minidns:minidns:0.1.7' - compile 'de.timroes.android:EnhancedListView:0.3.4' - compile 'me.leolin:ShortcutBadger:1.1.3@aar' - compile 'com.kyleduo.switchbutton:library:1.2.8' - compile 'org.whispersystems:axolotl-android:1.3.4' - compile 'com.makeramen:roundedimageview:2.2.0' - playstoreCompile 'com.google.android.gms:play-services-gcm:8.3.0' + compile project(':libs:MemorizingTrustManager') + compile 'org.sufficientlysecure:openpgp-api:10.0' + compile 'com.soundcloud.android:android-crop:1.0.1@aar' + compile 'com.android.support:support-v13:23.1.1' + compile 'org.bouncycastle:bcprov-jdk15on:1.52' + compile 'org.bouncycastle:bcmail-jdk15on:1.52' + compile 'org.jitsi:org.otr4j:0.22' + compile 'org.gnu.inet:libidn:1.15' + compile 'com.google.zxing:core:3.2.1' + compile 'com.google.zxing:android-integration:3.2.1' + compile 'de.measite.minidns:minidns:0.1.7' + compile 'de.timroes.android:EnhancedListView:0.3.4' + compile 'me.leolin:ShortcutBadger:1.1.3@aar' + compile 'com.kyleduo.switchbutton:library:1.2.8' + compile 'org.whispersystems:axolotl-android:1.3.4' + compile 'com.makeramen:roundedimageview:2.2.0' + playstoreCompile 'com.google.android.gms:play-services-gcm:8.3.0' } android { - compileSdkVersion 23 - buildToolsVersion "23.0.2" - - defaultConfig { - minSdkVersion 14 - targetSdkVersion 23 - versionCode 127 - versionName "1.10.0" - archivesBaseName += "-$versionName" - applicationId "eu.siacs.conversations" - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - - productFlavors { - playstore - free - } - if (project.hasProperty('mStoreFile') && - project.hasProperty('mStorePassword') && - project.hasProperty('mKeyAlias') && - project.hasProperty('mKeyPassword')) { - signingConfigs { - release { - storeFile file(mStoreFile) - storePassword mStorePassword - keyAlias mKeyAlias - keyPassword mKeyPassword - } - } - buildTypes.release.signingConfig = signingConfigs.release - } else { - buildTypes.release.signingConfig = null - } - - lintOptions { - disable 'ExtraTranslation', 'MissingTranslation', 'InvalidPackage', 'MissingQuantity', 'AppCompatResource' - } - - subprojects { - - afterEvaluate { - if (getPlugins().hasPlugin('android') || - getPlugins().hasPlugin('android-library')) { - - configure(android.lintOptions) { - disable 'AndroidGradlePluginVersion', 'MissingTranslation' - } - } - - } - - project.plugins.whenPluginAdded { plugin -> - if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) { - project.android.dexOptions.preDexLibraries = !project.hasProperty('disablePreDex') - } else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) { - project.android.dexOptions.preDexLibraries = !project.hasProperty('disablePreDex') - } - } - } - - packagingOptions { - exclude 'META-INF/BCKEY.DSA' - exclude 'META-INF/BCKEY.SF' - } + compileSdkVersion 23 + buildToolsVersion "23.0.2" + + defaultConfig { + minSdkVersion 14 + targetSdkVersion 23 + versionCode 127 + versionName "1.10.0" + archivesBaseName += "-$versionName" + applicationId "eu.siacs.conversations" + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + productFlavors { + playstore + free + } + if (project.hasProperty('mStoreFile') && + project.hasProperty('mStorePassword') && + project.hasProperty('mKeyAlias') && + project.hasProperty('mKeyPassword')) { + signingConfigs { + release { + storeFile file(mStoreFile) + storePassword mStorePassword + keyAlias mKeyAlias + keyPassword mKeyPassword + } + } + buildTypes.release.signingConfig = signingConfigs.release + } else { + buildTypes.release.signingConfig = null + } + + lintOptions { + disable 'ExtraTranslation', 'MissingTranslation', 'InvalidPackage', 'MissingQuantity', 'AppCompatResource' + } + + subprojects { + + afterEvaluate { + if (getPlugins().hasPlugin('android') || + getPlugins().hasPlugin('android-library')) { + + configure(android.lintOptions) { + disable 'AndroidGradlePluginVersion', 'MissingTranslation' + } + } + + } + } + + packagingOptions { + exclude 'META-INF/BCKEY.DSA' + exclude 'META-INF/BCKEY.SF' + } } -- cgit v1.2.3 From 894b5892a977c6b7ac52f07e00f452a44bdc1168 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 23 Feb 2016 15:30:41 +0100 Subject: Retry decryption from message menu --- src/main/java/eu/siacs/conversations/entities/Message.java | 1 + .../eu/siacs/conversations/ui/ConversationFragment.java | 13 +++++++++++++ src/main/java/eu/siacs/conversations/utils/UIHelper.java | 4 +++- src/main/res/menu/message_context.xml | 4 ++++ src/main/res/values/strings.xml | 1 - 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index 63db9a44..3dfbd787 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -449,6 +449,7 @@ public class Message extends AbstractEntity { this.getTransferable() == null && message.getTransferable() == null && message.getEncryption() != Message.ENCRYPTION_PGP && + message.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED && this.getType() == message.getType() && //this.getStatus() == message.getStatus() && isStatusMergeable(this.getStatus(), message.getStatus()) && diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index d5c77490..15e4b985 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -523,6 +523,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa activity.getMenuInflater().inflate(R.menu.message_context, menu); menu.setHeaderTitle(R.string.message_options); MenuItem copyText = menu.findItem(R.id.copy_text); + MenuItem retryDecryption = menu.findItem(R.id.retry_decryption); MenuItem correctMessage = menu.findItem(R.id.correct_message); MenuItem shareWith = menu.findItem(R.id.share_with); MenuItem sendAgain = menu.findItem(R.id.send_again); @@ -535,6 +536,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa && m.treatAsDownloadable() != Message.Decision.MUST) { copyText.setVisible(true); } + if (m.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) { + retryDecryption.setVisible(true); + } if (relevantForCorrection.getType() == Message.TYPE_TEXT && relevantForCorrection.isLastCorrectableMessage()) { correctMessage.setVisible(true); @@ -590,6 +594,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa case R.id.cancel_transmission: cancelTransmission(selectedMessage); return true; + case R.id.retry_decryption: + retryDecryption(selectedMessage); + return true; default: return super.onContextItemSelected(item); } @@ -673,6 +680,12 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } } + private void retryDecryption(Message message) { + message.setEncryption(Message.ENCRYPTION_PGP); + activity.xmppConnectionService.updateConversationUi(); + conversation.getAccount().getPgpDecryptionService().add(message); + } + protected void privateMessageWith(final Jid counterpart) { this.mEditMessage.setText(""); this.conversation.setNextCounterpart(counterpart); diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java index cf1e0d3b..5e8af085 100644 --- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java @@ -171,7 +171,9 @@ public class UIHelper { return new Pair<>("",false); } } else if (message.getEncryption() == Message.ENCRYPTION_PGP) { - return new Pair<>(context.getString(R.string.encrypted_message_received),true); + return new Pair<>(context.getString(R.string.pgp_message),true); + } else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) { + return new Pair<>(context.getString(R.string.decryption_failed), true); } else if (message.getType() == Message.TYPE_FILE || message.getType() == Message.TYPE_IMAGE) { if (message.getStatus() == Message.STATUS_RECEIVED) { return new Pair<>(context.getString(R.string.received_x_file, diff --git a/src/main/res/menu/message_context.xml b/src/main/res/menu/message_context.xml index 0d4e66ef..4096297c 100644 --- a/src/main/res/menu/message_context.xml +++ b/src/main/res/menu/message_context.xml @@ -5,6 +5,10 @@ android:id="@+id/copy_text" android:title="@string/copy_text" android:visible="false"/> + Conversations is unable to encrypt your messages because your contact is not announcing his or hers public key.\n\nPlease ask your contact to setup OpenPGP. No OpenPGP Keys found Conversations is unable to encrypt your messages because your contacts are not announcing their public key.\n\nPlease ask your contacts to setup OpenPGP. - Encrypted message received. Touch to decrypt. General XMPP resource The name this client identifies itself with -- cgit v1.2.3 From 0298f0181e564d1edfc4289598c56f5ce2a4e666 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 23 Feb 2016 16:14:55 +0100 Subject: reset pending subscription request when receiving roster update --- src/main/java/eu/siacs/conversations/entities/Contact.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java index faafe78c..9887d3ef 100644 --- a/src/main/java/eu/siacs/conversations/entities/Contact.java +++ b/src/main/java/eu/siacs/conversations/entities/Contact.java @@ -382,11 +382,13 @@ public class Contact implements ListItem, Blockable { this.resetOption(Options.TO); this.setOption(Options.FROM); this.resetOption(Options.PREEMPTIVE_GRANT); + this.resetOption(Options.PENDING_SUBSCRIPTION_REQUEST); break; case "both": this.setOption(Options.TO); this.setOption(Options.FROM); this.resetOption(Options.PREEMPTIVE_GRANT); + this.resetOption(Options.PENDING_SUBSCRIPTION_REQUEST); break; case "none": this.resetOption(Options.FROM); -- cgit v1.2.3 From 34f2a63190f499467c8ab517e61a98a6e8868f76 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 23 Feb 2016 16:15:23 +0100 Subject: update notification after message correction --- src/main/java/eu/siacs/conversations/parser/MessageParser.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index f01e7ce1..43edb2c3 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -411,6 +411,7 @@ public class MessageParser extends AbstractParser implements replacedMessage.markUnread(); } mXmppConnectionService.updateMessage(replacedMessage, uuid); + mXmppConnectionService.getNotificationService().updateNotification(false); if (mXmppConnectionService.confirmMessages() && remoteMsgId != null && !isForwarded && !isTypeGroupChat) { sendMessageReceipts(account, packet); } -- cgit v1.2.3 From 17b1fcc3eafa078a902c662a6e774bcd7f2927b3 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 23 Feb 2016 16:15:55 +0100 Subject: set noMessagesLeftOnServer before conference configuration fetch --- .../java/eu/siacs/conversations/services/XmppConnectionService.java | 3 ++- src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 24a728f7..ec13d6dc 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1772,6 +1772,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa account.pendingConferenceLeaves.remove(conversation); if (account.getStatus() == Account.State.ONLINE) { conversation.resetMucOptions(); + conversation.setHasMessagesLeftOnServer(false); fetchConferenceConfiguration(conversation, new OnConferenceConfigurationFetched() { private void join(Conversation conversation) { @@ -1806,7 +1807,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa conversation.setContactJid(joinJid); databaseBackend.updateConversation(conversation); } - conversation.setHasMessagesLeftOnServer(false); if (conversation.getMucOptions().mamSupport()) { getMessageArchiveService().catchupMUC(conversation); } @@ -1828,6 +1828,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } else { account.pendingConferenceJoins.add(conversation); conversation.resetMucOptions(); + conversation.setHasMessagesLeftOnServer(false); updateConversationUi(); } } diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index f8d1c97f..d50e0661 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -14,7 +14,6 @@ import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Intents; -import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; -- cgit v1.2.3 From d1a456f3e3e3f82e8e7b7f36d12b62ebb2a0fac2 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 24 Feb 2016 14:47:49 +0100 Subject: made hard coded choice for encryptions more flexible and disable parsing --- src/main/java/eu/siacs/conversations/Config.java | 34 ++++++++++++++++++++-- .../siacs/conversations/entities/Conversation.java | 10 +++++-- .../siacs/conversations/parser/MessageParser.java | 7 ++--- .../services/XmppConnectionService.java | 29 ++++++++++-------- .../conversations/ui/ConversationActivity.java | 10 ++++--- .../conversations/ui/ManageAccountActivity.java | 2 +- 6 files changed, 66 insertions(+), 26 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 4d64c3aa..549778f3 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -6,13 +6,43 @@ import eu.siacs.conversations.xmpp.chatstate.ChatState; public final class Config { + + private static final int UNENCRYPTED = 1; + private static final int OPENPGP = 2; + private static final int OTR = 4; + private static final int OMEMO = 8; + + private static final int ENCRYPTION_MASK = UNENCRYPTED | OPENPGP | OTR | OMEMO; + + public static boolean supportUnencrypted() { + return (ENCRYPTION_MASK & UNENCRYPTED) != 0; + } + + public static boolean supportOpenPgp() { + return (ENCRYPTION_MASK & OPENPGP) != 0; + } + + public static boolean supportOpenPgpOnly() { + return supportOpenPgp() && !multipleEncryptionChoices(); + } + + public static boolean supportOtr() { + return (ENCRYPTION_MASK & OTR) != 0; + } + + public static boolean supportOmemo() { + return (ENCRYPTION_MASK & OMEMO) != 0; + } + + public static boolean multipleEncryptionChoices() { + return (ENCRYPTION_MASK & (ENCRYPTION_MASK - 1)) != 0; + } + public static final String LOGTAG = "conversations"; public static final String DOMAIN_LOCK = null; //only allow account creation for this domain public static final boolean DISALLOW_REGISTRATION_IN_UI = false; //hide the register checkbox - public static final boolean HIDE_PGP_IN_UI = false; //some more consumer focused clients might want to disable OpenPGP - public static final boolean FORCE_E2E_ENCRYPTION = false; //disables ability to send unencrypted 1-on-1 public static final boolean ALLOW_NON_TLS_CONNECTIONS = false; //very dangerous. you should have a good reason to set this to true public static final boolean FORCE_ORBOT = false; // always use TOR public static final boolean HIDE_MESSAGE_TEXT_IN_NOTIFICATION = false; diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index a179d96b..796b36f9 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -673,11 +673,15 @@ public class Conversation extends AbstractEntity implements Blockable { next = outgoing; } } - if (Config.FORCE_E2E_ENCRYPTION && mode == MODE_SINGLE && next <= 0) { - if (axolotlService != null && axolotlService.isContactAxolotlCapable(getContact())) { + if (!Config.supportUnencrypted() + && (mode == MODE_SINGLE || Config.supportOpenPgpOnly()) + && next <= 0) { + if (Config.supportOmemo() && (axolotlService != null && axolotlService.isContactAxolotlCapable(getContact()) || !Config.multipleEncryptionChoices())) { return Message.ENCRYPTION_AXOLOTL; - } else { + } else if (Config.supportOtr()) { return Message.ENCRYPTION_OTR; + } else if (Config.supportOpenPgp()) { + return Message.ENCRYPTION_PGP; } } return next; diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index 43edb2c3..aa9d7f6c 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -3,7 +3,6 @@ package eu.siacs.conversations.parser; import android.util.Log; import android.util.Pair; -import eu.siacs.conversations.crypto.PgpDecryptionService; import net.java.otr4j.session.Session; import net.java.otr4j.session.SessionStatus; @@ -345,7 +344,7 @@ public class MessageParser extends AbstractParser implements } } Message message; - if (body != null && body.startsWith("?OTR")) { + if (body != null && body.startsWith("?OTR") && Config.supportOtr()) { if (!isForwarded && !isTypeGroupChat && isProperlyAddressed) { message = parseOtrChat(body, from, remoteMsgId, conversation); if (message == null) { @@ -355,9 +354,9 @@ public class MessageParser extends AbstractParser implements Log.d(Config.LOGTAG,account.getJid().toBareJid()+": ignoring OTR message from "+from+" isForwarded="+Boolean.toString(isForwarded)+", isProperlyAddressed="+Boolean.valueOf(isProperlyAddressed)); message = new Message(conversation, body, Message.ENCRYPTION_NONE, status); } - } else if (pgpEncrypted != null) { + } else if (pgpEncrypted != null && Config.supportOpenPgp()) { message = new Message(conversation, pgpEncrypted, Message.ENCRYPTION_PGP, status); - } else if (axolotlEncrypted != null) { + } else if (axolotlEncrypted != null && Config.supportOmemo()) { message = parseAxolotlChat(axolotlEncrypted, from, remoteMsgId, conversation, status); if (message == null) { return; diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index ec13d6dc..aec9b112 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -351,7 +351,9 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } public PgpEngine getPgpEngine() { - if (pgpServiceConnection != null && pgpServiceConnection.isBound()) { + if (!Config.supportOpenPgp()) { + return null; + } else if (pgpServiceConnection != null && pgpServiceConnection.isBound()) { if (this.mPgpEngine == null) { this.mPgpEngine = new PgpEngine(new OpenPgpApi( getApplicationContext(), @@ -689,20 +691,23 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa getContentResolver().registerContentObserver(ContactsContract.Contacts.CONTENT_URI, true, contactObserver); this.fileObserver.startWatching(); - this.pgpServiceConnection = new OpenPgpServiceConnection(getApplicationContext(), "org.sufficientlysecure.keychain", new OpenPgpServiceConnection.OnBound() { - @Override - public void onBound(IOpenPgpService2 service) { - for (Account account : accounts) { - if (account.getPgpDecryptionService() != null) { - account.getPgpDecryptionService().onOpenPgpServiceBound(); + if (Config.supportOpenPgp()) { + this.pgpServiceConnection = new OpenPgpServiceConnection(getApplicationContext(), "org.sufficientlysecure.keychain", new OpenPgpServiceConnection.OnBound() { + @Override + public void onBound(IOpenPgpService2 service) { + for (Account account : accounts) { + if (account.getPgpDecryptionService() != null) { + account.getPgpDecryptionService().onOpenPgpServiceBound(); + } } } - } - @Override - public void onError(Exception e) { } - }); - this.pgpServiceConnection.bindToService(); + @Override + public void onError(Exception e) { + } + }); + this.pgpServiceConnection.bindToService(); + } this.pm = (PowerManager) getSystemService(Context.POWER_SERVICE); this.wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "XmppConnectionService"); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 11e2e889..7b2565c3 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -408,9 +408,10 @@ public class ConversationActivity extends XmppActivity menuContactDetails.setVisible(false); menuAttach.setVisible(getSelectedConversation().getAccount().httpUploadAvailable() && getSelectedConversation().getMucOptions().participating()); menuInviteContact.setVisible(getSelectedConversation().getMucOptions().canInvite()); - menuSecure.setVisible(!Config.HIDE_PGP_IN_UI && !Config.X509_VERIFICATION); //if pgp is hidden conferences have no choice of encryption + menuSecure.setVisible(Config.supportOpenPgp() && Config.multipleEncryptionChoices()); //only if pgp is supported we have a choice } else { menuMucDetails.setVisible(false); + menuSecure.setVisible(Config.multipleEncryptionChoices()); } if (this.getSelectedConversation().isMuted()) { menuMute.setVisible(false); @@ -849,9 +850,10 @@ public class ConversationActivity extends XmppActivity MenuItem none = popup.getMenu().findItem(R.id.encryption_choice_none); MenuItem pgp = popup.getMenu().findItem(R.id.encryption_choice_pgp); MenuItem axolotl = popup.getMenu().findItem(R.id.encryption_choice_axolotl); - pgp.setVisible(!Config.HIDE_PGP_IN_UI && !Config.X509_VERIFICATION); - none.setVisible(!Config.FORCE_E2E_ENCRYPTION || conversation.getMode() == Conversation.MODE_MULTI); - otr.setVisible(!Config.X509_VERIFICATION); + pgp.setVisible(Config.supportOpenPgp()); + none.setVisible(Config.supportUnencrypted() || conversation.getMode() == Conversation.MODE_MULTI); + otr.setVisible(Config.supportOtr()); + axolotl.setVisible(Config.supportOmemo()); if (conversation.getMode() == Conversation.MODE_MULTI) { otr.setVisible(false); axolotl.setVisible(false); diff --git a/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java index f2511ecb..515f6fbd 100644 --- a/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -123,7 +123,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda menu.findItem(R.id.mgmt_account_publish_avatar).setVisible(false); } else { menu.findItem(R.id.mgmt_account_enable).setVisible(false); - menu.findItem(R.id.mgmt_account_announce_pgp).setVisible(!Config.HIDE_PGP_IN_UI); + menu.findItem(R.id.mgmt_account_announce_pgp).setVisible(Config.supportOpenPgp()); } menu.setHeaderTitle(this.selectedAccount.getJid().toBareJid().toString()); } -- cgit v1.2.3 From bbede8bbeb8728aac35856cc41eabea899056d74 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 24 Feb 2016 16:53:19 +0100 Subject: optionally lock conference domains as well and hide known domains in ui --- src/main/java/eu/siacs/conversations/Config.java | 4 ++++ .../eu/siacs/conversations/entities/Bookmark.java | 13 +++++++++++++ .../java/eu/siacs/conversations/entities/Contact.java | 11 +++++++++++ .../eu/siacs/conversations/entities/ListItem.java | 12 +++++++----- .../conversations/ui/ConferenceDetailsActivity.java | 7 +++++-- .../conversations/ui/ContactDetailsActivity.java | 8 ++++---- .../eu/siacs/conversations/ui/EnterJidDialog.java | 19 ++++++++++++++----- .../conversations/ui/StartConversationActivity.java | 18 ++++++++++++++---- .../conversations/ui/adapter/ListItemAdapter.java | 4 ++-- src/main/res/values/strings.xml | 2 ++ 10 files changed, 76 insertions(+), 22 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 549778f3..52925b94 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -42,6 +42,10 @@ public final class Config { public static final String DOMAIN_LOCK = null; //only allow account creation for this domain + public static final String CONFERENCE_DOMAIN_LOCK = null; //only allow conference creation for this domain + public static final boolean LOCK_DOMAINS_IN_CONVERSATIONS = false; //only add contacts and conferences for own domains + + public static final boolean DISALLOW_REGISTRATION_IN_UI = false; //hide the register checkbox public static final boolean ALLOW_NON_TLS_CONNECTIONS = false; //very dangerous. you should have a good reason to set this to true public static final boolean FORCE_ORBOT = false; // always use TOR diff --git a/src/main/java/eu/siacs/conversations/entities/Bookmark.java b/src/main/java/eu/siacs/conversations/entities/Bookmark.java index acb4bf1a..088dfd8a 100644 --- a/src/main/java/eu/siacs/conversations/entities/Bookmark.java +++ b/src/main/java/eu/siacs/conversations/entities/Bookmark.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; +import eu.siacs.conversations.Config; import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xmpp.jid.Jid; @@ -57,6 +58,18 @@ public class Bookmark extends Element implements ListItem { } } + @Override + public String getDisplayJid() { + Jid jid = getJid(); + if (Config.LOCK_DOMAINS_IN_CONVERSATIONS && jid != null && jid.getDomainpart().equals(Config.CONFERENCE_DOMAIN_LOCK)) { + return jid.getLocalpart(); + } else if (jid != null) { + return jid.toString(); + } else { + return null; + } + } + @Override public Jid getJid() { return this.getAttributeAsJid("jid"); diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java index 9887d3ef..691fc3e4 100644 --- a/src/main/java/eu/siacs/conversations/entities/Contact.java +++ b/src/main/java/eu/siacs/conversations/entities/Contact.java @@ -121,6 +121,17 @@ public class Contact implements ListItem, Blockable { } } + @Override + public String getDisplayJid() { + if (Config.LOCK_DOMAINS_IN_CONVERSATIONS && jid != null && jid.getDomainpart().equals(Config.DOMAIN_LOCK)) { + return jid.getLocalpart(); + } else if (jid != null) { + return jid.toString(); + } else { + return null; + } + } + public String getProfilePhoto() { return this.photoUri; } diff --git a/src/main/java/eu/siacs/conversations/entities/ListItem.java b/src/main/java/eu/siacs/conversations/entities/ListItem.java index efc1c2b9..22aedd4b 100644 --- a/src/main/java/eu/siacs/conversations/entities/ListItem.java +++ b/src/main/java/eu/siacs/conversations/entities/ListItem.java @@ -5,13 +5,15 @@ import java.util.List; import eu.siacs.conversations.xmpp.jid.Jid; public interface ListItem extends Comparable { - public String getDisplayName(); + String getDisplayName(); - public Jid getJid(); + String getDisplayJid(); - public List getTags(); + Jid getJid(); - public final class Tag { + List getTags(); + + final class Tag { private final String name; private final int color; @@ -29,5 +31,5 @@ public interface ListItem extends Comparable { } } - public boolean match(final String needle); + boolean match(final String needle); } diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index be454936..a83ca8ba 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -6,7 +6,6 @@ import android.app.PendingIntent; import android.content.Context; import android.content.DialogInterface; import android.content.IntentSender.SendIntentException; -import android.graphics.Bitmap; import android.os.Build; import android.os.Bundle; import android.view.ContextMenu; @@ -512,7 +511,11 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers mAccountJid.setText(getString(R.string.using_account, account)); mYourPhoto.setImageBitmap(avatarService().get(mConversation.getAccount(), getPixel(48))); setTitle(mConversation.getName()); - mFullJid.setText(mConversation.getJid().toBareJid().toString()); + if (Config.LOCK_DOMAINS_IN_CONVERSATIONS && mConversation.getJid().getDomainpart().equals(Config.CONFERENCE_DOMAIN_LOCK)) { + mFullJid.setText(mConversation.getJid().getLocalpart()); + } else { + mFullJid.setText(mConversation.getJid().toBareJid().toString()); + } mYourNick.setText(mucOptions.getActualNick()); mRoleAffiliaton = (TextView) findViewById(R.id.muc_role); if (mucOptions.online()) { diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index d50e0661..64653acd 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -139,7 +139,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd ContactDetailsActivity.this); builder.setTitle(getString(R.string.action_add_phone_book)); builder.setMessage(getString(R.string.add_phone_book_text, - contact.getJid())); + contact.getDisplayJid())); builder.setNegativeButton(getString(R.string.cancel), null); builder.setPositiveButton(getString(R.string.add), addToPhonebook); builder.create().show(); @@ -236,7 +236,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd builder.setTitle(getString(R.string.action_delete_contact)) .setMessage( getString(R.string.remove_contact_text, - contact.getJid())) + contact.getDisplayJid())) .setPositiveButton(getString(R.string.delete), removeFromRoster).create().show(); break; @@ -358,10 +358,10 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd } if (contact.getPresences().size() > 1) { - contactJidTv.setText(contact.getJid() + " (" + contactJidTv.setText(contact.getDisplayJid() + " (" + contact.getPresences().size() + ")"); } else { - contactJidTv.setText(contact.getJid().toString()); + contactJidTv.setText(contact.getDisplayJid()); } String account; if (Config.DOMAIN_LOCK != null) { diff --git a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java index bb55420d..a6b3c73c 100644 --- a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java @@ -2,13 +2,12 @@ package eu.siacs.conversations.ui; import android.app.AlertDialog; import android.content.Context; -import android.content.DialogInterface.OnClickListener; -import android.content.DialogInterface; import android.view.LayoutInflater; import android.view.View; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Spinner; +import android.widget.TextView; import java.util.List; @@ -44,12 +43,17 @@ public class EnterJidDialog { final String title, final String positiveButton, final String prefilledJid, final String account, boolean allowEditJid ) { + final boolean lock = Config.LOCK_DOMAINS_IN_CONVERSATIONS && Config.DOMAIN_LOCK != null; AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); View dialogView = LayoutInflater.from(context).inflate(R.layout.enter_jid_dialog, null); + final TextView jabberIdDesc = (TextView) dialogView.findViewById(R.id.jabber_id); + jabberIdDesc.setText(lock ? R.string.username : R.string.account_settings_jabber_id); final Spinner spinner = (Spinner) dialogView.findViewById(R.id.account); final AutoCompleteTextView jid = (AutoCompleteTextView) dialogView.findViewById(R.id.jid); - jid.setAdapter(new KnownHostsAdapter(context,android.R.layout.simple_list_item_1, knownHosts)); + if (!lock) { + jid.setAdapter(new KnownHostsAdapter(context, android.R.layout.simple_list_item_1, knownHosts)); + } if (prefilledJid != null) { jid.append(prefilledJid); if (!allowEditJid) { @@ -60,6 +64,7 @@ public class EnterJidDialog { } } + jid.setHint(Config.LOCK_DOMAINS_IN_CONVERSATIONS && Config.DOMAIN_LOCK != null ? R.string.username_hint : R.string.account_settings_example_jabber_id); if (account == null) { StartConversationActivity.populateAccountSpinner(context, activatedAccounts, spinner); @@ -95,9 +100,13 @@ public class EnterJidDialog { } final Jid contactJid; try { - contactJid = Jid.fromString(jid.getText().toString()); + if (lock) { + contactJid = Jid.fromParts(jid.getText().toString(), Config.DOMAIN_LOCK, null); + } else { + contactJid = Jid.fromString(jid.getText().toString()); + } } catch (final InvalidJidException e) { - jid.setError(context.getString(R.string.invalid_jid)); + jid.setError(context.getString(lock ? R.string.invalid_username : R.string.invalid_jid)); return; } diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index 8b3b4607..48baf914 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -44,6 +44,7 @@ import android.widget.Checkable; import android.widget.EditText; import android.widget.ListView; import android.widget.Spinner; +import android.widget.TextView; import android.widget.Toast; import com.google.zxing.integration.android.IntentIntegrator; @@ -64,7 +65,6 @@ import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.ListItem; import eu.siacs.conversations.entities.Presence; -import eu.siacs.conversations.entities.Presences; import eu.siacs.conversations.services.XmppConnectionService.OnRosterUpdate; import eu.siacs.conversations.ui.adapter.KnownHostsAdapter; import eu.siacs.conversations.ui.adapter.ListItemAdapter; @@ -390,7 +390,13 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU final View dialogView = getLayoutInflater().inflate(R.layout.join_conference_dialog, null); final Spinner spinner = (Spinner) dialogView.findViewById(R.id.account); final AutoCompleteTextView jid = (AutoCompleteTextView) dialogView.findViewById(R.id.jid); - jid.setAdapter(new KnownHostsAdapter(this, android.R.layout.simple_list_item_1, mKnownConferenceHosts)); + final boolean lock = Config.LOCK_DOMAINS_IN_CONVERSATIONS && Config.CONFERENCE_DOMAIN_LOCK != null; + final TextView jabberIdDesc = (TextView) dialogView.findViewById(R.id.jabber_id); + jabberIdDesc.setText(lock ? R.string.conference_name : R.string.conference_address); + jid.setHint(lock ? R.string.conference_name : R.string.conference_address_example); + if (!lock) { + jid.setAdapter(new KnownHostsAdapter(this, android.R.layout.simple_list_item_1, mKnownConferenceHosts)); + } if (prefilledJid != null) { jid.append(prefilledJid); } @@ -416,9 +422,13 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU } final Jid conferenceJid; try { - conferenceJid = Jid.fromString(jid.getText().toString()); + if (lock) { + conferenceJid = Jid.fromParts(jid.getText().toString(),Config.CONFERENCE_DOMAIN_LOCK, null); + } else { + conferenceJid = Jid.fromString(jid.getText().toString()); + } } catch (final InvalidJidException e) { - jid.setError(getString(R.string.invalid_jid)); + jid.setError(getString(lock ? R.string.invalid_conference_name : R.string.invalid_jid)); return; } diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java index 47414f90..da8e3910 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java @@ -76,10 +76,10 @@ public class ListItemAdapter extends ArrayAdapter { tagLayout.addView(tv); } } - final Jid jid = item.getJid(); + final String jid = item.getDisplayJid(); if (jid != null) { tvJid.setVisibility(View.VISIBLE); - tvJid.setText(jid.toString()); + tvJid.setText(jid); } else { tvJid.setVisibility(View.GONE); } diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 8e3629ca..a25c1a84 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -522,6 +522,8 @@ Username Username This is not a valid username + Conference name + This is not a valid conference name Download failed: Server not found Download failed: File not found Download failed: Could not connect to host -- cgit v1.2.3 From 5d3ee60ca4b98ea2defbe70e4c19a81e22a4f97e Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 24 Feb 2016 17:12:29 +0100 Subject: hide add account icons when single_account is set to true --- src/main/java/eu/siacs/conversations/Config.java | 3 ++- src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 52925b94..caadef80 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -45,8 +45,9 @@ public final class Config { public static final String CONFERENCE_DOMAIN_LOCK = null; //only allow conference creation for this domain public static final boolean LOCK_DOMAINS_IN_CONVERSATIONS = false; //only add contacts and conferences for own domains - + public static final boolean SINGLE_ACCOUNT = false; //set to true to allow only one account public static final boolean DISALLOW_REGISTRATION_IN_UI = false; //hide the register checkbox + public static final boolean ALLOW_NON_TLS_CONNECTIONS = false; //very dangerous. you should have a good reason to set this to true public static final boolean FORCE_ORBOT = false; // always use TOR public static final boolean HIDE_MESSAGE_TEXT_IN_NOTIFICATION = false; diff --git a/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java index 515f6fbd..1fc1924d 100644 --- a/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -154,7 +154,10 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda if (Config.X509_VERIFICATION) { addAccount.setVisible(false); addAccountWithCertificate.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); + } else { + addAccount.setVisible(!Config.SINGLE_ACCOUNT); } + addAccountWithCertificate.setVisible(!Config.SINGLE_ACCOUNT); if (!accountsLeftToEnable()) { enableAll.setVisible(false); -- cgit v1.2.3 From dc00a92499ebcf23eb5883ea5f5419abd7b8f348 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 26 Feb 2016 09:46:25 +0100 Subject: execute pending mam queries every time we come online --- .../java/eu/siacs/conversations/services/XmppConnectionService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index aec9b112..8df3808c 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -262,7 +262,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa if (mPushManagementService.available(account)) { mPushManagementService.registerPushTokenOnServer(account); } - mMessageArchiveService.executePendingQueries(account); connectMultiModeConversations(account); syncDirtyContacts(account); } @@ -276,6 +275,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa mOnAccountUpdate.onAccountUpdate(); } if (account.getStatus() == Account.State.ONLINE) { + mMessageArchiveService.executePendingQueries(account); if (connection != null && connection.getFeatures().csi()) { if (checkListeners()) { Log.d(Config.LOGTAG, account.getJid().toBareJid() + " sending csi//inactive"); -- cgit v1.2.3 From 7fd6a37e670682e5e7cc3c0a4cb1939e09b0f291 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 26 Feb 2016 09:48:58 +0100 Subject: disallow message correction by default. fixes #1720 --- .../java/eu/siacs/conversations/services/XmppConnectionService.java | 2 +- src/main/res/xml/preferences.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 8df3808c..dde8ad28 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -2629,7 +2629,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } public boolean allowMessageCorrection() { - return getPreferences().getBoolean("allow_message_correction", true); + return getPreferences().getBoolean("allow_message_correction", false); } public boolean sendChatStates() { diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index e8747a8b..35799573 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -147,7 +147,7 @@ android:summary="@string/pref_remove_trusted_certificates_summary" android:title="@string/pref_remove_trusted_certificates_title"/> -- cgit v1.2.3 From c393e6089177f31683c4cecfdb359802de1b5e0c Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 26 Feb 2016 09:53:02 +0100 Subject: version bump to 1.10.1 and changelog --- CHANGELOG.md | 4 ++++ build.gradle | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f847e94d..f18dab94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ###Changelog +####Version 1.10.1 +* made message correction opt-in +* various bug fixes + ####Version 1.10.0 * Support for XEP-0357: Push Notifications * Support for XEP-0308: Last Message Correction diff --git a/build.gradle b/build.gradle index deaae0e2..b6ef6013 100644 --- a/build.gradle +++ b/build.gradle @@ -58,8 +58,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 23 - versionCode 127 - versionName "1.10.0" + versionCode 128 + versionName "1.10.1" archivesBaseName += "-$versionName" applicationId "eu.siacs.conversations" } -- cgit v1.2.3