diff options
author | Matthew Newhook <matthew@zeroc.com> | 2005-03-11 06:22:50 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2005-03-11 06:22:50 +0000 |
commit | 7edfa34ba49643702fc8861b28026bb695c2ecdf (patch) | |
tree | 6a0e3da94de890d314dcb02e974d4a957d04cd7e /cpp | |
parent | fix for bug 170 (diff) | |
download | ice-7edfa34ba49643702fc8861b28026bb695c2ecdf.tar.bz2 ice-7edfa34ba49643702fc8861b28026bb695c2ecdf.tar.xz ice-7edfa34ba49643702fc8861b28026bb695c2ecdf.zip |
Couple of minor cleanups to the demo.
Diffstat (limited to 'cpp')
-rwxr-xr-x | cpp/demo/Glacier2/chat/ChatSessionI.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/cpp/demo/Glacier2/chat/ChatSessionI.cpp b/cpp/demo/Glacier2/chat/ChatSessionI.cpp index 3e5b0e3d918..0bf9d133a94 100755 --- a/cpp/demo/Glacier2/chat/ChatSessionI.cpp +++ b/cpp/demo/Glacier2/chat/ChatSessionI.cpp @@ -28,7 +28,13 @@ void ChatRoomMembers::remove(const ChatCallbackPrx& callback) { IceUtil::Mutex::Lock sync(*this); - list<ChatCallbackPrx>::iterator p = find(_members.begin(), _members.end(), callback); + for(list<ChatCallbackPrx>::iterator p = _members.begin(); p != _members.end(); ++p) + { + if(Ice::proxyIdentityEqual(callback, *p)) + { + break; + } + } if(p != _members.end()) { _members.erase(p); @@ -60,7 +66,6 @@ ChatSessionI::ChatSessionI(const ChatRoomMembersPtr& members, const string& user _userId(userId), _destroy(false) { - _members->message(_userId + " has entered the chat room."); } void @@ -70,6 +75,7 @@ ChatSessionI::setCallback(const ChatCallbackPrx& callback, const Ice::Current& c if(!_callback) { _callback = callback; + _members->message(_userId + " has entered the chat room."); _members->add(callback); } } @@ -91,9 +97,8 @@ ChatSessionI::destroy(const Ice::Current& current) { _members->remove(_callback); _callback = 0; + _members->message(_userId + " has left the chat room."); } current.adapter->remove(current.id); - _members->message(_userId + " has left the chat room."); } } - |