From fadd51fbed5111aba266a3b8b22be2c57ea11262 Mon Sep 17 00:00:00 2001 From: Mateusz Piekos Date: Tue, 3 Jul 2012 16:42:31 +0200 Subject: Modified statement about session request reject diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index 616c0c6..4705246 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -113,6 +113,7 @@ ChatsManager::ChatsManager( whiteboardSessionManager_->onSessionRequest.connect(boost::bind(&ChatsManager::handleWhiteboardSessionRequest, this, _1, _2)); whiteboardSessionManager_->onRequestAccepted.connect(boost::bind(&ChatsManager::handleWhiteboardStateChange, this, _1, ChatWindow::WhiteboardAccepted)); whiteboardSessionManager_->onSessionTerminate.connect(boost::bind(&ChatsManager::handleWhiteboardStateChange, this, _1, ChatWindow::WhiteboardCanceled)); + whiteboardSessionManager_->onRequestRejected.connect(boost::bind(&ChatsManager::handleWhiteboardStateChange, this, _1, ChatWindow::WhiteboardRejected)); roster_->onJIDAdded.connect(boost::bind(&ChatsManager::handleJIDAddedToRoster, this, _1)); roster_->onJIDRemoved.connect(boost::bind(&ChatsManager::handleJIDRemovedFromRoster, this, _1)); roster_->onJIDUpdated.connect(boost::bind(&ChatsManager::handleJIDUpdatedInRoster, this, _1)); diff --git a/Swift/Controllers/UIInterfaces/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h index db9e322..86fb439 100644 --- a/Swift/Controllers/UIInterfaces/ChatWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatWindow.h @@ -36,7 +36,7 @@ namespace Swift { enum OccupantAction {Kick, Ban, MakeModerator, MakeParticipant, MakeVisitor, AddContact}; enum RoomAction {ChangeSubject, Configure, Affiliations, Destroy, Invite}; enum FileTransferState {WaitingForAccept, Negotiating, Transferring, Canceled, Finished, FTFailed}; - enum WhiteboardSessionState {WhiteboardAccepted, WhiteboardCanceled, WhiteboardTerminated}; + enum WhiteboardSessionState {WhiteboardAccepted, WhiteboardCanceled, WhiteboardTerminated, WhiteboardRejected}; ChatWindow() {} virtual ~ChatWindow() {}; diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp index d8c0df1..ef55dff 100644 --- a/Swift/QtUI/QtChatView.cpp +++ b/Swift/QtUI/QtChatView.cpp @@ -369,6 +369,8 @@ void QtChatView::setWhiteboardSessionStatus(QString id, const ChatWindow::Whiteb QtChatWindow::buildChatWindowButton(tr("Show whitebaord"), QtChatWindow::ButtonWhiteboardShowWindow, id); } else if (state == ChatWindow::WhiteboardCanceled) { newInnerHTML = tr("Whiteboard session has been canceled"); + } else if (state == ChatWindow::WhiteboardRejected) { + newInnerHTML = tr("Whiteboard session request has been rejected"); } divElement.setInnerXml(newInnerHTML); } diff --git a/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp b/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp index 2de4ec4..f0b6d22 100644 --- a/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp +++ b/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp @@ -30,7 +30,7 @@ namespace Swift { void OutgoingWhiteboardSession::handleRequestResponse(boost::shared_ptr payload, ErrorPayload::ref error) { if (error) { - onSessionCancelled(toJID_); + onRequestRejected(toJID_); } } } diff --git a/Swiften/Whiteboard/WhiteboardSession.h b/Swiften/Whiteboard/WhiteboardSession.h index d3e435a..0d10af3 100644 --- a/Swiften/Whiteboard/WhiteboardSession.h +++ b/Swiften/Whiteboard/WhiteboardSession.h @@ -36,6 +36,7 @@ namespace Swift { boost::signal< void(const JID& contact)> onSessionTerminateReceived; boost::signal< void(const JID& contact)> onRequestAccepted; boost::signal< void(const JID& contact)> onSessionCancelled; + boost::signal< void(const JID& contact)> onRequestRejected; protected: JID toJID_; diff --git a/Swiften/Whiteboard/WhiteboardSessionManager.cpp b/Swiften/Whiteboard/WhiteboardSessionManager.cpp index 2e519e0..253febe 100644 --- a/Swiften/Whiteboard/WhiteboardSessionManager.cpp +++ b/Swiften/Whiteboard/WhiteboardSessionManager.cpp @@ -40,6 +40,7 @@ namespace Swift { 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)); return session; } @@ -80,4 +81,9 @@ namespace Swift { void WhiteboardSessionManager::handleSessionAccept(const JID& contact) { onRequestAccepted(contact); } + + void WhiteboardSessionManager::handleRequestReject(const JID& contact) { + sessions_.erase(contact.toBare()); + onRequestRejected(contact); + } } diff --git a/Swiften/Whiteboard/WhiteboardSessionManager.h b/Swiften/Whiteboard/WhiteboardSessionManager.h index 10f27d5..9711e5b 100644 --- a/Swiften/Whiteboard/WhiteboardSessionManager.h +++ b/Swiften/Whiteboard/WhiteboardSessionManager.h @@ -32,6 +32,7 @@ namespace Swift { boost::signal< void (const JID&, bool senderIsSelf)> onSessionRequest; boost::signal< void (const JID&)> onSessionTerminate; boost::signal< void (const JID&)> onRequestAccepted; + boost::signal< void (const JID&)> onRequestRejected; private: JID getFullJID(const JID& bareJID); @@ -40,6 +41,7 @@ namespace Swift { void handleSessionTerminate(const JID& contact); void handleSessionCancel(const JID& contact); void handleSessionAccept(const JID& contact); + void handleRequestReject(const JID& contact); private: std::map > sessions_; -- cgit v0.10.2-6-g49f6