diff options
Diffstat (limited to 'Swiften/Whiteboard/WhiteboardSessionManager.cpp')
-rw-r--r-- | Swiften/Whiteboard/WhiteboardSessionManager.cpp | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/Swiften/Whiteboard/WhiteboardSessionManager.cpp b/Swiften/Whiteboard/WhiteboardSessionManager.cpp index effdc4b..88771e7 100644 --- a/Swiften/Whiteboard/WhiteboardSessionManager.cpp +++ b/Swiften/Whiteboard/WhiteboardSessionManager.cpp @@ -27,10 +27,10 @@ namespace Swift { } WhiteboardSession::ref WhiteboardSessionManager::getSession(const JID& to) { - if (sessions_.find(to.toBare()) == sessions_.end()) { + if (sessions_.find(to) == sessions_.end()) { return boost::shared_ptr<WhiteboardSession>(); } - return sessions_[to.toBare()]; + return sessions_[to]; } OutgoingWhiteboardSession::ref WhiteboardSessionManager::createOutgoingSession(const JID& to) { @@ -39,11 +39,10 @@ namespace Swift { fullJID = getFullJID(fullJID); } OutgoingWhiteboardSession::ref session = boost::make_shared<OutgoingWhiteboardSession>(fullJID, router_); - sessions_[to.toBare()] = session; - session->onSessionTerminateReceived.connect(boost::bind(&WhiteboardSessionManager::handleSessionTerminate, this, _1)); - session->onSessionCancelled.connect(boost::bind(&WhiteboardSessionManager::handleSessionCancel, this, _1)); - session->onRequestAccepted.connect(boost::bind(&WhiteboardSessionManager::handleSessionAccept, this, _1)); - session->onRequestRejected.connect(boost::bind(&WhiteboardSessionManager::handleRequestReject, this, _1)); + sessions_[fullJID] = session; + session->onSessionTerminateReceived.connect(boost::bind(&WhiteboardSessionManager::deleteSessionEntry, this, _1)); + session->onSessionCancelled.connect(boost::bind(&WhiteboardSessionManager::deleteSessionEntry, this, _1)); + session->onRequestRejected.connect(boost::bind(&WhiteboardSessionManager::deleteSessionEntry, this, _1)); return session; } @@ -51,7 +50,6 @@ namespace Swift { WhiteboardSession::ref session = getSession(to); if (!session) { OutgoingWhiteboardSession::ref outgoingSession = createOutgoingSession(to); - onSessionRequest(to, true); outgoingSession->startSession(); return outgoingSession; } else { @@ -60,11 +58,10 @@ namespace Swift { } void WhiteboardSessionManager::handleIncomingSession(IncomingWhiteboardSession::ref session) { - sessions_[session->getTo().toBare()] = session; - session->onSessionTerminateReceived.connect(boost::bind(&WhiteboardSessionManager::handleSessionTerminate, this, _1)); - session->onSessionCancelled.connect(boost::bind(&WhiteboardSessionManager::handleSessionCancel, this, _1)); - session->onRequestAccepted.connect(boost::bind(&WhiteboardSessionManager::handleSessionAccept, this, _1)); - onSessionRequest(session->getTo(), false); + sessions_[session->getTo()] = session; + session->onSessionTerminateReceived.connect(boost::bind(&WhiteboardSessionManager::deleteSessionEntry, this, _1)); + session->onSessionCancelled.connect(boost::bind(&WhiteboardSessionManager::deleteSessionEntry, this, _1)); + onSessionRequest(session); } JID WhiteboardSessionManager::getFullJID(const JID& bareJID) { @@ -89,22 +86,7 @@ namespace Swift { return fullReceipientJID; } - void WhiteboardSessionManager::handleSessionTerminate(const JID& contact) { - sessions_.erase(contact.toBare()); - onSessionTerminate(contact); - } - - void WhiteboardSessionManager::handleSessionCancel(const JID& contact) { - sessions_.erase(contact.toBare()); - onSessionTerminate(contact); - } - - void WhiteboardSessionManager::handleSessionAccept(const JID& contact) { - onRequestAccepted(contact); - } - - void WhiteboardSessionManager::handleRequestReject(const JID& contact) { - sessions_.erase(contact.toBare()); - onRequestRejected(contact); + void WhiteboardSessionManager::deleteSessionEntry(const JID& contact) { + sessions_.erase(contact); } } |