From 8dcdfb7e8a5d3cadf91dbe041c2e43c97ff30f74 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 18 Oct 2001 18:40:18 +0000 Subject: [PATCH] Added loggedOn() which indicates whether or not we're logged on and modified code not to try to logoff in logoff() unless we're actually logged on. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@491 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/presents/client/Client.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/presents/client/Client.java b/src/java/com/threerings/presents/client/Client.java index 0cc827bbf..ed813f853 100644 --- a/src/java/com/threerings/presents/client/Client.java +++ b/src/java/com/threerings/presents/client/Client.java @@ -1,5 +1,5 @@ // -// $Id: Client.java,v 1.17 2001/10/11 04:07:52 mdb Exp $ +// $Id: Client.java,v 1.18 2001/10/18 18:40:18 mdb Exp $ package com.threerings.presents.client; @@ -195,6 +195,15 @@ public class Client return _bstrap; } + /** + * Returns true if we are logged on, false if we're not. + */ + public synchronized boolean loggedOn () + { + // if we have a communicator, we're logged on + return (_comm != null); + } + /** * Requests that this client connect and logon to the server with * which it was previously configured. @@ -226,6 +235,14 @@ public class Client */ public boolean logoff (boolean abortable) { + // if we have no communicator, we're not logged on anyway, so fake + // it + if (_comm == null) { + Log.warning("Ignoring request to logoff because we're not " + + "logged on."); + return true; + } + // if the request is abortable, let's run it past the observers // before we act upon it if (abortable && notifyObservers(CLIENT_WILL_LOGOFF, null)) {