store jid if it was changed during bind
This commit is contained in:
parent
7b52e6984c
commit
4359afacb4
|
@ -277,8 +277,10 @@ public class Account extends AbstractEntity {
|
||||||
return jid.getLocalpart();
|
return jid.getLocalpart();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJid(final Jid jid) {
|
public boolean setJid(final Jid next) {
|
||||||
this.jid = jid;
|
final Jid prev = this.jid != null ? this.jid.toBareJid() : null;
|
||||||
|
this.jid = next;
|
||||||
|
return prev == null || (next != null && !prev.equals(next.toBareJid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Jid getServer() {
|
public Jid getServer() {
|
||||||
|
|
|
@ -981,7 +981,10 @@ public class XmppConnection implements Runnable {
|
||||||
final Element jid = bind.findChild("jid");
|
final Element jid = bind.findChild("jid");
|
||||||
if (jid != null && jid.getContent() != null) {
|
if (jid != null && jid.getContent() != null) {
|
||||||
try {
|
try {
|
||||||
account.setJid(Jid.fromString(jid.getContent()));
|
if (account.setJid(Jid.fromString(jid.getContent()))) {
|
||||||
|
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": bare jid changed during bind. updating database");
|
||||||
|
mXmppConnectionService.databaseBackend.updateAccount(account);
|
||||||
|
}
|
||||||
if (streamFeatures.hasChild("session")
|
if (streamFeatures.hasChild("session")
|
||||||
&& !streamFeatures.findChild("session").hasChild("optional")) {
|
&& !streamFeatures.findChild("session").hasChild("optional")) {
|
||||||
sendStartSession();
|
sendStartSession();
|
||||||
|
|
Loading…
Reference in a new issue