From 0a185a13aa4c202ad8d76ac3e62a878dc5f06619 Mon Sep 17 00:00:00 2001 From: Michael Jurkoic Date: Sun, 7 Apr 2024 13:45:33 -0500 Subject: Remove default event handling Caching events and fetching them in batches is out of scope for NostrService. In the future, an additional service should be added to the library that handles local event caching and provides some default handlers for incoming messages from relays. --- include/nostr.hpp | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'include') diff --git a/include/nostr.hpp b/include/nostr.hpp index 5f5ce25..e450505 100644 --- a/include/nostr.hpp +++ b/include/nostr.hpp @@ -160,15 +160,6 @@ public: */ std::tuple publishEvent(std::shared_ptr event); - /** - * @brief Queries all open relay connections for events matching the given set of filters. - * @param filters The filters to use for the query. - * @returns The ID of the subscription created for the query. - * @remarks The service will store a limited number of events returned from the relay for the - * given filters. These events may be retrieved via `getNewEvents`. - */ - std::string queryRelays(std::shared_ptr filters); - /** * @brief Queries all open relay connections for events matching the given set of filters. * @param filters The filters to use for the query. @@ -182,20 +173,6 @@ public: std::string queryRelays( std::shared_ptr filters, std::function)> responseHandler); - - /** - * @brief Get any new events received since the last call to this method, across all - * subscriptions. - * @returns A pointer to a vector of new events. - */ - std::vector> getNewEvents(); - - /** - * @brief Get any new events received since the last call to this method, for the given - * subscription. - * @returns A pointer to a vector of new events. - */ - std::vector> getNewEvents(std::string subscriptionId); /** * @brief Closes the subscription with the given ID on all open relay connections. @@ -238,10 +215,6 @@ private: RelayList _activeRelays; ///< A map from relay URIs to the subscription IDs open on each relay. std::unordered_map> _subscriptions; - ///< A map from subscription IDs to the events returned by the relays for each subscription. - std::unordered_map>> _events; - ///< A map from the subscription IDs to the ID of the latest read event for each subscription. - std::unordered_map _lastRead; /** * @brief Determines which of the given relays are currently connected. @@ -301,15 +274,6 @@ private: void onMessage( std::string message, std::function)> eventHandler); - - /** - * @brief A default message handler for events returned from relay queries. - * @param subscriptionId The ID of the subscription for which the event was received. - * @param event The event received from the relay. - * @remark By default, new events are stored in a map of subscription IDs to vectors of events. - * Events are retrieved by calling `getNewEvents` or `getNewEvents(subscriptionId)`. - */ - void onEvent(std::string subscriptionId, std::shared_ptr event); }; class ISigner -- cgit