Merge remote-tracking branch 'origin/master' into new-event-store
Conflicts: CMakeLists.txt io.github.NhekoReborn.Nheko.json src/Cache.cpp src/timeline/TimelineModel.cpp src/timeline/TimelineModel.h src/timeline/TimelineViewManager.cpp
This commit is contained in:
commit
de7ec4d2b3
44 changed files with 4066 additions and 74 deletions
|
|
@ -1,5 +1,7 @@
|
|||
#include "EventAccessors.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <type_traits>
|
||||
|
||||
namespace {
|
||||
|
|
@ -65,6 +67,29 @@ struct EventRoomTopic
|
|||
}
|
||||
};
|
||||
|
||||
struct CallType
|
||||
{
|
||||
template<class T>
|
||||
std::string operator()(const T &e)
|
||||
{
|
||||
if constexpr (std::is_same_v<mtx::events::RoomEvent<mtx::events::msg::CallInvite>,
|
||||
T>) {
|
||||
const char video[] = "m=video";
|
||||
const std::string &sdp = e.content.sdp;
|
||||
return std::search(sdp.cbegin(),
|
||||
sdp.cend(),
|
||||
std::cbegin(video),
|
||||
std::cend(video) - 1,
|
||||
[](unsigned char c1, unsigned char c2) {
|
||||
return std::tolower(c1) == std::tolower(c2);
|
||||
}) != sdp.cend()
|
||||
? "video"
|
||||
: "voice";
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
};
|
||||
|
||||
struct EventBody
|
||||
{
|
||||
template<class C>
|
||||
|
|
@ -339,6 +364,12 @@ mtx::accessors::room_topic(const mtx::events::collections::TimelineEvents &event
|
|||
return std::visit(EventRoomTopic{}, event);
|
||||
}
|
||||
|
||||
std::string
|
||||
mtx::accessors::call_type(const mtx::events::collections::TimelineEvents &event)
|
||||
{
|
||||
return std::visit(CallType{}, event);
|
||||
}
|
||||
|
||||
std::string
|
||||
mtx::accessors::body(const mtx::events::collections::TimelineEvents &event)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue