diff --git a/apps/webchat/build/ant b/apps/webchat/build/ant deleted file mode 100644 index b4319cf79..000000000 --- a/apps/webchat/build/ant +++ /dev/null @@ -1,42 +0,0 @@ -#! /bin/sh - -# //--------------------------------------------------------------------------// -# // $RCSfile$ -# // $Revision$ -# // $Date$ -# // -# // Standard Jive Software ant file. Do not change this file. If you do, -# // you will have seven years of bad luck and bad builds. -# //--------------------------------------------------------------------------// - -# //--------------------------------------------------------------------------// -# // Uncomment the following lines if you wish to set JAVA_HOME in this script -# //--------------------------------------------------------------------------// -# JAVA_HOME= -# EXPORT JAVA_HOME - -# //--------------------------------------------------------------------------// -# // Check for the JAVA_HOME environment variable // -# //--------------------------------------------------------------------------// -if [ "$JAVA_HOME" != "" ] ; then - # //----------------------------------------------------------------------// - # // Create Ant's classpath // - # //----------------------------------------------------------------------// - CP=$JAVA_HOME/lib/tools.jar:../../../build/ant.jar - - # //----------------------------------------------------------------------// - # // Run ant // - # //----------------------------------------------------------------------// - $JAVA_HOME/bin/java -classpath $CP -Dant.home=. org.apache.tools.ant.Main $@ -else - # //----------------------------------------------------------------------// - # // No JAVA_HOME error message // - # //----------------------------------------------------------------------// - echo "Jive Forums Build Error:" - echo "" - echo "The JAVA_HOME environment variable is not set. JAVA_HOME should point" - echo "to your java directory, ie: /usr/local/bin/jdk1.3. You can set" - echo "this via the command line like so:" - echo " export JAVA_HOME=/usr/local/bin/jdk1.3" -fi - diff --git a/apps/webchat/build/ant.bat b/apps/webchat/build/ant.bat deleted file mode 100644 index fcbd96e70..000000000 --- a/apps/webchat/build/ant.bat +++ /dev/null @@ -1,52 +0,0 @@ -@echo off - -rem //------------------------------------------------------------------------// -rem // $RCSfile$ -rem // $Revision$ -rem // $Date$ -rem // -rem // Standard Jive Software ant.bat file. Do not change this file. If you do, -rem // you will have seven years of bad luck and bad builds. -rem //------------------------------------------------------------------------// - -rem //------------------------------------------------------------------------// -rem // Uncomment the following if you wish to set JAVA_HOME in this bat file: -rem //------------------------------------------------------------------------// -rem SET JAVA_HOME= - -rem //------------------------------------------------------------------------// -rem // Check for the JAVA_HOME environment variable -rem //------------------------------------------------------------------------// -if "%JAVA_HOME%" == "" goto noJavaHome - -rem //------------------------------------------------------------------------// -rem // Make the correct classpath (should include the java jars and the -rem // Ant jars) -rem //------------------------------------------------------------------------// -SET CP=%JAVA_HOME%\lib\tools.jar;..\..\..\build\ant.jar - -rem //------------------------------------------------------------------------// -rem // Run Ant -rem // Note for Win 98/95 users: You need to change "%*" in the following -rem // line to be "%1 %2 %3 %4 %5 %6 %7 %8 %9" -rem //------------------------------------------------------------------------// - -%JAVA_HOME%\bin\java -Xms32m -Xmx128m -classpath %CP% -Dant.home=. org.apache.tools.ant.Main %* -goto end - -rem //------------------------------------------------------------------------// -rem // Error message for missing JAVA_HOME -rem //------------------------------------------------------------------------// -:noJavaHome -echo. -echo Jive Forums Build Error: -echo. -echo The JAVA_HOME environment variable is not set. JAVA_HOME should point to -echo your java directory, ie: c:\jdk1.3.1. You can set this via the command -echo line like so: -echo SET JAVA_HOME=c:\jdk1.3 -echo. -goto end - -:end - diff --git a/apps/webchat/build/build.xml b/apps/webchat/build/build.xml deleted file mode 100644 index eb9095f21..000000000 --- a/apps/webchat/build/build.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/apps/webchat/build/lib/servlet.jar b/apps/webchat/build/lib/servlet.jar deleted file mode 100644 index cda22d2a4..000000000 Binary files a/apps/webchat/build/lib/servlet.jar and /dev/null differ diff --git a/apps/webchat/source/config/WEB-INF/web.xml b/apps/webchat/source/config/WEB-INF/web.xml deleted file mode 100644 index 98cbd9e49..000000000 --- a/apps/webchat/source/config/WEB-INF/web.xml +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - WebChat - Smack-powered WebChat Application - - - host - jivesoftware.com - - - - - - - allowAnonymous - true - - - - - allowAccountCreation - true - - - - - allowLogin - true - - - - - logoFilename - images/logo.gif - - - - - chat.announcement-color - #009d00 - - - - - chat.owner-label-color - #aa0000 - - - - - chat.participant-label-color - #0000aa - - - - - chat.text-color - #434343 - - - - - error.text-color - #ff0000 - - - - - link.color - #045d30 - - - - - link.hover-color - #350000 - - - - - link.visited-color - #3b3757 - - - - - body.background-color - #ffffff - - - - - body.text-color - #362f2d - - - - - frame.divider-color - #83272b - - - - - button.color - #d6dfdf - - - - - button.text-color - #333333 - - - - - textfield.color - #f7f7fb - - - - - textfield.text-color - #333333 - - - - - - org.jivesoftware.webchat.JiveChatServlet - - - - - ChatServlet - org.jivesoftware.webchat.JiveChatServlet - 1 - - - - - ChatServlet - /ChatServlet/* - - - - 3 - - - - - index.jsp - - - \ No newline at end of file diff --git a/apps/webchat/source/java/org/jivesoftware/webchat/EmoticonFilter.java b/apps/webchat/source/java/org/jivesoftware/webchat/EmoticonFilter.java deleted file mode 100644 index 293edf0ff..000000000 --- a/apps/webchat/source/java/org/jivesoftware/webchat/EmoticonFilter.java +++ /dev/null @@ -1,292 +0,0 @@ -/** - * $RCSfile$ - * $Revision$ - * $Date$ - * - * Copyright (C) 2003 Jive Software. All rights reserved. - * - * This software is the proprietary information of Jive Software. Use is subject to license terms. - */ - -package org.jivesoftware.webchat; - -/** - * A Filter that converts ASCII emoticons into image equivalents. - * This filter should only be run after any HTML stripping filters.

