summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/SwiftenDevelopersGuide/Examples')
-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;
};