aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authorSam Whited <sam@samwhited.com>2014-11-06 14:49:39 -0500
committerSam Whited <sam@samwhited.com>2014-11-09 07:00:40 -0500
commit9db624ec7b6323c7e55aab6f8ec8489d1068fb5f (patch)
tree8a2f424c3bb8a91cd38fb462a53f860d3575adf0 /src/main/java/eu
parent864f319500937fb46d86104b12ce767dd6725f64 (diff)
It builds again!
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Account.java14
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java7
-rw-r--r--src/main/java/eu/siacs/conversations/ui/SettingsActivity.java6
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java6
4 files changed, 14 insertions, 19 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Account.java b/src/main/java/eu/siacs/conversations/entities/Account.java
index ee4cce80..e367b41a 100644
--- a/src/main/java/eu/siacs/conversations/entities/Account.java
+++ b/src/main/java/eu/siacs/conversations/entities/Account.java
@@ -88,10 +88,7 @@ public class Account extends AbstractEntity {
this.uuid = uuid;
this.jid = jid;
if (jid.getResourcepart().isEmpty()) {
- try {
- this.setResource("mobile");
- } catch (final InvalidJidException ignored) {
- }
+ this.setResource("mobile");
}
this.password = password;
this.options = options;
@@ -164,9 +161,12 @@ public class Account extends AbstractEntity {
return getXmppConnection() != null && getStatus() > STATUS_NO_INTERNET && (getXmppConnection().getAttempt() >= 2);
}
- public void setResource(final String resource) throws InvalidJidException {
- jid = Jid.fromParts(jid.getLocalpart(), jid.getDomainpart(), resource);
- }
+ public void setResource(final String resource){
+ try {
+ jid = Jid.fromParts(jid.getLocalpart(), jid.getDomainpart(), resource);
+ } catch (final InvalidJidException ignored) {
+ }
+ }
public String getResource() {
return jid.getResourcepart();
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index e7897c9b..f2f9becd 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -535,11 +535,8 @@ public class XmppConnectionService extends Service {
public XmppConnection createConnection(Account account) {
SharedPreferences sharedPref = getPreferences();
- try {
- account.setResource(sharedPref.getString("resource", "mobile")
- .toLowerCase(Locale.getDefault()));
- } catch (final InvalidJidException ignored) {
- }
+ account.setResource(sharedPref.getString("resource", "mobile")
+ .toLowerCase(Locale.getDefault()));
XmppConnection connection = new XmppConnection(account, this);
connection.setOnMessagePacketReceivedListener(this.mMessageParser);
connection.setOnStatusChangedListener(this.statusListener);
diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
index fc6308fc..aba60175 100644
--- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
@@ -5,6 +5,8 @@ import java.util.Arrays;
import java.util.Locale;
import eu.siacs.conversations.entities.Account;
+import eu.siacs.conversations.xmpp.jid.InvalidJidException;
+
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Build;
@@ -62,8 +64,8 @@ public class SettingsActivity extends XmppActivity implements
.toLowerCase(Locale.US);
if (xmppConnectionServiceBound) {
for (Account account : xmppConnectionService.getAccounts()) {
- account.setResource(resource);
- if (!account.isOptionSet(Account.OPTION_DISABLED)) {
+ account.setResource(resource);
+ if (!account.isOptionSet(Account.OPTION_DISABLED)) {
xmppConnectionService.reconnectAccount(account, false);
}
}
diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
index 9c160384..11cbca81 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -851,11 +851,7 @@ public class XmppConnection implements Runnable {
Element streamError = tagReader.readElement(currentTag);
if (streamError != null && streamError.hasChild("conflict")) {
final String resource = account.getResource().split("\\.")[0];
- try {
- account.setResource(resource + "." + nextRandomId());
- } catch (final InvalidJidException ignored) {
- // Should never reach here.
- }
+ account.setResource(resource + "." + nextRandomId());
Log.d(Config.LOGTAG,
account.getJid() + ": switching resource due to conflict ("
+ account.getResource() + ")");