#pragma once #include #include #include #include #include #include #include #include // tmp class IRCClientContactModel : public IRCClientEventI, public ContactModel3I { Contact3Registry& _cr; ConfigModelI& _conf; IRCClient1& _ircc; IRCClient1::SubscriptionReference _ircc_sr; // cm needs the connect event to happen bool _connected {false}; std::vector _server_hash; // cached for id gen Contact3 _server = entt::null; Contact3 _self = entt::null; // used if not connected std::queue _join_queue; public: IRCClientContactModel( Contact3Registry& cr, ConfigModelI& conf, IRCClient1& ircc ); virtual ~IRCClientContactModel(void); void join(const std::string& channel); private: // just the hash algo std::vector getHash(std::string_view value); std::vector getHash(const std::vector& value); public: // the actually ID is a chain containing the server+channel or server+name // eg: hash(hash(ServerName)+ChannelName) std::vector getIDHash(std::string_view name); Contact3Handle getC(std::string_view channel); Contact3Handle getU(std::string_view nick); // user or channel using channel prefix Contact3Handle getCU(std::string_view name); private: // ircclient bool onEvent(const IRCClient::Events::Connect& e) override; bool onEvent(const IRCClient::Events::Numeric& e) override; bool onEvent(const IRCClient::Events::Join& e) override; bool onEvent(const IRCClient::Events::Part& e) override; bool onEvent(const IRCClient::Events::Topic& e) override; bool onEvent(const IRCClient::Events::Quit& e) override; bool onEvent(const IRCClient::Events::CTCP_Req&) override; bool onEvent(const IRCClient::Events::Disconnect&) override; };