diff options
Diffstat (limited to 'src/bridge/bridge.hpp')
-rw-r--r-- | src/bridge/bridge.hpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp index 8e7d9d7..6b15478 100644 --- a/src/bridge/bridge.hpp +++ b/src/bridge/bridge.hpp @@ -72,16 +72,14 @@ public: **/ /** - * Try to join an irc_channel, does nothing and return true if the channel - * was already joined. + * Try to join an irc_channel. */ bool join_irc_channel(const Iid& iid, std::string nickname, const std::string& password, const std::string& resource, - HistoryLimit history_limit, - const bool force_join); + HistoryLimit history_limit); - void send_channel_message(const Iid& iid, const std::string& body, std::string id); + void send_channel_message(const Iid& iid, const std::string& body, std::string id, std::vector<XmlNode> nodes_to_reflect); void send_private_message(const Iid& iid, const std::string& body, const std::string& type="PRIVMSG"); void send_raw_message(const std::string& hostname, const std::string& body); void leave_irc_channel(Iid&& iid, const std::string& status_message, const std::string& resource); @@ -164,9 +162,9 @@ public: void send_room_history(const std::string& hostname, const std::string& chan_name, const HistoryLimit& history_limit); void send_room_history(const std::string& hostname, std::string chan_name, const std::string& resource, const HistoryLimit& history_limit); /** - * Send a MUC message from some participant + * Send a message from a MUC participant or a direct message */ - void send_message(const Iid& iid, const std::string& nick, const std::string& body, const bool muc); + void send_message(const Iid& iid, const std::string& nick, const std::string& body, const bool muc, const bool log=true); /** * Send a presence of type error, from a room. */ @@ -241,8 +239,8 @@ public: * iq_responder_callback_t and remove the callback from the list. */ void trigger_on_irc_message(const std::string& irc_hostname, const IrcMessage& message); - std::unordered_map<std::string, std::shared_ptr<IrcClient>>& get_irc_clients(); - const std::unordered_map<std::string, std::shared_ptr<IrcClient>>& get_irc_clients() const; + std::unordered_map<std::string, std::unique_ptr<IrcClient>>& get_irc_clients(); + const std::unordered_map<std::string, std::unique_ptr<IrcClient>>& get_irc_clients() const; std::set<char> get_chantypes(const std::string& hostname) const; #ifdef USE_DATABASE void set_record_history(const bool val); @@ -275,7 +273,7 @@ private: * One IrcClient for each IRC server we need to be connected to. * The pointer is shared by the bridge and the poller. */ - std::unordered_map<std::string, std::shared_ptr<IrcClient>> irc_clients; + std::unordered_map<std::string, std::unique_ptr<IrcClient>> irc_clients; /** * To communicate back with the XMPP component */ @@ -316,13 +314,14 @@ private: */ void add_resource_to_chan(const ChannelKey& channel, const std::string& resource); void remove_resource_from_chan(const ChannelKey& channel, const std::string& resource); +public: bool is_resource_in_chan(const ChannelKey& channel, const std::string& resource) const; +private: void remove_all_resources_from_chan(const ChannelKey& channel); std::size_t number_of_resources_in_chan(const ChannelKey& channel) const; void add_resource_to_server(const IrcHostname& irc_hostname, const std::string& resource); void remove_resource_from_server(const IrcHostname& irc_hostname, const std::string& resource); - bool is_resource_in_server(const IrcHostname& irc_hostname, const std::string& resource) const; size_t number_of_channels_the_resource_is_in(const std::string& irc_hostname, const std::string& resource) const; /** |