diff options
Diffstat (limited to 'Swiften/MUC/MUCBookmarkManager.cpp')
-rw-r--r-- | Swiften/MUC/MUCBookmarkManager.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Swiften/MUC/MUCBookmarkManager.cpp b/Swiften/MUC/MUCBookmarkManager.cpp new file mode 100644 index 0000000..f789300 --- /dev/null +++ b/Swiften/MUC/MUCBookmarkManager.cpp @@ -0,0 +1,37 @@ +#include "MUCBookmarkManager.h" + +#include "Swiften/Queries/IQRouter.h" + +namespace Swift { + +MUCBookmarkManager::MUCBookmarkManager(IQRouter* iqRouter) { + iqRouter_ = iqRouter; +} + +void MUCBookmarkManager::addBookmark(boost::shared_ptr<MUCBookmark> bookmark) { + bookmarks_.push_back(bookmark); + flush(); +} + + +void MUCBookmarkManager::removeBookmark(boost::shared_ptr<MUCBookmark> bookmark) { + std::vector<boost::shared_ptr<MUCBookmark> >::iterator it; + for (it = bookmarks_.begin(); it != bookmarks_.end(); it++) { + if ((*it).get() == bookmark.get()) { + bookmarks_.erase(it); + return; + } + } + assert(false); + flush(); +} + +void MUCBookmarkManager::flush() { + //FIXME: some code may be useful +} + +const std::vector<boost::shared_ptr<MUCBookmark> >& MUCBookmarkManager::getBookmarks() { + return bookmarks_; +} + +} |