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/Controllers/Chat/MUCController.cpp | |
| 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/Controllers/Chat/MUCController.cpp')
| -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 | |||
| @@ -926,14 +926,26 @@ void MUCController::handleChangeSubjectRequest(const std::string& subject) { | |||
| 926 | muc_->changeSubject(subject); | 926 | muc_->changeSubject(subject); |
| 927 | } | 927 | } |
| 928 | 928 | ||
| 929 | void MUCController::handleBookmarkRequest() { | 929 | void MUCController::handleBookmarkRequest() { |
| 930 | const JID jid = muc_->getJID(); | 930 | const JID jid = muc_->getJID(); |
| 931 | MUCBookmark bookmark(jid, jid.toBare().toString()); | 931 | |
| 932 | bookmark.setPassword(password_); | 932 | // Prepare new bookmark for this room. |
| 933 | bookmark.setNick(nick_); | 933 | MUCBookmark roomBookmark(jid, jid.toBare().toString()); |
| 934 | chatWindow_->showBookmarkWindow(bookmark); | 934 | roomBookmark.setPassword(password_); |
| 935 | roomBookmark.setNick(nick_); | ||
| 936 | |||
| 937 | // Check for existing bookmark for this room and, if it exists, use it instead. | ||
| 938 | std::vector<MUCBookmark> bookmarks = mucBookmarkManager_->getBookmarks(); | ||
| 939 | foreach (const MUCBookmark& bookmark, bookmarks) { | ||
| 940 | if (bookmark.getRoom() == jid.toBare()) { | ||
| 941 | roomBookmark = bookmark; | ||
| 942 | break; | ||
| 943 | } | ||
| 944 | } | ||
| 945 | |||
| 946 | chatWindow_->showBookmarkWindow(roomBookmark); | ||
| 935 | } | 947 | } |
| 936 | 948 | ||
| 937 | void MUCController::handleConfigureRequest(Form::ref form) { | 949 | void MUCController::handleConfigureRequest(Form::ref form) { |
| 938 | if (form) { | 950 | if (form) { |
| 939 | muc_->configureRoom(form); | 951 | muc_->configureRoom(form); |
Swift