org.starhope.vergil.badItalian
Class SmartFauxClient

java.lang.Object
  extended by org.starhope.vergil.badItalian.SmartFauxClient

public class SmartFauxClient
extends Object

A nearly drop-in replacement for the basics of porting a SmartFox Server Pro client application to use Appius Claudius Caecus.

Author:
brpocock@star-hope.org

Field Summary
private  String connectedHost
          server to which we're connected
private  int connectedPort
          server port to which we're connected
private  String connectedZone
          server zone to which we're connected
private  String randomKey
          random key from server
 boolean smartConnect
          An ignored public boolean for compatibility purposes.
private  Socket socket
          Server connection
 
Constructor Summary
SmartFauxClient(boolean b)
          Constructor
 
Method Summary
 void addEventListener(String onconnection, ISFSEventListener onConnection2)
          WRITEME: Document this method brpocock@star-hope.org
 void connect(String server)
          Connect to a server, trying the default Smart Fox Server port (9339) and the default Appius port (2770).
 void connect(String server, int port)
          Connect to a server on a specific port.
 void disconnect()
          Disconnect from the server, if connected.
 String getConnectedHost()
           
 int getConnectedPort()
           
 String getConnectedZone()
           
 String getRandomKey()
          WRITEME: Document this method brpocock@star-hope.org
 void getRoomList()
          fetch and store the room list.
 void joinRoom(int i)
          WRITEME: Document this method brpocock@star-hope.org
 void joinRoom(String roomMoniker, String roomPassword, boolean b)
          WRITEME: Document this method brpocock@star-hope.org
 void login(String string, String userName, String string2)
          WRITEME: Document this method brpocock@star-hope.org
 void logout()
          WRITEME: Document this method brpocock@star-hope.org
 void sendJson(String string)
          WRITEME: Document this method brpocock@star-hope.org
 void sendPublicMessage(String string)
          WRITEME: Document this method brpocock@star-hope.org
 void sendXtMessage(String string, String string2, org.json.JSONObject jsonObject)
          WRITEME: Document this method brpocock@star-hope.org
 void setDebug(boolean b)
          WRITEME: Document this method brpocock@star-hope.org
 void setUserVariables(Map<String,SFSVariable> vars)
          WRITEME: Document this method brpocock@star-hope.org
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

smartConnect

public boolean smartConnect
An ignored public boolean for compatibility purposes.


socket

private Socket socket
Server connection


connectedHost

private String connectedHost
server to which we're connected


connectedPort

private int connectedPort
server port to which we're connected


connectedZone

private final String connectedZone
server zone to which we're connected

See Also:
Constant Field Values

randomKey

private String randomKey
random key from server

Constructor Detail

SmartFauxClient

public SmartFauxClient(boolean b)
Constructor

Parameters:
b - Whether to enable debugging mode
Method Detail

addEventListener

public void addEventListener(String onconnection,
                             ISFSEventListener onConnection2)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
onconnection - WRITEME
onConnection2 - WRITEME

connect

public void connect(String server)
             throws UnknownHostException
Connect to a server, trying the default Smart Fox Server port (9339) and the default Appius port (2770).

Parameters:
server - The server to which to connect.
Throws:
UnknownHostException - if the server name can't be resolved

connect

public void connect(String server,
                    int port)
             throws UnknownHostException
Connect to a server on a specific port.

Parameters:
server - The server to which to connect
port - The port number on which to connect. The default for SmartFox Server is 9339; the default for Appius is 2770.
Throws:
UnknownHostException - if the given server name can't be resolved

disconnect

public void disconnect()
Disconnect from the server, if connected.


getConnectedHost

public String getConnectedHost()
Returns:
the connectedHost

getConnectedPort

public int getConnectedPort()
Returns:
the connectedPort

getConnectedZone

public String getConnectedZone()
Returns:
the connectedZone

getRandomKey

public String getRandomKey()
WRITEME: Document this method brpocock@star-hope.org

Returns:
random key for cryptographic exchange (CHAP)

getRoomList

public void getRoomList()
fetch and store the room list.


joinRoom

public void joinRoom(int i)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
i - WRITEME

joinRoom

public void joinRoom(String roomMoniker,
                     String roomPassword,
                     boolean b)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
roomMoniker - WRITEME
roomPassword - WRITEME
b - WRITEME

login

public void login(String string,
                  String userName,
                  String string2)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
string - WRITEME
userName - WRITEME
string2 - WRITEME

logout

public void logout()
WRITEME: Document this method brpocock@star-hope.org


sendJson

public void sendJson(String string)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
string - WRITEME

sendPublicMessage

public void sendPublicMessage(String string)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
string - WRITEME

sendXtMessage

public void sendXtMessage(String string,
                          String string2,
                          org.json.JSONObject jsonObject)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
string - WRITEME
string2 - WRITEME
jsonObject - WRITEME

setDebug

public void setDebug(boolean b)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
b - WRITEME

setUserVariables

public void setUserVariables(Map<String,SFSVariable> vars)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
vars - WRITEME