Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F116495
matrix-room-list.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
matrix-room-list.cpp
View Options
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2020 Tusooa Zhu <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include
<libkazv-config.hpp>
#include
<immer/config.hpp>
// https://github.com/arximboldi/immer/issues/168
#include
<lager/constant.hpp>
#include
<lager/lenses/optional.hpp>
#include
"matrix-room-list.hpp"
#include
"matrix-room.hpp"
#include
"helper.hpp"
MatrixRoomList
::
MatrixRoomList
(
Kazv
::
Client
client
,
QObject
*
parent
)
:
QObject
(
parent
)
,
m_client
(
client
)
,
m_roomIds
(
m_client
.
roomIds
())
,
LAGER_QT
(
count
)(
m_roomIds
.
xform
(
containerSize
))
,
LAGER_QT
(
roomIds
)(
m_roomIds
.
xform
(
zug
::
map
(
[](
auto
container
)
{
return
zug
::
into
(
QStringList
{},
strToQt
,
std
::
move
(
container
));
})))
{
}
MatrixRoomList
::~
MatrixRoomList
()
=
default
;
MatrixRoom
*
MatrixRoomList::at
(
int
index
)
const
{
qDebug
()
<<
"Room at index "
<<
index
<<
" requested"
;
return
new
MatrixRoom
(
m_client
.
roomByCursor
(
lager
::
with
(
m_roomIds
,
lager
::
make_constant
(
index
))
.
xform
(
zug
::
map
([](
auto
ids
,
auto
i
)
{
try
{
return
ids
.
at
(
i
);
}
catch
(
const
std
::
out_of_range
&
)
{
return
std
::
string
{};
}
}))));
}
QString
MatrixRoomList::roomIdAt
(
int
index
)
const
{
using
namespace
Kazv
::
CursorOp
;
return
+
m_roomIds
[
index
][
lager
::
lenses
::
or_default
].
xform
(
strToQt
);
}
MatrixRoom
*
MatrixRoomList
::
room
(
QString
roomId
)
const
{
return
new
MatrixRoom
(
m_client
.
room
(
roomId
.
toStdString
()));
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sun, Dec 1, 5:18 PM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41760
Default Alt Text
matrix-room-list.cpp (1 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment