summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/BuildingOnUnix.txt9
-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
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayload.h3
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadParserFactory.h6
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadSerializer.h4
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript12
-rw-r--r--Documentation/SwiftenDevelopersGuide/SConscript1
-rw-r--r--Documentation/SwiftenDevelopersGuide/Swiften Developers Guide.xml21
14 files changed, 45 insertions, 29 deletions
diff --git a/Documentation/BuildingOnUnix.txt b/Documentation/BuildingOnUnix.txt
index 8de73c8..fa5759e 100644
--- a/Documentation/BuildingOnUnix.txt
+++ b/Documentation/BuildingOnUnix.txt
@@ -20,6 +20,9 @@ Running tests
-------------
- Run
./scons test=unit
- for running the unit tests, or
- ./scons test=all
- for running all tests.
+ for running the unit tests.
+
+Installing
+----------
+- To install swift in /usr/local, run
+ ./scons SWIFT_INSTALLDIR=/usr/local /usr/local
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));
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayload.h b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayload.h
index 7533a1e..62ea495 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayload.h
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayload.h
@@ -8,9 +8,8 @@
#include <Swiften/Swiften.h>
-using namespace Swift;
//...
-class EchoPayload : public Payload {
+class EchoPayload : public Swift::Payload {
public:
EchoPayload() {}
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadParserFactory.h b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadParserFactory.h
index 9cbb795..33a8c41 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadParserFactory.h
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadParserFactory.h
@@ -9,9 +9,7 @@
#include <Swiften/Swiften.h>
#include "EchoPayload.h"
-using namespace Swift;
-
-class EchoPayloadParser : public GenericPayloadParser<EchoPayload> {
+class EchoPayloadParser : public Swift::GenericPayloadParser<EchoPayload> {
public:
EchoPayloadParser() : currentDepth(0) {}
@@ -36,7 +34,7 @@ class EchoPayloadParser : public GenericPayloadParser<EchoPayload> {
std::string currentText;
};
-class EchoPayloadParserFactory : public GenericPayloadParserFactory<EchoPayloadParser> {
+class EchoPayloadParserFactory : public Swift::GenericPayloadParserFactory<EchoPayloadParser> {
public:
EchoPayloadParserFactory() :
GenericPayloadParserFactory<EchoPayloadParser>("echo", "http://swift.im/echo") {}
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadSerializer.h b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadSerializer.h
index 85e8e67..068113c 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadSerializer.h
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadSerializer.h
@@ -9,9 +9,7 @@
#include <Swiften/Swiften.h>
#include "EchoPayload.h"
-using namespace Swift;
-
-class EchoPayloadSerializer : public GenericPayloadSerializer<EchoPayload> {
+class EchoPayloadSerializer : public Swift::GenericPayloadSerializer<EchoPayload> {
public:
std::string serializePayload(boost::shared_ptr<EchoPayload> payload) const {
XMLElement element("echo", "http://swift.im/protocol/echo");
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript
index 1960609..c6349bd 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript
@@ -15,11 +15,11 @@ if env["PLATFORM"] == "win32" :
if int(env["MSVS_VERSION"].split(".")[0]) >= 10 :
cpp0x = True
else :
- pass
-# Disabling C++0x compilation, because older boosts are not compliant yet
-# if env["CCVERSION"].split(".") >= ["4", "5", "0"] :
-# cpp0x = True
-# cpp0x_env.Replace(CXXFLAGS = [flag for flag in env["CXXFLAGS"] if flag != "-Werror"])
-# cpp0x_env.Append(CXXFLAGS = ["-std=c++0x"])
+ if env["CCVERSION"].split(".") >= ["4", "5", "0"] :
+ # Temporarily disabling c++0x mode because of problems with boost::thread
+ # on some platforms
+ #cpp0x = True
+ cpp0x_env.Replace(CXXFLAGS = [flag for flag in env["CXXFLAGS"] if flag != "-Werror"])
+ cpp0x_env.Append(CXXFLAGS = ["-std=c++0x"])
if cpp0x :
cpp0x_env.Program("EchoBot0x", "EchoBot0x.cpp")
diff --git a/Documentation/SwiftenDevelopersGuide/SConscript b/Documentation/SwiftenDevelopersGuide/SConscript
index e000ac2..c50641f 100644
--- a/Documentation/SwiftenDevelopersGuide/SConscript
+++ b/Documentation/SwiftenDevelopersGuide/SConscript
@@ -87,6 +87,7 @@ if "doc" in ARGUMENTS :
sources = []
for i in range(1, 7) :
sources.append("Examples/EchoBot/EchoBot" + str(i) + ".cpp")
+sources.append("Examples/EchoBot/EchoBot0x.cpp")
sources += ["Examples/EchoBot/" + i for i in ["EchoPayloadParserFactory.h", "EchoPayloadSerializer.h", "EchoPayload.h", "EchoComponent.cpp"]]
for source in sources :
env.Command(source + ".xml", source, Action(generateDocBookCode, cmdstr = "$GENCOMSTR"))
diff --git a/Documentation/SwiftenDevelopersGuide/Swiften Developers Guide.xml b/Documentation/SwiftenDevelopersGuide/Swiften Developers Guide.xml
index e0daff3..fae79e4 100644
--- a/Documentation/SwiftenDevelopersGuide/Swiften Developers Guide.xml
+++ b/Documentation/SwiftenDevelopersGuide/Swiften Developers Guide.xml
@@ -94,7 +94,12 @@
<literal>connect()</literal> to instruct the client to connect to
the XMPP server with the given credentials. Note that this call returns
immediately; it is only when starting the event loop that network
- the actual connection process will start.
+ the actual connection process will start. The call to
+ <literal>setAlwaysTrustCertificates()</literal> before connecting
+ avoids checks for certificate validity; this is convenient for
+ the examples in this guide (because not all servers have trusted
+ certificates), but for production software, you should
+ not call this.
</para>
</sect1>
@@ -177,8 +182,20 @@
</para>
<para>
+ If you use a C++ compiler that supports C++0x lambda expressions (such as
+ GCC 4.5 or Microsoft Visual Studio 2010), you can write this example in a more
+ concise way, as illustrated in <xref linkend="Example-EchoBot0x"/>. However,
+ for the remainder of this guide, we will not use this functionality.
+ </para>
+ <example id="Example-EchoBot0x">
+ <title>EchoBot using C++0x lambda expressions. This is currently only possible with a limited set of C++compilers.</title>
+ <include xmlns="http://www.w3.org/2001/XInclude" href="Examples/EchoBot/EchoBot0x.cpp.xml" xpointer="xpointer(//programlisting|//calloutlist)"/>
+ </example>
+
+ <para>
Before moving on to the next step, we are going to rearrange our
- code a bit, to make it a bit cleaner. Instead of using global
+ code from <xref linkend="Example-EchoBot2"/> a bit, to make it a bit cleaner.
+ Instead of using global
variables, we are going to create an <literal>EchoBot</literal>
class with the current code in it. The resulting code can be found
in <xref linkend="Example-EchoBot3"/>.