Ciao a tutti!
Sto tentando di personalizzare la chat conquer, (Mi pare si chiami così).
Volevo fare in modo che all'invio del messaggio se vi sono in esso presenti link ad url o mail, venissero convertiti in collegamenti in automatico!
Ho provato ad utilizzare (Personalizzare) gli script da voi proposti, ma nonostante ciò non riesco a farlo funzionare.
Vi posto il codice della pagina che gestisce l'invio del messaggio, nella speranza che mi possiate aiutare!
<%
' user wants to logoff, so we will have to notify all other users
' about this by printing some kind of 'user X is now logging off'
' message.
If (Len(Request("logoff.x")) > 0) Then
Dim x
' add a leaving message to chatroom and remove user from list of active
' users in this chat room
logoutUser(userId)
' by executing this script, we redirect user to login page
' you might want to change the "top" location to suit your
' needs, e.g. if you embed ConquerChat into a frame-enabled
' site.
Response.Write "<script language='JavaScript'>"
Response.Write " top.location.href = 'default.asp';"
Response.Write "</script>"
ElseIf (Request("mode") = "message") Then
' a new message has been send to chat. We want this message to
' be added our list of messages, indicating which user send it
Dim textMessage
textMessage = Request("message")
' do not add empty messages to chat
If (Len(textMessage) > 0) Then
' we do not support most tags, however <b>, <i> and <u> ARE supported,
' thus we have to make check for these and replace with actual tags
textMessage = Server.HTMLEncode(textMessage)
textMessage = Replace(textMessage, "<b>", "<b>", 1, -1, 1)
textMessage = Replace(textMessage, "</b>", "</b>", 1, -1, 1)
textMessage = Replace(textMessage, "<i>", "<i>", 1, -1, 1)
textMessage = Replace(textMessage, "</i>", "</i>", 1, -1, 1)
textMessage = Replace(textMessage, "<u>", "<u>", 1, -1, 1)
textMessage = Replace(textMessage, "</u>", "</u>", 1, -1, 1)
QUESTO E' IL PUNTO DOLENTE!!
************************************************
' Hyperlink automatico,
Dim replacelinkmail
replacelinkmail = SPLIT(textMessage,VbCrLf)
FOR m=0 TO ubound(textMessage)
parola = SPLIT(textMessage(m)," ")
FOR i=0 TO ubound(parola)
IF Mid (parola(i),1,7) = "http://" THEN
parola(i)="<a href="""&parola(i)&""">"&parola(i)&"</a>"
END IF
IF Mid (parola(i),1,4) = "www." THEN
parola(i)="<a href=""http://"&parola(i)&""">"&parola(i)&"</a>"
END IF
IF (InStr(parola(i),"@") <> 0) AND (InStr(parola(i),".") <> 0) THEN
parola(i)="<a href=""mailto:"&parola(i)&""">"&parola(i)&"</a>"
END IF
NEXT
textMessage(m)=JOIN(parola," ")
NEXT
textMessage = JOIN(textMessage,VbCrLf)
textMessage = REPLACE (textMessageo, VbCrLf, "<BR>")
*************************************************************
' if chat administrator wants it, we replace smilies with images
If (USE_IMAGE_SMILEY) Then
textMessage = replaceSmilies(textMessage)
End If
' filter out bad words according to filter setup
If (Len(BAD_WORDS_FILTER) > 0) Then
textMessage = replaceBadWords(textMessage)
End If
' build new message - we use tables to make a better formatting
textMessage= "<table width=100% border=0 cellpadding=2 cellspacing=1>" & _
"<tr>" & _
" <td nowrap valign=top class=MessageName><span class='Name'>" & user.name & "</span></td>" & _
" <td width=100% align=justify><div class='Message' align='justify'>" & textMessage & "</span></td>" & _
"</tr>" & _
"</table>"
If (DEBUG__) Then
Response.Write("<br>userId = " & userId)
Response.Write("<br>textMessage = " & textMessage)
Response.Write("<br>user.roomId = " & user.roomId)
End If
Call addUserMessage(userId, textMessage)
If (CLEAR_MESSAGE) Then
Response.Write("<script language=JavaScript>parent.message.clearMessageArea();</script>")
End If
End If ' > If (Len(textMessage) > 0) Then
End If ' > ElseIf ( Request("mode") = "message" ) Then
kickInactiveUsers()
If (countUsers() = 0 AND CLEAR_ON_EMPTY) Then
' clear all messages in all rooms
conquerChatMessages.RemoveAll
End If
' print all messages in this room
If (NEWEST_MESSAGE_IN_TOP) Then
Response.Write("<a name='newestMessage'>")
Call printMessages(user.roomId, user.id, True)
Else
Call printMessages(user.roomId, user.id, False)
Response.Write("<a name='newestMessage'>")
End If
%>
Spero davvero possiate aiutarmi!