From 7edfa34ba49643702fc8861b28026bb695c2ecdf Mon Sep 17 00:00:00 2001 From: Matthew Newhook Date: Fri, 11 Mar 2005 06:22:50 +0000 Subject: Couple of minor cleanups to the demo. --- cpp/demo/Glacier2/chat/ChatSessionI.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'cpp') 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::iterator p = find(_members.begin(), _members.end(), callback); + for(list::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."); } } - -- cgit v1.2.3