summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-08-27 20:19:14 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-08-27 21:52:18 (GMT)
commit7f1bcf974efac0ed87b6f8f639e1fdc16a89eb09 (patch)
tree7fa948375b6cc56f37bd2be400d6d8be9ca97837 /Swiften
parentba774f85e77531c7971804cb738c6b434a197258 (diff)
downloadswift-contrib-7f1bcf974efac0ed87b6f8f639e1fdc16a89eb09.zip
swift-contrib-7f1bcf974efac0ed87b6f8f639e1fdc16a89eb09.tar.bz2
Separate MUCRegistry from ChatsManager.
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Avatars/AvatarManager.cpp4
-rw-r--r--Swiften/Avatars/AvatarManager.h2
-rw-r--r--Swiften/Avatars/VCardUpdateAvatarManager.cpp4
-rw-r--r--Swiften/Avatars/VCardUpdateAvatarManager.h2
-rw-r--r--Swiften/MUC/MUCRegistry.cpp15
-rw-r--r--Swiften/MUC/MUCRegistry.h13
-rw-r--r--Swiften/VCards/VCardManager.h1
7 files changed, 26 insertions, 15 deletions
diff --git a/Swiften/Avatars/AvatarManager.cpp b/Swiften/Avatars/AvatarManager.cpp
index 909b07c..cd691c0 100644
--- a/Swiften/Avatars/AvatarManager.cpp
+++ b/Swiften/Avatars/AvatarManager.cpp
@@ -21,10 +21,6 @@ AvatarManager::~AvatarManager() {
delete vcardUpdateAvatarManager;
}
-void AvatarManager::setMUCRegistry(MUCRegistry* mucRegistry) {
- vcardUpdateAvatarManager->setMUCRegistry(mucRegistry);
-}
-
boost::filesystem::path AvatarManager::getAvatarPath(const JID& jid) const {
return vcardUpdateAvatarManager->getAvatarPath(jid);
}
diff --git a/Swiften/Avatars/AvatarManager.h b/Swiften/Avatars/AvatarManager.h
index d3d593d..90f0076 100644
--- a/Swiften/Avatars/AvatarManager.h
+++ b/Swiften/Avatars/AvatarManager.h
@@ -29,8 +29,6 @@ namespace Swift {
AvatarManager(VCardManager*, StanzaChannel*, AvatarStorage*, MUCRegistry* = NULL);
virtual ~AvatarManager();
- virtual void setMUCRegistry(MUCRegistry*);
-
virtual boost::filesystem::path getAvatarPath(const JID&) const;
public:
diff --git a/Swiften/Avatars/VCardUpdateAvatarManager.cpp b/Swiften/Avatars/VCardUpdateAvatarManager.cpp
index c7f1637..80d7730 100644
--- a/Swiften/Avatars/VCardUpdateAvatarManager.cpp
+++ b/Swiften/Avatars/VCardUpdateAvatarManager.cpp
@@ -28,10 +28,6 @@ VCardUpdateAvatarManager::~VCardUpdateAvatarManager() {
}
-void VCardUpdateAvatarManager::setMUCRegistry(MUCRegistry* mucRegistry) {
- mucRegistry_ = mucRegistry;
-}
-
void VCardUpdateAvatarManager::handlePresenceReceived(boost::shared_ptr<Presence> presence) {
boost::shared_ptr<VCardUpdate> update = presence->getPayload<VCardUpdate>();
if (!update || presence->getPayload<ErrorPayload>()) {
diff --git a/Swiften/Avatars/VCardUpdateAvatarManager.h b/Swiften/Avatars/VCardUpdateAvatarManager.h
index b7ef34b..16c0ca3 100644
--- a/Swiften/Avatars/VCardUpdateAvatarManager.h
+++ b/Swiften/Avatars/VCardUpdateAvatarManager.h
@@ -28,8 +28,6 @@ namespace Swift {
VCardUpdateAvatarManager(VCardManager*, StanzaChannel*, AvatarStorage*, MUCRegistry* = NULL);
virtual ~VCardUpdateAvatarManager();
- virtual void setMUCRegistry(MUCRegistry*);
-
virtual boost::filesystem::path getAvatarPath(const JID&) const;
public:
diff --git a/Swiften/MUC/MUCRegistry.cpp b/Swiften/MUC/MUCRegistry.cpp
index 910d740..e433165 100644
--- a/Swiften/MUC/MUCRegistry.cpp
+++ b/Swiften/MUC/MUCRegistry.cpp
@@ -6,9 +6,24 @@
#include "Swiften/MUC/MUCRegistry.h"
+#include <algorithm>
+
namespace Swift {
MUCRegistry::~MUCRegistry() {
}
+bool MUCRegistry::isMUC(const JID& j) const {
+ return std::find(mucs.begin(), mucs.end(), j) != mucs.end();
+}
+
+void MUCRegistry::addMUC(const JID& j) {
+ mucs.push_back(j);
+}
+
+void MUCRegistry::removeMUC(const JID& j) {
+ mucs.erase(std::remove(mucs.begin(), mucs.end(), j), mucs.end());
+}
+
+
}
diff --git a/Swiften/MUC/MUCRegistry.h b/Swiften/MUC/MUCRegistry.h
index e6f2ab6..6356931 100644
--- a/Swiften/MUC/MUCRegistry.h
+++ b/Swiften/MUC/MUCRegistry.h
@@ -6,13 +6,22 @@
#pragma once
+#include <vector>
+
+#include "Swiften/JID/JID.h"
+
namespace Swift {
class JID;
class MUCRegistry {
public:
- virtual ~MUCRegistry();
+ ~MUCRegistry();
+
+ bool isMUC(const JID& j) const;
+ void addMUC(const JID& j);
+ void removeMUC(const JID& j);
- virtual bool isMUC(const JID&) const = 0;
+ private:
+ std::vector<JID> mucs;
};
}
diff --git a/Swiften/VCards/VCardManager.h b/Swiften/VCards/VCardManager.h
index fc99128..61fc50d 100644
--- a/Swiften/VCards/VCardManager.h
+++ b/Swiften/VCards/VCardManager.h
@@ -31,7 +31,6 @@ namespace Swift {
* The JID will always be bare.
*/
boost::signal<void (const JID&, VCard::ref)> onVCardChanged;
- boost::signal<void (VCard::ref)> onOwnVCardChanged;
private:
void handleVCardReceived(const JID& from, VCard::ref, const boost::optional<ErrorPayload>&);