From b5e5f5f4e1b9fee709c57fec092ae52f69374366 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Mon, 28 Oct 2002 00:22:38 +0000 Subject: [PATCH] director audit: make sure things shut down well. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1854 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../crowd/chat/client/ChatDirector.java | 29 +++++++++++++++---- .../crowd/chat/client/MuteDirector.java | 18 ++++++++++-- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/java/com/threerings/crowd/chat/client/ChatDirector.java b/src/java/com/threerings/crowd/chat/client/ChatDirector.java index e09aa0714..54dd3fe3a 100644 --- a/src/java/com/threerings/crowd/chat/client/ChatDirector.java +++ b/src/java/com/threerings/crowd/chat/client/ChatDirector.java @@ -1,5 +1,5 @@ // -// $Id: ChatDirector.java,v 1.34 2002/10/27 22:34:11 ray Exp $ +// $Id: ChatDirector.java,v 1.35 2002/10/28 00:22:38 ray Exp $ package com.threerings.crowd.chat; @@ -145,11 +145,18 @@ public class ChatDirector extends BasicDirector _chatters.removeLast(); } - for (Iterator iter = _chatterObservers.iterator(); - iter.hasNext(); ) { - ChatterObserver co = (ChatterObserver) iter.next(); - co.chattersUpdated(_chatters.listIterator()); - } + notifyChatterObservers(); + } + } + + /** + * Notify ChatterObservers that the list of chatters has changed. + */ + protected void notifyChatterObservers () + { + for (int ii=0, nn=_chatterObservers.size(); ii < nn; ii++) { + ChatterObserver co = (ChatterObserver) _chatterObservers.get(ii); + co.chattersUpdated(_chatters.listIterator()); } } @@ -528,6 +535,16 @@ public class ChatDirector extends BasicDirector super.clientDidLogoff(client); clearDisplays(true); + + // clear out the list of people we've chatted with + _chatters.clear(); + notifyChatterObservers(); + + // clear the _place + locationDidChange(null); + + // clear our service + _cservice = null; } /** Our active chat context. */ diff --git a/src/java/com/threerings/crowd/chat/client/MuteDirector.java b/src/java/com/threerings/crowd/chat/client/MuteDirector.java index ac8ff669f..20c64f750 100644 --- a/src/java/com/threerings/crowd/chat/client/MuteDirector.java +++ b/src/java/com/threerings/crowd/chat/client/MuteDirector.java @@ -1,5 +1,5 @@ // -// $Id: MuteDirector.java,v 1.3 2002/10/25 20:32:41 ray Exp $ +// $Id: MuteDirector.java,v 1.4 2002/10/28 00:22:38 ray Exp $ package com.threerings.crowd.chat; @@ -8,12 +8,15 @@ import java.util.HashSet; import com.threerings.crowd.util.CrowdContext; +import com.threerings.presents.client.BasicDirector; +import com.threerings.presents.client.Client; + /** * Manages the mutelist. * * TODO: This class right now is pretty much just a placeholder. */ -public class MuteDirector +public class MuteDirector extends BasicDirector implements ChatValidator { /** @@ -33,7 +36,7 @@ public class MuteDirector */ public MuteDirector (CrowdContext ctx) { - // nothing to initialize right now + super(ctx); } /** @@ -111,6 +114,15 @@ public class MuteDirector } } + // documentation inherited + public void clientDidLogoff (Client client) + { + super.clientDidLogoff(client); + + // clear the mutelist, don't notify.. + _mutelist.clear(); + } + /** The chat director that we're working hard for. */ protected ChatDirector _chatdir;