summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-10 18:14:14 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-10-10 18:35:57 (GMT)
commit815af99155f7f59fb4e43d75e271a5061706449b (patch)
treee19b66ca78d00e2396b27eb3627b9146162c387a /Swiften/Client
parentdcf30da8e1bf6c3e42f9d0ac8adbdb14f77a9622 (diff)
downloadswift-contrib-815af99155f7f59fb4e43d75e271a5061706449b.zip
swift-contrib-815af99155f7f59fb4e43d75e271a5061706449b.tar.bz2
Moved XMPP roster & controller from Swift to Client.
Diffstat (limited to 'Swiften/Client')
-rw-r--r--Swiften/Client/Client.cpp13
-rw-r--r--Swiften/Client/Client.h29
2 files changed, 41 insertions, 1 deletions
diff --git a/Swiften/Client/Client.cpp b/Swiften/Client/Client.cpp
index 5c64506..e3e8a45 100644
--- a/Swiften/Client/Client.cpp
+++ b/Swiften/Client/Client.cpp
@@ -7,15 +7,23 @@
#include "Swiften/Client/Client.h"
#include "Swiften/Queries/Responders/SoftwareVersionResponder.h"
+#include "Swiften/Roster/XMPPRoster.h"
+#include "Swiften/Roster/XMPPRosterController.h"
namespace Swift {
Client::Client(const JID& jid, const String& password) : CoreClient(jid, password) {
softwareVersionResponder = new SoftwareVersionResponder(getIQRouter());
softwareVersionResponder->start();
+
+ roster = new XMPPRoster();
+ rosterController = new XMPPRosterController(getIQRouter(), roster);
}
Client::~Client() {
+ delete rosterController;
+ delete roster;
+
softwareVersionResponder->stop();
delete softwareVersionResponder;
}
@@ -24,4 +32,9 @@ void Client::setSoftwareVersion(const String& name, const String& version) {
softwareVersionResponder->setVersion(name, version);
}
+void Client::requestRoster() {
+ rosterController->requestRoster();
+}
+
+
}
diff --git a/Swiften/Client/Client.h b/Swiften/Client/Client.h
index 54d6e56..9f3e935 100644
--- a/Swiften/Client/Client.h
+++ b/Swiften/Client/Client.h
@@ -10,6 +10,8 @@
namespace Swift {
class SoftwareVersionResponder;
+ class XMPPRoster;
+ class XMPPRosterController;
/**
* Provides the core functionality for writing XMPP client software.
@@ -30,8 +32,33 @@ namespace Swift {
*/
void setSoftwareVersion(const String& name, const String& version);
+ /**
+ * Returns a representation of the roster.
+ *
+ * The roster is initially empty. To populate it, call requestRoster(), which
+ * will request the roster from the server. When the roster has been requested,
+ * it will also be kept up to date when it is updated on the server side.
+ *
+ * This pointer remains the same across the lifetime of Client. All changes
+ * to the roster (e.g. after the initial roster request, or after subsequent
+ * roster updates) are notified through the XMPPRoster's signals.
+ *
+ * \see requestRoster()
+ */
+ XMPPRoster* getRoster() const {
+ return roster;
+ }
+
+ /**
+ * Requests the roster from the server.
+ *
+ * \see getRoster()
+ */
+ void requestRoster();
+
private:
SoftwareVersionResponder* softwareVersionResponder;
-
+ XMPPRoster* roster;
+ XMPPRosterController* rosterController;
};
}