Chat room to achieve private chat (iii)

Source: Internet
Author: User
Tags count
The two sections of the chat room described how to handle chat room conversations and the special handling of private whispers. Let's go and see how the conversation is displayed on the client side. Please take a look at our display dialog file (top.asp) First

*top.asp

 

<% @language = "VBScript"%>
<%
Response.expires=0
' Response.buffer=true
%>
<meta http-equiv= "Refresh" content= "2.5" >
<body bgcolor= "<%=application (" Zj_1color ")%>" topmargin= "0" leftmargin= "0" >
<i><center><font color= "#FFFF00" Size=4><%=application ("Zj_1title")%></font></ Center></i>
<%
If session ("userzj_1") = "" Then
Session ("userzj_1") = ""
Session ("zj_1level") = ""
Session ("Zj_1start") = ""
Session ("Zj_1total") =0
Session ("zj_1boot") = ""
Session ("Zj_1counter") =0
Session ("Zj_1open") = ""
' Session.Abandon
%>
<script language= "JavaScript" >
parent.location= "Timeout.htm"
</script>
<%
Response.End
End If

' Are you messing with me?
For N=1 to 40
If session ("Userzj_1") =application ("Peoplezj_1" &n) Then
Exit For
End If

If N=40 Then
Session ("zj_1boot") = "true"
%>
<script language= "JavaScript" >
parent.location= "Boot.htm"
</script>
<%
End If

Next
%>
<script language= "JavaScript" >
<%

If session ("Zj_1counter") <>application ("Zj_1counter") Then
If session ("Zj_1counter") <application ("Zj_1counter") Then
For I=session ("Zj_1counter") +1 to Application ("Zj_1counter")
%>
Parent.middle.document.writeln ("<%=application" ("Zj_1chats") (I)%> ")
<%

Next

Else
For I=session ("Zj_1counter") to 20
If Application ("Zj_1counter") <>1 Then
%>
Parent.middle.document.writeln ("<%=application" ("Zj_1chats") (I)%> ")
<%
End If
Next

For I=1 to Application ("Zj_1counter")

%>
Parent.middle.document.writeln ("<%=application" ("Zj_1chats") (I)%> ")
<%
Next
End If

If session ("Zj_1open") = "true" Then

Session ("Zj_1counter") =application ("Zj_1counter")
End If
End If

' Bulletin

If session ("Zj_1public") <>application ("Zj_1public") Then
%>
Parent.middle.document.writeln ("<%=application (" Zj_1public ")%>")

<%
Session ("Zj_1public") =application ("Zj_1public")
End If

' Is there a whisper? '
If session ("Zj_1chat") <>application ("Zj_1chat") Then
If Application ("Zj_1owner") =session ("Userzj_1") or Application ("Zj_1chatto") =session ("Userzj_1") or application ("ZJ _1chatto ") =" All "Then

%>
Parent.middle.document.writeln ("<%=application (" Zj_1chat ")%>")
<%
End If
Session ("Zj_1chat") =application ("Zj_1chat")
End If

Application ("Peoplezj_1_appear" &n)

Count=0
For N=1 to 40
If Application ("Peoplezj_1" &n) <> "" Then
Count=count+1

End If
Next
If session ("Zj_1total") <>count Then
Session ("Zj_1total") =count
Session ("Zj_1refresh") = "true"

%>
</script>

<%
End If

Response.Flush

%>

The chat room has the function of managing (kicking out unwanted people out of chat rooms, announcements, etc.), so that some of the tigers that have nothing to do with the speech processing and whispering function are not explained.

We used a application ("Zj_1counter") public object to hold the buffer element for the most recent speech. Use session ("Zj_1counter") to save the dialog elements that are already displayed by the current user itself. In each call to top.asp this file, as long as the contrast between the session ("Zj_1counter") and Application ("Zj_1counter") of different values, you can learn the need to display a new conversation to speak. Each time the completion of the display, it is necessary to unify the two values. Otherwise, there will be a repeated error displaying the conversation content.

Again, the buffer is recycled, for example, the current user-displayed dialog is stored in application ("Chats") (18), and the new statement has been returned to application ("Chats") (2), so this time need to display 4 statements, The detailed treatment above explains that the tiger is not doing it. Let's take a closer look. And then think about it, it's easy to understand.

The Whisper and the Public Conversation application ("chat") (n) are handled separately, so the public conversation is processed and the whisper is processed. The WHISPER flag is the session ("chat") (it is used to store the last whispered content when contrasting the application ("chat")



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.