diff options
author | Tobias Markmann <tm@ayena.de> | 2015-09-10 22:39:47 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2015-09-18 09:32:24 (GMT) |
commit | 909ecaea63618e9b94c9063c94cd51aa69654b00 (patch) | |
tree | 6c90c1b96709fcb1a6a39b2aca17789e9b04d79a /Swift | |
parent | 64aa58d97676be61a5bb23b1b3d351b032b9b5a0 (diff) | |
download | swift-909ecaea63618e9b94c9063c94cd51aa69654b00.zip swift-909ecaea63618e9b94c9063c94cd51aa69654b00.tar.bz2 |
Show potentially existing MUC bookmark in chat window bookmark dialog
The MUC bookmark editor window opened from the chat window would
always show a new bookmark. With this commit it will show the
existing bookmark if it exists. Otherwise it will show a new
bookmark.
Test-Information:
Tested this behavior by creating a bookmark, changing name and
nickname to different values and verified that the bookmark dialog
for this room, opened from its chat view, would show the existing
bookmark.
Change-Id: I6766253ce11be271016473dff1105369482e73df
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index c9936c0..35e79cc 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -928,10 +928,22 @@ void MUCController::handleChangeSubjectRequest(const std::string& subject) { void MUCController::handleBookmarkRequest() { const JID jid = muc_->getJID(); - MUCBookmark bookmark(jid, jid.toBare().toString()); - bookmark.setPassword(password_); - bookmark.setNick(nick_); - chatWindow_->showBookmarkWindow(bookmark); + + // Prepare new bookmark for this room. + MUCBookmark roomBookmark(jid, jid.toBare().toString()); + roomBookmark.setPassword(password_); + roomBookmark.setNick(nick_); + + // Check for existing bookmark for this room and, if it exists, use it instead. + std::vector<MUCBookmark> bookmarks = mucBookmarkManager_->getBookmarks(); + foreach (const MUCBookmark& bookmark, bookmarks) { + if (bookmark.getRoom() == jid.toBare()) { + roomBookmark = bookmark; + break; + } + } + + chatWindow_->showBookmarkWindow(roomBookmark); } void MUCController::handleConfigureRequest(Form::ref form) { |