
uk.org.retep.xmpp.muc.MucRoom Maven / Gradle / Ivy
/*
* Copyright (c) 1998-2009, Peter T Mount
* All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see .
*
*
*
* GNU GENERAL PUBLIC LICENSE - CLASSPATH EXCEPTION
*
*
*
* Linking this library statically or dynamically with other modules
* is making a combined work based on this library. Thus, the terms
* and conditions of the GNU General Public License cover the whole
* combination.
*
*
*
* As a special exception, the copyright holders of this library give
* you permission to link this library with independent modules to
* produce an executable, regardless of the license terms of these
* independent modules, and to copy and distribute the resulting
* executable under terms of your choice, provided that you also meet,
* for each linked independent module, the terms and conditions of the
* license of that module.
*
*
*
* An independent module is a module which is either not derived from or based
* on this library, or a module who's classes extend those within this library
* as part of the implementation of the library.
*
*
*
* If you modify this library, you may extend this exception to your version
* of the library, but you are not obligated to do so. If you do not wish to
* do so, delete this exception statement from your version.
*
*/
package uk.org.retep.xmpp.muc;
import java.util.Collection;
import uk.org.retep.util.messaging.MessageException;
import uk.org.retep.xmpp.JID;
import uk.org.retep.xmpp.XMPPException;
/**
*
* @author peter
*/
public interface MucRoom
{
/**
* The capacity of the room, 0 for unlimited members
* @return
*/
int getCapacity();
/**
* Set the capacity of the room or 0 for unlimited members
* @param capacity
*/
void setCapacity( int capacity );
/**
* The JID of this room
* @return
*/
JID getJid();
/**
* The name of this room
* @return the name of this room, null if none
*/
String getName();
/**
* The subject of this room
* @return Subject or null
*/
String getSubject();
/**
* Set the subject of this room
*
* @param subject Subject of this room, may be null
*/
void setSubject( String subject );
/**
* Collection of {@link MucFeature}'s supported by this room
* @return
*/
Collection getFeatures();
/**
* Set a {@link MucFeature}
* @param feature MucFeature
*/
void setFeature( MucFeature feature );
/**
* Remove a {@link MucFeature}
* @param feature MucFeature
*/
void removeFeature( MucFeature feature );
/**
* Is a {@link MucFeature} supported?
* @param feature MucFeature
* @return true if feature is supported
*/
boolean hasFeature( MucFeature feature );
/**
* Remove the member from the room
* @param memberJid JID to remove
* @return MucRoomMember they had prior to removal
* @throws uk.org.retep.xmpp.XMPPException
*/
MucRoomMember remove( final JID memberJid )
throws XMPPException;
/**
* Remove the member from the room
* @param nick to remove
* @return MucRoomMember they had prior to removal
* @throws uk.org.retep.xmpp.XMPPException
*/
MucRoomMember remove( final String nick )
throws XMPPException;
/**
* Add the member to the room. If it was not possible to add the
* MucRoomMember, the {@link XMPPException} thrown will have the following
* values:
*
* - LOCKED_ROOM, the room is locked and MucRoomMember is not the owner
* - MAX_USERS if the room is full
* - NICK_NAME_CONFLICT if the nickname is already in use
*
*
*
* Additional values will be included at this point, like reserved nicknames
* etc
*
*
* @param User data type in XMPPServer
* @param member MucRoomMember to add
* @param authenticator MucAuthenticator or null to disallow nickname changes
* @return null or the original nickname if a nickname change
* @throws uk.org.retep.xmpp.XMPPException
* @throws MessageException if a nickname change fails
*/
String add( final MucRoomMember member,
final MucAuthenticator authenticator )
throws XMPPException,
MessageException;
/**
* Returns the members in this room
* @return Collection of members - never null
*/
Collection getMemberNicknames();
/**
* Returns the MucRoomMember's in this room
* @return
*/
Collection getMembers();
/**
* Returns a collection of JID's of all members in this room
* @return
*/
Collection getMemberJids();
/**
* The number of members in the room
* @return
*/
int getMemberCount();
/**
* Returns the MucRoomMember for a specific JID
* @param jid
* @return
*/
MucRoomMember getMember( final JID jid );
/**
* Returns the MucRoomMember for a specific nickname
* @param nickname
* @return
*/
MucRoomMember getMember( final String nickname );
/**
* Returns the MucRoomHistory implementation for this room.
* @return MucRoomHistory implementation, null if none
*/
MucRoomHistory getRoomHistory();
/**
* Sets the MucRoomHistory implementation for this room.
* Any existing history stored in the previous implementation is not copied
* into the new one.
* @param history MucRoomHistory implementation to use, null to disable history
* @return MucRoomHistory that has just been replaced, null if none
*/
MucRoomHistory setRoomHistory( MucRoomHistory history );
/**
* Is the room currently locked
* @return true if locked
*/
boolean isLocked();
/**
* Set the room's locked state
* @param locked true if locked
*/
void setLocked( boolean locked );
}