diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-03-30 09:06:49 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-03-30 09:06:49 (GMT) |
commit | 2a61f9f00df213e92d7ca1df7e659accd6bd1620 (patch) | |
tree | be1d9712bed90fa73723080bf4e75127604a2956 /Swiften/Examples/SendMessage | |
parent | 9593ec65fa0def4c840d8a68578c671bbf0981c9 (diff) | |
download | swift-contrib-2a61f9f00df213e92d7ca1df7e659accd6bd1620.zip swift-contrib-2a61f9f00df213e92d7ca1df7e659accd6bd1620.tar.bz2 |
Fix previous commit
Diffstat (limited to 'Swiften/Examples/SendMessage')
-rw-r--r-- | Swiften/Examples/SendMessage/SendMessage.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Swiften/Examples/SendMessage/SendMessage.cpp b/Swiften/Examples/SendMessage/SendMessage.cpp index 7699eef..b7625fb 100644 --- a/Swiften/Examples/SendMessage/SendMessage.cpp +++ b/Swiften/Examples/SendMessage/SendMessage.cpp @@ -17,6 +17,7 @@ Client* client = 0; JID recipient; std::string messageBody; int exitCode = 0; +boost::bsignals::connection errorConnection; void handleConnected() { @@ -24,6 +25,7 @@ void handleConnected() { message->setBody(messageBody); message->setTo(recipient); client->sendMessage(message); + errorConnection.disconnect(); client->disconnect(); eventLoop.stop(); } @@ -31,6 +33,7 @@ void handleConnected() { void handleError(const ClientError&) { std::cerr << "Error!" << std::endl; exitCode = 1; + eventLoop.stop(); } int main(int argc, char* argv[]) { @@ -45,7 +48,7 @@ int main(int argc, char* argv[]) { client = new Swift::Client(JID(argv[1]), String(argv[2])); ClientXMLTracer* tracer = new ClientXMLTracer(client); client->onConnected.connect(&handleConnected); - client->onError.connect(&handleError); + errorConnection = client->onError.connect(&handleError); client->connect(); { |