diff options
Diffstat (limited to 'NET/worlds/network/Galaxy.java')
| -rw-r--r-- | NET/worlds/network/Galaxy.java | 1246 |
1 files changed, 1246 insertions, 0 deletions
diff --git a/NET/worlds/network/Galaxy.java b/NET/worlds/network/Galaxy.java new file mode 100644 index 0000000..69324c0 --- /dev/null +++ b/NET/worlds/network/Galaxy.java @@ -0,0 +1,1246 @@ +/* */ package NET.worlds.network; +/* */ +/* */ import NET.worlds.console.Console; +/* */ import NET.worlds.console.DialogReceiver; +/* */ import NET.worlds.console.InternetConnectionDialog; +/* */ import NET.worlds.console.LoginWizard; +/* */ import NET.worlds.core.IniFile; +/* */ import java.io.PrintStream; +/* */ import java.util.Enumeration; +/* */ import java.util.Hashtable; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class Galaxy +/* */ implements DialogReceiver +/* */ { +/* */ private static Hashtable<String, Galaxy> _galaxyHash; +/* */ private static boolean _globalUserAllowsOnline; +/* */ +/* */ private Galaxy(ServerURL serverURL) +/* */ { +/* 153 */ this._serverURL = serverURL; +/* */ +/* 155 */ this._serverType = 0; +/* 156 */ this._nFlongID = new Hashtable(); +/* 157 */ this._worldCount = 0; +/* 158 */ this._channel = ""; +/* 159 */ this._serverTracker = new ServerTracker(this); +/* 160 */ this._waiters = new WaitList(this); +/* */ +/* */ +/* */ +/* */ +/* */ +/* 166 */ this._username = ""; +/* 167 */ this._usernameU = ""; +/* 168 */ this._consoleList = new NetworkMulti(this._username, this); +/* 169 */ regObject(this._username, this._consoleList); +/* */ +/* 171 */ if (serverURL == null) +/* */ { +/* 173 */ this._onlineEnabled = false; +/* 174 */ this._online = false; +/* */ } else { +/* 176 */ this._onlineEnabled = true; +/* 177 */ this._online = false; +/* */ } +/* 179 */ setOnlineState(this._onlineEnabled, this._online); +/* */ } +/* */ +/* */ private synchronized void incWorldCount() { +/* 183 */ this._worldCount += 1; +/* */ } +/* */ +/* */ public synchronized void decWorldCount() { +/* 187 */ this._worldCount -= 1; +/* 188 */ assert (this._worldCount >= 0); +/* 189 */ if (this._worldCount <= 0) +/* */ { +/* */ +/* */ +/* */ +/* */ +/* 195 */ if (this._serverURL != null) { +/* 196 */ _galaxyHash.remove(this._serverURL.getHost()); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 206 */ this._waiters.clear(); +/* */ +/* */ +/* */ +/* */ +/* 211 */ this._serverTracker = new ServerTracker(this); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public static Galaxy getGalaxy(String strServerURL) +/* */ throws InvalidServerURLException +/* */ { +/* 231 */ ServerURL serverURL = new ServerURL(strServerURL); +/* */ +/* 233 */ String serverHost = serverURL.getHost(); +/* */ +/* 235 */ Galaxy reqGal = (Galaxy)_galaxyHash.get(serverHost); +/* 236 */ if (reqGal == null) { +/* 237 */ reqGal = new Galaxy(serverURL); +/* 238 */ _galaxyHash.put(serverHost, reqGal); +/* */ } +/* 240 */ assert (reqGal != null); +/* 241 */ reqGal.incWorldCount(); +/* 242 */ return reqGal; +/* */ } +/* */ +/* */ +/* */ +/* */ public static Galaxy getGalaxy(URL serverURL) +/* */ throws InvalidServerURLException +/* */ { +/* 250 */ return getGalaxy(serverURL.unalias()); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public static Galaxy getAnonGalaxy() +/* */ { +/* 258 */ Galaxy reqGal = new Galaxy(null); +/* 259 */ reqGal.incWorldCount(); +/* 260 */ return reqGal; +/* */ } +/* */ +/* */ public boolean isAnonymous() { +/* 264 */ return this._serverURL == null; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 277 */ private boolean _localUserAllowsOnline = true; +/* */ +/* */ private ServerURL _serverURL; +/* */ +/* */ private int _serverType; +/* */ +/* */ private int _worldCount; +/* */ +/* */ private Hashtable<String, NetworkObject> _nFlongID; +/* */ +/* */ private ServerTracker _serverTracker; +/* */ +/* */ private RoomMgr _roomTable; +/* */ +/* */ private String _channel; +/* */ private String _username; +/* */ private String _usernameU; +/* */ private String _password; +/* */ private String _serial; +/* */ private String _newUsername; +/* */ private String _newPassword; +/* */ private int _mode; +/* */ private NetworkMulti _consoleList; +/* 300 */ private int _retriesLeft = 2; +/* */ +/* */ +/* */ +/* */ private InternetConnectionDialog _icd; +/* */ +/* */ +/* */ +/* */ private LoginWizard _wizard; +/* */ +/* */ +/* 311 */ private Object _wizardMutex = new Object(); +/* */ private static int _debugLevel; +/* */ private WaitList _waiters; +/* */ private boolean _relogin; +/* */ private boolean _onlineEnabled; +/* */ private boolean _online; +/* */ private boolean sentFriendsList; +/* */ private int protocolLevel; +/* */ +/* */ static +/* */ { +/* 267 */ _galaxyHash = new Hashtable(); +/* */ +/* */ +/* */ +/* */ +/* 272 */ _globalUserAllowsOnline = true; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 316 */ _debugLevel = IniFile.gamma().getIniInt("netdebug", 0); +/* 317 */ if (_debugLevel > 0) { +/* 318 */ System.out.println("NETWORK DEBUGGING LEVEL = " + _debugLevel); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public WorldServer getServer(String StrServerURL) +/* */ throws InvalidServerURLException +/* */ { +/* 351 */ if (this._serverURL == null) +/* 352 */ return null; +/* 353 */ if (!_globalUserAllowsOnline) +/* 354 */ return null; +/* 355 */ if (!this._localUserAllowsOnline) +/* 356 */ return null; +/* 357 */ if (this._icd != null) { +/* 358 */ return null; +/* */ } +/* */ +/* 361 */ synchronized (this._wizardMutex) { +/* 362 */ if ((this._wizard != null) && (!this._wizard.waitingForConnection()) && +/* 363 */ (!this._wizard.safeToQueryServer())) { +/* 364 */ return null; +/* */ } +/* */ } +/* */ +/* 368 */ return this._serverTracker.getServer(StrServerURL); +/* */ } +/* */ +/* */ public WorldServer getServer(URL serverURL) +/* */ throws InvalidServerURLException +/* */ { +/* 374 */ return getServer(serverURL.unalias()); +/* */ } +/* */ +/* */ public boolean isActive() { +/* 378 */ return this._serverTracker.isActive(); +/* */ } +/* */ +/* */ protected boolean addPendingServer(WorldServer ws) { +/* 382 */ assert (ws != null); +/* 383 */ boolean firstOnline = this._serverTracker.addPendingServer(ws); +/* 384 */ if (firstOnline) +/* */ { +/* */ +/* 387 */ this._retriesLeft = 2; +/* */ +/* 389 */ setOnlineState(true, true); +/* 390 */ synchronized (this) { +/* 391 */ this._roomTable = new RoomMgr(); +/* */ } +/* */ } +/* 394 */ return firstOnline; +/* */ } +/* */ +/* */ void addActiveServer(WorldServer ws) { +/* 398 */ boolean firstActive = this._serverTracker.addActiveServer(ws); +/* 399 */ if (firstActive) +/* */ { +/* 401 */ this._waiters.notify(true); +/* */ +/* 403 */ if (this._wizard != null) +/* */ { +/* 405 */ System.out.println("LWDB: calling " + this._wizard + " setConnected"); +/* 406 */ this._wizard.setConnected(); +/* */ } +/* */ } +/* */ } +/* */ +/* */ boolean addClosingServer(WorldServer ws) { +/* 412 */ assert (this._nFlongID != null); +/* 413 */ assert (ws != null); +/* 414 */ boolean lastActive = this._serverTracker.addClosingServer(ws); +/* 415 */ if (lastActive) { +/* 416 */ forceDisconnect(); +/* */ } +/* 418 */ return lastActive; +/* */ } +/* */ +/* */ void markClosedServer(WorldServer ws) { +/* 422 */ this._serverTracker.markClosedServer(ws); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ void killServer(WorldServer serv) +/* */ { +/* 430 */ this._serverTracker.killServer(serv); +/* */ } +/* */ +/* */ protected void noteServerDeath(VarErrorException lastError) { +/* 434 */ synchronized (this._serverTracker) { +/* 435 */ if (this._serverTracker.isActive()) +/* */ { +/* 437 */ return; +/* */ } +/* 439 */ synchronized (this) +/* */ { +/* 441 */ this._roomTable = null; +/* */ } +/* */ +/* 444 */ setOnlineState(false, false); +/* */ +/* */ +/* */ +/* */ +/* 449 */ if (getProtocol() == 0) +/* */ { +/* */ +/* 452 */ this._icd = new InternetConnectionDialog(this, lastError); +/* 453 */ return; +/* */ } +/* */ +/* */ +/* */ +/* 458 */ if ((lastError != null) && ((!lastError.getStatusFlag()) || (this._relogin))) { +/* 459 */ _globalUserAllowsOnline = true; +/* */ +/* */ +/* 462 */ boolean tryBackup = false; +/* 463 */ synchronized (this._serverTracker) { +/* 464 */ Enumeration<WorldServer> list = this._serverTracker.getAllServers(); +/* 465 */ while (list.hasMoreElements()) { +/* 466 */ WorldServer ws = (WorldServer)list.nextElement(); +/* 467 */ if (ws.useBackupServer()) { +/* 468 */ tryBackup = true; +/* */ } +/* */ } +/* */ } +/* 472 */ if (tryBackup) { +/* 473 */ System.out.println("Server death noted, trying alternate."); +/* 474 */ setChatname(this._username); +/* 475 */ goOnline(); +/* */ } else { +/* 477 */ System.out.println("Server death noted, no more alternates. How sad."); +/* */ +/* */ +/* */ +/* */ +/* 482 */ if ((this._retriesLeft > 0) && ( +/* 483 */ (this._relogin) || (lastError.getRetryFlag()))) +/* */ { +/* */ +/* 486 */ System.out.println(this + ": doing retry on " + +/* 487 */ lastError); +/* 488 */ this._retriesLeft -= lastError.getRetryCount(); +/* */ +/* 490 */ setChatname(this._username); +/* */ +/* 492 */ goOnline(); +/* */ } +/* */ else +/* */ { +/* 496 */ setChatname(""); +/* */ +/* */ +/* */ +/* 500 */ killZombies(); +/* */ +/* */ +/* */ +/* 504 */ if (this._wizard == null) { +/* 505 */ this._wizard = new LoginWizard(this, getIniSection(), +/* 506 */ lastError.getMsg()); +/* 507 */ System.out.println("LWDB: brought up " + this._wizard + +/* 508 */ " error " + lastError.getMsg()); +/* */ +/* */ } +/* */ else +/* */ { +/* 513 */ System.out.println("LWDB: reporting error " + +/* 514 */ lastError.getMsg() + " to " + this._wizard); +/* 515 */ this._wizard.loginError(lastError.getMsg()); +/* */ } +/* */ } +/* */ } +/* 519 */ this._relogin = false; +/* */ } +/* */ else +/* */ { +/* 523 */ setOnlineState(true, false); +/* */ } +/* */ } +/* */ } +/* */ +/* */ +/* */ public void waitForConnection(ConnectionWaiter cw) +/* */ { +/* 531 */ this._waiters.addWaiter(cw); +/* */ } +/* */ +/* */ +/* */ public void goOffline(boolean relogin) +/* */ { +/* 537 */ this._relogin = relogin; +/* */ +/* 539 */ if (!this._serverTracker.isActive()) { +/* 540 */ this._relogin = false; +/* */ } +/* */ +/* */ +/* 544 */ synchronized (this._serverTracker) { +/* 545 */ Enumeration<WorldServer> list = this._serverTracker.getAllServers(); +/* 546 */ while (list.hasMoreElements()) { +/* 547 */ WorldServer ws = (WorldServer)list.nextElement(); +/* 548 */ ws.forceOffline(); +/* */ } +/* */ } +/* */ } +/* */ +/* */ +/* */ private void killZombies() +/* */ { +/* 556 */ synchronized (this._serverTracker) { +/* 557 */ Enumeration<WorldServer> list = this._serverTracker.getAllServers(); +/* 558 */ while (list.hasMoreElements()) { +/* 559 */ ((WorldServer)list.nextElement()).killZombies(); +/* */ } +/* */ } +/* */ } +/* */ +/* */ void goOnline() +/* */ { +/* 566 */ synchronized (this._serverTracker) { +/* 567 */ Enumeration<WorldServer> list = this._serverTracker.getAllServers(); +/* 568 */ while (list.hasMoreElements()) { +/* 569 */ WorldServer ws = (WorldServer)list.nextElement(); +/* 570 */ ws.goOnline(); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* 576 */ reacquireServer(null); +/* */ } +/* */ +/* */ public static synchronized void forceOffline(boolean relogin) { +/* 580 */ if (!_globalUserAllowsOnline) +/* 581 */ return; +/* 582 */ _globalUserAllowsOnline = false; +/* 583 */ synchronized (_galaxyHash) { +/* 584 */ Enumeration<Galaxy> list = _galaxyHash.elements(); +/* 585 */ while (list.hasMoreElements()) { +/* 586 */ Galaxy g = (Galaxy)list.nextElement(); +/* 587 */ g.goOffline(relogin); +/* */ } +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void localForceOnline() +/* */ { +/* 611 */ _globalUserAllowsOnline = true; +/* 612 */ this._relogin = false; +/* 613 */ if (isActive()) +/* 614 */ return; +/* 615 */ setOnlineState(false, false); +/* 616 */ this._localUserAllowsOnline = true; +/* 617 */ if (getGalaxyType() != 0) +/* */ { +/* */ +/* 620 */ setChatname(""); +/* 621 */ this._wizard = new LoginWizard(this, getIniSection()); +/* 622 */ System.out.println("LWDB: brought up " + this._wizard + +/* 623 */ " in localForceOnline"); +/* */ +/* */ +/* */ } +/* */ else +/* */ { +/* */ +/* */ +/* 631 */ reacquireServer(null); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public static int getDebugLevel() +/* */ { +/* 640 */ return _debugLevel; +/* */ } +/* */ +/* */ +/* */ public static void printDebugging() +/* */ { +/* 646 */ System.out.println("----GALAXY DEBUGGING-------"); +/* 647 */ Enumeration<Galaxy> e = _galaxyHash.elements(); +/* 648 */ while (e.hasMoreElements()) { +/* 649 */ Galaxy g = (Galaxy)e.nextElement(); +/* 650 */ System.out.println(g + " : "); +/* 651 */ System.out.println(g._serverTracker); +/* */ } +/* 653 */ System.out.println("---------------------------"); +/* */ } +/* */ +/* */ public String getChannel() +/* */ { +/* 658 */ return this._channel; +/* */ } +/* */ +/* */ +/* */ +/* */ void setChannel(String channel) +/* */ { +/* 665 */ changeChannel(channel, false); +/* */ } +/* */ +/* */ +/* */ public void changeChannel(String channel) +/* */ { +/* 671 */ if (channel == null) +/* 672 */ channel = ""; +/* 673 */ channel = channel.replace(' ', '_'); +/* 674 */ channel = channel.replace('<', '{'); +/* 675 */ channel = channel.replace('>', '}'); +/* 676 */ changeChannel(channel, true); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ private void changeChannel(String channel, boolean sendMsg) +/* */ { +/* 684 */ if (!channel.equals(this._channel)) +/* */ { +/* */ +/* 687 */ String oldChannel = this._channel; +/* 688 */ this._channel = channel; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 695 */ Hashtable<String, NetworkObject> tmpIDtable = (Hashtable)this._nFlongID.clone(); +/* */ +/* */ +/* 698 */ Enumeration<NetworkObject> e = tmpIDtable.elements(); +/* 699 */ while (e.hasMoreElements()) { +/* 700 */ NetworkObject no = (NetworkObject)e.nextElement(); +/* 701 */ assert (no != null); +/* 702 */ no.changeChannel(this, oldChannel, this._channel); +/* */ } +/* 704 */ if (sendMsg) { +/* 705 */ WorldServer ws = this._serverTracker.getActive(this); +/* 706 */ if (ws != null) { +/* 707 */ ws.tmpRefCnt(this); +/* */ try { +/* 709 */ ws.sendNetworkMsg(new ChannelCmd(channel)); +/* */ } catch (PacketTooLargeException e1) { +/* 711 */ if (!$assertionsDisabled) throw new AssertionError(); +/* */ } +/* */ catch (InfiniteWaitException localInfiniteWaitException) {} +/* */ } +/* */ } +/* */ } +/* */ } +/* */ +/* */ public ServerURL getServerURL() +/* */ { +/* 721 */ return this._serverURL; +/* */ } +/* */ +/* */ public String toString() +/* */ { +/* 726 */ if (this._serverURL == null) { +/* 727 */ return "AnonGalaxy=" + super.toString(); +/* */ } +/* 729 */ return "Galaxy[" + this._serverURL + "]"; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ void swapServer(WorldServer oldServ, WorldServer newServ) +/* */ { +/* 740 */ if ((_debugLevel & 0x2000) > 0) { +/* 741 */ System.out.println(this + ".swapServer(" + oldServ + ", " + +/* 742 */ newServ + ")"); +/* */ } +/* 744 */ this._serverTracker.swapServer(oldServ, newServ); +/* 745 */ reacquireServer(oldServ); +/* */ } +/* */ +/* */ void reacquireServer(WorldServer oldServ) +/* */ { +/* 750 */ if ((_debugLevel & 0x2000) > 0) { +/* 751 */ System.out.println(this + ".reacquireServer(" + oldServ + ")"); +/* */ } +/* */ +/* */ +/* 755 */ Enumeration<NetworkObject> e = this._nFlongID.elements(); +/* 756 */ while (e.hasMoreElements()) { +/* 757 */ ((NetworkObject)e.nextElement()).reacquireServer(oldServ); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void regObject(String longID, NetworkObject obj) +/* */ { +/* 770 */ if ((_debugLevel & 0x2000) > 0) { +/* 771 */ System.out.println(this + ".regObject(" + longID + ", " + obj + +/* 772 */ ")"); +/* */ } +/* */ +/* */ +/* 776 */ this._nFlongID.put(longID, obj); +/* */ } +/* */ +/* */ +/* */ +/* */ public NetworkObject getObject(String longID) +/* */ { +/* 783 */ return (NetworkObject)this._nFlongID.get(longID); +/* */ } +/* */ +/* */ public void delObject(String longID) +/* */ { +/* 788 */ if ((_debugLevel & 0x2000) > 0) { +/* 789 */ System.out.println(this + ".delObject(" + longID + ")"); +/* */ } +/* */ +/* 792 */ this._nFlongID.remove(longID); +/* */ } +/* */ +/* */ public void forceObjectRereg() +/* */ { +/* 797 */ if ((_debugLevel & 0x2000) > 0) { +/* 798 */ System.out.println(this + ".forceObjectRereg()"); +/* */ } +/* */ +/* */ +/* 802 */ Hashtable<String, NetworkObject> oldTable = this._nFlongID; +/* 803 */ this._nFlongID = new Hashtable(); +/* 804 */ Enumeration<NetworkObject> e = oldTable.elements(); +/* */ +/* 806 */ while (e.hasMoreElements()) { +/* 807 */ ((NetworkObject)e.nextElement()).register(); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ private void forceDisconnect() +/* */ { +/* 816 */ if ((_debugLevel & 0x2000) > 0) { +/* 817 */ System.out.println(this + ".forceDisconnect()"); +/* */ } +/* 819 */ Enumeration<NetworkObject> e = this._nFlongID.elements(); +/* 820 */ while (e.hasMoreElements()) { +/* 821 */ NetworkObject no = (NetworkObject)e.nextElement(); +/* 822 */ assert (no != null); +/* 823 */ no.galaxyDisconnected(); +/* */ } +/* */ } +/* */ +/* */ void addRoomRequest(String roomName, NetworkRoom room) { +/* 828 */ assert (this._roomTable != null); +/* 829 */ this._roomTable.addRequest(roomName, room); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ void delRoomRequest(String roomName) +/* */ { +/* 838 */ if (this._roomTable == null) +/* 839 */ return; +/* 840 */ this._roomTable.delRequest(roomName); +/* */ } +/* */ +/* */ +/* */ NetworkRoom regRoomID(int roomID, String roomName) +/* */ { +/* 846 */ assert (this._roomTable != null); +/* 847 */ NetworkRoom room = this._roomTable.getRequest(roomName); +/* */ +/* */ +/* */ +/* 851 */ if ((roomID != 0) && (room != null)) { +/* 852 */ this._roomTable.regRoomID(roomID, room); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* 859 */ return room; +/* */ } +/* */ +/* */ +/* */ public void setRoomID(int roomID, NetworkRoom room) +/* */ { +/* 865 */ assert (this._roomTable != null); +/* 866 */ assert (roomID != 0); +/* 867 */ assert (room != null); +/* 868 */ this._roomTable.regRoomID(roomID, room); +/* */ } +/* */ +/* */ void delRoomID(int roomID, NetworkRoom room) +/* */ { +/* 873 */ if (this._roomTable == null) +/* 874 */ return; +/* 875 */ this._roomTable.delRoomID(roomID, room); +/* */ } +/* */ +/* */ NetworkRoom getRoom(int roomID) { +/* 879 */ if (this._roomTable == null) +/* 880 */ return null; +/* 881 */ return this._roomTable.getRoom(roomID); +/* */ } +/* */ +/* */ void setGalaxyType(int type) { +/* 885 */ this._serverType = type; +/* 886 */ if (_globalUserAllowsOnline) +/* */ { +/* */ +/* */ +/* 890 */ setOnlineState(false, this._online); +/* 891 */ setChatname(""); +/* 892 */ this._wizard = new LoginWizard(this, getIniSection()); +/* 893 */ System.out.println("LWDB: brought up " + this._wizard + +/* 894 */ " in setGalaxyType"); +/* */ } +/* */ } +/* */ +/* */ public int getGalaxyType() { +/* 899 */ return this._serverType; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public synchronized void setAuthInfo(String usernm, String newUsernm, String passwd, String newPasswd, String serial, int mode) +/* */ { +/* 907 */ _globalUserAllowsOnline = true; +/* 908 */ this._localUserAllowsOnline = true; +/* */ +/* */ +/* */ +/* 912 */ assert (this._serverType != 0); +/* 913 */ setUsernameU(usernm); +/* 914 */ setChatname(usernm); +/* 915 */ this._newUsername = newUsernm; +/* 916 */ this._password = passwd; +/* 917 */ this._newPassword = newPasswd; +/* 918 */ this._serial = serial; +/* 919 */ this._mode = mode; +/* 920 */ switch (this._serverType) +/* */ { +/* */ case 1: +/* 923 */ switch (this._mode) { +/* */ case 3: +/* 925 */ this._password = null; +/* 926 */ this._serial = null; +/* 927 */ break; +/* */ case 2: +/* 929 */ this._serial = null; +/* 930 */ break; +/* */ } +/* */ +/* 933 */ if ((!$assertionsDisabled) && +/* 934 */ (this._mode == 4)) { throw new AssertionError(); +/* */ } +/* */ break; +/* */ case 3: +/* 938 */ if (!$assertionsDisabled) throw new AssertionError(); +/* */ break; +/* */ case 4: +/* 941 */ assert (this._mode == 2); +/* */ +/* */ case 2: +/* 944 */ assert (this._mode != 1); +/* 945 */ assert (this._mode != 4); +/* 946 */ if ((this._password != null) && (this._password.length() != 0)) { +/* 947 */ System.out.println(this + ": Password shouldn't be specified."); +/* */ } +/* 949 */ this._password = null; +/* 950 */ if ((this._serial != null) && (this._serial.length() != 0)) { +/* 951 */ System.out.println(this + +/* 952 */ ": Serial number shouldn't be specified."); +/* */ } +/* 954 */ this._serial = null; +/* */ } +/* */ +/* 957 */ goOnline(); +/* */ } +/* */ +/* */ public String getSerialNum() { +/* 961 */ return this._serial; +/* */ } +/* */ +/* */ public String getPassword() { +/* 965 */ return this._password; +/* */ } +/* */ +/* */ String getNewPassword() { +/* 969 */ return this._newPassword; +/* */ } +/* */ +/* */ public String getChatname() { +/* 973 */ return this._username; +/* */ } +/* */ +/* */ String getNewChatname() { +/* 977 */ return this._newUsername; +/* */ } +/* */ +/* */ String getGuestExpiration() { +/* 981 */ if (!$assertionsDisabled) throw new AssertionError(); +/* 982 */ return null; +/* */ } +/* */ +/* */ public int getLoginMode() { +/* 986 */ return this._mode; +/* */ } +/* */ +/* */ +/* */ +/* */ void setOnlineState(boolean enabled, boolean online) +/* */ { +/* 993 */ synchronized (this) { +/* 994 */ this._onlineEnabled = enabled; +/* 995 */ this._online = online; +/* */ } +/* */ +/* 998 */ synchronized (this._consoleList) { +/* 999 */ Enumeration<NetworkObject> cList = getConsoles(); +/* 1000 */ while (cList.hasMoreElements()) { +/* 1001 */ Console c = (Console)cList.nextElement(); +/* 1002 */ c.setOnlineState(enabled, online); +/* */ } +/* */ } +/* */ } +/* */ +/* */ public boolean getOnlineEnabled() { +/* 1008 */ return this._onlineEnabled; +/* */ } +/* */ +/* */ public boolean getOnline() { +/* 1012 */ return this._online; +/* */ } +/* */ +/* */ void setPassword(String password) { +/* 1016 */ this._password = password; +/* */ } +/* */ +/* */ void setNewPassword(String password) { +/* 1020 */ this._newPassword = password; +/* */ } +/* */ +/* */ void setNewChatname(String chatname) { +/* 1024 */ this._newUsername = chatname; +/* */ } +/* */ +/* */ void setSerialNum(String sn) { +/* 1028 */ this._serial = sn; +/* */ } +/* */ +/* */ public void setUsernameU(String username) { +/* 1032 */ this._usernameU = username; +/* */ } +/* */ +/* */ public String getUsernameU() { +/* 1036 */ return this._usernameU; +/* */ } +/* */ +/* */ void setChatname(String newname) { +/* 1040 */ synchronized (this) +/* */ { +/* */ +/* 1043 */ this._consoleList = new NetworkMulti(newname, this._consoleList, this); +/* */ +/* */ +/* 1046 */ if (this._username != null) { +/* 1047 */ delObject(this._username); +/* */ } +/* 1049 */ regObject(newname, this._consoleList); +/* */ +/* */ +/* 1052 */ this._username = newname; +/* */ } +/* */ +/* */ +/* 1056 */ synchronized (this._consoleList) { +/* 1057 */ Enumeration<NetworkObject> cList = getConsoles(); +/* 1058 */ while (cList.hasMoreElements()) { +/* 1059 */ Console c = (Console)cList.nextElement(); +/* 1060 */ c.setChatname(this._username); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* 1066 */ synchronized (this._serverTracker) { +/* 1067 */ Enumeration<WorldServer> list = this._serverTracker.getAllServers(); +/* 1068 */ while (list.hasMoreElements()) { +/* 1069 */ WorldServer ws = (WorldServer)list.nextElement(); +/* 1070 */ ws.regShortID(1, this._username); +/* */ } +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public IniFile getIniSection() +/* */ { +/* 1085 */ if (this._serverURL == null) { +/* 1086 */ return new IniFile("UNSHARED"); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 1096 */ return new IniFile(this._serverURL.getHost()); +/* */ } +/* */ +/* */ +/* */ public void dialogDone(Object who, boolean confirmed) +/* */ { +/* 1102 */ if ((who instanceof LoginWizard)) +/* */ { +/* */ +/* 1105 */ synchronized (this._wizardMutex) { +/* 1106 */ System.out.println("LWDB: setting who " + who + " wiz " + +/* 1107 */ this._wizard + " to null"); +/* 1108 */ this._wizard = null; +/* */ } +/* 1110 */ if (!confirmed) +/* */ { +/* 1112 */ setOnlineState(true, false); +/* 1113 */ this._localUserAllowsOnline = false; +/* */ } else { +/* 1115 */ this._localUserAllowsOnline = true; +/* 1116 */ _globalUserAllowsOnline = true; +/* */ } +/* */ } +/* 1119 */ else if ((who instanceof InternetConnectionDialog)) { +/* 1120 */ this._icd = null; +/* 1121 */ if (!confirmed) +/* */ { +/* 1123 */ setOnlineState(true, false); +/* 1124 */ this._localUserAllowsOnline = false; +/* */ } else { +/* 1126 */ this._localUserAllowsOnline = true; +/* 1127 */ _globalUserAllowsOnline = true; +/* */ +/* */ +/* */ +/* */ +/* 1132 */ reacquireServer(null); +/* */ } +/* */ } +/* 1135 */ else if (!$assertionsDisabled) { throw new AssertionError(); +/* */ } +/* */ } +/* */ +/* */ public void addConsole(Console c) { +/* 1140 */ assert (this._consoleList != null); +/* 1141 */ this._consoleList.addObject(c); +/* 1142 */ setOnlineState(this._onlineEnabled, this._online); +/* */ } +/* */ +/* */ public void delConsole(Console c) { +/* 1146 */ assert (this._consoleList != null); +/* 1147 */ this._consoleList.delObject(c); +/* */ } +/* */ +/* */ public Enumeration<NetworkObject> getConsoles() { +/* 1151 */ return this._consoleList.elements(); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void sentFriendsList(boolean state) +/* */ { +/* 1162 */ this.sentFriendsList = state; +/* */ } +/* */ +/* */ public boolean sentFriendsList() +/* */ { +/* 1167 */ return this.sentFriendsList; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public int getProtocol() +/* */ { +/* 1178 */ return this.protocolLevel; +/* */ } +/* */ +/* */ void setProtocol(int level) +/* */ { +/* 1183 */ this.protocolLevel = level; +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\network\Galaxy.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |