From 7a4cea426d0a07d577753ee008416e19eca6260d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Tue, 24 Jul 2018 23:14:35 +0200 Subject: Reflect messages to XMPP only when they are actually sent --- src/irc/irc_client.hpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/irc/irc_client.hpp') diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp index 8c5c0c8..aa314f8 100644 --- a/src/irc/irc_client.hpp +++ b/src/irc/irc_client.hpp @@ -21,6 +21,10 @@ #include #include +class IrcClient; + +using MessageCallback = std::function; + class Bridge; /** @@ -86,9 +90,9 @@ public: * (actually, into our out_buf and signal the poller that we want to wach * for send events to be ready) */ - void send_message(IrcMessage message, bool throttle=true); + void send_message(IrcMessage message, MessageCallback callback={}, bool throttle=true); void send_raw(const std::string& txt); - void actual_send(const IrcMessage& message); + void actual_send(std::pair message_pair); /** * Send the PONG irc command */ @@ -117,7 +121,8 @@ public: * Send a PRIVMSG command for a channel * Return true if the message was actually sent */ - bool send_channel_message(const std::string& chan_name, const std::string& body); + bool send_channel_message(const std::string& chan_name, const std::string& body, + MessageCallback callback); /** * Send a PRIVMSG command for an user */ @@ -336,7 +341,7 @@ private: /** * Where messaged are stored when they are throttled. */ - std::deque message_queue{}; + std::deque> message_queue{}; /** * The list of joined channels, indexed by name */ -- cgit v1.2.3