405 modified source files and 17,367 lines of diffs later we now enforce

more discipline when handling names in our code base. Any user entered
name should find its way into a Name object as soon as it comes out of a
text field or whatnot, and stay that way until it makes its way into a
text field or into a database record (for which String objects are vastly
simpler because of JORA magic).

Dear God, let me never again make a change this large for the rest of my
mortal life.

Unfortunately, this means we have to keep an eye out for funny business
pretty much everywhere. However, since we will absolutely want to test
market stalls and so forth on Azure, we'll have an opportunity to iron out
any funny business that might fall under the radar during our internal
testing.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2980 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2004-03-06 11:29:19 +00:00
parent 92b716d790
commit 32dee3cbaf
58 changed files with 335 additions and 286 deletions
@@ -1,5 +1,5 @@
//
// $Id: SpeakProvider.java,v 1.19 2004/02/25 14:41:47 mdb Exp $
// $Id: SpeakProvider.java,v 1.20 2004/03/06 11:29:18 mdb Exp $
package com.threerings.crowd.chat.server;
@@ -7,6 +7,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import com.samskivert.util.ObserverList;
import com.threerings.util.Name;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.dobj.DObject;
@@ -55,7 +56,7 @@ public class SpeakProvider
/**
* Called for each player that hears a particular chat message.
*/
public void messageDelivered (String hearer, UserMessage message);
public void messageDelivered (Name hearer, UserMessage message);
}
/**
@@ -144,7 +145,7 @@ public class SpeakProvider
* "faking" a chat message.
* @param message the text of the speak message.
*/
public static void sendSpeak (DObject speakObj, String speaker,
public static void sendSpeak (DObject speakObj, Name speaker,
String bundle, String message)
{
sendSpeak(speakObj, speaker, bundle, message, ChatCodes.DEFAULT_MODE);
@@ -167,7 +168,7 @@ public class SpeakProvider
* @param mode the mode of the message, see {@link
* ChatCodes#DEFAULT_MODE}.
*/
public static void sendSpeak (DObject speakObj, String speaker,
public static void sendSpeak (DObject speakObj, Name speaker,
String bundle, String message, byte mode)
{
sendMessage(speakObj, new UserMessage(message, bundle, speaker, mode));
@@ -277,7 +278,7 @@ public class SpeakProvider
* Returns a list of {@link ChatMessage} objects to which this user
* has been privy in the recent past.
*/
public static ArrayList getChatHistory (String username)
public static ArrayList getChatHistory (Name username)
{
HistoryList history = getHistoryList(username);
pruneHistory(System.currentTimeMillis(), history);
@@ -287,7 +288,7 @@ public class SpeakProvider
/**
* Called to clear the chat history for the specified user.
*/
public static void clearHistory (String username)
public static void clearHistory (Name username)
{
// Log.info("Clearing history for " + username + ".");
_histories.remove(username);
@@ -298,7 +299,7 @@ public class SpeakProvider
* message. If {@link ChatMessage#timestamp} is not already filled in,
* it will be.
*/
protected static void noteMessage (String username, UserMessage msg)
protected static void noteMessage (Name username, UserMessage msg)
{
// fill in the message's time stamp if necessary
if (msg.timestamp == 0L) {
@@ -325,7 +326,7 @@ public class SpeakProvider
/**
* Returns this user's chat history, creating one if necessary.
*/
protected static HistoryList getHistoryList (String username)
protected static HistoryList getHistoryList (Name username)
{
HistoryList history = (HistoryList)_histories.get(username);
if (history == null) {
@@ -361,7 +362,7 @@ public class SpeakProvider
}
}
public void apply (String username) {
public void apply (Name username) {
noteMessage(username, message);
}
}
@@ -378,7 +379,7 @@ public class SpeakProvider
/** Used to notify our {@link MessageObserver}s. */
protected static class MessageObserverOp implements ObserverList.ObserverOp
{
public void init (String hearer, UserMessage message) {
public void init (Name hearer, UserMessage message) {
_hearer = hearer;
_message = message;
}
@@ -388,7 +389,7 @@ public class SpeakProvider
return true;
}
protected String _hearer;
protected Name _hearer;
protected UserMessage _message;
}