It builds again!
This commit is contained in:
parent
864f319500
commit
9db624ec7b
|
@ -88,10 +88,7 @@ public class Account extends AbstractEntity {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.jid = jid;
|
this.jid = jid;
|
||||||
if (jid.getResourcepart().isEmpty()) {
|
if (jid.getResourcepart().isEmpty()) {
|
||||||
try {
|
|
||||||
this.setResource("mobile");
|
this.setResource("mobile");
|
||||||
} catch (final InvalidJidException ignored) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
@ -164,8 +161,11 @@ public class Account extends AbstractEntity {
|
||||||
return getXmppConnection() != null && getStatus() > STATUS_NO_INTERNET && (getXmppConnection().getAttempt() >= 2);
|
return getXmppConnection() != null && getStatus() > STATUS_NO_INTERNET && (getXmppConnection().getAttempt() >= 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResource(final String resource) throws InvalidJidException {
|
public void setResource(final String resource){
|
||||||
|
try {
|
||||||
jid = Jid.fromParts(jid.getLocalpart(), jid.getDomainpart(), resource);
|
jid = Jid.fromParts(jid.getLocalpart(), jid.getDomainpart(), resource);
|
||||||
|
} catch (final InvalidJidException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getResource() {
|
public String getResource() {
|
||||||
|
|
|
@ -535,11 +535,8 @@ public class XmppConnectionService extends Service {
|
||||||
|
|
||||||
public XmppConnection createConnection(Account account) {
|
public XmppConnection createConnection(Account account) {
|
||||||
SharedPreferences sharedPref = getPreferences();
|
SharedPreferences sharedPref = getPreferences();
|
||||||
try {
|
|
||||||
account.setResource(sharedPref.getString("resource", "mobile")
|
account.setResource(sharedPref.getString("resource", "mobile")
|
||||||
.toLowerCase(Locale.getDefault()));
|
.toLowerCase(Locale.getDefault()));
|
||||||
} catch (final InvalidJidException ignored) {
|
|
||||||
}
|
|
||||||
XmppConnection connection = new XmppConnection(account, this);
|
XmppConnection connection = new XmppConnection(account, this);
|
||||||
connection.setOnMessagePacketReceivedListener(this.mMessageParser);
|
connection.setOnMessagePacketReceivedListener(this.mMessageParser);
|
||||||
connection.setOnStatusChangedListener(this.statusListener);
|
connection.setOnStatusChangedListener(this.statusListener);
|
||||||
|
|
|
@ -5,6 +5,8 @@ import java.util.Arrays;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
|
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
|
@ -851,11 +851,7 @@ public class XmppConnection implements Runnable {
|
||||||
Element streamError = tagReader.readElement(currentTag);
|
Element streamError = tagReader.readElement(currentTag);
|
||||||
if (streamError != null && streamError.hasChild("conflict")) {
|
if (streamError != null && streamError.hasChild("conflict")) {
|
||||||
final String resource = account.getResource().split("\\.")[0];
|
final String resource = account.getResource().split("\\.")[0];
|
||||||
try {
|
|
||||||
account.setResource(resource + "." + nextRandomId());
|
account.setResource(resource + "." + nextRandomId());
|
||||||
} catch (final InvalidJidException ignored) {
|
|
||||||
// Should never reach here.
|
|
||||||
}
|
|
||||||
Log.d(Config.LOGTAG,
|
Log.d(Config.LOGTAG,
|
||||||
account.getJid() + ": switching resource due to conflict ("
|
account.getJid() + ": switching resource due to conflict ("
|
||||||
+ account.getResource() + ")");
|
+ account.getResource() + ")");
|
||||||
|
|
Loading…
Reference in New Issue