/**
* $RCSfile$
* $Revision: 3158 $
* $Date: 2005-12-04 22:55:49 -0300 (Sun, 04 Dec 2005) $
*
* Copyright (C) 2004-2008 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution, or a commercial license
* agreement with Jive.
*/
package org.jivesoftware.openfire.muc.spi;
import org.dom4j.Element;
import org.jivesoftware.database.SequenceManager;
import org.jivesoftware.openfire.PacketRouter;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.auth.UnauthorizedException;
import org.jivesoftware.openfire.cluster.NodeID;
import org.jivesoftware.openfire.muc.*;
import org.jivesoftware.openfire.muc.cluster.*;
import org.jivesoftware.openfire.user.UserAlreadyExistsException;
import org.jivesoftware.openfire.user.UserNotFoundException;
import org.jivesoftware.util.JiveConstants;
import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.NotFoundException;
import org.jivesoftware.util.cache.CacheFactory;
import org.jivesoftware.util.cache.ExternalizableUtil;
import org.xmpp.packet.*;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* Implementation of a chatroom that is being hosted by this JVM. A LocalMUCRoom could represent
* a persistent room which means that its configuration will be maintained in synch with its
* representation in the database.<p>
*
* When running in a cluster each cluster node will have its own copy of local rooms. Persistent
* rooms will be loaded by each cluster node when starting up. Not persistent rooms will be copied
* from the senior cluster member. All room occupants will be copied from the senior cluster member
* too.
*
* @author Gaston Dombiak
*/
public class LocalMUCRoom implements MUCRoom {
/**
* The service hosting the room.
*/
private MultiUserChatService mucService;
/**
* The occupants of the room accessible by the occupants nickname.
*/
private Map<String,MUCRole> occupants = new ConcurrentHashMap<String, MUCRole>();
/**
* The occupants of the room accessible by the occupants bare JID.
*/
private Map<String, List<MUCRole>> occupantsByBareJID = new ConcurrentHashMap<String, List<MUCRole>>();
/**
* The occupants of the room accessible by the occupants full JID.
*/
private Map<JID, MUCRole> occupantsByFullJID = new ConcurrentHashMap<JID, MUCRole>();
/**
* The name of the room.
*/
private String name;
/**
* A lock to protect the room occupants.
*/
ReadWriteLock lock = new ReentrantReadWriteLock();
/**
* The role of the room itself.
*/
private MUCRole role = new RoomRole(this);
/**
* The router used to send packets for the room.
*/
private PacketRouter router;
/**
* The start time of the chat.
*/
long startTime;
/**
* The end time of the chat.
*/
long endTime;
/**
* After a room has been destroyed it may remain in memory but it won't be possible to use it.
* When a room is destroyed it is immediately removed from the MultiUserChatService but it's
* possible that while the room was being destroyed it was being used by another thread so we
* need to protect the room under these rare circumstances.
*/
boolean isDestroyed = false;
/**
* ChatRoomHistory object.
*/
private MUCRoomHistory roomHistory;
/**
* Time when the room was locked. A value of zero means that the room is unlocked.
*/
private long lockedTime;
/**
* List of chatroom's owner. The list contains only bare jid.
*/
List<String> owners = new CopyOnWriteArrayList<String>();
/**
* List of chatroom's admin. The list contains only bare jid.
*/
List<String> admins = new CopyOnWriteArrayList<String>();
/**
* List of chatroom's members. The list contains only bare jid.
*/
private Map<String, String> members = new ConcurrentHashMap<String,String>();
/**
* List of chatroom's outcast. The list contains only bare jid of not allowed users.
*/
private List<String> outcasts = new CopyOnWriteArrayList<String>();
/**
* The natural language name of the room.
*/
private String naturalLanguageName;
/**
* Description of the room. The owner can change the description using the room configuration
* form.
*/
private String description;
/**
* Indicates if occupants are allowed to change the subject of the room.
*/
private boolean canOccupantsChangeSubject;
/**
* Maximum number of occupants that could be present in the room. If the limit's been reached
* and a user tries to join, a not-allowed error will be returned.
*/
private int maxUsers;
/**
* List of roles of which presence will be broadcasted to the rest of the occupants. This
* feature is useful for implementing "invisible" occupants.
*/
private List<String> rolesToBroadcastPresence = new ArrayList<String>();
/**
* A public room means that the room is searchable and visible. This means that the room can be
* located using disco requests.
*/
private boolean publicRoom;
/**
* Persistent rooms are saved to the database to make sure that rooms configurations can be
* restored in case the server goes down.
*/
private boolean persistent;
/**
* Moderated rooms enable only participants to speak. Users that join the room and aren't
* participants can't speak (they are just visitors).
*/
private boolean moderated;
/**
* A room is considered members-only if an invitation is required in order to enter the room.
* Any user that is not a member of the room won't be able to join the room unless the user
* decides to register with the room (thus becoming a member).
*/
private boolean membersOnly;
/**
* Some rooms may restrict the occupants that are able to send invitations. Sending an
* invitation in a members-only room adds the invitee to the members list.
*/
private boolean canOccupantsInvite;
/**
* The password that every occupant should provide in order to enter the room.
*/
private String password = null;
/**
* Every presence packet can include the JID of every occupant unless the owner deactives this
* configuration.
*/
private boolean canAnyoneDiscoverJID;
/**
* Enables the logging of the conversation. The conversation in the room will be saved to the
* database.
*/
private boolean logEnabled;
/**
* Enables the logging of the conversation. The conversation in the room will be saved to the
* database.
*/
private boolean loginRestrictedToNickname;
/**
* Enables the logging of the conversation. The conversation in the room will be saved to the
* database.
*/
private boolean canChangeNickname;
/**
* Enables the logging of the conversation. The conversation in the room will be saved to the
* database.
*/
private boolean registrationEnabled;
/**
* Internal component that handles IQ packets sent by the room owners.
*/
private IQOwnerHandler iqOwnerHandler;
/**
* Internal component that handles IQ packets sent by moderators,
没有合适的资源?快使用搜索试试~ 我知道了~
openfire_src_3_6_4[1].tar.gz_java openfire_java 聊天系统_openfire sp
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 141 浏览量
2022-09-14
18:06:17
上传
评论
收藏 48.81MB GZ 举报
温馨提示
共2877个文件
html:989个
java:889个
gif:276个
功能强大的即时聊天系统,openfire为一个服务器,openfire+spark 是一个实现即时聊天的最佳聊天组合
资源推荐
资源详情
资源评论
收起资源包目录
openfire_src_3_6_4[1].tar.gz_java openfire_java 聊天系统_openfire sp (2877个子文件)
openfire-dev.bat 2KB
embedded-db-viewer.bat 682B
openfire.bat 662B
authTool.c 4KB
changelog 209B
checkinstall 421B
compat 2B
openfire.conffiles 134B
control 643B
copyright 495B
global.css 21KB
setup.css 11KB
ldap.css 10KB
style.css 7KB
style.css 7KB
style.css 7KB
calendar-win2k-1.css 6KB
calendar-win2k-cold-1.css 6KB
style.css 4KB
setup-style.css 2KB
stylesheet.css 1KB
login.css 1KB
lightbox.css 1KB
style.css 995B
packetfilter.css 36B
openfire.init.d 2KB
openfire.default 238B
openfire.dirs 116B
tray.dll 56KB
shaj.dll 34KB
examplerules.gif 15KB
splash.gif 10KB
disabled.gif 9KB
splash2.gif 7KB
header-title.gif 7KB
wait24trans.gif 5KB
setup_header_logo.gif 4KB
logo-liveassistant.gif 3KB
working-16x16.gif 3KB
header-title_new.gif 3KB
login_logo.gif 3KB
header_logo.gif 3KB
jive-login-bg.gif 3KB
certificateimg_error.gif 3KB
certificateimg_error.gif 3KB
certificateimg_warning.gif 3KB
certificateimg_warning.gif 3KB
pdf_generatedbyof.gif 2KB
logo_large.gif 2KB
personal_online.gif 2KB
logo_large.gif 2KB
logo_large.gif 2KB
offline.gif 1KB
personal_offline.gif 1KB
logo_large.gif 1KB
online.gif 1KB
login_boxbg.gif 1KB
header-help.gif 1KB
header-help_new.gif 1KB
server-network-24x24.gif 1KB
greenlight-24x24.gif 1KB
redlight-24x24.gif 1KB
login_header.gif 1KB
arrow_right_blue.gif 1KB
star-16x16.gif 1KB
logo_large.gif 1KB
logo_large.gif 1KB
error-16x16.gif 1KB
error-16x16.gif 1KB
logo_small.gif 1KB
error-16x16.gif 1KB
error-16x16.gif 1KB
error-16x16.gif 1KB
error-16x16.gif 1KB
error-16x16.gif 1KB
error-16x16.gif 1KB
error-16x16.gif 1KB
client-icon_adium.gif 1KB
calendar.gif 1KB
logo_small.gif 1KB
client-icon_ichat.gif 1KB
icon_calendar-week.gif 1KB
icon_calendar-week.gif 1KB
feed-icon-16x16.gif 1KB
folder-out-16x16.gif 1024B
logo_small.gif 1023B
forbidden-16x16.gif 1023B
help-16x16.gif 1021B
folder-new-16x16.gif 1021B
cache-16x16.gif 1017B
success-16x16.gif 1016B
delete-16x16.gif 1016B
success-16x16.gif 1016B
success-16x16.gif 1016B
delete-16x16.gif 1016B
success-16x16.gif 1016B
delete-16x16.gif 1016B
success-16x16.gif 1016B
success-16x16.gif 1016B
success-16x16.gif 1016B
共 2877 条
- 1
- 2
- 3
- 4
- 5
- 6
- 29
资源评论
钱亚锋
- 粉丝: 86
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功