From 13e5d3093d4e4c7caaf3ffd325279382fe347da2 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Sat, 9 Dec 2006 00:41:00 +0000 Subject: [PATCH] Publicize addChatter(). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4478 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../crowd/chat/client/ChatDirector.as | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/src/as/com/threerings/crowd/chat/client/ChatDirector.as b/src/as/com/threerings/crowd/chat/client/ChatDirector.as index 14590ca9e..65f1becd9 100644 --- a/src/as/com/threerings/crowd/chat/client/ChatDirector.as +++ b/src/as/com/threerings/crowd/chat/client/ChatDirector.as @@ -186,6 +186,33 @@ public class ChatDirector extends BasicDirector return _chatters; } + /** + * Adds a chatter to our list of recent chatters. This is normally done + * automatically by the ChatDirector, but may be called to also to + * forcibly add a chatter. The ChatterValidator will have to approve + * of the chatter. + */ + public function addChatter (name :Name) :void + { + // check to see if the chatter validator approves.. + if ((_chatterValidator != null) && + (!_chatterValidator.isChatterValid(name))) { + return; + } + + var wasThere :Boolean = ArrayUtil.removeAll(_chatters, name); + _chatters.unshift(name); + + if (!wasThere) { + if (_chatters.length > MAX_CHATTERS) { + _chatters.length = MAX_CHATTERS; // truncate array + } + + // we only notify on a change to the contents, not just reordering + notifyChatterObservers(); + } + } + /** * Registers a chat command handler. * @@ -896,30 +923,6 @@ public class ChatDirector extends BasicDirector return _history; } - /** - * Adds a chatter to our list of recent chatters. - */ - protected function addChatter (name :Name) :void - { - // check to see if the chatter validator approves.. - if ((_chatterValidator != null) && - (!_chatterValidator.isChatterValid(name))) { - return; - } - - var wasThere :Boolean = ArrayUtil.removeAll(_chatters, name); - _chatters.unshift(name); - - if (!wasThere) { - if (_chatters.length > MAX_CHATTERS) { - _chatters.length = MAX_CHATTERS; // truncate array - } - - // we only notify on a change to the contents, not just reordering - notifyChatterObservers(); - } - } - /** * Notifies all registered {@link ChatterObserver}s that the list of * chatters has changed.