8#include <spdlog/spdlog.h>
26 std::shared_ptr<async::async_queue<events::display_filter_input_t>>
display;
43 std::visit([
this](
const auto &evt) { this->
handle(evt); }, event);
53 const auto &sender_display = evt.sender_alias.empty() ? evt.sender_rdx : evt.sender_alias;
57 "Message from {}: {}\n",
72 "Encrypted session established with {}\n",
83 spdlog::debug(
"Received bundle announcement from {}", evt.pubkey);
93 spdlog::debug(
"Bundle announcement removed for {}", evt.pubkey);
110 "Failed to send message to {}\n",
127 "Identity bundle published (event: {})\n",
133 "Failed to publish identity bundle\n");
144 spdlog::debug(
"Subscription established: {}", evt.subscription_id);
155 if (evt.identities.empty()) {
159 for (
const auto &identity : evt.identities) {
164 identity.rdx_fingerprint,
165 identity.nostr_pubkey);
171 std::shared_ptr<async::async_queue<events::display_filter_input_t>> display_out_queue_;
173 template<
typename... Args>
175 std::optional<std::string> contact_rdx,
176 std::uint64_t timestamp,
177 fmt::format_string<Args...> format_string,
178 Args &&...args)
const ->
void
180 display_out_queue_->push(
182 .contact_rdx = std::move(contact_rdx),
183 .timestamp = timestamp,
184 .source_type = source_type });
Thread-safe asynchronous queue for message passing between coroutines.
std::variant< message_received, session_established, bundle_announcement_received, bundle_announcement_removed, message_sent, bundle_published, subscription_established, identities_listed > presentation_event_variant_t
Variant type for presentation events.
Notification of received bundle announcement.
Notification of removed bundle announcement.
Notification of published bundle status.
Request to display a message to the user.
@ outgoing_message
User sent a message.
@ system
System messages (always show)
@ bundle_announcement
Bundle published/removed.
@ session_event
Session established/lost.
@ incoming_message
Received message from contact.
std::string message
Message content to display.
Response containing discovered identities.
Notification of received encrypted message.
Notification of sent message status.
Notification of successfully established session.
Notification of established subscription.
std::shared_ptr< async::async_queue< events::display_filter_input_t > > display
Handles presentation events and generates user-facing messages.
auto handle(const events::bundle_published &evt) const -> void
Handles a bundle published event.
auto handle(const events::presentation_event_variant_t &event) const -> void
Variant handler for standard_processor.
presentation_handler(const out_queues_t &queues)
Constructs a presentation handler.
auto handle(const events::identities_listed &evt) const -> void
Handles an identities listed event.
auto handle(const events::message_received &evt) const -> void
Handles a received encrypted message event.
static auto handle(const events::bundle_announcement_received &evt) -> void
Handles a bundle announcement received event.
static auto handle(const events::subscription_established &evt) -> void
Handles a subscription established event.
auto handle(const events::session_established &evt) const -> void
Handles a session established event.
auto handle(const events::message_sent &evt) const -> void
Handles a message sent event.
static auto handle(const events::bundle_announcement_removed &evt) -> void
Handles a bundle announcement removed event.