summaryrefslogtreecommitdiffstats
path: root/Limber
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-13 19:30:56 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-13 19:30:56 (GMT)
commit43eadfb5d884407c54ccd41cf46881ae374fdf15 (patch)
tree433d3a368bd494ee7d3a46f84b52cede71c19164 /Limber
parent92614cf44bc98c3aae240a8089452fb950af5c7e (diff)
downloadswift-contrib-43eadfb5d884407c54ccd41cf46881ae374fdf15.zip
swift-contrib-43eadfb5d884407c54ccd41cf46881ae374fdf15.tar.bz2
Implemented session initialization.
Diffstat (limited to 'Limber')
-rw-r--r--Limber/main.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/Limber/main.cpp b/Limber/main.cpp
index 969a390..c3db296 100644
--- a/Limber/main.cpp
+++ b/Limber/main.cpp
@@ -8,6 +8,7 @@
#include <boost/enable_shared_from_this.hpp>
#include <boost/thread.hpp>
+#include "Swiften/Server/SimpleUserRegistry.h"
#include "Swiften/Base/ByteArray.h"
#include "Swiften/Base/IDGenerator.h"
#include "Swiften/EventLoop/MainEventLoop.h"
@@ -122,7 +123,7 @@ class BoostConnectionServer : public ConnectionServer {
class Server {
public:
- Server() {
+ Server(UserRegistry* userRegistry) : userRegistry_(userRegistry) {
serverFromClientConnectionServer_ = new BoostConnectionServer(5222, boostIOServiceThread_.getIOService());
serverFromClientConnectionServer_->onNewConnection.connect(boost::bind(&Server::handleNewConnection, this, _1));
}
@@ -133,7 +134,7 @@ class Server {
private:
void handleNewConnection(boost::shared_ptr<IncomingConnection> c) {
- ServerFromClientSession* session = new ServerFromClientSession(idGenerator_.generateID(), c, &payloadParserFactories_, &payloadSerializers_);
+ ServerFromClientSession* session = new ServerFromClientSession(idGenerator_.generateID(), c, &payloadParserFactories_, &payloadSerializers_, userRegistry_);
serverFromClientSessions_.push_back(session);
session->onSessionFinished.connect(boost::bind(&Server::handleSessionFinished, this, session));
}
@@ -145,6 +146,7 @@ class Server {
private:
IDGenerator idGenerator_;
+ UserRegistry* userRegistry_;
BoostIOServiceThread boostIOServiceThread_;
BoostConnectionServer* serverFromClientConnectionServer_;
std::vector<ServerFromClientSession*> serverFromClientSessions_;
@@ -154,7 +156,9 @@ class Server {
int main() {
SimpleEventLoop eventLoop;
- Server server;
+ SimpleUserRegistry userRegistry;
+ userRegistry.addUser(JID("remko@limber"), "pass");
+ Server server(&userRegistry);
eventLoop.run();
return 0;
}