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/SendMessage | |
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/SendMessage')
-rw-r--r-- | Swiften/Examples/SendMessage/SendMessage.cpp | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/Swiften/Examples/SendMessage/SendMessage.cpp b/Swiften/Examples/SendMessage/SendMessage.cpp index 5f13903..973cda5 100644 --- a/Swiften/Examples/SendMessage/SendMessage.cpp +++ b/Swiften/Examples/SendMessage/SendMessage.cpp @@ -30,62 +30,62 @@ static boost::bsignals::connection errorConnection; static void handleConnected() { - boost::shared_ptr<Message> message(new Message()); - message->setBody(messageBody); - message->setTo(recipient); - client->sendMessage(message); - exitCode = 0; - errorConnection.disconnect(); - client->disconnect(); - eventLoop.stop(); + boost::shared_ptr<Message> message(new Message()); + message->setBody(messageBody); + message->setTo(recipient); + client->sendMessage(message); + exitCode = 0; + errorConnection.disconnect(); + client->disconnect(); + eventLoop.stop(); } static void handleDisconnected(const boost::optional<ClientError>&) { - std::cerr << "Error!" << std::endl; - exitCode = 1; - eventLoop.stop(); + std::cerr << "Error!" << std::endl; + exitCode = 1; + eventLoop.stop(); } int main(int argc, char* argv[]) { - if (argc < 5 || argc > 6) { - std::cerr << "Usage: " << argv[0] << " <jid> [<connect_host>]<password> <recipient> <message>" << std::endl; - return -1; - } - - int argi = 1; - - std::string jid = argv[argi++]; - std::string connectHost = ""; - if (argc == 6) { - connectHost = argv[argi++]; - } - - client = new Swift::Client(JID(jid), std::string(argv[argi++]), &networkFactories); - client->setAlwaysTrustCertificates(); - - recipient = JID(argv[argi++]); - messageBody = std::string(argv[argi++]); - - ClientXMLTracer* tracer = new ClientXMLTracer(client); - client->onConnected.connect(&handleConnected); - errorConnection = client->onDisconnected.connect(&handleDisconnected); - if (!connectHost.empty()) { - ClientOptions options; - options.manualHostname = connectHost; - client->connect(options); - } else { - client->connect(); - } - - { - Timer::ref timer = networkFactories.getTimerFactory()->createTimer(30000); - timer->onTick.connect(boost::bind(&SimpleEventLoop::stop, &eventLoop)); - timer->start(); - - eventLoop.run(); - } - - delete tracer; - delete client; - return exitCode; + if (argc < 5 || argc > 6) { + std::cerr << "Usage: " << argv[0] << " <jid> [<connect_host>]<password> <recipient> <message>" << std::endl; + return -1; + } + + int argi = 1; + + std::string jid = argv[argi++]; + std::string connectHost = ""; + if (argc == 6) { + connectHost = argv[argi++]; + } + + client = new Swift::Client(JID(jid), std::string(argv[argi++]), &networkFactories); + client->setAlwaysTrustCertificates(); + + recipient = JID(argv[argi++]); + messageBody = std::string(argv[argi++]); + + ClientXMLTracer* tracer = new ClientXMLTracer(client); + client->onConnected.connect(&handleConnected); + errorConnection = client->onDisconnected.connect(&handleDisconnected); + if (!connectHost.empty()) { + ClientOptions options; + options.manualHostname = connectHost; + client->connect(options); + } else { + client->connect(); + } + + { + Timer::ref timer = networkFactories.getTimerFactory()->createTimer(30000); + timer->onTick.connect(boost::bind(&SimpleEventLoop::stop, &eventLoop)); + timer->start(); + + eventLoop.run(); + } + + delete tracer; + delete client; + return exitCode; } |