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:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ChatDirector.java,v 1.57 2004/02/25 14:41:47 mdb Exp $
|
||||
// $Id: ChatDirector.java,v 1.58 2004/03/06 11:29:18 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.chat.client;
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.threerings.presents.dobj.MessageListener;
|
||||
|
||||
import com.threerings.util.MessageBundle;
|
||||
import com.threerings.util.MessageManager;
|
||||
import com.threerings.util.Name;
|
||||
import com.threerings.util.TimeUtil;
|
||||
|
||||
import com.threerings.crowd.Log;
|
||||
@@ -63,7 +64,7 @@ public class ChatDirector extends BasicDirector
|
||||
/**
|
||||
* Returns whether the username may be added to the chatters list.
|
||||
*/
|
||||
public boolean isChatterValid (String username);
|
||||
public boolean isChatterValid (Name username);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +153,7 @@ public class ChatDirector extends BasicDirector
|
||||
/**
|
||||
* Adds a chatter to our list of recent chatters.
|
||||
*/
|
||||
protected void addChatter (String name)
|
||||
protected void addChatter (Name name)
|
||||
{
|
||||
// check to see if the chatter validator approves..
|
||||
if ((_chatterValidator != null) &&
|
||||
@@ -351,8 +352,8 @@ public class ChatDirector extends BasicDirector
|
||||
* @param rl an optional result listener if you'd like to be notified
|
||||
* of success or failure.
|
||||
*/
|
||||
public void requestTell (
|
||||
final String target, String msg, final ResultListener rl)
|
||||
public void requestTell (final Name target, String msg,
|
||||
final ResultListener rl)
|
||||
{
|
||||
// make sure they can say what they want to say
|
||||
final String message = filter(msg, target, true);
|
||||
@@ -502,13 +503,13 @@ public class ChatDirector extends BasicDirector
|
||||
// if the message came from a user, make sure we want to hear it
|
||||
if (msg instanceof UserMessage) {
|
||||
UserMessage umsg = (UserMessage)msg;
|
||||
String speaker = umsg.speaker;
|
||||
message = filter(message, speaker, false);
|
||||
if (message == null) {
|
||||
Name speaker = umsg.speaker;
|
||||
if ((message = filter(message, speaker, false)) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
} else if (USER_CHAT_TYPE.equals(localtype) &&
|
||||
umsg.mode == ChatCodes.DEFAULT_MODE) {
|
||||
if (USER_CHAT_TYPE.equals(localtype) &&
|
||||
umsg.mode == ChatCodes.DEFAULT_MODE) {
|
||||
// if it was a tell, add the speaker as a chatter
|
||||
addChatter(speaker);
|
||||
|
||||
@@ -529,7 +530,7 @@ public class ChatDirector extends BasicDirector
|
||||
|
||||
// if we auto-responded, report as much
|
||||
if (autoResponse != null) {
|
||||
String teller = ((UserMessage) msg).speaker;
|
||||
Name teller = ((UserMessage) msg).speaker;
|
||||
String amsg = MessageBundle.tcompose(
|
||||
"m.auto_responded", teller, autoResponse);
|
||||
displayFeedback(_bundle, amsg);
|
||||
@@ -630,7 +631,7 @@ public class ChatDirector extends BasicDirector
|
||||
/**
|
||||
* Run a message through all the currently registered filters.
|
||||
*/
|
||||
public String filter (String msg, String otherUser, boolean outgoing)
|
||||
public String filter (String msg, Name otherUser, boolean outgoing)
|
||||
{
|
||||
_filterMessageOp.setMessage(msg, otherUser, outgoing);
|
||||
_filters.apply(_filterMessageOp);
|
||||
@@ -643,7 +644,7 @@ public class ChatDirector extends BasicDirector
|
||||
*/
|
||||
protected static class FilterMessageOp implements ObserverList.ObserverOp
|
||||
{
|
||||
public void setMessage (String msg, String otherUser, boolean outgoing)
|
||||
public void setMessage (String msg, Name otherUser, boolean outgoing)
|
||||
{
|
||||
_msg = msg;
|
||||
_otherUser = otherUser;
|
||||
@@ -663,7 +664,7 @@ public class ChatDirector extends BasicDirector
|
||||
return _msg;
|
||||
}
|
||||
|
||||
protected String _otherUser;
|
||||
protected Name _otherUser;
|
||||
protected String _msg;
|
||||
protected boolean _out;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
//
|
||||
// $Id: ChatFilter.java,v 1.1 2003/09/15 21:11:40 ray Exp $
|
||||
// $Id: ChatFilter.java,v 1.2 2004/03/06 11:29:18 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.chat.client;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
/**
|
||||
* Filters messages chat messages to or from the server.
|
||||
*/
|
||||
@@ -18,5 +20,5 @@ public interface ChatFilter
|
||||
*
|
||||
* @return the filtered message, or null to block it completely.
|
||||
*/
|
||||
public String filter (String msg, String otherUser, boolean outgoing);
|
||||
public String filter (String msg, Name otherUser, boolean outgoing);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
//
|
||||
// $Id: ChatService.java,v 1.12 2003/09/18 17:53:48 mdb Exp $
|
||||
// $Id: ChatService.java,v 1.13 2004/03/06 11:29:18 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.chat.client;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
|
||||
@@ -41,7 +43,7 @@ public interface ChatService extends InvocationService
|
||||
* @param message the contents of the message.
|
||||
* @param listener the reference that will receive the tell response.
|
||||
*/
|
||||
public void tell (Client client, String target, String message,
|
||||
public void tell (Client client, Name target, String message,
|
||||
TellListener listener);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: MuteDirector.java,v 1.10 2003/09/15 21:11:40 ray Exp $
|
||||
// $Id: MuteDirector.java,v 1.11 2004/03/06 11:29:18 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.chat.client;
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.HashSet;
|
||||
import com.samskivert.util.ObserverList;
|
||||
|
||||
import com.threerings.util.MessageBundle;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.crowd.util.CrowdContext;
|
||||
|
||||
@@ -31,7 +32,7 @@ public class MuteDirector extends BasicDirector
|
||||
/**
|
||||
* The specified player was added or removed from the mutelist.
|
||||
*/
|
||||
public void muteChanged (String playername, boolean nowMuted);
|
||||
public void muteChanged (Name playername, boolean nowMuted);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,7 +46,7 @@ public class MuteDirector extends BasicDirector
|
||||
/**
|
||||
* Set up the mute director with the specified list of initial mutees.
|
||||
*/
|
||||
public MuteDirector (CrowdContext ctx, String[] list)
|
||||
public MuteDirector (CrowdContext ctx, Name[] list)
|
||||
{
|
||||
this(ctx);
|
||||
|
||||
@@ -84,7 +85,7 @@ public class MuteDirector extends BasicDirector
|
||||
/**
|
||||
* Check to see if the specified user is muted.
|
||||
*/
|
||||
public boolean isMuted (String username)
|
||||
public boolean isMuted (Name username)
|
||||
{
|
||||
return _mutelist.contains(username);
|
||||
}
|
||||
@@ -92,7 +93,7 @@ public class MuteDirector extends BasicDirector
|
||||
/**
|
||||
* Mute or unmute the specified user.
|
||||
*/
|
||||
public void setMuted (String username, boolean mute)
|
||||
public void setMuted (Name username, boolean mute)
|
||||
{
|
||||
if (mute ? _mutelist.add(username) : _mutelist.remove(username)) {
|
||||
_chatdir.displayFeedback(null, MessageBundle.tcompose(
|
||||
@@ -107,13 +108,13 @@ public class MuteDirector extends BasicDirector
|
||||
* This list may be out of date immediately upon returning from this
|
||||
* method.
|
||||
*/
|
||||
public String[] getMuted ()
|
||||
public Name[] getMuted ()
|
||||
{
|
||||
return (String[]) _mutelist.toArray(new String[_mutelist.size()]);
|
||||
return (Name[]) _mutelist.toArray(new Name[_mutelist.size()]);
|
||||
}
|
||||
|
||||
// documentation inherited from interface ChatFilter
|
||||
public String filter (String msg, String otherUser, boolean outgoing)
|
||||
public String filter (String msg, Name otherUser, boolean outgoing)
|
||||
{
|
||||
// we are only concerned with filtering things going to or coming
|
||||
// from muted users
|
||||
@@ -132,7 +133,7 @@ public class MuteDirector extends BasicDirector
|
||||
/**
|
||||
* Notify our observers of a change in the mutelist.
|
||||
*/
|
||||
protected void notifyObservers (final String username, final boolean muted)
|
||||
protected void notifyObservers (final Name username, final boolean muted)
|
||||
{
|
||||
_observers.apply(new ObserverList.ObserverOp() {
|
||||
public boolean apply (Object observer) {
|
||||
|
||||
Reference in New Issue
Block a user