001/**
002 *
003 * Copyright 2003-2007 Jive Software.
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.jivesoftware.smackx.muc;
018
019import org.jivesoftware.smackx.disco.packet.DiscoverItems;
020
021/**
022 * Hosted rooms by a chat service may be discovered if they are configured to appear in the room
023 * directory . The information that may be discovered is the XMPP address of the room and the room
024 * name. The address of the room may be used for obtaining more detailed information
025 * {@link org.jivesoftware.smackx.muc.MultiUserChatManager#getRoomInfo(String)}
026 * or could be used for joining the room
027 * {@link org.jivesoftware.smackx.muc.MultiUserChatManager#getMultiUserChat(String)}
028 * and {@link org.jivesoftware.smackx.muc.MultiUserChat#join(String)}.
029 *
030 * @author Gaston Dombiak
031 */
032public class HostedRoom {
033
034    private final String jid;
035
036    private final String name;
037
038    public HostedRoom(DiscoverItems.Item item) {
039        jid = item.getEntityID();
040        name = item.getName();
041    }
042
043    /**
044     * Returns the XMPP address of the hosted room by the chat service. This address may be used
045     * when creating a <code>MultiUserChat</code> when joining a room.
046     *
047     * @return the XMPP address of the hosted room by the chat service.
048     */
049    public String getJid() {
050        return jid;
051    }
052
053    /**
054     * Returns the name of the room.
055     *
056     * @return the name of the room.
057     */
058    public String getName() {
059        return name;
060    }
061}