summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-05-01 09:13:23 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-05-01 09:13:23 (GMT)
commitd94737ef177524014fbf9b1ee2b446825536514b (patch)
tree004df9a022c7c42cad39162ffa84537b63c1953d /Documentation/SwiftenDevelopersGuide/Examples/EchoBot
parent4091acca56c189a350e195450272ec4471ba91cd (diff)
downloadswift-d94737ef177524014fbf9b1ee2b446825536514b.zip
swift-d94737ef177524014fbf9b1ee2b446825536514b.tar.bz2
Updated Swiften developers guide.
Added call to setAlwaysTrustCertificates in examples. Added C++0x example.
Diffstat (limited to 'Documentation/SwiftenDevelopersGuide/Examples/EchoBot')
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot0x.cpp12
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot1.cpp1
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot2.cpp1
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot3.cpp1
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot4.cpp1
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot5.cpp1
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot6.cpp1
7 files changed, 9 insertions, 9 deletions
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot0x.cpp b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot0x.cpp
index b4ccc21..11773ae 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot0x.cpp
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot0x.cpp
@@ -13,25 +13,19 @@ int main(int, char**) {
SimpleEventLoop eventLoop;
BoostNetworkFactories networkFactories(&eventLoop);
- // Initialize the client with the JID and password
Client client("echobot@wonderland.lit", "mypass", &networkFactories);
-
- // When the client is convnected, send out initial presence
+ client.setAlwaysTrustCertificates();
client.onConnected.connect([&] {
- client.sendPresence(Presence::create("Send me a message"));
+ std::cout << "Connected" << std::endl;
});
-
- // When the client receives an incoming message, echo it back
client.onMessageReceived.connect([&] (Message::ref message) {
message->setTo(message->getFrom());
message->setFrom(JID());
client.sendMessage(message);
});
-
- // Start the client
client.connect();
- // Run the event loop to start processing incoming network events
eventLoop.run();
+
return 0;
}
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot1.cpp b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot1.cpp
index 4736494..8a64b56 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot1.cpp
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot1.cpp
@@ -13,6 +13,7 @@ int main(int, char**) {
BoostNetworkFactories networkFactories(&eventLoop);
Client client("echobot@wonderland.lit", "mypass", &networkFactories);
+ client.setAlwaysTrustCertificates();
client.connect();
eventLoop.run();
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot2.cpp b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot2.cpp
index f431245..deeb852 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot2.cpp
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot2.cpp
@@ -22,6 +22,7 @@ int main(int, char**) {
BoostNetworkFactories networkFactories(&eventLoop);
client = new Client("echobot@wonderland.lit", "mypass", &networkFactories);
+ client->setAlwaysTrustCertificates();
client->onConnected.connect(&handleConnected);
client->onMessageReceived.connect(bind(&handleMessageReceived, _1));
client->connect();
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot3.cpp b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot3.cpp
index cd95b91..e3e3560 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot3.cpp
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot3.cpp
@@ -16,6 +16,7 @@ class EchoBot {
public:
EchoBot(NetworkFactories* networkFactories) {
client = new Client("echobot@wonderland.lit", "mypass", networkFactories);
+ client->setAlwaysTrustCertificates();
client->onConnected.connect(bind(&EchoBot::handleConnected, this));
client->onMessageReceived.connect(
bind(&EchoBot::handleMessageReceived, this, _1));
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot4.cpp b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot4.cpp
index c2f555c..c8d8c84 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot4.cpp
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot4.cpp
@@ -18,6 +18,7 @@ class EchoBot {
EchoBot(NetworkFactories* networkFactories) {
//...
client = new Client("echobot@wonderland.lit", "mypass", networkFactories);
+ client->setAlwaysTrustCertificates();
client->onConnected.connect(bind(&EchoBot::handleConnected, this));
client->onMessageReceived.connect(
bind(&EchoBot::handleMessageReceived, this, _1));
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot5.cpp b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot5.cpp
index 0b00330..810424c 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot5.cpp
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot5.cpp
@@ -18,6 +18,7 @@ class EchoBot {
EchoBot(NetworkFactories* networkFactories) {
//...
client = new Client("echobot@wonderland.lit", "mypass", networkFactories);
+ client->setAlwaysTrustCertificates();
client->onConnected.connect(bind(&EchoBot::handleConnected, this));
client->onMessageReceived.connect(
bind(&EchoBot::handleMessageReceived, this, _1));
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot6.cpp b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot6.cpp
index d3587e9..92a2ab6 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot6.cpp
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot6.cpp
@@ -23,6 +23,7 @@ class EchoBot {
EchoBot(NetworkFactories* networkFactories) {
//...
client = new Client("echobot@wonderland.lit", "mypass", networkFactories);
+ client->setAlwaysTrustCertificates();
client->onConnected.connect(bind(&EchoBot::handleConnected, this));
client->onMessageReceived.connect(
bind(&EchoBot::handleMessageReceived, this, _1));