diff options
author | Tobias Markmann <tm@ayena.de> | 2016-03-31 14:57:35 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-03-31 14:57:35 (GMT) |
commit | cfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch) | |
tree | 18d94153a302445196fc0c18586abf44a1ce4a38 /Swiften/Examples/ConnectivityTest | |
parent | 1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff) | |
download | swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2 |
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines
in the process.
Changed CheckTabs.py tool to disallow hard tabs in source
files.
Test-Information:
Manually checked 30 random files that the conversion worked
as expected.
Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'Swiften/Examples/ConnectivityTest')
-rw-r--r-- | Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp index 8d1da38..50f857c 100644 --- a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp +++ b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp @@ -31,72 +31,72 @@ static int exitCode = CANNOT_CONNECT; static boost::bsignals::connection errorConnection; static void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> /*info*/, ErrorPayload::ref error) { - if (!error) { - errorConnection.disconnect(); - client->disconnect(); - eventLoop.stop(); - exitCode = OK; - } else { - errorConnection.disconnect(); - exitCode = DISCO_ERROR; - } + if (!error) { + errorConnection.disconnect(); + client->disconnect(); + eventLoop.stop(); + exitCode = OK; + } else { + errorConnection.disconnect(); + exitCode = DISCO_ERROR; + } } static void handleConnected() { - exitCode = NO_RESPONSE; - GetDiscoInfoRequest::ref discoInfoRequest = GetDiscoInfoRequest::create(JID(), client->getIQRouter()); - discoInfoRequest->onResponse.connect(&handleServerDiscoInfoResponse); - discoInfoRequest->send(); + exitCode = NO_RESPONSE; + GetDiscoInfoRequest::ref discoInfoRequest = GetDiscoInfoRequest::create(JID(), client->getIQRouter()); + discoInfoRequest->onResponse.connect(&handleServerDiscoInfoResponse); + discoInfoRequest->send(); } static void handleDisconnected(const boost::optional<ClientError>&) { - exitCode = CANNOT_AUTH; - eventLoop.stop(); + exitCode = CANNOT_AUTH; + eventLoop.stop(); } int main(int argc, char* argv[]) { - if (argc < 4 || argc > 5) { - std::cerr << "Usage: " << argv[0] << " <jid> [<connect_host>] <password> <timeout_seconds>" << std::endl; - return -1; - } - - int argi = 1; - - std::string jid = argv[argi++]; - std::string connectHost = ""; - if (argc == 5) { - connectHost = argv[argi++]; - } - - client = new Swift::Client(JID(jid), std::string(argv[argi++]), &networkFactories); - char* timeoutChar = argv[argi++]; - int timeout = atoi(timeoutChar); - timeout = (timeout ? timeout : 30) * 1000; - ClientXMLTracer* tracer = new ClientXMLTracer(client); - client->onConnected.connect(&handleConnected); - errorConnection = client->onDisconnected.connect(&handleDisconnected); - std::cout << "Connecting to JID " << jid << " with timeout " << timeout << "ms on host: "; ; - if (!connectHost.empty()) { - std::cout << connectHost << std::endl; - ClientOptions options; - options.manualHostname = connectHost; - client->connect(options); - } else { - std::cout << " Default" << std::endl; - client->connect(); - } - - { - Timer::ref timer = networkFactories.getTimerFactory()->createTimer(timeout); - timer->onTick.connect(boost::bind(&SimpleEventLoop::stop, &eventLoop)); - timer->start(); - - eventLoop.run(); - } - - delete tracer; - delete client; - return exitCode; + if (argc < 4 || argc > 5) { + std::cerr << "Usage: " << argv[0] << " <jid> [<connect_host>] <password> <timeout_seconds>" << std::endl; + return -1; + } + + int argi = 1; + + std::string jid = argv[argi++]; + std::string connectHost = ""; + if (argc == 5) { + connectHost = argv[argi++]; + } + + client = new Swift::Client(JID(jid), std::string(argv[argi++]), &networkFactories); + char* timeoutChar = argv[argi++]; + int timeout = atoi(timeoutChar); + timeout = (timeout ? timeout : 30) * 1000; + ClientXMLTracer* tracer = new ClientXMLTracer(client); + client->onConnected.connect(&handleConnected); + errorConnection = client->onDisconnected.connect(&handleDisconnected); + std::cout << "Connecting to JID " << jid << " with timeout " << timeout << "ms on host: "; ; + if (!connectHost.empty()) { + std::cout << connectHost << std::endl; + ClientOptions options; + options.manualHostname = connectHost; + client->connect(options); + } else { + std::cout << " Default" << std::endl; + client->connect(); + } + + { + Timer::ref timer = networkFactories.getTimerFactory()->createTimer(timeout); + timer->onTick.connect(boost::bind(&SimpleEventLoop::stop, &eventLoop)); + timer->start(); + + eventLoop.run(); + } + + delete tracer; + delete client; + return exitCode; } |