diff options
author | louiz’ <louiz@louiz.org> | 2018-07-24 23:14:35 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2018-07-24 23:16:14 +0200 |
commit | 7a4cea426d0a07d577753ee008416e19eca6260d (patch) | |
tree | 6fb72dbdb0c6834000794715ade3cf7d75f25a0b /src/irc/irc_client.hpp | |
parent | a43fb352c85e1a0b428e6fba4c01093c8cd13a98 (diff) | |
download | biboumi-7a4cea426d0a07d577753ee008416e19eca6260d.tar.gz biboumi-7a4cea426d0a07d577753ee008416e19eca6260d.tar.bz2 biboumi-7a4cea426d0a07d577753ee008416e19eca6260d.tar.xz biboumi-7a4cea426d0a07d577753ee008416e19eca6260d.zip |
Reflect messages to XMPP only when they are actually sent
Diffstat (limited to 'src/irc/irc_client.hpp')
-rw-r--r-- | src/irc/irc_client.hpp | 13 |
1 files changed, 9 insertions, 4 deletions
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 <set> #include <utils/tokens_bucket.hpp> +class IrcClient; + +using MessageCallback = std::function<void(const IrcClient*, const IrcMessage&)>; + 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<IrcMessage, MessageCallback> 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<IrcMessage> message_queue{}; + std::deque<std::pair<IrcMessage, MessageCallback>> message_queue{}; /** * The list of joined channels, indexed by name */ |