diff options
author | Kevin Smith <git@kismith.co.uk> | 2011-09-26 14:27:49 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-09-26 14:27:49 (GMT) |
commit | 2680416456d722a4779322949f6ed230de3d422b (patch) | |
tree | 7ed7f79ead222adbe0d978376967d9b508d5068f /Swift/Controllers | |
parent | 101053d01cf2274e8eb75c520cce0bfee4d15618 (diff) | |
download | swift-2680416456d722a4779322949f6ed230de3d422b.zip swift-2680416456d722a4779322949f6ed230de3d422b.tar.bz2 |
Allow setting of room topics
Diffstat (limited to 'Swift/Controllers')
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 6 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.h | 1 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/ChatWindow.h | 2 | ||||
-rw-r--r-- | Swift/Controllers/UnitTest/MockChatWindow.h | 1 |
4 files changed, 10 insertions, 0 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index 19d7b4d..ca1509e 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -71,6 +71,7 @@ MUCController::MUCController ( chatWindow_->onClosed.connect(boost::bind(&MUCController::handleWindowClosed, this)); chatWindow_->onOccupantSelectionChanged.connect(boost::bind(&MUCController::handleWindowOccupantSelectionChanged, this, _1)); chatWindow_->onOccupantActionSelected.connect(boost::bind(&MUCController::handleActionRequestedOnOccupant, this, _1, _2)); + chatWindow_->onChangeSubjectRequest.connect(boost::bind(&MUCController::handleChangeSubjectRequest, this, _1)); muc_->onJoinComplete.connect(boost::bind(&MUCController::handleJoinComplete, this, _1)); muc_->onJoinFailed.connect(boost::bind(&MUCController::handleJoinFailed, this, _1)); muc_->onOccupantJoined.connect(boost::bind(&MUCController::handleOccupantJoined, this, _1)); @@ -341,6 +342,7 @@ void MUCController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> mes if (!message->getSubject().empty() && message->getBody().empty()) { chatWindow_->addSystemMessage(str(format(QT_TRANSLATE_NOOP("", "The room subject is now: %1%")) % message->getSubject()));; + chatWindow_->setSubject(message->getSubject()); doneGettingHistory_ = true; } @@ -570,4 +572,8 @@ std::string MUCController::generateJoinPartString(const std::vector<NickJoinPart return result; } +void MUCController::handleChangeSubjectRequest(const std::string& subject) { + muc_->changeSubject(subject); +} + } diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h index 39e5fa4..fc87738 100644 --- a/Swift/Controllers/Chat/MUCController.h +++ b/Swift/Controllers/Chat/MUCController.h @@ -76,6 +76,7 @@ namespace Swift { void handleJoinComplete(const std::string& nick); void handleJoinFailed(boost::shared_ptr<ErrorPayload> error); void handleJoinTimeoutTick(); + void handleChangeSubjectRequest(const std::string&); std::string roleToGroupName(MUCOccupant::Role role); std::string roleToSortName(MUCOccupant::Role role); JID nickToJID(const std::string& nick); diff --git a/Swift/Controllers/UIInterfaces/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h index b90efd9..39fb7f8 100644 --- a/Swift/Controllers/UIInterfaces/ChatWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatWindow.h @@ -71,6 +71,7 @@ namespace Swift { virtual void replaceLastMessage(const std::string& message) = 0; virtual void setAckState(const std::string& id, AckState state) = 0; virtual void flash() = 0; + virtual void setSubject(const std::string& subject) = 0; /** * Set an alert on the window. * @param alertText Description of alert (required). @@ -95,6 +96,7 @@ namespace Swift { boost::signal<void ()> onAlertButtonClicked; boost::signal<void (ContactRosterItem*)> onOccupantSelectionChanged; boost::signal<void (ChatWindow::OccupantAction, ContactRosterItem*)> onOccupantActionSelected; + boost::signal<void (const std::string&)> onChangeSubjectRequest; // File transfer related boost::signal<void (std::string /* id */)> onFileTransferCancel; diff --git a/Swift/Controllers/UnitTest/MockChatWindow.h b/Swift/Controllers/UnitTest/MockChatWindow.h index b410c69..143e281 100644 --- a/Swift/Controllers/UnitTest/MockChatWindow.h +++ b/Swift/Controllers/UnitTest/MockChatWindow.h @@ -46,6 +46,7 @@ namespace Swift { virtual void cancelAlert() {}; virtual void setCorrectionEnabled(Tristate /*enabled*/) {} void setAvailableOccupantActions(const std::vector<OccupantAction>&/* actions*/) {} + void setSubject(const std::string& /*subject*/) {} boost::signal<void ()> onClosed; boost::signal<void ()> onAllMessagesRead; |