Publicize addChatter().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4478 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -186,6 +186,33 @@ public class ChatDirector extends BasicDirector
|
|||||||
return _chatters;
|
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.
|
* Registers a chat command handler.
|
||||||
*
|
*
|
||||||
@@ -896,30 +923,6 @@ public class ChatDirector extends BasicDirector
|
|||||||
return _history;
|
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
|
* Notifies all registered {@link ChatterObserver}s that the list of
|
||||||
* chatters has changed.
|
* chatters has changed.
|
||||||
|
|||||||
Reference in New Issue
Block a user