HostedRoom.java

  1. /**
  2.  *
  3.  * Copyright 2003-2007 Jive Software.
  4.  *
  5.  * Licensed under the Apache License, Version 2.0 (the "License");
  6.  * you may not use this file except in compliance with the License.
  7.  * You may obtain a copy of the License at
  8.  *
  9.  *     http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.jivesoftware.smackx.muc;

  18. import org.jivesoftware.smackx.disco.packet.DiscoverItems;
  19. import org.jxmpp.jid.Jid;

  20. /**
  21.  * Hosted rooms by a chat service may be discovered if they are configured to appear in the room
  22.  * directory . The information that may be discovered is the XMPP address of the room and the room
  23.  * name. The address of the room may be used for obtaining more detailed information
  24.  * {@link org.jivesoftware.smackx.muc.MultiUserChatManager#getRoomInfo(org.jxmpp.jid.BareJid)}
  25.  * or could be used for joining the room
  26.  * {@link org.jivesoftware.smackx.muc.MultiUserChatManager#getMultiUserChat(org.jxmpp.jid.BareJid)}
  27.  * and {@link org.jivesoftware.smackx.muc.MultiUserChat#join(org.jxmpp.jid.parts.Resourcepart)}.
  28.  *
  29.  * @author Gaston Dombiak
  30.  */
  31. public class HostedRoom {

  32.     private final Jid jid;

  33.     private final String name;

  34.     public HostedRoom(DiscoverItems.Item item) {
  35.         jid = item.getEntityID();
  36.         name = item.getName();
  37.     }

  38.     /**
  39.      * Returns the XMPP address of the hosted room by the chat service. This address may be used
  40.      * when creating a <code>MultiUserChat</code> when joining a room.
  41.      *
  42.      * @return the XMPP address of the hosted room by the chat service.
  43.      */
  44.     public Jid getJid() {
  45.         return jid;
  46.     }

  47.     /**
  48.      * Returns the name of the room.
  49.      *
  50.      * @return the name of the room.
  51.      */
  52.     public String getName() {
  53.         return name;
  54.     }
  55. }