📄 chatroom.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Mon Jan 05 13:28:43 CET 2004 -->
<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
<TITLE>
Chatroom
</TITLE>
<META NAME="keywords" CONTENT="jChatBox.Chat.Chatroom,Chatroom class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title="Chatroom";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../jChatBox/Chat/Blacklist.html"><B>PREV CLASS</B></A>
<A HREF="../../jChatBox/Chat/ChatroomManager.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="Chatroom.html" TARGET="_top"><B>NO FRAMES</B></A>
<SCRIPT> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT><A HREF="../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A></NOSCRIPT></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
jChatBox.Chat</FONT>
<BR>
Class Chatroom</H2>
<PRE>
java.lang.Object
|
+--<B>jChatBox.Chat.Chatroom</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../jChatBox/Chat/LogListener.html">LogListener</A>, java.io.Serializable</DD>
</DL>
<HR>
<DL>
<DT>public class <B>Chatroom</B><DT>extends java.lang.Object<DT>implements java.io.Serializable, <A HREF="../../jChatBox/Chat/LogListener.html">LogListener</A></DL>
<P>
This class implements all features for jChatBox rooms. <br> Description : <br> - open/close chatroom.<br> - setup chatroom's name,topic,...<br> - reopen chatroom.<br> - add/remove user to chatroom.<br> - blackList management.<br> - Chatroom management (MAX users).<br>
<P>
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../serialized-form.html" TARGET="jChatBox.Chat.Chatroom">Serialized Form</A></DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#Chatroom(jChatBox.Chat.ChatroomParams)">Chatroom</A></B>(<A HREF="../../jChatBox/Chat/ChatroomParams.html">ChatroomParams</A> params)</CODE>
<BR>
Chatroom constructor.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#addListener(jChatBox.Chat.Event.ChatroomListener)">addListener</A></B>(<A HREF="../../jChatBox/Chat/Event/ChatroomListener.html">ChatroomListener</A> listener)</CODE>
<BR>
Add listener to be notified on chatroom's events. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#addMsg(jChatBox.Chat.Msg)">addMsg</A></B>(<A HREF="../../jChatBox/Chat/Msg.html">Msg</A> msg)</CODE>
<BR>
Adds message to Chat. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#addToBlacklist(jChatBox.Chat.ChatroomUser, java.lang.String)">addToBlacklist</A></B>(<A HREF="../../jChatBox/Chat/ChatroomUser.html">ChatroomUser</A> user, java.lang.String reason)</CODE>
<BR>
Add user to blacklist.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#addUser(jChatBox.Chat.ChatroomUser)">addUser</A></B>(<A HREF="../../jChatBox/Chat/ChatroomUser.html">ChatroomUser</A> newUser)</CODE>
<BR>
Adds user to Chatroom. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#clear()">clear</A></B>()</CODE>
<BR>
Clear chatroom content.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#close()">close</A></B>()</CODE>
<BR>
Close the Chatroom.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../jChatBox/Chat/Blacklist.html">Blacklist</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#getBlacklist()">getBlacklist</A></B>()</CODE>
<BR>
Returns Blacklist.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.util.Vector</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#getChat()">getChat</A></B>()</CODE>
<BR>
Returns the whole Chat.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.util.Vector</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#getChat(java.lang.String)">getChat</A></B>(java.lang.String username)</CODE>
<BR>
Returns the Chat content for an user only. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.util.Date</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#getDate()">getDate</A></B>()</CODE>
<BR>
Returns opening date.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.util.Vector</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#getListeners()">getListeners</A></B>()</CODE>
<BR>
Return chatroom's listeners.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../jChatBox/Chat/ChatroomParams.html">ChatroomParams</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#getParams()">getParams</A></B>()</CODE>
<BR>
Returns Chatroom's parameters.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#getTotalUsers()">getTotalUsers</A></B>()</CODE>
<BR>
Counts Users.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../jChatBox/Chat/ChatroomUser.html">ChatroomUser</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#getUser(java.lang.String)">getUser</A></B>(java.lang.String name)</CODE>
<BR>
Returns an User.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.util.Hashtable</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#getUsers()">getUsers</A></B>()</CODE>
<BR>
Returns Users.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#isOpened()">isOpened</A></B>()</CODE>
<BR>
Return true if chatroom is opened.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#notifyListeners(jChatBox.Chat.Event.ChatroomEvent)">notifyListeners</A></B>(<A HREF="../../jChatBox/Chat/Event/ChatroomEvent.html">ChatroomEvent</A> event)</CODE>
<BR>
Notify chatroom's listeners.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#open()">open</A></B>()</CODE>
<BR>
Opens the Chatroom.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#performLogin(jChatBox.Chat.ChatroomUser)">performLogin</A></B>(<A HREF="../../jChatBox/Chat/ChatroomUser.html">ChatroomUser</A> user)</CODE>
<BR>
LogListener dummy implementation.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#performLogout(jChatBox.Chat.ChatroomUser)">performLogout</A></B>(<A HREF="../../jChatBox/Chat/ChatroomUser.html">ChatroomUser</A> user)</CODE>
<BR>
Remove user from chatroom. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#removeFromBlacklist(java.lang.String)">removeFromBlacklist</A></B>(java.lang.String ip)</CODE>
<BR>
Remove IP from blacklist.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#removeListener(jChatBox.Chat.Event.ChatroomListener)">removeListener</A></B>(<A HREF="../../jChatBox/Chat/Event/ChatroomListener.html">ChatroomListener</A> listener)</CODE>
<BR>
Remove listener.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#removeUser(java.lang.String)">removeUser</A></B>(java.lang.String name)</CODE>
<BR>
Removes an User.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#reOpen()">reOpen</A></B>()</CODE>
<BR>
ReOpen the Chatroom (Should be used after servlet container crash ot stop). </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#resetBlacklist()">resetBlacklist</A></B>()</CODE>
<BR>
Reset Blacklist.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#runTimer(jChatBox.Chat.Event.ChatroomListener)">runTimer</A></B>(<A HREF="../../jChatBox/Chat/Event/ChatroomListener.html">ChatroomListener</A> listener)</CODE>
<BR>
Run ChatroomTimer in a Thread.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jChatBox/Chat/Chatroom.html#updateParams(jChatBox.Chat.ChatroomParams)">updateParams</A></B>(<A HREF="../../jChatBox/Chat/ChatroomParams.html">ChatroomParams</A> params)</CODE>
<BR>
Updates Chatroom's parameters.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="Chatroom(jChatBox.Chat.ChatroomParams)"><!-- --></A><H3>
Chatroom</H3>
<PRE>
public <B>Chatroom</B>(<A HREF="../../jChatBox/Chat/ChatroomParams.html">ChatroomParams</A> params)</PRE>
<DL>
<DD>Chatroom constructor.
<P>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="open()"><!-- --></A><H3>
open</H3>
<PRE>
public void <B>open</B>()</PRE>
<DL>
<DD>Opens the Chatroom.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="isOpened()"><!-- --></A><H3>
isOpened</H3>
<PRE>
public boolean <B>isOpened</B>()</PRE>
<DL>
<DD>Return true if chatroom is opened.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>false is chatroom is closed<DT><B>Since:</B></DT> <DD>2.6</DD></DL>
</DD>
</DL>
<HR>
<A NAME="reOpen()"><!-- --></A><H3>
reOpen</H3>
<PRE>
public void <B>reOpen</B>()</PRE>
<DL>
<DD>ReOpen the Chatroom (Should be used after servlet container crash ot stop). <br> We keep the whole thanks to Serialization but we lost all user's session<br> because we're not sure HTTPSession is serializable (depending on Servlet/JSP engine).<br> We update chatroom's opening date too.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="addListener(jChatBox.Chat.Event.ChatroomListener)"><!-- --></A><H3>
addListener</H3>
<PRE>
public void <B>addListener</B>(<A HREF="../../jChatBox/Chat/Event/ChatroomListener.html">ChatroomListener</A> listener)</PRE>
<DL>
<DD>Add listener to be notified on chatroom's events. If ChatroomListener is an instance of TimerListener then a new Thread is
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -