1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-25 15:52:06 +01:00

Improve HostedRoom API

return EntityBareJid instead of Jid.
This commit is contained in:
Florian Schmaus 2015-07-17 09:06:40 +02:00
parent 7032688123
commit 2e03f0f3f3

View file

@ -16,8 +16,9 @@
*/
package org.jivesoftware.smackx.muc;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
import org.jxmpp.jid.Jid;
import org.jxmpp.jid.EntityBareJid;
/**
* Hosted rooms by a chat service may be discovered if they are configured to appear in the room
@ -32,12 +33,13 @@ import org.jxmpp.jid.Jid;
*/
public class HostedRoom {
private final Jid jid;
private final EntityBareJid jid;
private final String name;
public HostedRoom(DiscoverItems.Item item) {
jid = item.getEntityID();
jid = Objects.requireNonNull(item.getEntityID().asEntityBareJidIfPossible(),
"The discovered item must be an entity bare JID");
name = item.getName();
}
@ -47,7 +49,7 @@ public class HostedRoom {
*
* @return the XMPP address of the hosted room by the chat service.
*/
public Jid getJid() {
public EntityBareJid getJid() {
return jid;
}