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: ChatPanel.java,v 1.26 2004/02/25 14:43:37 mdb Exp $
|
||||
// $Id: ChatPanel.java,v 1.27 2004/03/06 11:29:19 mdb Exp $
|
||||
|
||||
package com.threerings.micasa.client;
|
||||
|
||||
@@ -31,6 +31,8 @@ import com.samskivert.swing.HGroupLayout;
|
||||
import com.samskivert.swing.VGroupLayout;
|
||||
import com.samskivert.swing.event.AncestorAdapter;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.crowd.chat.client.ChatDirector;
|
||||
import com.threerings.crowd.chat.client.ChatDisplay;
|
||||
import com.threerings.crowd.chat.data.ChatCodes;
|
||||
@@ -202,7 +204,7 @@ public class ChatPanel
|
||||
String message = text.substring(uidx + username.length()).trim();
|
||||
|
||||
// request to send this text as a tell message
|
||||
_chatdtr.requestTell(username, message, null);
|
||||
_chatdtr.requestTell(new Name(username), message, null);
|
||||
|
||||
} else if (text.startsWith("/clear")) {
|
||||
// clear the chat box
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: LogonPanel.java,v 1.9 2004/02/25 14:43:37 mdb Exp $
|
||||
// $Id: LogonPanel.java,v 1.10 2004/03/06 11:29:19 mdb Exp $
|
||||
|
||||
package com.threerings.micasa.client;
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.samskivert.swing.HGroupLayout;
|
||||
import com.samskivert.swing.VGroupLayout;
|
||||
|
||||
import com.threerings.util.MessageBundle;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.client.ClientObserver;
|
||||
@@ -182,7 +183,7 @@ public class LogonPanel extends JPanel
|
||||
// disable further logon attempts until we hear back
|
||||
setLogonEnabled(false);
|
||||
|
||||
String username = _username.getText().trim();
|
||||
Name username = new Name(_username.getText().trim());
|
||||
String password = new String(_password.getPassword()).trim();
|
||||
|
||||
String server = _ctx.getClient().getHostname();
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
//
|
||||
// $Id: MiCasaApp.java,v 1.12 2004/02/22 18:55:26 ray Exp $
|
||||
// $Id: MiCasaApp.java,v 1.13 2004/03/06 11:29:19 mdb Exp $
|
||||
|
||||
package com.threerings.micasa.client;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.samskivert.swing.util.SwingUtil;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.net.Credentials;
|
||||
import com.threerings.presents.net.UsernamePasswordCreds;
|
||||
|
||||
import com.threerings.micasa.Log;
|
||||
@@ -75,8 +76,8 @@ public class MiCasaApp
|
||||
String password = getProperty("password");
|
||||
if (username != null && password != null) {
|
||||
// create and set our credentials
|
||||
Credentials creds = new UsernamePasswordCreds(username, password);
|
||||
client.setCredentials(creds);
|
||||
client.setCredentials(
|
||||
new UsernamePasswordCreds(new Name(username), password));
|
||||
client.logon();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
//
|
||||
// $Id: MiCasaApplet.java,v 1.7 2002/08/14 19:07:49 mdb Exp $
|
||||
// $Id: MiCasaApplet.java,v 1.8 2004/03/06 11:29:19 mdb Exp $
|
||||
|
||||
package com.threerings.micasa.client;
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.samskivert.swing.util.SwingUtil;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.client.ClientAdapter;
|
||||
@@ -32,7 +34,7 @@ public class MiCasaApplet extends Applet
|
||||
_client = new MiCasaClient();
|
||||
_client.init(_frame);
|
||||
|
||||
String username = requireParameter("username");
|
||||
Name username = new Name(requireParameter("username"));
|
||||
String authkey = requireParameter("authkey");
|
||||
String server = getCodeBase().getHost();
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
//
|
||||
// $Id: LobbyController.java,v 1.9 2002/08/14 19:07:49 mdb Exp $
|
||||
// $Id: LobbyController.java,v 1.10 2004/03/06 11:29:19 mdb Exp $
|
||||
|
||||
package com.threerings.micasa.lobby;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.crowd.data.PlaceConfig;
|
||||
import com.threerings.crowd.data.PlaceObject;
|
||||
import com.threerings.crowd.client.PlaceController;
|
||||
@@ -48,7 +50,8 @@ public class LobbyController extends PlaceController
|
||||
// create a game config object
|
||||
try {
|
||||
GameConfig config = _config.getGameConfig();
|
||||
_ctx.getParlorDirector().invite(invitee, config, this);
|
||||
_ctx.getParlorDirector().invite(
|
||||
new Name(invitee), config, this);
|
||||
} catch (Exception e) {
|
||||
Log.warning("Error instantiating game config.");
|
||||
Log.logStackTrace(e);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: TableItem.java,v 1.3 2001/10/24 01:26:54 mdb Exp $
|
||||
// $Id: TableItem.java,v 1.4 2004/03/06 11:29:19 mdb Exp $
|
||||
|
||||
package com.threerings.micasa.lobby.table;
|
||||
|
||||
@@ -16,7 +16,7 @@ import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.crowd.data.BodyObject;
|
||||
|
||||
@@ -137,7 +137,7 @@ public class TableItem
|
||||
// now enable and label the buttons accordingly
|
||||
int slength = _seats.length;
|
||||
for (int i = 0; i < slength; i++) {
|
||||
if (StringUtil.blank(table.occupants[i])) {
|
||||
if (table.occupants[i] == null) {
|
||||
_seats[i].setText(JOIN_LABEL);
|
||||
_seats[i].setEnabled(!isSeated);
|
||||
_seats[i].setActionCommand("join");
|
||||
@@ -149,7 +149,7 @@ public class TableItem
|
||||
_seats[i].setActionCommand("leave");
|
||||
|
||||
} else {
|
||||
_seats[i].setText(table.occupants[i]);
|
||||
_seats[i].setText(table.occupants[i].toString());
|
||||
_seats[i].setEnabled(false);
|
||||
}
|
||||
}
|
||||
@@ -220,7 +220,7 @@ public class TableItem
|
||||
protected MiCasaContext _ctx;
|
||||
|
||||
/** Our username. */
|
||||
protected String _self;
|
||||
protected Name _self;
|
||||
|
||||
/** A reference to our table director. */
|
||||
protected TableDirector _tdtr;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SimulatorApp.java,v 1.15 2004/02/22 18:55:26 ray Exp $
|
||||
// $Id: SimulatorApp.java,v 1.16 2004/03/06 11:29:19 mdb Exp $
|
||||
|
||||
package com.threerings.micasa.simulator.client;
|
||||
|
||||
@@ -11,9 +11,10 @@ import com.samskivert.util.Interval;
|
||||
import com.samskivert.util.IntervalManager;
|
||||
import com.samskivert.util.ResultListener;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.client.ClientAdapter;
|
||||
import com.threerings.presents.net.Credentials;
|
||||
import com.threerings.presents.net.UsernamePasswordCreds;
|
||||
|
||||
import com.threerings.micasa.Log;
|
||||
@@ -139,8 +140,8 @@ public class SimulatorApp
|
||||
}
|
||||
|
||||
// create and set our credentials
|
||||
Credentials creds = new UsernamePasswordCreds(username, password);
|
||||
client.setCredentials(creds);
|
||||
client.setCredentials(
|
||||
new UsernamePasswordCreds(new Name(username), password));
|
||||
|
||||
// this is a bit of a hack, but we need to give the server long
|
||||
// enough to fully initialize and start listening on its socket
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
//
|
||||
// $Id: SimulatorManager.java,v 1.15 2004/02/25 14:43:37 mdb Exp $
|
||||
// $Id: SimulatorManager.java,v 1.16 2004/03/06 11:29:19 mdb Exp $
|
||||
|
||||
package com.threerings.micasa.simulator.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.dobj.RootDObjectManager;
|
||||
import com.threerings.presents.server.ClientManager;
|
||||
@@ -82,10 +84,10 @@ public class SimulatorManager
|
||||
// once the game object creation has completed)
|
||||
|
||||
// configure the game config with the player names
|
||||
config.players = new String[_playerCount];
|
||||
config.players = new Name[_playerCount];
|
||||
config.players[0] = _source.username;
|
||||
for (int ii = 1; ii < _playerCount; ii++) {
|
||||
config.players[ii] = "simulant" + ii;
|
||||
config.players[ii] = new Name("simulant" + ii);
|
||||
}
|
||||
|
||||
// we needn't hang around and wait for game object
|
||||
@@ -121,7 +123,7 @@ public class SimulatorManager
|
||||
// resolve the simulant body objects
|
||||
ClientResolutionListener listener = new ClientResolutionListener()
|
||||
{
|
||||
public void clientResolved (String username, ClientObject clobj)
|
||||
public void clientResolved (Name username, ClientObject clobj)
|
||||
{
|
||||
// hold onto the body object for later game creation
|
||||
_sims.add(clobj);
|
||||
@@ -132,7 +134,7 @@ public class SimulatorManager
|
||||
}
|
||||
}
|
||||
|
||||
public void resolutionFailed (String username, Exception cause)
|
||||
public void resolutionFailed (Name username, Exception cause)
|
||||
{
|
||||
Log.warning("Unable to create simulant body object " +
|
||||
"[error=" + cause + "].");
|
||||
@@ -141,7 +143,7 @@ public class SimulatorManager
|
||||
|
||||
// resolve client objects for all of our simulants
|
||||
for (int ii = 1; ii < _playerCount; ii++) {
|
||||
String username = "simulant" + ii;
|
||||
Name username = new Name("simulant" + ii);
|
||||
_clmgr.resolveClientObject(username, listener);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user