FileDocCategorySizeDatePackage
Chat.javaAPI DocExample1303Sun Feb 15 20:44:44 GMT 2004chat

Chat

public class Chat extends Object
Constants and Class Methods for Java Chat Clients and Server. The protocol: --> Lusername --> Btext_to_broadcast --> Musername\Message --> Q <-- any text to be displayed.
author
Ian Darwin
version
$Id: Chat.java,v 1.3 2004/02/16 02:44:43 ian Exp $

Fields Summary
public static final int
PORTNUM
public static final int
MAX_LOGIN_LENGTH
public static final char
SEPARATOR
public static final char
COMMAND
public static final char
CMD_LOGIN
public static final char
CMD_QUIT
public static final char
CMD_MESG
public static final char
CMD_BCAST
public static final char
RESP_PUBLIC
public static final char
RESP_PRIVATE
public static final char
RESP_SYSTEM
Constructors Summary
Methods Summary
public static booleanisValidLoginName(java.lang.String login)


	// TODO in main loop:
	// if (text.charAt(0) == '/')
	//		send(text);
	// else send("B"+text);

	     
		// check length
		if (login.length() > MAX_LOGIN_LENGTH)
			return false;

		// check for bad chars
		// if (contains bad chars)
		//	return false

		// Passed above tests, is OK
		return true;