diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-12-04 15:40:40 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-12-04 15:40:40 (GMT) |
commit | bf5b66e7a8252fd1d9db26f5822c393e24ad091a (patch) | |
tree | a3dfe81e4bacd9d45fef5183da38b28854e62b0b /Documentation/SwiftenDevelopersGuide | |
parent | bbf8a5fcb47d649bdcee1b2122eaa76f2c914ef7 (diff) | |
download | swift-contrib-bf5b66e7a8252fd1d9db26f5822c393e24ad091a.zip swift-contrib-bf5b66e7a8252fd1d9db26f5822c393e24ad091a.tar.bz2 |
Document custom requests & responders, and components.
Diffstat (limited to 'Documentation/SwiftenDevelopersGuide')
3 files changed, 33 insertions, 5 deletions
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp index a4155be..4843b80 100644 --- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp +++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp @@ -15,7 +15,8 @@ using namespace boost; class EchoComponent { public: EchoComponent(EventLoop* eventLoop, NetworkFactories* networkFactories) { - component = new Component(eventLoop, networkFactories, JID("echo.wonderland.lit"), "EchoSecret"); + component = new Component(eventLoop, networkFactories, + JID("echo.wonderland.lit"), "EchoSecret"); component->onConnected.connect(bind(&EchoComponent::handleConnected, this)); component->onMessageReceived.connect( bind(&EchoComponent::handleMessageReceived, this, _1)); diff --git a/Documentation/SwiftenDevelopersGuide/SConscript b/Documentation/SwiftenDevelopersGuide/SConscript index 54a3ad2..e000ac2 100644 --- a/Documentation/SwiftenDevelopersGuide/SConscript +++ b/Documentation/SwiftenDevelopersGuide/SConscript @@ -87,7 +87,7 @@ if "doc" in ARGUMENTS : sources = [] for i in range(1, 7) : sources.append("Examples/EchoBot/EchoBot" + str(i) + ".cpp") -sources += ["Examples/EchoBot/" + i for i in ["EchoPayloadParserFactory.h", "EchoPayloadSerializer.h", "EchoPayload.h"]] +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 ea4ccd4..e0daff3 100644 --- a/Documentation/SwiftenDevelopersGuide/Swiften Developers Guide.xml +++ b/Documentation/SwiftenDevelopersGuide/Swiften Developers Guide.xml @@ -202,7 +202,7 @@ </para> </sect1> - <sect1> + <sect1 id="Section-Requests"> <title>Presence Management: Requests</title> <para> The current version of our EchoBot does what it is supposed to do: @@ -252,7 +252,7 @@ </para> </sect1> - <sect1> + <sect1 id="Section-Responders"> <title>Publishing version information: Responders</title> <para> Most XMPP clients have support for querying software version information @@ -377,7 +377,16 @@ <sect1 id="Section-CustomQueries"> <title>Extending Swiften with new queries and responders</title> - <remark>TODO</remark> + <para> + <xref linkend="Section-Requests"/> and <xref linkend="Section-Responders"/> + explained that Swiften provides Requests and Responder classes for querying + or responding to queries of specific payloads. If you extend Swiften with your + own payloads, you can use these to create your own <literal>Request</literal> + or <literal>Responder</literal> subclasses. Swiften also provides convenience + classes such as <literal>GenericRequest</literal>, <literal>GetResponder</literal> + and <literal>SetResponder</literal> for creating your requests and responders + for your custom payloads. + </para> </sect1> <sect1> @@ -395,6 +404,24 @@ management, VCards, Avatars, Service Discovery, Multi-User Chats, ... </para> </sect1> + + <sect1> + <title>Writing server components</title> + <para> + Swiften also provides classes for creating server components. The + <literal>Component</literal> class has a similar interface + as <literal>Client</literal>, but uses the component protocol to connect with + the XMPP server. Except for a few classes, the same techniques and classes for + writing clients can be applied to write components. + <xref linkend="Example-EchoComponent"/> illustrates how we would build a + component version of our Echo bot. + </para> + + <example id="Example-EchoComponent"> + <title>EchoBot as a server component</title> + <include xmlns="http://www.w3.org/2001/XInclude" href="Examples/EchoBot/EchoComponent.cpp.xml" xpointer="xpointer(//programlisting|//calloutlist)"/> + </example> + </sect1> </chapter> <bibliography> |