summaryrefslogtreecommitdiff
path: root/src/bridge/bridge.hpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-10-03 00:58:21 +0200
committerlouiz’ <louiz@louiz.org>2016-10-03 01:08:48 +0200
commit76a8189b46177eb78eee12d1cb3266f282acd380 (patch)
tree4db56bf37cd37c42c469e78bf6c10040ca8c014c /src/bridge/bridge.hpp
parentffad4306b9e9c6065a01a5fcaca668d70af0db8a (diff)
downloadbiboumi-76a8189b46177eb78eee12d1cb3266f282acd380.tar.gz
biboumi-76a8189b46177eb78eee12d1cb3266f282acd380.tar.bz2
biboumi-76a8189b46177eb78eee12d1cb3266f282acd380.tar.xz
biboumi-76a8189b46177eb78eee12d1cb3266f282acd380.zip
Implement result-set-management for LIST queries
ref #2948
Diffstat (limited to 'src/bridge/bridge.hpp')
-rw-r--r--src/bridge/bridge.hpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp
index b278ea7..1a1d201 100644
--- a/src/bridge/bridge.hpp
+++ b/src/bridge/bridge.hpp
@@ -1,5 +1,7 @@
#pragma once
+#include <bridge/result_set_management.hpp>
+#include <bridge/list_element.hpp>
#include <irc/irc_message.hpp>
#include <irc/irc_client.hpp>
@@ -17,6 +19,7 @@
class BiboumiComponent;
class Poller;
+class ResultSetInfo;
/**
* A callback called for each IrcMessage we receive. If the message triggers
@@ -87,8 +90,19 @@ public:
void send_irc_version_request(const std::string& irc_hostname, const std::string& target,
const std::string& iq_id, const std::string& to_jid,
const std::string& from_jid);
- void send_irc_channel_list_request(const Iid& iid, const std::string& iq_id,
- const std::string& to_jid);
+ void send_irc_channel_list_request(const Iid& iid, const std::string& iq_id, const std::string& to_jid,
+ ResultSetInfo rs_info);
+ /**
+ * Check if the channel list contains what is needed to answer the RSM request,
+ * if it does, send the iq result. If the list is complete but does not contain
+ * everything, send the result anyway (because there are no more available
+ * channels that could complete the list).
+ *
+ * Returns true if we sent the answer.
+ */
+ bool send_matching_channel_list(const ChannelList& channel_list,
+ const ResultSetInfo& rs_info, const std::string& id, const std::string& to_jid,
+ const std::string& from);
void forward_affiliation_role_change(const Iid& iid, const std::string& nick,
const std::string& affiliation, const std::string& role);
/**
@@ -271,7 +285,6 @@ private:
* response iq.
*/
std::vector<irc_responder_callback_t> waiting_irc;
-
/**
* Resources to IRC channel/server mapping:
*/
@@ -300,6 +313,13 @@ private:
* TODO: send message history
*/
void generate_channel_join_for_resource(const Iid& iid, const std::string& resource);
+ /**
+ * A cache of the channels list (as returned by the server on a LIST
+ * request), to be re-used on a subsequent XMPP list request that
+ * uses result-set-management.
+ */
+ std::map<IrcHostname, ChannelList> channel_list_cache;
+
#ifdef USE_DATABASE
bool record_history { true };
#endif