port to contact4

This commit is contained in:
Green Sky 2025-03-10 23:00:57 +01:00
parent 5b0dd13598
commit a67f41b4a3
No known key found for this signature in database
GPG Key ID: DBE05085D874AB4A
3 changed files with 14 additions and 7 deletions

@ -3,6 +3,8 @@
#include <entt/entt.hpp>
#include <entt/fwd.hpp>
#include <solanaceae/contact/contact_store_i.hpp>
#include "message_n10n.hpp"
#include <iostream>
@ -29,7 +31,7 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api)
}
try {
auto* cr = PLUG_RESOLVE_INSTANCE_VERSIONED(Contact3Registry, "1");
auto* cs = PLUG_RESOLVE_INSTANCE(ContactStore4I);
auto* rmm = PLUG_RESOLVE_INSTANCE(RegistryMessageModelI);
// static store, could be anywhere tho

@ -1,5 +1,7 @@
#include "./message_n10n.hpp"
#include <solanaceae/contact/contact_store_i.hpp>
#include <solanaceae/message3/components.hpp>
#include <solanaceae/contact/components.hpp>
@ -30,7 +32,7 @@ class OurHandler : public WinToastLib::IWinToastHandler {
};
MessageN10n::MessageN10n(Contact3Registry& cr, RegistryMessageModelI& rmm) : _cr(cr), _rmm(rmm), _rmm_sr(_rmm.newSubRef(this)) {
MessageN10n::MessageN10n(ContactStore4I& cs, RegistryMessageModelI& rmm) : _cs(cs), _rmm(rmm), _rmm_sr(_rmm.newSubRef(this)) {
// Register WinToast App User Model
WinToastLib::WinToast::instance()->setAppName(L"Tomato");
const auto aumi = WinToastLib::WinToast::configureAUMI(L"green", L"solanaceae", L"solanaceae_message_n10n", L"20240517");
@ -65,17 +67,19 @@ bool MessageN10n::onEvent(const Message::Events::MessageConstruct& e) {
const auto sender_c = e.e.get<Message::Components::ContactFrom>().c;
if (_cr.all_of<Contact::Components::TagSelfStrong>(sender_c)) {
const auto& cr = _cs.registry();
if (cr.all_of<Contact::Components::TagSelfStrong>(sender_c)) {
return false;
}
if (!_cr.all_of<
if (!cr.all_of<
Contact::Components::Name
>(sender_c)) {
return false;
}
std::string title {
_cr.get<Contact::Components::Name>(sender_c).name
cr.get<Contact::Components::Name>(sender_c).name
};
if (title.empty()) {

@ -1,14 +1,15 @@
#pragma once
#include <solanaceae/contact/fwd.hpp>
#include <solanaceae/message3/registry_message_model.hpp>
class MessageN10n : public RegistryMessageModelEventI {
Contact3Registry& _cr;
ContactStore4I& _cs;
RegistryMessageModelI& _rmm;
RegistryMessageModelI::SubscriptionReference _rmm_sr;
public:
MessageN10n(Contact3Registry& cr, RegistryMessageModelI& rmm);
MessageN10n(ContactStore4I& cs, RegistryMessageModelI& rmm);
virtual ~MessageN10n(void);
protected: // rmm