Some more thoughts
This commit is contained in:
parent
b997972ec1
commit
bc2dc9bf07
18 changed files with 146 additions and 42 deletions
|
@ -5,7 +5,8 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
Message::Message(const std::shared_ptr<Config>& config, const std::shared_ptr<gloox::Client>& client):
|
||||
Message::Message(const std::shared_ptr<Config>& config, const std::shared_ptr<gloox::Client>& client, const Callback& callback):
|
||||
callback(callback),
|
||||
config(config),
|
||||
client(client)
|
||||
{
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
|
||||
#include <gloox/client.h>
|
||||
#include <gloox/messagehandler.h>
|
||||
|
@ -12,13 +14,17 @@
|
|||
#include "component/config.h"
|
||||
|
||||
class Message : public gloox::MessageHandler {
|
||||
private:
|
||||
typedef std::function<void (const std::string&, const std::string&)> Callback;
|
||||
|
||||
public:
|
||||
Message(const std::shared_ptr<Config>& config, const std::shared_ptr<gloox::Client>& client);
|
||||
Message(const std::shared_ptr<Config>& config, const std::shared_ptr<gloox::Client>& client, const Callback& callback);
|
||||
~Message();
|
||||
|
||||
void handleMessage(const gloox::Message& message, gloox::MessageSession* session = 0) override;
|
||||
|
||||
private:
|
||||
Callback callback;
|
||||
std::weak_ptr<Config> config;
|
||||
std::weak_ptr<gloox::Client> client;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue