fix jid.withResource() for domain jids
This commit is contained in:
parent
a0920b83e2
commit
df3273a6fc
|
@ -451,13 +451,13 @@ public class Contact implements ListItem, Blockable {
|
|||
|
||||
@Override
|
||||
public boolean isDomainBlocked() {
|
||||
return getAccount().isBlocked(Jid.ofDomain(this.getJid().getDomain()));
|
||||
return getAccount().isBlocked(this.getJid().getDomain());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Jid getBlockedJid() {
|
||||
if (isDomainBlocked()) {
|
||||
return Jid.ofDomain(getJid().getDomain());
|
||||
return getJid().getDomain();
|
||||
} else {
|
||||
return getJid();
|
||||
}
|
||||
|
|
|
@ -2821,7 +2821,7 @@ public class XmppConnectionService extends Service {
|
|||
boolean changed = false;
|
||||
for (ListIterator<Jid> iterator = cryptoTargets.listIterator(); iterator.hasNext(); ) {
|
||||
Jid jid = iterator.next();
|
||||
if (!members.contains(jid) && !members.contains(Jid.ofDomain(jid.getDomain()))) {
|
||||
if (!members.contains(jid) && !members.contains(jid.getDomain())) {
|
||||
iterator.remove();
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": removed " + jid + " from crypto targets of " + conversation.getName());
|
||||
changed = true;
|
||||
|
|
|
@ -520,7 +520,7 @@ public class UIHelper {
|
|||
return ((Conversation) conversation).getMucOptions().getSelf().getName();
|
||||
} else {
|
||||
final Jid jid = conversation.getAccount().getJid();
|
||||
return jid.getLocal() != null ? jid.getLocal() : Jid.ofDomain(jid.getDomain()).toString();
|
||||
return jid.getLocal() != null ? jid.getLocal() : jid.getDomain().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,13 +40,19 @@ public class WrappedJid implements eu.siacs.conversations.xmpp.Jid {
|
|||
|
||||
@Override
|
||||
public eu.siacs.conversations.xmpp.Jid withResource(CharSequence resource) {
|
||||
final Localpart localpart = inner.getLocalpartOrNull();
|
||||
try {
|
||||
final Resourcepart resourcepart = Resourcepart.from(resource.toString());
|
||||
if (localpart == null) {
|
||||
return new WrappedJid(JidCreate.domainFullFrom(inner.getDomain(),resourcepart));
|
||||
} else {
|
||||
return new WrappedJid(
|
||||
JidCreate.fullFrom(
|
||||
inner.getLocalpartOrThrow(),
|
||||
localpart,
|
||||
inner.getDomain(),
|
||||
Resourcepart.from(resource.toString())
|
||||
resourcepart
|
||||
));
|
||||
}
|
||||
} catch (XmppStringprepException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
|
|
|
@ -1276,7 +1276,7 @@ public class XmppConnection implements Runnable {
|
|||
private void sendServiceDiscoveryItems(final Jid server) {
|
||||
mPendingServiceDiscoveries.incrementAndGet();
|
||||
final IqPacket iq = new IqPacket(IqPacket.TYPE.GET);
|
||||
iq.setTo(Jid.ofDomain(server.getDomain()));
|
||||
iq.setTo(server.getDomain());
|
||||
iq.query("http://jabber.org/protocol/disco#items");
|
||||
this.sendIqPacket(iq, (account, packet) -> {
|
||||
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
||||
|
@ -1641,7 +1641,7 @@ public class XmppConnection implements Runnable {
|
|||
|
||||
public Identity getServerIdentity() {
|
||||
synchronized (this.disco) {
|
||||
ServiceDiscoveryResult result = disco.get(Jid.ofDomain(account.getJid().getDomain()));
|
||||
ServiceDiscoveryResult result = disco.get(account.getJid().getDomain());
|
||||
if (result == null) {
|
||||
return Identity.UNKNOWN;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue