 import com.threerings.presents.dobj.DObject;
 import com.threerings.presents.dobj.Subscriber;
 
-/**
- * The object action is used to queue up a subscribe or unsubscribe
- * request.
- */
-class ObjectAction
-{
-    public var oid :int;
-    public var target :Subscriber;
-    public var subscribe :Boolean;
-
-    public function ObjectAction (
-            oid :int, target :Subscriber, subscribe :Boolean)
-    {
-        this.oid = oid;
-        this.target = target;
-        this.subscribe = subscribe;
-    }
-
-    public function toString () :String
-    {
-        return "oid=" + oid + ", target=" + target + ", subscribe=" + subscribe;
-    }
-}
-
 class PendingRequest
 {
     public var oid :int;

        _flushInterval = new Timer(FLUSH_INTERVAL);
        _flushInterval.addEventListener(TimerEvent.TIMER, flushObjects);
        _flushInterval.start();

        client.getStage().addEventListener(
            Event.ENTER_FRAME, processNextAction);
    }

    // documentation inherited from interface DObjectManager

     */
    public function processMessage (msg :DownstreamMessage) :void
    {
        // do the proper thing depending on the object
        if (msg is EventNotification) {
            var evt :DEvent = (msg as EventNotification).getEvent();
//             log.info("Dispatch event: " + evt);
            dispatchEvent(evt);

        } else if (msg is BootstrapNotification) {
            _client.gotBootstrap((msg as BootstrapNotification).getData(), this);

        } else if (msg is ObjectResponse) {
            registerObjectAndNotify((msg as ObjectResponse).getObject());

        } else if (msg is UnsubscribeResponse) {
            var oid :int = (msg as UnsubscribeResponse).getOid();
            if (_dead.remove(oid) == null) {
                log.warning("Received unsub ACK from unknown object [oid=" + oid + "].");
            }

        } else if (msg is FailureResponse) {
            notifyFailure((msg as FailureResponse).getOid(), (msg as FailureResponse).getMessage());

        } else if (msg is PongResponse) {
            _client.gotPong(msg as PongResponse);
        }
    }

