summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-12-06 17:54:46 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-12-06 17:54:46 (GMT)
commita38a702e8dd10a5abdd8cebe245c0cd31d6c4ddc (patch)
treee31e41babaf5eb5f32fbe935cadeb49af6241eaa /Documentation/SwiftenDevelopersGuide
parentf32492bec456866fb5101274e6789efc59a47bdc (diff)
downloadswift-a38a702e8dd10a5abdd8cebe245c0cd31d6c4ddc.zip
swift-a38a702e8dd10a5abdd8cebe245c0cd31d6c4ddc.tar.bz2
Fixed EchoComponent example.
Diffstat (limited to 'Documentation/SwiftenDevelopersGuide')
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp
index 4843b80..397bc21 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp
@@ -14,9 +14,9 @@ using namespace boost;
class EchoComponent {
public:
- EchoComponent(EventLoop* eventLoop, NetworkFactories* networkFactories) {
+ EchoComponent(EventLoop* eventLoop, NetworkFactories* networkFactories) : jid("echo.wonderland.lit") {
component = new Component(eventLoop, networkFactories,
- JID("echo.wonderland.lit"), "EchoSecret");
+ jid, "EchoSecret");
component->onConnected.connect(bind(&EchoComponent::handleConnected, this));
component->onMessageReceived.connect(
bind(&EchoComponent::handleMessageReceived, this, _1));
@@ -48,11 +48,12 @@ class EchoComponent {
void handleMessageReceived(Message::ref message) {
// Echo back the incoming message
message->setTo(message->getFrom());
- message->setFrom(JID());
+ message->setFrom(jid);
component->sendMessage(message);
}
private:
+ JID jid;
Component* component;
ComponentXMLTracer* tracer;
};