Rethink! Instead of hacking up the peer ClientInfo system for the one thing

that actually needs to look clients up by visible name (chat forwarding), we'll
just leave things as is (as in mapped by auth username) and take care of our
own shit in ClientPeerManager.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5683 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2009-03-11 17:47:35 +00:00
parent 8f05b41c6a
commit 4a7cb2c82f
4 changed files with 61 additions and 27 deletions
@@ -986,7 +986,7 @@ public abstract class PeerManager
/**
* Called when we hear about a client logging on to another node.
*/
protected void clientLoggedOnOtherNode (String nodeName, ClientInfo clinfo)
protected void clientLoggedOn (String nodeName, ClientInfo clinfo)
{
PresentsSession session = _clmgr.getClient(clinfo.username);
if (session != null) {
@@ -996,6 +996,14 @@ public abstract class PeerManager
}
}
/**
* Called when we hear about a client logging off of another node.
*/
protected void clientLoggedOff (String nodeName, ClientInfo clinfo)
{
// nothing to do by default
}
/**
* Called when a peer connects to this server.
*/
@@ -255,8 +255,7 @@ public class PeerNode
implements AttributeChangeListener, SetListener<DSet.Entry>
{
// documentation inherited from interface AttributeChangeListener
public void attributeChanged (AttributeChangedEvent event)
{
public void attributeChanged (AttributeChangedEvent event) {
String name = event.getName();
if (name.equals(NodeObject.ACQUIRING_LOCK)) {
NodeObject.Lock lock = nodeobj.acquiringLock;
@@ -299,24 +298,24 @@ public class PeerNode
}
// documentation inherited from interface SetListener
public void entryAdded (EntryAddedEvent<DSet.Entry> event)
{
public void entryAdded (EntryAddedEvent<DSet.Entry> event) {
String name = event.getName();
if (NodeObject.CLIENTS.equals(name)) {
_peermgr.clientLoggedOnOtherNode(getNodeName(), (ClientInfo)event.getEntry());
_peermgr.clientLoggedOn(getNodeName(), (ClientInfo)event.getEntry());
}
}
// documentation inherited from interface SetListener
public void entryUpdated (EntryUpdatedEvent<DSet.Entry> event)
{
public void entryUpdated (EntryUpdatedEvent<DSet.Entry> event) {
// nada
}
// documentation inherited from interface SetListener
public void entryRemoved (EntryRemovedEvent<DSet.Entry> event)
{
// nada
public void entryRemoved (EntryRemovedEvent<DSet.Entry> event) {
String name = event.getName();
if (NodeObject.CLIENTS.equals(name)) {
_peermgr.clientLoggedOff(getNodeName(), (ClientInfo)event.getOldEntry());
}
}
} // END: class NodeObjectListener