aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java4
-rw-r--r--src/main/java/de/pixart/messenger/entities/Account.java7
-rw-r--r--src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java3
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/EditAccountActivity.java7
5 files changed, 19 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
index 098586efa..0aa797aff 100644
--- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
+++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
@@ -533,7 +533,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
} else {
if (AxolotlService.this.changeAccessMode.compareAndSet(true, false)) {
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": done changing access mode");
- account.setOption(Account.OPTION_REQURIES_ACCESS_MODE_CHANGE, false);
+ account.setOption(Account.OPTION_REQUIRES_ACCESS_MODE_CHANGE,false);
mXmppConnectionService.databaseBackend.updateAccount(account);
}
ownPushPending.set(false);
@@ -589,7 +589,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
Log.d(Config.LOGTAG, getLogprefix(account) + "publishBundlesIfNeeded called, but PEP is broken. Ignoring... ");
return;
}
- this.changeAccessMode.set(account.isOptionSet(Account.OPTION_REQURIES_ACCESS_MODE_CHANGE) && account.getXmppConnection().getFeatures().pepPublishOptions());
+ this.changeAccessMode.set(account.isOptionSet(Account.OPTION_REQUIRES_ACCESS_MODE_CHANGE) && account.getXmppConnection().getFeatures().pepPublishOptions());
if (this.changeAccessMode.get()) {
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": server gained publish-options capabilities. changing access model");
}
diff --git a/src/main/java/de/pixart/messenger/entities/Account.java b/src/main/java/de/pixart/messenger/entities/Account.java
index 1ad4295d3..03673c689 100644
--- a/src/main/java/de/pixart/messenger/entities/Account.java
+++ b/src/main/java/de/pixart/messenger/entities/Account.java
@@ -57,7 +57,8 @@ public class Account extends AbstractEntity {
public static final int OPTION_REGISTER = 2;
public static final int OPTION_USECOMPRESSION = 3;
public static final int OPTION_MAGIC_CREATE = 4;
- public static final int OPTION_REQURIES_ACCESS_MODE_CHANGE = 5;
+ public static final int OPTION_REQUIRES_ACCESS_MODE_CHANGE = 5;
+ public static final int OPTION_LOGGED_IN_SUCCESSFULLY = 6;
public final HashSet<Pair<String, String>> inProgressDiscoFetches = new HashSet<>();
public boolean httpUploadAvailable(long filesize) {
@@ -297,12 +298,14 @@ public class Account extends AbstractEntity {
return ((options & (1 << option)) != 0);
}
- public void setOption(final int option, final boolean value) {
+ public boolean setOption(final int option, final boolean value) {
+ final int before = this.options;
if (value) {
this.options |= 1 << option;
} else {
this.options &= ~(1 << option);
}
+ return before != this.options;
}
public String getUsername() {
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
index b23212c83..07ff600d6 100644
--- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
@@ -460,7 +460,8 @@ public class DatabaseBackend extends SQLiteOpenHelper {
if (oldVersion < 37 && newVersion >= 37) {
List<Account> accounts = getAccounts(db);
for (Account account : accounts) {
- account.setOption(Account.OPTION_REQURIES_ACCESS_MODE_CHANGE, true);
+ account.setOption(Account.OPTION_REQUIRES_ACCESS_MODE_CHANGE, true);
+ account.setOption(Account.OPTION_LOGGED_IN_SUCCESSFULLY, false);
db.update(Account.TABLENAME, account.getContentValues(), Account.UUID
+ "=?", new String[]{account.getUuid()});
}
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index e7fd076cc..b54d94100 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -302,6 +302,9 @@ public class XmppConnectionService extends Service {
}
}
}
+ if (account.setOption(Account.OPTION_LOGGED_IN_SUCCESSFULLY, true)) {
+ databaseBackend.updateAccount(account);
+ }
account.getRoster().clearPresences();
mJingleConnectionManager.cancelInTransmission();
fetchRosterFromServer(account);
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
index 28224501d..634443165 100644
--- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
@@ -878,6 +878,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} else {
this.mAccountJid.getEditableText().append(this.mAccount.getJid().toBareJid().toString());
}
+ this.mPassword.getEditableText().clear();
+ this.mPassword.getEditableText().append(this.mAccount.getPassword());
this.mPassword.setText(this.mAccount.getPassword());
this.mHostname.setText("");
this.mHostname.getEditableText().append(this.mAccount.getHostname());
@@ -887,6 +889,11 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
+ final boolean editable = !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY);
+ this.mAccountJid.setEnabled(editable);
+ this.mAccountJid.setFocusable(editable);
+ this.mAccountJid.setFocusableInTouchMode(editable);
+
if (!mInitMode) {
this.mAvatar.setVisibility(View.VISIBLE);
this.mAvatar.setImageBitmap(avatarService().get(this.mAccount, getPixel(Config.AVATAR_SIZE)));