diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-07-21 15:07:02 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-07-21 15:07:02 (GMT) |
commit | 3c6895ea29dad8a93d7d3ee43bb70e2bf5d8717e (patch) | |
tree | a7dc7c6fb153e68cdbce8c479482117c69c4704c /Slimber/CLI | |
parent | 0c0df47a4667a0cd5b0005b70c1beda376678d09 (diff) | |
download | swift-3c6895ea29dad8a93d7d3ee43bb70e2bf5d8717e.zip swift-3c6895ea29dad8a93d7d3ee43bb70e2bf5d8717e.tar.bz2 |
Create a Slimber/CLI module.
Diffstat (limited to 'Slimber/CLI')
-rw-r--r-- | Slimber/CLI/Makefile.inc | 16 | ||||
-rw-r--r-- | Slimber/CLI/main.cpp | 37 |
2 files changed, 53 insertions, 0 deletions
diff --git a/Slimber/CLI/Makefile.inc b/Slimber/CLI/Makefile.inc new file mode 100644 index 0000000..601929c --- /dev/null +++ b/Slimber/CLI/Makefile.inc @@ -0,0 +1,16 @@ +SLIMBER_CLI_TARGET = Slimber/CLI/slimber +SLIMBER_CLI_SOURCES = \ + Slimber/CLI/main.cpp +SLIMBER_CLI_OBJECTS = \ + $(SLIMBER_CLI_SOURCES:.cpp=.o) + +$(SLIMBER_CLI_TARGET): $(SWIFTEN_TARGET) $(SLIMBER_TARGET) $(SLIMBER_CLI_OBJECTS) + $(QUIET_LINK)$(CXX) -o $(SLIMBER_CLI_TARGET) $(SLIMBER_CLI_OBJECTS) $(LDFLAGS) $(SLIMBER_TARGET) $(SWIFTEN_TARGET) $(LIBS) + +TARGETS += $(SLIMBER_CLI_TARGET) +SLIMBER_TARGETS += $(SLIMBER_CLI_TARGET) +CLEANFILES += \ + $(SLIMBER_CLI_OBJECTS) \ + $(SLIMBER_CLI_TARGET) +DEPS += \ + $(SLIMBER_CLI_SOURCES:.cpp=.dep) \ diff --git a/Slimber/CLI/main.cpp b/Slimber/CLI/main.cpp new file mode 100644 index 0000000..40f41c8 --- /dev/null +++ b/Slimber/CLI/main.cpp @@ -0,0 +1,37 @@ +#include <string> +#include <boost/bind.hpp> + +#include "Swiften/Base/Platform.h" +#if defined(SWIFTEN_PLATFORM_MACOSX) || defined(SWIFTEN_PLATFORM_WINDOWS) +#include "Swiften/LinkLocal/AppleDNSSDService.h" +#else +#include "Swiften/LinkLocal/AvahiDNSSDService.h" +#endif +#include "Slimber/Server.h" +#include "Slimber/FileVCardCollection.h" +#include "Swiften/LinkLocal/LinkLocalRoster.h" +#include "Swiften/EventLoop/SimpleEventLoop.h" +#include "Swiften/Application/Platform/PlatformApplication.h" + +using namespace Swift; + +int main() { + SimpleEventLoop eventLoop; + + boost::shared_ptr<DNSSDService> dnsSDService; +#if defined(SWIFTEN_PLATFORM_MACOSX) || defined(SWIFTEN_PLATFORM_WINDOWS) + dnsSDService = boost::shared_ptr<AppleDNSSDService>( + new AppleDNSSDService()); +#else + dnsSDService = boost::shared_ptr<AvahiDNSSDService>( + new AvahiDNSSDService()); +#endif + + boost::shared_ptr<LinkLocalRoster> linkLocalRoster = boost::shared_ptr<LinkLocalRoster>(new LinkLocalRoster(dnsSDService)); + + FileVCardCollection vCardCollection(PlatformApplication("Slimber").getSettingsDir()); + + Server server(5222, 5562, linkLocalRoster, dnsSDService, &vCardCollection); + eventLoop.run(); + return 0; +} |