1 /** 2 * $RCSfile: MUCUser.java,v $ 3 * $Revision: 1.5 $ 4 * $Date: 2004/12/01 18:31:18 $ 5 * 6 * Copyright (C) 2004 Jive Software. All rights reserved. 7 * 8 * This software is published under the terms of the GNU Public License (GPL), 9 * a copy of which is included in this distribution. 10 */ 11 12 package org.jivesoftware.messenger.muc; 13 14 import org.jivesoftware.util.NotFoundException; 15 import org.jivesoftware.messenger.ChannelHandler; 16 import org.xmpp.packet.JID; 17 18 import java.util.Iterator; 19 20 /** 21 * The chat user is a separate user abstraction for interacting with 22 * the chat server. Centralizing chat users to the Jabber entity that 23 * sends and receives the chat messages allows us to create quality of 24 * service, authorization, and resource decisions on a real-user basis. 25 * <p/> 26 * Most chat users in a typical s2s scenario will not be local users. 27 * </p><p> 28 * MUCUsers play one or more roles in one or more chat rooms on the 29 * server. 30 * 31 * @author Gaston Dombiak 32 */ 33 public interface MUCUser extends ChannelHandler { 34 35 /** 36 * Obtain a user ID (useful for database indexing). 37 * 38 * @return The user's id number if any (-1 indicates the implementation doesn't support ids) 39 */ 40 long getID(); 41 42 /** 43 * Obtain the address of the user. The address is used by services like the core 44 * server packet router to determine if a packet should be sent to the handler. 45 * Handlers that are working on behalf of the server should use the generic server 46 * hostname address (e.g. server.com). 47 * 48 * @return the address of the packet handler. 49 */ 50 public JID getAddress(); 51 52 /** 53 * Obtain the role of the user in a particular room. 54 * 55 * @param roomName The name of the room we're interested in 56 * @return The role the user plays in that room 57 * @throws NotFoundException if the user does not have a role in the given room 58 */ 59 MUCRole getRole(String roomName) throws NotFoundException; 60 61 /** 62 * Get all roles for this user. 63 * 64 * @return Iterator over all roles for this user 65 */ 66 Iterator<MUCRole> getRoles(); 67 68 /** 69 * Removes the role of the use in a particular room.<p> 70 * <p/> 71 * Note: PREREQUISITE: A lock on this object has already been obtained. 72 * 73 * @param roomName The name of the room we're being removed 74 */ 75 void removeRole(String roomName); 76 77 /** 78 * Get time (in milliseconds from System currentTimeMillis()) since last packet. 79 * 80 * @return The time when the last packet was sent from this user 81 */ 82 long getLastPacketTime(); 83 }