A crash fix, as well as fixes for the latest matrix_client #26

Merged
kallisti5 merged 6 commits from fixes into master 2023-12-29 20:28:16 -06:00
Showing only changes of commit 4964605432 - Show all commits

View File

@ -282,6 +282,20 @@ room_sync(mtx::responses::Rooms rooms)
app->fRoomList.Add(BString(chat_id)); app->fRoomList.Add(BString(chat_id));
} }
// Grab the latest room metadata
BMessage metadataMsg(IM_MESSAGE);
metadataMsg.AddInt32("im_what", IM_ROOM_METADATA);
metadataMsg.AddString("chat_id", chat_id);
for (const auto &e : room.state.events) {
auto ev = std::get_if<mtx::events::StateEvent<mtx::events::state::Name>>(&e);
if (ev != nullptr) {
metadataMsg.AddString("chat_name", ev->content.name.c_str());
break;
}
}
((MatrixApp*)be_app)->SendMessage(metadataMsg);
// Grab the room timeline and add it
for (mtx::events::collections::TimelineEvents &ev : room.timeline.events) for (mtx::events::collections::TimelineEvents &ev : room.timeline.events)
if (auto event = std::get_if<mtx::events::RoomEvent<mtx::events::msg::Text>>(&ev); if (auto event = std::get_if<mtx::events::RoomEvent<mtx::events::msg::Text>>(&ev);
event != nullptr) event != nullptr)