Skip to content

Commit

Permalink
update to rmmi
Browse files Browse the repository at this point in the history
  • Loading branch information
Green-Sky committed Oct 6, 2024
1 parent 70bc3a4 commit f7471ca
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/chat_gui4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void ChatGui4::setClipboardData(std::vector<std::string> mime_types, std::shared
ChatGui4::ChatGui4(
ConfigModelI& conf,
ObjectStore2& os,
RegistryMessageModel& rmm,
RegistryMessageModelI& rmm,
Contact3Registry& cr,
TextureUploaderI& tu,
ContactTextureCache& contact_tc,
Expand Down
4 changes: 2 additions & 2 deletions src/chat_gui4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using MessageTextureCache = TextureCache<void*, Message3Handle, MessageImageLoad
class ChatGui4 {
ConfigModelI& _conf;
ObjectStore2& _os;
RegistryMessageModel& _rmm;
RegistryMessageModelI& _rmm;
Contact3Registry& _cr;

ContactTextureCache& _contact_tc;
Expand Down Expand Up @@ -60,7 +60,7 @@ class ChatGui4 {
ChatGui4(
ConfigModelI& conf,
ObjectStore2& os,
RegistryMessageModel& rmm,
RegistryMessageModelI& rmm,
Contact3Registry& cr,
TextureUploaderI& tu,
ContactTextureCache& contact_tc,
Expand Down
2 changes: 1 addition & 1 deletion src/main_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ MainScreen::MainScreen(SimpleConfigModel&& conf_, SDL_Renderer* renderer_, Theme

g_provideInstance<ConfigModelI>("ConfigModelI", "host", &conf);
g_provideInstance<Contact3Registry>("Contact3Registry", "1", "host", &cr);
g_provideInstance<RegistryMessageModel>("RegistryMessageModel", "host", &rmm);
g_provideInstance<RegistryMessageModelI>("RegistryMessageModelI", "host", &rmm);
g_provideInstance<MessageSerializerNJ>("MessageSerializerNJ", "host", &msnj);

g_provideInstance<ToxI>("ToxI", "host", &tc);
Expand Down
3 changes: 2 additions & 1 deletion src/main_screen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <solanaceae/util/simple_config_model.hpp>
#include <solanaceae/contact/contact_model3.hpp>
#include <solanaceae/message3/registry_message_model.hpp>
#include <solanaceae/message3/registry_message_model_impl.hpp>
#include <solanaceae/message3/message_time_sort.hpp>
#include <solanaceae/message3/message_serializer.hpp>
#include <solanaceae/plugin/plugin_manager.hpp>
Expand Down Expand Up @@ -58,7 +59,7 @@ struct MainScreen final : public Screen {

SimpleConfigModel conf;
Contact3Registry cr;
RegistryMessageModel rmm;
RegistryMessageModelImpl rmm;
MessageSerializerNJ msnj;
MessageTimeSort mts;

Expand Down
2 changes: 1 addition & 1 deletion src/media_meta_info_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void MediaMetaInfoLoader::handleMessage(const Message3Handle& m) {
_rmm.throwEventUpdate(m);
}

MediaMetaInfoLoader::MediaMetaInfoLoader(RegistryMessageModel& rmm) : _rmm(rmm) {
MediaMetaInfoLoader::MediaMetaInfoLoader(RegistryMessageModelI& rmm) : _rmm(rmm) {
// HACK: make them be added externally?
_image_loaders.push_back(std::make_unique<ImageLoaderWebP>());
_image_loaders.push_back(std::make_unique<ImageLoaderSDLBMP>());
Expand Down
4 changes: 2 additions & 2 deletions src/media_meta_info_loader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ namespace Message::Components {
// adds metadata to file messages
class MediaMetaInfoLoader : public RegistryMessageModelEventI {
protected:
RegistryMessageModel& _rmm;
RegistryMessageModelI& _rmm;

std::vector<std::unique_ptr<ImageLoaderI>> _image_loaders;

void handleMessage(const Message3Handle& m);

public:
MediaMetaInfoLoader(RegistryMessageModel& rmm);
MediaMetaInfoLoader(RegistryMessageModelI& rmm);
virtual ~MediaMetaInfoLoader(void);

protected: // rmm
Expand Down
6 changes: 3 additions & 3 deletions src/tox_friend_faux_offline_messaging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Contact::Components {

ToxFriendFauxOfflineMessaging::ToxFriendFauxOfflineMessaging(
Contact3Registry& cr,
RegistryMessageModel& rmm,
RegistryMessageModelI& rmm,
ToxContactModel2& tcm,
ToxI& t,
ToxEventProviderI& tep
Expand Down Expand Up @@ -54,7 +54,7 @@ float ToxFriendFauxOfflineMessaging::tick(float time_delta) {
// cleanup
if (_cr.all_of<Contact::Components::NextSendAttempt>(c)) {
_cr.remove<Contact::Components::NextSendAttempt>(c);
auto* mr = static_cast<const RegistryMessageModel&>(_rmm).get(c);
auto* mr = static_cast<const RegistryMessageModelI&>(_rmm).get(c);
if (mr != nullptr) {
mr->storage<Message::Components::LastSendAttempt>().clear();
}
Expand Down Expand Up @@ -99,7 +99,7 @@ ToxFriendFauxOfflineMessaging::dfmc_Ret ToxFriendFauxOfflineMessaging::doFriendM
// unacked message
// timeouts for exising unacked messages expired (send)

auto* mr = static_cast<const RegistryMessageModel&>(_rmm).get(c);
auto* mr = static_cast<const RegistryMessageModelI&>(_rmm).get(c);
if (mr == nullptr) {
// no messages
return dfmc_Ret::NO_MSG;
Expand Down
4 changes: 2 additions & 2 deletions src/tox_friend_faux_offline_messaging.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Contact::Components {
// timers get reset on connection changes, and send order is preserved.
class ToxFriendFauxOfflineMessaging : public ToxEventI {
Contact3Registry& _cr;
RegistryMessageModel& _rmm;
RegistryMessageModelI& _rmm;
ToxContactModel2& _tcm;
ToxI& _t;
ToxEventProviderI& _tep;
Expand All @@ -30,7 +30,7 @@ class ToxFriendFauxOfflineMessaging : public ToxEventI {
public:
ToxFriendFauxOfflineMessaging(
Contact3Registry& cr,
RegistryMessageModel& rmm,
RegistryMessageModelI& rmm,
ToxContactModel2& tcm,
ToxI& t,
ToxEventProviderI& tep
Expand Down

0 comments on commit f7471ca

Please sign in to comment.