summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Avatars/AvatarManager.cpp6
-rw-r--r--Swiften/Avatars/AvatarManager.h4
-rw-r--r--Swiften/MUC/MUCBookmarkManager.cpp2
-rw-r--r--Swiften/MUC/MUCBookmarkManager.h3
4 files changed, 12 insertions, 3 deletions
diff --git a/Swiften/Avatars/AvatarManager.cpp b/Swiften/Avatars/AvatarManager.cpp
index 42451af..3825ffd 100644
--- a/Swiften/Avatars/AvatarManager.cpp
+++ b/Swiften/Avatars/AvatarManager.cpp
@@ -27,6 +27,10 @@ AvatarManager::~AvatarManager() {
}
+void AvatarManager::setMUCRegistry(MUCRegistry* mucRegistry) {
+ mucRegistry_ = mucRegistry;
+}
+
void AvatarManager::handlePresenceReceived(boost::shared_ptr<Presence> presence) {
boost::shared_ptr<VCardUpdate> update = presence->getPayload<VCardUpdate>();
if (!update) {
@@ -97,7 +101,7 @@ boost::filesystem::path AvatarManager::getAvatarPath(const JID& jid) const {
JID AvatarManager::getAvatarJID(const JID& jid) const {
JID bareFrom = jid.toBare();
- return (mucRegistry_->isMUC(bareFrom) ? jid : bareFrom);
+ return (mucRegistry_ && mucRegistry_->isMUC(bareFrom)) ? jid : bareFrom;
}
diff --git a/Swiften/Avatars/AvatarManager.h b/Swiften/Avatars/AvatarManager.h
index 448526e..fd308d9 100644
--- a/Swiften/Avatars/AvatarManager.h
+++ b/Swiften/Avatars/AvatarManager.h
@@ -19,9 +19,11 @@ namespace Swift {
class AvatarManager {
public:
- AvatarManager(StanzaChannel*, IQRouter*, AvatarStorage*, MUCRegistry*);
+ AvatarManager(StanzaChannel*, IQRouter*, AvatarStorage*, MUCRegistry* = NULL);
virtual ~AvatarManager();
+ virtual void setMUCRegistry(MUCRegistry*);
+
virtual String getAvatarHash(const JID&) const;
virtual boost::filesystem::path getAvatarPath(const JID&) const;
virtual void setAvatar(const JID&, const ByteArray& avatar);
diff --git a/Swiften/MUC/MUCBookmarkManager.cpp b/Swiften/MUC/MUCBookmarkManager.cpp
index f789300..f9295e2 100644
--- a/Swiften/MUC/MUCBookmarkManager.cpp
+++ b/Swiften/MUC/MUCBookmarkManager.cpp
@@ -11,6 +11,7 @@ MUCBookmarkManager::MUCBookmarkManager(IQRouter* iqRouter) {
void MUCBookmarkManager::addBookmark(boost::shared_ptr<MUCBookmark> bookmark) {
bookmarks_.push_back(bookmark);
flush();
+ onBookmarkAdded(bookmark);
}
@@ -19,6 +20,7 @@ void MUCBookmarkManager::removeBookmark(boost::shared_ptr<MUCBookmark> bookmark)
for (it = bookmarks_.begin(); it != bookmarks_.end(); it++) {
if ((*it).get() == bookmark.get()) {
bookmarks_.erase(it);
+ onBookmarkRemoved(bookmark);
return;
}
}
diff --git a/Swiften/MUC/MUCBookmarkManager.h b/Swiften/MUC/MUCBookmarkManager.h
index e1f8708..ade2e3e 100644
--- a/Swiften/MUC/MUCBookmarkManager.h
+++ b/Swiften/MUC/MUCBookmarkManager.h
@@ -18,7 +18,8 @@ namespace Swift {
void flush();
/** Returns pointers to the bookmarks. These can be edited, and then flush()ed.*/
const std::vector<boost::shared_ptr<MUCBookmark> >& getBookmarks();
- boost::signal<void ()> onBookmarksChanged;
+ boost::signal<void (boost::shared_ptr<MUCBookmark>)> onBookmarkAdded;
+ boost::signal<void (boost::shared_ptr<MUCBookmark>)> onBookmarkRemoved;
private:
std::vector<boost::shared_ptr<MUCBookmark> > bookmarks_;