- * - * The filter must be configured with information about where the image files - * are located. A table containing all the supported emoticons with their - * ASCII representations and image file names is as follows:

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
EmotionASCIIImage
Happy:) or :-)happy.gif
Sad:( or :-(sad.gif
Grin:Dgrin.gif
Love:xlove.gif
Mischief;\mischief.gif
CoolB-)cool.gif
Devil]:)devil.gif
Silly:psilly.gif
AngryX-(angry.gif
Laugh:^Olaugh.gif
Wink;) or ;-)wink.gif
Blush:8}blush.gif
Cry:_|cry.gif
Confused?:|confused.gif
Shocked:Oshocked.gif
Plain:|plain.gif
- * - * Note: special thanks to August Harrison for implementing an earlier version of this filter. - */ -public class EmoticonFilter { - - private static String imageHappy = "happy.gif"; - private static String imageSad = "sad.gif"; - private static String imageGrin = "grin.gif"; - private static String imageLove = "love.gif"; - private static String imageMischief = "mischief.gif"; - private static String imageCool = "cool.gif"; - private static String imageDevil = "devil.gif"; - private static String imageSilly = "silly.gif"; - private static String imageAngry = "angry.gif"; - private static String imageLaugh = "laugh.gif"; - private static String imageWink = "wink.gif"; - private static String imageBlush = "blush.gif"; - private static String imageCry = "cry.gif"; - private static String imageConfused = "confused.gif"; - private static String imageShocked = "shocked.gif"; - private static String imagePlain = "plain.gif"; - private static String imageURL = "images/emoticons"; - - // Placeholders for the built image tags - private static String imgHappy; - private static String imgSad; - private static String imgGrin; - private static String imgLove; - private static String imgMischief; - private static String imgCool; - private static String imgDevil; - private static String imgSilly; - private static String imgAngry; - private static String imgLaugh; - private static String imgWink; - private static String imgBlush; - private static String imgCry; - private static String imgConfused; - private static String imgShocked; - private static String imgPlain; - - public EmoticonFilter() { - buildImageTags(); - } - - public String applyFilter(String string) { - if (string == null || string.length() < 1) { - return string; - } - - int length = string.length(); - StringBuffer filtered = new StringBuffer(string.length() + 100); - char[] chars = string.toCharArray(); - - int length1 = length - 1; - int length2 = length - 2; - - int index = -1, i = 0, oldend = 0; - String imgTag; - - // Replace each of the emoticons, expanded search for performance - while (++index < length1) { - // no tag found yet... - imgTag = null; - - switch (chars[i = index]) { - case ']': - // "]:)" - if (i < length2 && chars[++i] == ':' && chars[++i] == ')') { - imgTag = imgDevil; - } - break; - case ':': - switch (chars[++i]) { - case ')': - // ":)" - imgTag = imgHappy; - break; - case '-': - // ":-)" - if (i < length1 && chars[++i] == ')') { - imgTag = imgHappy; - } - // ":-(" - else if (chars[i] == '(') { - imgTag = imgSad; - } - break; - case '(': - // ":(" - imgTag = imgSad; - break; - case 'D': - // ":D" - imgTag = imgGrin; - break; - case 'x': - // ":x" - imgTag = imgLove; - break; - case 'p': - // ":p" - imgTag = imgSilly; - break; - case '^': - // ":^O" - if (i < length1 && chars[++i] == 'O') { - imgTag = imgLaugh; - } - break; - case '8': - // ":8}" - if (i < length1 && chars[++i] == '}') { - imgTag = imgBlush; - } - break; - case '_': - // ":_|" - if (i < length1 && chars[++i] == '|') { - imgTag = imgCry; - } - break; - case 'O': - // ":O" - imgTag = imgShocked; - break; - case '|': - // ":|" - imgTag = imgPlain; - break; - default: - break; - } - break; - case ';': - switch (chars[++i]) { - case ')': - // ";)" - imgTag = imgWink; - break; - case '-': - // ";-)" - if (i < length1 && chars[++i] == ')') { - imgTag = imgWink; - } - break; - case '\\': - // ";\\" - imgTag = imgMischief; - break; - default: - break; - } - break; - case 'B': - // "B-)" - if (i < length2 && chars[++i] == '-' && chars[++i] == ')') { - imgTag = imgCool; - } - break; - case 'X': - // "X-(" - if (i < length2 && chars[++i] == '-' && chars[++i] == '(') { - imgTag = imgAngry; - } - break; - case '?': - // "?:|" - if (i < length2 && chars[++i] == ':' && chars[++i] == '|') { - imgTag = imgConfused; - } - break; - default: - break; - } - - // if we found one, replace - if (imgTag != null) { - filtered.append(chars, oldend, index-oldend); - filtered.append(imgTag); - - oldend = i + 1; - index = i; - } - } - - if (oldend < length) { - filtered.append(chars, oldend, length-oldend); - } - - return filtered.toString(); - } - - /** - * Returns the base URL for emoticon images. This can be specified as - * an absolute or relative path. - * - * @return the base URL for smiley images. - */ - public String getImageURL() { - return imageURL; - } - - /** - * Sets the base URL for emoticon images. This can be specified as - * an absolute or relative path. - * - * @param imageURL the base URL for emoticon images. - */ - public void setImageURL(String imageURL) { - if (imageURL != null && imageURL.length() > 0) { - if (imageURL.charAt(imageURL.length()-1) == '/') { - imageURL = imageURL.substring(0, imageURL.length()-1); - } - } - this.imageURL = imageURL; - - // rebuild the image tags - buildImageTags(); - } - - /** - * Build image tags - */ - private void buildImageTags() { - imgHappy = buildURL(imageHappy); - imgSad = buildURL(imageSad); - imgGrin = buildURL(imageGrin); - imgLove = buildURL(imageLove); - imgMischief = buildURL(imageMischief); - imgCool = buildURL(imageCool); - imgDevil = buildURL(imageDevil); - imgSilly = buildURL(imageSilly); - imgAngry = buildURL(imageAngry); - imgLaugh = buildURL(imageLaugh); - imgWink = buildURL(imageWink); - imgBlush = buildURL(imageBlush); - imgCry = buildURL(imageCry); - imgConfused = buildURL(imageConfused); - imgShocked = buildURL(imageShocked); - imgPlain = buildURL(imagePlain); - } - - /** - * Returns an HTML image tag using the base image URL and image name. - */ - private String buildURL(String imageName) { - String tag = ""; - - return tag; - } -} \ No newline at end of file diff --git a/apps/webchat/source/java/org/jivesoftware/webchat/JiveChatServlet.java b/apps/webchat/source/java/org/jivesoftware/webchat/JiveChatServlet.java deleted file mode 100644 index b509da321..000000000 --- a/apps/webchat/source/java/org/jivesoftware/webchat/JiveChatServlet.java +++ /dev/null @@ -1,729 +0,0 @@ -/** - * $RCSfile$ - * $Revision$ - * $Date$ - * - * Copyright (C) 2003 Jive Software. All rights reserved. - * - * This software is the proprietary information of Jive Software. Use is subject to license terms. - */ - -package org.jivesoftware.webchat; - -import java.io.*; -import java.util.*; - -import javax.servlet.*; -import javax.servlet.http.*; - -import org.jivesoftware.smack.*; -import org.jivesoftware.smack.filter.*; -import org.jivesoftware.smack.packet.*; -import org.jivesoftware.smack.util.StringUtils; - - -/** - * An extension of HttpServlet customized to handle transactions between N webclients - * and M chats located on a given XMPP server. While N >= M in the case of group chats, - * the code will currently, never the less, hold onto N connections to the XMPP server.
- * - * It is assumed that all JSP pages are in the context root. The init params should be: - *

- * - * @author Bill Lynch - * @author loki der quaeler - */ -public class JiveChatServlet - extends HttpServlet - implements HttpSessionListener, PacketListener { - - static public final String JIVE_WEB_CHAT_RESOURCE_NAME = "WebChat"; - - static protected long PACKET_RESPONSE_TIMEOUT_MS = 5000; - - static protected String CHAT_LAUNCHER_URI_SUFFIX = "/chat-launcher.jsp"; - static protected String CREATE_ACCOUNT_URI = "/account_creation.jsp"; - static protected String LOGIN_URI = "/index.jsp"; - - static protected String ERRORS_ATTRIBUTE_STRING = "messenger.servlet.errors"; - static protected String NICKNAME_ATTRIBUTE_STRING = "messenger.servlet.nickname"; - static protected String ROOM_ATTRIBUTE_STRING = "messenger.servlet.room"; - - static protected String HOST_PARAM_STRING = "host"; - static protected String PORT_PARAM_STRING = "port"; - static protected String SSL_PARAM_STRING = "SSLEnabled"; - - static protected String COMMAND_PARAM_STRING = "command"; - static protected String NICKNAME_PARAM_STRING = "nickname"; - static protected String PASSWORD_PARAM_STRING = "password"; - static protected String RETYPED_PASSWORD_PARAM_STRING = "password_zwei"; - static protected String ROOM_PARAM_STRING = "room"; - static protected String USERNAME_PARAM_STRING = "username"; - - static protected String ANON_LOGIN_COMMAND_STRING = "anon_login"; - static protected String CREATE_ACCOUNT_COMMAND_STRING = "create_account"; - static protected String LOGIN_COMMAND_STRING = "login"; - static protected String LOGOUT_COMMAND_STRING = "logout"; - static protected String READ_COMMAND_STRING = "read"; - static protected String SILENCE_COMMAND_STRING = "silence"; - static protected String WRITE_COMMAND_STRING = "write"; - - static protected String MESSAGE_REQUEST_STRING = "message"; - - // is this value used elsewhere? (if not, why a string?) PENDING - static protected String ERROR_RETURN_CODE_STRING = "error"; - static protected String SUCCESS_RETURN_CODE_STRING = "success"; - - // k/v :: S(session id) / ChatData - static protected Map SESSION_CHATDATA_MAP = new HashMap(); - // k/v :: S(unique root of packet ids) / ChatData - static protected Map PACKET_ROOT_CHATDATA_MAP = new HashMap(); - - static protected EmoticonFilter EMOTICONFILTER = new EmoticonFilter(); - static protected URLTranscoder URLTRANSCODER = new URLTranscoder(); - - - protected String host; - protected int port; - protected boolean sslEnabled; - - public void init (ServletConfig config) - throws ServletException { - ServletContext context = null; - String portParameter = null; - - super.init(config); - -// XMPPConnection.DEBUG_ENABLED = true; - - context = config.getServletContext(); - - this.host = context.getInitParameter(HOST_PARAM_STRING); - if (this.host == null) { - throw new ServletException("Init parameter \"" + HOST_PARAM_STRING + "\" must be set."); - } - - this.port = -1; - - portParameter = context.getInitParameter(PORT_PARAM_STRING); - if (portParameter != null) { - try { - this.port = Integer.parseInt(portParameter); - } catch (NumberFormatException nfe) { - throw new ServletException("Init parameter \"" + PORT_PARAM_STRING - + "\" must be a valid number.", nfe); - } - } - - this.sslEnabled - = Boolean.valueOf(context.getInitParameter(SSL_PARAM_STRING)).booleanValue(); - } - - /** - * Take care of closing down everything we're holding on to, then bubble up the destroy - * to our superclass. - */ - public void destroy () { - synchronized (SESSION_CHATDATA_MAP) { - for (Iterator i = SESSION_CHATDATA_MAP.values().iterator(); i.hasNext(); ) { - ChatData chatData = (ChatData)i.next(); - - if (chatData.groupChat != null) { - chatData.groupChat.leave(); - } - - chatData.connection.close(); - } - } - - super.destroy(); - } - - protected void service (HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - HttpSession session = request.getSession(); - String sessionID = session.getId(); - String path = request.getContextPath(); - String command = request.getParameter(COMMAND_PARAM_STRING); - - if (READ_COMMAND_STRING.equals(command)) { - ChatData chatData = (ChatData)SESSION_CHATDATA_MAP.get(sessionID); - StringBuffer reply = null; - boolean foundData = false; - Message message = null; - int i = 0; - - if (chatData == null) { - this.writeData("Must login first.", response); - - return; - } - - reply = new StringBuffer(); - reply.append("\n"); - reply.append("Chat Read Page\n"); - reply.append("\n"); - reply.append(""); - reply.append("\n"); - - this.writeData(reply.toString(), response); - } else if (WRITE_COMMAND_STRING.equals(command)) { - String message = request.getParameter(MESSAGE_REQUEST_STRING); - ChatData chatData = (ChatData)SESSION_CHATDATA_MAP.get(sessionID); - - if (message == null) { - this.writeData("Parameter \"" + MESSAGE_REQUEST_STRING + "\" is required.", - response); - - return; - } else if (chatData == null) { - this.writeData("Must login first.", response); - - return; - } - - try { - StringBuffer reply = new StringBuffer(); - - chatData.groupChat.sendMessage(message.trim()); - - reply.append("\n"); - reply.append("\n"); - reply.append( - "\n"); - reply.append("Chat Form"); - reply.append("\n"); - reply.append("
\n"); - reply.append("\n"); - reply.append("\n"); - reply.append("
"); - - this.writeData(reply.toString(), response); - } catch (XMPPException e) { - // PENDING - better handling - e.printStackTrace(); - } - } else if (LOGOUT_COMMAND_STRING.equals(command)) { - ChatData chatData = null; - - synchronized (SESSION_CHATDATA_MAP) { - chatData = (ChatData)SESSION_CHATDATA_MAP.remove(sessionID); - } - - if (chatData != null) { - if (chatData.groupChat != null) { - chatData.groupChat.leave(); - } - - synchronized (PACKET_ROOT_CHATDATA_MAP) { - Packet p = new IQ(); - String root = this.getPacketIDRoot(p); - - PACKET_ROOT_CHATDATA_MAP.remove(root); - } - - chatData.connection.close(); - } - } else if (ANON_LOGIN_COMMAND_STRING.equals(command)) { - String returnCode = this.handleLogin(request, true); - - if (SUCCESS_RETURN_CODE_STRING.equals(returnCode)) { - response.sendRedirect(path + CHAT_LAUNCHER_URI_SUFFIX); - } else { - // error, return to the original page to display errors and allow re-attempts - RequestDispatcher rd = request.getRequestDispatcher(LOGIN_URI); - - rd.forward(request, response); - } - } else if (LOGIN_COMMAND_STRING.equals(command)) { - String returnCode = this.handleLogin(request, false); - - if (SUCCESS_RETURN_CODE_STRING.equals(returnCode)) { - response.sendRedirect(path + CHAT_LAUNCHER_URI_SUFFIX); - } else { - // error, return to the original page to display errors and allow re-attempts - RequestDispatcher rd = request.getRequestDispatcher(LOGIN_URI); - - rd.forward(request, response); - } - } else if (CREATE_ACCOUNT_COMMAND_STRING.equals(command)) { - String returnCode = this.createAccount(request); - - if (SUCCESS_RETURN_CODE_STRING.equals(returnCode)) { - response.sendRedirect(path + LOGIN_URI); - } else { - // error, return to the original page to display errors and allow re-attempts - RequestDispatcher rd = request.getRequestDispatcher(CREATE_ACCOUNT_URI); - - rd.forward(request, response); - } - } else if (SILENCE_COMMAND_STRING.equals(command)) { - // do nothing - } else if (command != null) { - this.writeData(("Invalid command: " + command), response); - } else { - this.writeData("Jive Messenger Chat Servlet", response); - } - } - - protected String getPacketIDRoot (Packet p) { - if (p == null) { - return null; - } - - return p.getPacketID().substring(0, 5); - } - - /** - * Creates an account for the user data specified. - */ - private String createAccount (HttpServletRequest request) { - String sessionID = request.getSession().getId(); - String username = request.getParameter(USERNAME_PARAM_STRING); - String password = request.getParameter(PASSWORD_PARAM_STRING); - String retypedPassword = request.getParameter(RETYPED_PASSWORD_PARAM_STRING); - Map errors = new HashMap(); - - // PENDING: validate already taken username - - if ((username == null) || (username.trim().length() == 0)) { - errors.put("empty_username", ""); - } - - if ((password == null) || (password.trim().length() == 0)) { - errors.put("empty_password", ""); - } - - if ((retypedPassword == null) || (retypedPassword.trim().length() == 0)) { - errors.put("empty_password_two", ""); - } - - if ((retypedPassword != null) && (password != null) - && (! retypedPassword.equals(password))) { - errors.put("mismatch_password", ""); - } - - // If there were no errors, continue - if (errors.size() == 0) { - ChatData chatData = (ChatData)SESSION_CHATDATA_MAP.get(sessionID); - - // If a connection already exists for this session, close it before creating - // another. - if (chatData != null) { - if (chatData.groupChat != null) { - chatData.groupChat.leave(); - } - - chatData.connection.close(); - } - - chatData = new ChatData(); - - try { - AccountManager am = null; - - // Create connection. - if (! this.sslEnabled) { - if (port != -1) { - chatData.connection = new XMPPConnection(this.host, this.port); - } else { - chatData.connection = new XMPPConnection(this.host); - } - } else { - if (port != -1) { - chatData.connection = new SSLXMPPConnection(this.host, this.port); - } - else { - chatData.connection = new SSLXMPPConnection(this.host); - } - } - - am = chatData.connection.getAccountManager(); - - // PENDING check whether the server even supports account creation - am.createAccount(username, password); - } catch (XMPPException e) { - errors.put("general", "The server reported an error in account creation: " - + e.getXMPPError().getMessage()); - } - } - - if (errors.size() > 0) { - request.setAttribute(ERRORS_ATTRIBUTE_STRING, errors); - - return ERROR_RETURN_CODE_STRING; - } - - return SUCCESS_RETURN_CODE_STRING; - } - - /** - * Handles login logic. - */ - private String handleLogin (HttpServletRequest request, boolean anonymous) { - String sessionID = request.getSession().getId(); - String username = request.getParameter(USERNAME_PARAM_STRING); - String password = request.getParameter(PASSWORD_PARAM_STRING); - String room = request.getParameter(ROOM_PARAM_STRING); - String nickname = request.getParameter(NICKNAME_PARAM_STRING); - Map errors = new HashMap(); - - // Validate parameters - if ((! anonymous) && ((username == null) || (username.trim().length() == 0))) { - errors.put(USERNAME_PARAM_STRING, ""); - } - - if ((! anonymous) && ((password == null) || (password.trim().length() == 0))) { - errors.put(PASSWORD_PARAM_STRING, ""); - } - - if ((room == null) || (room.trim().length() == 0)) { - errors.put(ROOM_PARAM_STRING, ""); - } - - if ((nickname == null) || (nickname.trim().length() == 0)) { - errors.put(NICKNAME_PARAM_STRING, ""); - } - - // If there were no errors, continue - if (errors.size() == 0) { - ChatData chatData = (ChatData)SESSION_CHATDATA_MAP.get(sessionID); - - // If a connection already exists for this session, close it before creating - // another. - if (chatData != null) { - if (chatData.groupChat != null) { - chatData.groupChat.leave(); - } - - chatData.connection.close(); - } - - chatData = new ChatData(); - - try { - // Create connection. - if (! this.sslEnabled) { - if (port != -1) { - chatData.connection = new XMPPConnection(this.host, this.port); - } else { - chatData.connection = new XMPPConnection(this.host); - } - } else { - if (port != -1) { - chatData.connection = new SSLXMPPConnection(this.host, this.port); - } - else { - chatData.connection = new SSLXMPPConnection(this.host); - } - } - - if (anonymous) { - Authentication a = new Authentication(); - PacketCollector pc = chatData.connection.createPacketCollector( - new PacketIDFilter(a.getPacketID())); - Authentication responsePacket = null; - - a.setType(IQ.Type.SET); - - chatData.connection.sendPacket(a); - - responsePacket = (Authentication)pc.nextResult(PACKET_RESPONSE_TIMEOUT_MS); - if (responsePacket == null) { -// throw new XMPPException("No response from the server."); - } - // check for error response - - pc.cancel(); - - // since GroupChat isn't setting the 'from' in it's message sends, - // i can't see a problem in not doing anything with the unique resource - // we've just been given by the server. if GroupChat starts setting the - // from, it would probably grab the information from the XMPPConnection - // instance it holds, and as such we would then need to introduce the - // concept of anonymous logins to XMPPConnection, or tell GroupChat what - // to do what username is null or blank but a resource exists... PENDING - } else { - chatData.connection.login(username, password, JIVE_WEB_CHAT_RESOURCE_NAME); - } - - chatData.connection.addPacketListener(this, - new PacketTypeFilter(Presence.class)); - - synchronized (SESSION_CHATDATA_MAP) { - SESSION_CHATDATA_MAP.put(sessionID, chatData); - } - - synchronized (PACKET_ROOT_CHATDATA_MAP) { - Packet p = new IQ(); - String root = this.getPacketIDRoot(p); - - // PENDING -- we won't do anything with this packet, so it will ultimately look - // to the server as though a packet has disappeared -- is this ok with the - // server? - PACKET_ROOT_CHATDATA_MAP.put(root, chatData); - } - - // Join groupChat room. - chatData.groupChat = chatData.connection.createGroupChat(room); - chatData.groupChat.join(nickname); - - // Put the user's nickname in the session - this is used by the view to correctly - // display the user's messages in a different color: - request.getSession().setAttribute(NICKNAME_ATTRIBUTE_STRING, nickname); - request.getSession().setAttribute(ROOM_ATTRIBUTE_STRING, room); - } catch (XMPPException e) { - XMPPError err = e.getXMPPError(); - - errors.put("general", ((err != null) ? err.getMessage() : e.getMessage())); - - if (chatData.groupChat != null) { - chatData.groupChat.leave(); - } - } - } - - if (errors.size() > 0) { - request.setAttribute(ERRORS_ATTRIBUTE_STRING, errors); - - return ERROR_RETURN_CODE_STRING; - } - - return SUCCESS_RETURN_CODE_STRING; - } - - private void writeData (String data, HttpServletResponse response) { - try { - PrintWriter responseWriter = response.getWriter(); - - response.setContentType("text/html"); - - responseWriter.println(data); - responseWriter.close(); - } catch (IOException ioe) { - // PENDING - } - } - - // a hack class to hold a data glom (really hacky) - private class ChatData { - - private XMPPConnection connection; - private GroupChat groupChat; - private Set newJoins = new HashSet(); - private Set newDepartures = new HashSet(); - - } - - /** - * Replaces all instances of oldString with newString in string. - * - * PENDING - why is this final? - * PENDING - take this out -- it fails under some cases... - * - * @param string the String to search to perform replacements on - * @param oldString the String that should be replaced by newString - * @param newString the String that will replace all instances of oldString - * - * @return a String will all instances of oldString replaced by newString - */ - static public final String replace (String string, String oldString, String newString) { - int i = 0; - - // MAY RETURN THIS BLOCK - if (string == null) { - return null; - } - - if (newString == null) { - return string; - } - - // Make sure that oldString appears at least once before doing any processing. - if (( i=string.indexOf(oldString, i)) >= 0) { - // Use char []'s, as they are more efficient to deal with. - char[] string2 = string.toCharArray(); - char[] newString2 = newString.toCharArray(); - int oLength = oldString.length(); - StringBuffer buf = new StringBuffer(string2.length); - int j = 1; - - buf.append(string2, 0, i).append(newString2); - - i += oLength; - - // Replace all remaining instances of oldString with newString. - while ((i=string.indexOf(oldString, i)) > 0) { - buf.append(string2, j, (i - j)).append(newString2); - - i += oLength; - j = i; - } - - buf.append(string2, j, (string2.length - j)); - - return buf.toString(); - } - - return string; - } - - /** - * - * HttpSessionListener implementation - * - */ - public void sessionCreated (HttpSessionEvent event) { } - - public void sessionDestroyed (HttpSessionEvent event) { - String sessionID = event.getSession().getId(); - ChatData chatData = null; - - synchronized (SESSION_CHATDATA_MAP) { - chatData = (ChatData)SESSION_CHATDATA_MAP.remove(sessionID); - } - - if (chatData != null) { - if (chatData.groupChat != null) { - chatData.groupChat.leave(); - } - - synchronized (PACKET_ROOT_CHATDATA_MAP) { - Packet p = new IQ(); - String root = this.getPacketIDRoot(p); - - PACKET_ROOT_CHATDATA_MAP.remove(root); - } - - chatData.connection.close(); - } - } - - /** - * - * PacketListener implementation - * - */ - public void processPacket (Packet packet) { - Presence presence = (Presence)packet; - String root = null; - ChatData chatData = null; - String userName = null; - - // MAY RETURN THIS BLOCK - if (presence.getMode() == Presence.Mode.INVISIBLE) { - return; - } - - root = this.getPacketIDRoot(presence); - chatData = (ChatData)PACKET_ROOT_CHATDATA_MAP.get(root); - - // MAY RETURN THIS BLOCK - if (chatData == null) { - return; - } - - userName = StringUtils.parseResource(packet.getFrom()); - - if (presence.getType() == Presence.Type.UNAVAILABLE) { - synchronized (chatData.newDepartures) { - synchronized (chatData.newJoins) { - chatData.newJoins.remove(userName); - - chatData.newDepartures.add(userName); - } - } - } else if (presence.getType() == Presence.Type.AVAILABLE) { - synchronized (chatData.newJoins) { - synchronized (chatData.newDepartures) { - chatData.newDepartures.remove(userName); - - chatData.newJoins.add(userName); - } - } - } - } - -} diff --git a/apps/webchat/source/java/org/jivesoftware/webchat/TextStyle.java b/apps/webchat/source/java/org/jivesoftware/webchat/TextStyle.java deleted file mode 100644 index 3e6aa955e..000000000 --- a/apps/webchat/source/java/org/jivesoftware/webchat/TextStyle.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * $RCSfile$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1999-2002 CoolServlets, Inc. All rights reserved. - * - * This software is the proprietary information of CoolServlets, Inc. - * Use is subject to license terms. - */ - -package org.jivesoftware.webchat; - -/** - * A Filter that replaces [b][/b], [i][/i], [u][/u], [pre][/pre] tags with their HTML - * tag equivalents. - */ -public class TextStyle { - - public String applyFilter(String string) { - if (string == null || string.length() == 0) { - return string; - } - - // To figure out how many times we've made text replacements, we - // need to pass around integer count objects. - int[] boldStartCount = new int[1]; - int[] italicsStartCount = new int[1]; - int[] boldEndCount = new int[1]; - int[] italicsEndCount = new int[1]; - int[] underlineStartCount = new int[1]; - int[] underlineEndCount = new int[1]; - int[] preformatStartCount = new int[1]; - int[] preformatEndCount = new int[1]; - - // Bold - string = replaceIgnoreCase(string, "[b]", "", boldStartCount); - string = replaceIgnoreCase(string, "[/b]", "", boldEndCount); - int bStartCount = boldStartCount[0]; - int bEndCount = boldEndCount[0]; - - while (bStartCount > bEndCount) { - string = string.concat(""); - bEndCount++; - } - - // Italics - string = replaceIgnoreCase(string, "[i]", "", italicsStartCount); - string = replaceIgnoreCase(string, "[/i]", "", italicsEndCount); - int iStartCount = italicsStartCount[0]; - int iEndCount = italicsEndCount[0]; - - while (iStartCount > iEndCount) { - string = string.concat(""); - iEndCount++; - } - - // Underline - string = replaceIgnoreCase(string, "[u]", "", underlineStartCount); - string = replaceIgnoreCase(string, "[/u]", "", underlineEndCount); - int uStartCount = underlineStartCount[0]; - int uEndCount = underlineEndCount[0]; - - while (uStartCount > uEndCount) { - string = string.concat(""); - uEndCount++; - } - - // Pre - string = replaceIgnoreCase(string, "[pre]", "
", preformatStartCount);
-        string = replaceIgnoreCase(string, "[/pre]", "
", preformatEndCount); - int preStartCount = preformatStartCount[0]; - int preEndCount = preformatEndCount[0]; - - while (preStartCount > preEndCount) { - string = string.concat(""); - preEndCount++; - } - - return string; - } - - /** - * Replaces all instances of oldString with newString in line with the - * added feature that matches of newString in oldString ignore case. - * The count paramater is set to the number of replaces performed. - * - * @param line the String to search to perform replacements on - * @param oldString the String that should be replaced by newString - * @param newString the String that will replace all instances of oldString - * @param count a value that will be updated with the number of replaces - * performed. - * - * @return a String will all instances of oldString replaced by newString - */ - private static final String replaceIgnoreCase(String line, String oldString, - String newString, int [] count) - { - if (line == null) { - return null; - } - String lcLine = line.toLowerCase(); - String lcOldString = oldString.toLowerCase(); - int i=0; - if ((i=lcLine.indexOf(lcOldString, i)) >= 0) { - int counter = 1; - char [] line2 = line.toCharArray(); - char [] newString2 = newString.toCharArray(); - int oLength = oldString.length(); - StringBuffer buf = new StringBuffer(line2.length); - buf.append(line2, 0, i).append(newString2); - i += oLength; - int j = i; - while ((i=lcLine.indexOf(lcOldString, i)) > 0) { - counter++; - buf.append(line2, j, i-j).append(newString2); - i += oLength; - j = i; - } - buf.append(line2, j, line2.length - j); - count[0] = counter; - return buf.toString(); - } - return line; - } -} \ No newline at end of file diff --git a/apps/webchat/source/java/org/jivesoftware/webchat/URLFilter.java b/apps/webchat/source/java/org/jivesoftware/webchat/URLFilter.java deleted file mode 100644 index de2f972b5..000000000 --- a/apps/webchat/source/java/org/jivesoftware/webchat/URLFilter.java +++ /dev/null @@ -1,312 +0,0 @@ -/** - * $RCSfile$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1999-2002 CoolServlets, Inc. All rights reserved. - * - * This software is the proprietary information of CoolServlets, Inc. - * Use is subject to license terms. - */ - -package org.jivesoftware.webchat; - -import java.util.*; - -/** - * A Filter that converts URL's to working HTML web links.

- * - * The default set of patterns recognized are ftp://path-of-url, - * http://path-of-url, https://path-of-url but can be expanded upon.

- * - * In addition, the following patterns are also recognized. - * - * [url path-of-url]descriptive text[/url] and - * [url=path-of-url]descriptive text[/url].

- * - * The [url] allows any path to be defined as link. - */ -public class URLFilter{ - - private ArrayList schemes = new ArrayList(); - - // define a preset default set of schemes - public URLFilter() { - schemes.add("http://"); - schemes.add("https://"); - schemes.add("ftp://"); - } - - public String applyFilter(String string) { - if (string == null || string.length() == 0) { - return string; - } - - int length = string.length(); - StringBuffer filtered = new StringBuffer((int) (length * 1.5)); - ArrayList urlBlocks = new ArrayList(5); - - // search for url's such as [url=..]text[/url] or [url ..]text[/url] - int start = string.indexOf("[url"); - while (start != -1 && (start + 5 < length)) { - // check to verify we're not in another block - if (withinAnotherBlock(urlBlocks, start)) { - start = string.indexOf("[url", start + 5); - continue; - } - - int end = string.indexOf("[/url]", start + 5); - - if (end == -1 || end >= length) { - // went past end of string, skip - break; - } - - String u = string.substring(start, end + 6); - int startTagClose = u.indexOf(']'); - String url; - String description; - if (startTagClose > 5) { - url = u.substring(5, startTagClose); - description = u.substring(startTagClose + 1, u.length() - 6); - - // Check the user entered URL for a "javascript:" or "file:" link. Only - // append the user entered link if it doesn't contain 'javascript:' and 'file:' - String lcURL = url.toLowerCase(); - if (lcURL.indexOf("javascript:") == -1 && lcURL.indexOf("file:") == -1) { - URLBlock block = new URLBlock(start, end + 5, url, description); - urlBlocks.add(block); - } - } - else { - url = description = u.substring(startTagClose + 1, u.length() - 6); - // Check the user entered URL for a "javascript:" or "file:" link. Only - // append the user entered link if it doesn't contain 'javascript:' and 'file:' - String lcURL = url.toLowerCase(); - if (lcURL.indexOf("javascript:") == -1 && lcURL.indexOf("file:") == -1) { - URLBlock block = new URLBlock(start, end + 5, url); - urlBlocks.add(block); - } - } - - start = string.indexOf("[url", end + 6); - } - - // now handle all the other urls - Iterator iter = schemes.iterator(); - - while (iter.hasNext()) { - String scheme = (String) iter.next(); - start = string.indexOf(scheme, 0); - - while (start != -1) { - int end = start; - - // check context, don't handle patterns preceded by any of '"<= - if (start > 0) { - char c = string.charAt(start - 1); - - if (c == '\'' || c == '"' || c == '<' || c == '=') { - start = string.indexOf(scheme, start + scheme.length()); - continue; - } - } - - // check to verify we're not in another block - if (withinAnotherBlock(urlBlocks, start)) { - start = string.indexOf(scheme, start + scheme.length()); - continue; - } - - // find the end of the url - int cur = start + scheme.length(); - while (end == start && cur < length) { - char c = string.charAt(cur); - - switch (c) { - case ' ': - end = cur; - break; - case '\t': - end = cur; - break; - case '\'': - end = cur; - break; - case '\"': - end = cur; - break; - case '<': - end = cur; - break; - case '[': - end = cur; - break; - case '\n': - end = cur; - break; - case '\r': - end = cur; - break; - default: - // acceptable character - } - - cur++; - } - - // if this is true it means the url goes to the end of the string - if (end == start) { - end = length - 1; - } - - URLBlock block = new URLBlock(start, end-1, string.substring(start, end)); - urlBlocks.add(block); - - start = string.indexOf(scheme, end); - } - } - - // sort the blocks so that they are in start index order - sortBlocks(urlBlocks); - - // now, markup the urls and pass along the filter chain the rest - Iterator blocks = urlBlocks.iterator(); - int last = 0; - - while (blocks.hasNext()) { - URLBlock block = (URLBlock) blocks.next(); - - if (block.getStart() > 0) { - filtered.append(string.substring(last, block.getStart())); - } - - last = block.getEnd() + 1; - - filtered.append(""); - if (block.getDescription().length() > 0) { - filtered.append(block.getDescription()); - } - else { - filtered.append(block.getUrl()); - } - filtered.append(""); - } - - if (last < string.length() - 1) { - filtered.append(string.substring(last)); - } - - return filtered.toString(); - } - - /** - * Returns the current supported uri schemes as a comma seperated string. - * - * @return the current supported uri schemes as a comma seperated string. - */ - public String getSchemes() { - StringBuffer buf = new StringBuffer(50); - - for (int i = 0; i < schemes.size(); i++) { - buf.append((String) schemes.get(i)).append(","); - } - buf.deleteCharAt(buf.length() - 1); - - return buf.toString(); - } - - /** - * Sets the current supported uri schemes as a comma seperated string. - * - * @param schemes a comma seperated string of uri schemes. - */ - public void setSchemes(String schemes) { - if (schemes == null) { - return; - } - - // enpty the current list - this.schemes.clear(); - - StringTokenizer st = new StringTokenizer(schemes, ","); - - while (st.hasMoreElements()) { - this.schemes.add(st.nextElement()); - } - } - - private void sortBlocks(ArrayList blocks) { - Collections.sort(blocks, new Comparator() { - public int compare(Object object1, Object object2) { - URLBlock b1 = (URLBlock) object1; - URLBlock b2 = (URLBlock) object2; - return (b1.getStart() > b2.getStart()) ? 1 : -1; - } - }); - } - - private boolean withinAnotherBlock(List blocks, int start) { - for (int i = 0; i < blocks.size(); i++) { - URLBlock block = (URLBlock) blocks.get(i); - - if (start >= block.getStart() && start < block.getEnd()) { - return true; - } - } - - return false; - } - - class URLBlock { - int start = 0; - int end = 0; - String description = ""; - String url = ""; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - URLBlock(int start, int end, String url) { - this.start = start; - this.end = end; - this.url = url; - } - - URLBlock(int start, int end, String url, String description) { - this.start = start; - this.end = end; - this.description = description; - this.url = url; - } - - public int getStart() { - return start; - } - - public void setStart(int start) { - this.start = start; - } - - public int getEnd() { - return end; - } - - public void setEnd(int end) { - this.end = end; - } - } -} \ No newline at end of file diff --git a/apps/webchat/source/java/org/jivesoftware/webchat/URLTranscoder.java b/apps/webchat/source/java/org/jivesoftware/webchat/URLTranscoder.java deleted file mode 100644 index 84310eca0..000000000 --- a/apps/webchat/source/java/org/jivesoftware/webchat/URLTranscoder.java +++ /dev/null @@ -1,188 +0,0 @@ -/** - * $RCSfile$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1999-2003 Jive Software. All rights reserved. - * - * This software is the proprietary information of Jive Software. - * Use is subject to license terms. - */ - -package org.jivesoftware.webchat; - -import java.util.*; - -/** - * This is a really good example of why software development projects have frameworks, and the - * other apps in their own modules that sit on top of the frameworks... this class should not - * be confused with com.jivesoftware.messenger.operator.util.URLTranscoder, which does a - * variant of the functionality found here.
- * - * The default set of patterns recognized are ftp://path-of-url, - * http://path-of-url, https://path-of-url but can be expanded upon.
- * - * This was originally URLTranscoder, from CoolServlets, but that class did basically nothing that - * i wanted, so i kept the schemes collection and that was about it.
- * - * @author loki der quaeler - */ -public class URLTranscoder { - - static protected final String A_HREF_PREFIX = ""; - static protected final String A_HREF_CLOSING_TAG = ""; - - - protected ArrayList schemes; - - public URLTranscoder () { - super(); - - this.schemes = new ArrayList(); - - this.schemes.add("http://"); - this.schemes.add("https://"); - this.schemes.add("ftp://"); - } - - /** - * Sets the current supported uri schemes. - * - * @param schemeCollection a collection of String instances of uri schemes. - */ - public synchronized void setSchemes (Collection schemeCollection) { - // MAY EXIT THIS BLOCK - if (schemes == null) { - return; - } - - this.schemes.clear(); - - this.schemes.addAll(schemeCollection); - } - - /** - * Returns a String based off the original text, but now with any a.href blocks html-ized - * inside. (for example, supplying the string "this: http://dict.leo.org/ is a cool url" - * returns "this: http://dict.leo.org/ - * is a cool url" - */ - public String encodeURLsInText (String text) { - StringBuffer rhett = null;; - List runs = this.getURLRunsInString(text); - Iterator it = null; - int lastStart = 0; - - // MAY RETURN THIS BLOCK - if (runs.size() == 0) { - return text; - } - - rhett = new StringBuffer(); - it = runs.iterator(); - while (it.hasNext()) { - URLRun run = (URLRun)it.next(); - String url = text.substring(run.getStartIndex(), run.getEndIndex()); - - if (lastStart < run.getStartIndex()) { - rhett.append(text.substring(lastStart, run.getStartIndex())); - - lastStart += run.getEndIndex(); - } - - rhett.append(A_HREF_PREFIX).append(url).append(A_HREF_SUFFIX).append(url); - rhett.append(A_HREF_CLOSING_TAG); - } - - if (lastStart < text.length()) { - rhett.append(text.substring(lastStart, text.length())); - } - - return rhett.toString(); - } - - protected List getURLRunsInString (String text) { - ArrayList rhett = new ArrayList(); - Vector vStarts = new Vector(); - Iterator sIt = this.schemes.iterator(); - Integer[] iStarts = null; - char[] tArray = null; - - while (sIt.hasNext()) { - String scheme = (String)sIt.next(); - int index = text.indexOf(scheme); - - while (index != -1) { - vStarts.add(new Integer(index)); - - index = text.indexOf(scheme, (index + 1)); - } - } - - // MAY RETURN THIS BLOCK - if (vStarts.size() == 0) { - return rhett; - } - - iStarts = (Integer[])vStarts.toArray(new Integer[0]); - Arrays.sort(iStarts); - - tArray = text.toCharArray(); - - for (int i = 0; i < iStarts.length; i++) { - int start = iStarts[i].intValue(); - int end = start + 1; - - while ((end < tArray.length) && (! this.characterIsURLTerminator(tArray[end]))) { - end++; - } - - if (end == tArray.length) { - end--; - } - - rhett.add(new URLRun(start, end)); - } - - return rhett; - } - - protected boolean characterIsURLTerminator (char c) { - switch (c) { - case ' ': - case '\n': - case '(': - case ')': - case '>': - case '\t': - case '\r': return true; - } - - return false; - } - - - protected class URLRun { - - protected int start; - protected int end; - - protected URLRun (int s, int e) { - super(); - - this.start = s; - this.end = e; - } - - protected int getStartIndex () { - return this.start; - } - - protected int getEndIndex () { - return this.end; - } - - } - -} \ No newline at end of file diff --git a/apps/webchat/source/web/account_creation.jsp b/apps/webchat/source/web/account_creation.jsp deleted file mode 100644 index b30e1f503..000000000 --- a/apps/webchat/source/web/account_creation.jsp +++ /dev/null @@ -1,116 +0,0 @@ -<%-- - - - - ---%> - -<%@ page import="java.util.*" %> - -<% // Get error map as a request attribute: - Map errors = (Map)request.getAttribute("messenger.servlet.errors"); - if (errors == null) { errors = new HashMap(); } -%> - - - - - - Create an account - - - - - - - - - - -
- - - - - - - - - - - - - -
-

Jive Account Creation

- - <% if (errors.get("general") != null) { %> -

- - Error creating account. <%= errors.get("general") %> - -

-
- <% } %> -
-
- - - - - - - - - - - - - - - -
Desired username: - - <% if (errors.get("empty_username") != null) { %> -
- Please enter a username. -
- <% } %> -
Desired password: - - <% if (errors.get("empty_password") != null) { %> -
- Please enter a password. -
- <% } %> - <% if (errors.get("mismatch_password") != null) { %> -
- Your passwords did not match. -
- <% } %> -
Retype your password: - - <% if (errors.get("empty_password_two") != null) { %> -
- You must retype your password. -
- <% } %> -
-
-
- - -
-
Click here to return to the login page. -
-
- - - - diff --git a/apps/webchat/source/web/chat-hiddenform.jsp b/apps/webchat/source/web/chat-hiddenform.jsp deleted file mode 100644 index c29c3d0a4..000000000 --- a/apps/webchat/source/web/chat-hiddenform.jsp +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - Chat Form - - - - - -

- - -
- - - diff --git a/apps/webchat/source/web/chat-launcher.jsp b/apps/webchat/source/web/chat-launcher.jsp deleted file mode 100644 index fba6cceb2..000000000 --- a/apps/webchat/source/web/chat-launcher.jsp +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - Web Chat Session - - - - - - - -

Chat Session Options

- - Your chat session should have already started. If for some reason it did - not, click this link - to start your chat session. - -

- - Other options: - - - - - diff --git a/apps/webchat/source/web/common.js b/apps/webchat/source/web/common.js deleted file mode 100644 index ace272e48..000000000 --- a/apps/webchat/source/web/common.js +++ /dev/null @@ -1,182 +0,0 @@ -function addChatText (someText, isAnnouncement) { - var yakDiv = window.parent.frames['yak'].document.getElementById('ytext'); - var children = yakDiv.childNodes.length; - var appendFailed = false; - var spanElement = document.createElement("span"); - - if (! isAnnouncement) { - spanElement.setAttribute("class", "chat_text"); - } else { - spanElement.setAttribute("class", "chat_announcement"); - } - // it's easier to dump the possibily html-containing text into the innerHTML - // of the span element than deciphering and building sub-elements. - spanElement.innerHTML = someText; - - try { - // various versions of IE crash out on this, and safari - yakDiv.appendChild(spanElement); - } catch (exception) { - appendFailed = true; - } - - if (! appendFailed) { - // really make sure the browser appended - appendFailed = (children == yakDiv.childNodes.length); - } - - if (appendFailed) { - // try this, the only way left - var inn = yakDiv.innerHTML; - - inn += "" : "chat_text\">"); - inn += someText + "
"; - - yakDiv.innerHTML = inn; - } else { - yakDiv.appendChild(document.createElement("br")); - } - - scrollYakToEnd(); -} - -function addUserName (userName) { - var yakDiv = window.parent.frames['yak'].document.getElementById('ytext'); - var children = yakDiv.childNodes.length; - var appendFailed = false; - var spanElement = document.createElement("span"); - var userIsClientOwner = false; - var announcement = false; - - if (userName == "") { - announcement = true; - - spanElement.setAttribute("class", "chat_announcement"); - - userName = "room announcement"; - } else if (userName == nickname) { - userIsClientOwner = true; - - spanElement.setAttribute("class", "chat_owner"); - } else { - spanElement.setAttribute("class", "chat_participant"); - } - - try { - spanElement.appendChild(document.createTextNode(userName + ": ")); - - // various versions of IE crash out on this, and safari - yakDiv.appendChild(spanElement); - } catch (exception) { - appendFailed = true; - } - - if (! appendFailed) { - // really make sure the browser appended - appendFailed = (children == yakDiv.childNodes.length); - } - - if (appendFailed) { - // try this, the only way left - var inn = yakDiv.innerHTML - - inn += "" + userName + ": "; - - yakDiv.innerHTML = inn; - } -} - -function scrollYakToEnd () { - var endDiv = window.parent.frames['yak'].document.getElementById('enddiv'); - - window.parent.frames['yak'].window.scrollTo(0, endDiv.offsetTop); -} - -function userJoined (username) { - var parentDIV = window.parent.frames['participants'].document.getElementById('par__list'); - var children = parentDIV.childNodes.length; - var appendFailed = false; - var divElement = document.createElement("div"); - - divElement.setAttribute("id", username); - - try { - divElement.appendChild(document.createTextNode(username)); - divElement.appendChild(document.createElement("br")); - - parentDIV.appendChild(divElement); - } catch (exception) { - appendFailed = true; - } - - if (! appendFailed) { - // really make sure the browser appended - appendFailed = (children == parentDIV.childNodes.length); - } - - if (appendFailed) { - // try this, the only way left - var inn = parentDIV.innerHTML; - - inn += "
· " + username + "
"; - - parentDIV.innerHTML = inn; - } -} - -function userDeparted (username) { - var partDoc = window.parent.frames['participants'].document; - var parentDIV = partDoc.getElementById('par__list'); - var userDIV = partDoc.getElementById(username); - var children = parentDIV.childNodes.length; - var removeFailed = false; - - // MAY RETURN THIS BLOCK - if (userDIV == null) { - return; - } - - try { - parentDIV.removeChild(userDIV); - } catch (exception) { - removeFailed = true; - } - - if (! removeFailed) { - // really make sure the browser appended - removeFailed = (children == parentDIV.childNodes.length); - } - - if (removeFailed) { - // try this, the only way left - var inn = parentDIV.innerHTML; - var openingTag = "
"; - var index = inn.toLowerCase().indexOf(openingTag); - var patchedHTML = inn.substring(0, index); - var secondIndex = openingTag.length + username.length + 13; - - patchedHTML += inn.substring(secondIndex, (inn.length)); - - parentDIV.innerHTML = inn; - } -} - -function writeDate () { - var msg = "This frame loaded at: "; - var now = new Date(); - - msg += now + "

"; - - document.write(msg); -} diff --git a/apps/webchat/source/web/frame_master.jsp b/apps/webchat/source/web/frame_master.jsp deleted file mode 100644 index a96b88f4c..000000000 --- a/apps/webchat/source/web/frame_master.jsp +++ /dev/null @@ -1,33 +0,0 @@ - - - <%= request.getSession().getAttribute("messenger.servlet.room") %> - - Jive Web Chat Client - - - - - - - - - - - - - - - - diff --git a/apps/webchat/source/web/images/emoticons/angry.gif b/apps/webchat/source/web/images/emoticons/angry.gif deleted file mode 100644 index 6489c9bc9..000000000 Binary files a/apps/webchat/source/web/images/emoticons/angry.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/blush.gif b/apps/webchat/source/web/images/emoticons/blush.gif deleted file mode 100644 index 22f1db550..000000000 Binary files a/apps/webchat/source/web/images/emoticons/blush.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/confused.gif b/apps/webchat/source/web/images/emoticons/confused.gif deleted file mode 100644 index ef1107bec..000000000 Binary files a/apps/webchat/source/web/images/emoticons/confused.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/cool.gif b/apps/webchat/source/web/images/emoticons/cool.gif deleted file mode 100644 index 2d805e5da..000000000 Binary files a/apps/webchat/source/web/images/emoticons/cool.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/cry.gif b/apps/webchat/source/web/images/emoticons/cry.gif deleted file mode 100644 index e244944c8..000000000 Binary files a/apps/webchat/source/web/images/emoticons/cry.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/devil.gif b/apps/webchat/source/web/images/emoticons/devil.gif deleted file mode 100644 index 31bca49fb..000000000 Binary files a/apps/webchat/source/web/images/emoticons/devil.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/grin.gif b/apps/webchat/source/web/images/emoticons/grin.gif deleted file mode 100644 index e5c92e2d5..000000000 Binary files a/apps/webchat/source/web/images/emoticons/grin.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/happy.gif b/apps/webchat/source/web/images/emoticons/happy.gif deleted file mode 100644 index 20a93e32b..000000000 Binary files a/apps/webchat/source/web/images/emoticons/happy.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/laugh.gif b/apps/webchat/source/web/images/emoticons/laugh.gif deleted file mode 100644 index e808a2583..000000000 Binary files a/apps/webchat/source/web/images/emoticons/laugh.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/love.gif b/apps/webchat/source/web/images/emoticons/love.gif deleted file mode 100644 index d1c320e3d..000000000 Binary files a/apps/webchat/source/web/images/emoticons/love.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/mischief.gif b/apps/webchat/source/web/images/emoticons/mischief.gif deleted file mode 100644 index 238db06f3..000000000 Binary files a/apps/webchat/source/web/images/emoticons/mischief.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/plain.gif b/apps/webchat/source/web/images/emoticons/plain.gif deleted file mode 100644 index a5beeea43..000000000 Binary files a/apps/webchat/source/web/images/emoticons/plain.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/sad.gif b/apps/webchat/source/web/images/emoticons/sad.gif deleted file mode 100644 index 0320885df..000000000 Binary files a/apps/webchat/source/web/images/emoticons/sad.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/shocked.gif b/apps/webchat/source/web/images/emoticons/shocked.gif deleted file mode 100644 index 20a70f8cd..000000000 Binary files a/apps/webchat/source/web/images/emoticons/shocked.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/silly.gif b/apps/webchat/source/web/images/emoticons/silly.gif deleted file mode 100644 index a162605bd..000000000 Binary files a/apps/webchat/source/web/images/emoticons/silly.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/emoticons/wink.gif b/apps/webchat/source/web/images/emoticons/wink.gif deleted file mode 100644 index 6d91b0fa2..000000000 Binary files a/apps/webchat/source/web/images/emoticons/wink.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/logo.gif b/apps/webchat/source/web/images/logo.gif deleted file mode 100644 index ad9573d92..000000000 Binary files a/apps/webchat/source/web/images/logo.gif and /dev/null differ diff --git a/apps/webchat/source/web/images/logout-16x16.gif b/apps/webchat/source/web/images/logout-16x16.gif deleted file mode 100644 index b380a7576..000000000 Binary files a/apps/webchat/source/web/images/logout-16x16.gif and /dev/null differ diff --git a/apps/webchat/source/web/index.jsp b/apps/webchat/source/web/index.jsp deleted file mode 100644 index 617b63b77..000000000 --- a/apps/webchat/source/web/index.jsp +++ /dev/null @@ -1,164 +0,0 @@ -<%-- - - - - ---%> - -<%@ page import="java.util.*" %> - -<% // Get error map as a request attribute: - Map errors = (Map)request.getAttribute("messenger.servlet.errors"); - boolean allowAnonymous = true; - boolean allowAccountCreate = true; - boolean allowLogin = true; - String param = null; - if (errors == null) { errors = new HashMap(); } - param = application.getInitParameter("allowAnonymous"); - if ((param != null) && (param.equalsIgnoreCase("false"))) { - allowAnonymous = false; - } - param = application.getInitParameter("allowAccountCreation"); - if ((param != null) && (param.equalsIgnoreCase("false"))) { - allowAccountCreate = false; - } - param = application.getInitParameter("allowLogin"); - if ((param != null) && (param.equalsIgnoreCase("false"))) { - allowLogin = false; - } -%> - - - - - - Jive Web Chat Client Login - - - - - - - - - - - - -
- - - - - - - - - - - <% if (allowAccountCreate) { %> - - - - <% } %> -
-

Welcome to the Jive Web Chat Client - Please Login

- <% if (errors.get("general") != null) { %> -

- Error logging in. Make sure your username and - password are correct. <%= errors.get("general") %> -

- <% } %> -
-
- - - - <% if (allowLogin) { %> - - - - - - - - - <% } %> - - - - - - - - -
Username: - - <% if (errors.get("username") != null) { %> -
- Please enter a valid username. -
- <% } %> -
Password: - - <% if (errors.get("password") != null) { %> -
- Please enter a valid password. -
- <% } %> -
Nickname: - - <% if (errors.get("nickname") != null) { %> -
- Please enter a nickname. -
- <% } %> -
Room: - - <% if (errors.get("room") != null) { %> -
- Please enter a valid room. -
- <% } %> -
-
-
- <% if (allowLogin) { %> - - <% } %> - <% if (allowAnonymous) { %> - - <% } %> - -
-
Don't have an account and would like to create one? - Click here. -
-
- - - - - diff --git a/apps/webchat/source/web/input_frame.jsp b/apps/webchat/source/web/input_frame.jsp deleted file mode 100644 index 352863160..000000000 --- a/apps/webchat/source/web/input_frame.jsp +++ /dev/null @@ -1,75 +0,0 @@ -<%@ page import="javax.servlet.*" %> - -<% // Get error map as a request attribute: - String logoFilename = application.getInitParameter("logoFilename"); - if (logoFilename == null) { - logoFilename = "images/logo.gif"; - } -%> - - - - - - - - - - - -
-
- -
- -
-
- - - - - diff --git a/apps/webchat/source/web/participants_frame.jsp b/apps/webchat/source/web/participants_frame.jsp deleted file mode 100644 index a2369de83..000000000 --- a/apps/webchat/source/web/participants_frame.jsp +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - -
In the room:
-
-
- -
- -
- -
- - - - Logout - - - diff --git a/apps/webchat/source/web/style_sheet.jsp b/apps/webchat/source/web/style_sheet.jsp deleted file mode 100644 index 381dceeef..000000000 --- a/apps/webchat/source/web/style_sheet.jsp +++ /dev/null @@ -1,132 +0,0 @@ -<% // Set the content type of the this page to be CSS - String contentType = "text/css"; - String chatAnnouncementColor = application.getInitParameter("chat.announcement-color"); - String chatOwnerLabelColor = application.getInitParameter("chat.owner-label-color"); - String chatParticipantLabelColor = application.getInitParameter("chat.participant-label-color"); - String chatTextColor = application.getInitParameter("chat.text-color"); - String errorTextColor = application.getInitParameter("error.text-color"); - String linkColor = application.getInitParameter("link.color"); - String linkHoverColor = application.getInitParameter("link.hover-color"); - String linkVisitedColor = application.getInitParameter("link.visited-color"); - String bodyBGColor = application.getInitParameter("body.background-color"); - String bodyTextColor = application.getInitParameter("body.text-color"); - String frameDividerColor = application.getInitParameter("frame.divider-color"); - String buttonColor = application.getInitParameter("button.color"); - String buttonTextColor = application.getInitParameter("button.text-color"); - String textFieldColor = application.getInitParameter("textfield.color"); - String textFieldTextColor = application.getInitParameter("textfield.text-color"); - response.setContentType(contentType); - if (chatAnnouncementColor == null) { - chatAnnouncementColor = "#009d00"; - } - if (chatOwnerLabelColor == null) { - chatOwnerLabelColor = "#aa0000"; - } - if (chatParticipantLabelColor == null) { - chatParticipantLabelColor = "#0000aa"; - } - if (chatTextColor == null) { - chatTextColor = "#434343"; - } - if (errorTextColor == null) { - errorTextColor = "#ff0000"; - } - if (linkColor == null) { - linkColor = "#045d30"; - } - if (linkHoverColor == null) { - linkHoverColor = "#350000"; - } - if (linkVisitedColor == null) { - linkVisitedColor = "#3b3757"; - } - if (bodyBGColor == null) { - bodyBGColor = "#ffffff"; - } - if (bodyTextColor == null) { - bodyTextColor = "#362f2d"; - } - if (frameDividerColor == null) { - frameDividerColor = "#83272b"; - } - if (buttonColor == null) { - buttonColor = "#d6dfdf"; - } - if (buttonTextColor == null) { - buttonTextColor = "#333333"; - } - if (textFieldColor == null) { - textFieldColor = "#f7f7fb"; - } - if (textFieldTextColor == null) { - textFieldTextColor = "#333333"; - } -%> - -BODY, TD, TH { font-family : Tahoma, Arial, Verdana, sans serif; font-size: 13px; } - -H3 { font-size : 1.2em; } - -.error-text { color : <%= errorTextColor %>; } - - -/* default unvisited, visited and hover link presentation */ -A:link { background: transparent; color: <%= linkColor %>; - text-decoration: none; } -A:visited { background: transparent; color: <%= linkVisitedColor %>; - text-decoration: none; } -A:hover { background: transparent; color: <%= linkHoverColor %>; - text-decoration: underline; } - -/** - * site wide BODY style rule; the scrollbar stuff only works in IE for windows, - * but doesn't seem to hurt on other browsers.. - */ -BODY.deffr { background-color: <%= bodyBGColor %>; color: <%= bodyTextColor %>; - scrollbar-face-color: <%= bodyBGColor %>; - scrollbar-shadow-color: <%= bodyTextColor %>; - scrollbar-highlight-color: <%= bodyBGColor %>; - scrollbar-darkshadow-color: <%= bodyBGColor %>; - scrollbar-track-color: <%= bodyBGColor %>; - scrollbar-arrow-color: <%= bodyTextColor %>; } - - -FRAME.bordered_left { border-left: 3px solid <%= frameDividerColor %>; } - - -IMG.logo { position: absolute; bottom: 12px; left: 10px; } - -IMG.logout { vertical-align: middle; } - - -INPUT.submit { background-color: <%= buttonColor %>; color: <%= buttonTextColor %>; - font-size: 12px; font-family: Arial, Verdana, sans serif; - border-style: ridge; margin: 1px 5px 1px 5px; } - -INPUT.submit_right { background-color: <%= buttonColor %>; color: <%= buttonTextColor %>; - font-size: 12px; font-family: Arial, Verdana, sans serif; - border-style: ridge; margin: 1px 5px 1px 5px; - position: absolute; right: 10px; } - -INPUT.text { background-color: <%= textFieldColor %>; color: <%= textFieldTextColor %>; - font: normal 12px Arial, Verdana, sans serif; height: 20px; width: 271px; - border-style: groove; margin-left: 10px; } - - -SPAN.chat_text { font: normal 11px Arial, Verdana, sans serif; - color: <%= chatTextColor %>; } - -SPAN.chat_announcement { font: italic 11px Arial, Verdana, sans serif; - color: <%= chatAnnouncementColor %>; } - -SPAN.chat_owner { font: bold 11px Arial, Verdana, sans serif; - color: <%= chatOwnerLabelColor %>; } - -SPAN.chat_participant { font: bold 11px Arial, Verdana, sans serif; - color: <%= chatParticipantLabelColor %>; } - -SPAN.logout { position: absolute; bottom: 12px; right: 15px; } - - -TEXTAREA { color: <%= textFieldTextColor %>; font: normal 12px Arial, Verdana, sans serif; - width: 500px; height: 130px; } diff --git a/apps/webchat/source/web/transcript_frame.html b/apps/webchat/source/web/transcript_frame.html deleted file mode 100644 index a4cc1faf5..000000000 --- a/apps/webchat/source/web/transcript_frame.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - -

- - - diff --git a/build/build.xml b/build/build.xml index 00f86257b..683d31dbe 100644 --- a/build/build.xml +++ b/build/build.xml @@ -24,8 +24,14 @@ - + + + + + + + @@ -35,11 +41,6 @@ - - - - - @@ -78,8 +79,8 @@ destdir="${compile.dir}" includeAntRuntime="no" debug="on" - source="1.3" - target="1.2" + source="1.5" + target="1.5" > @@ -102,8 +103,8 @@ destdir="${compile.test.dir}" includeAntRuntime="no" debug="on" - source="1.3" - target="1.2" + source="1.5" + target="1.5" > diff --git a/build/projects/Smack.iml b/build/projects/Smack.iml index 41e9e7ce2..73ac27096 100644 --- a/build/projects/Smack.iml +++ b/build/projects/Smack.iml @@ -8,7 +8,8 @@ - + + diff --git a/build/projects/Smack.ipr b/build/projects/Smack.ipr index 6a0e8eafd..b168f4e95 100644 --- a/build/projects/Smack.ipr +++ b/build/projects/Smack.ipr @@ -201,7 +201,7 @@ - +