From d47ee877be5d1175bdc36f2d87881ddaf875a8e9 Mon Sep 17 00:00:00 2001 From: Oleg Morozenkov Date: Mon, 23 Jul 2018 01:56:42 +0300 Subject: Refactor http clients, fix webhook server, add more samples, change tabs to 4 spaces --- include/tgbot/net/TgWebhookLocalServer.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'include/tgbot/net/TgWebhookLocalServer.h') diff --git a/include/tgbot/net/TgWebhookLocalServer.h b/include/tgbot/net/TgWebhookLocalServer.h index 685979d..d7cb06e 100644 --- a/include/tgbot/net/TgWebhookLocalServer.h +++ b/include/tgbot/net/TgWebhookLocalServer.h @@ -20,8 +20,8 @@ * SOFTWARE. */ -#ifndef TGBOT_TGWEBHOOKTCPSERVER_H -#define TGBOT_TGWEBHOOKTCPSERVER_H +#ifndef TGBOT_TGWEBHOOKLOCALSERVER_H +#define TGBOT_TGWEBHOOKLOCALSERVER_H #ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS @@ -37,19 +37,21 @@ namespace TgBot { class TgWebhookLocalServer : public TgWebhookServer { public: - TgWebhookLocalServer(std::shared_ptr>& acceptor, const std::string& path, EventHandler* eventHandler) = delete; - - TgWebhookLocalServer(const std::string& path, const EventHandler* eventHandler) : - TgWebhookServer(std::make_shared>(_ioService, boost::asio::local::stream_protocol::endpoint(path)), path, eventHandler) - { - } - - TgWebhookLocalServer(const std::string& path, const Bot& bot) : TgWebhookLocalServer(path, &bot.getEventHandler()) { - } + TgWebhookLocalServer(const std::string& unixSocketPath, const std::string& path, const EventHandler& eventHandler) + : TgWebhookServer(boost::asio::local::stream_protocol::endpoint(unixSocketPath), + path, eventHandler) + { + } + + TgWebhookLocalServer(const std::string& unixSocketPath, const Bot& bot) + : TgWebhookServer(boost::asio::local::stream_protocol::endpoint(unixSocketPath), + bot) + { + } }; } #endif //BOOST_ASIO_HAS_LOCAL_SOCKETS -#endif //TGBOT_TGWEBHOOKTCPSERVER_H +#endif //TGBOT_TGWEBHOOKLOCALSERVER_H -- cgit v1.2.3