Page MenuHomePhorge

D296.1774652963.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D296.1774652963.diff

diff --git a/src/client/room/room-model.hpp b/src/client/room/room-model.hpp
--- a/src/client/room/room-model.hpp
+++ b/src/client/room/room-model.hpp
@@ -120,6 +120,13 @@
std::string localDraft;
};
+ struct SetDraftRelAction
+ {
+ std::string draftReltype;
+ std::string draftRelTo;
+ std::string oldDraft;
+ };
+
struct SetRoomEncryptionAction
{
};
@@ -257,6 +264,9 @@
immer::map<std::string, Event> ephemeral;
std::string localDraft;
+ std::string oldDraft;
+ std::string draftRelType;
+ std::string draftRelTo;
bool encrypted{false};
/// a marker to indicate whether we need to rotate
@@ -377,6 +387,7 @@
ChangeInviteStateAction,
AddEphemeralAction,
SetLocalDraftAction,
+ SetDraftRelAction,
SetRoomEncryptionAction,
MarkMembersFullyLoadedAction,
SetHeroIdsAction,
@@ -442,6 +453,9 @@
& r.ephemeral
& r.localDraft
+ & r.oldDraft
+ & r.draftRelType
+ & r.draftRelTo
& r.encrypted
& r.shouldRotateSessionKey
diff --git a/src/client/room/room-model.cpp b/src/client/room/room-model.cpp
--- a/src/client/room/room-model.cpp
+++ b/src/client/room/room-model.cpp
@@ -280,6 +280,12 @@
r.localDraft = a.localDraft;
return r;
},
+ [&](SetDraftRelAction a) {
+ r.draftRelType = a.draftReltype;
+ r.draftRelTo = a.draftRelTo;
+ r.oldDraft = a.oldDraft;
+ return r;
+ },
[&](SetRoomEncryptionAction) {
r.encrypted = true;
return r;
diff --git a/src/client/room/room.hpp b/src/client/room/room.hpp
--- a/src/client/room/room.hpp
+++ b/src/client/room/room.hpp
@@ -337,6 +337,12 @@
KAZV_WRAP_ATTR(RoomModel, roomCursor(), membership);
/*lager::reader<std::string>*/
KAZV_WRAP_ATTR(RoomModel, roomCursor(), localDraft);
+ /*lager::reader<std::string>*/
+ KAZV_WRAP_ATTR(RoomModel, roomCursor(), oldDraft);
+ /*lager::reader<std::string>*/
+ KAZV_WRAP_ATTR(RoomModel, roomCursor(), draftRelType);
+ /*lager::reader<std::string>*/
+ KAZV_WRAP_ATTR(RoomModel, roomCursor(), draftRelTo);
/* lager::reader<bool> */
KAZV_WRAP_ATTR(RoomModel, roomCursor(), membersFullyLoaded);
@@ -383,6 +389,23 @@
*/
PromiseT setLocalDraft(std::string localDraft) const;
+ /**
+ * Set draftRelType, draftRelTo, oldDraft for this room.
+ *
+ * After the returned Promise is resolved,
+ * @c draftRelType() will contain @c draftRelType.
+ * @c draftRelTo() will contain @c draftRelTo.
+ * @c oldDraft() will contain @c oldDraft.
+ *
+ * @param draftRelType One of ["m.replace", "m.reply"].
+ * @param draftRelTo eventId of the event that occupying the chat box.
+ * @param oldDraft The old draft.
+ * @return A Promise that resolves when the local draft
+ * has been set, or when there is an error.
+ */
+ PromiseT setDraftRel(std::string draftRelType, std::string draftRelTo,
+ std::string oldDraft) const;
+
/**
* Send an event to this room.
*
diff --git a/src/client/room/room.cpp b/src/client/room/room.cpp
--- a/src/client/room/room.cpp
+++ b/src/client/room/room.cpp
@@ -323,6 +323,14 @@
return m_ctx.dispatch(UpdateRoomAction{+roomId(), SetLocalDraftAction{localDraft}});
}
+ auto Room::setDraftRel(std::string draftRelType, std::string draftRelTo,
+ std::string oldDraft) const -> PromiseT
+ {
+ using namespace CursorOp;
+ return m_ctx.dispatch(UpdateRoomAction{+roomId(), SetDraftRelAction{
+ draftRelType, draftRelTo, oldDraft}});
+ }
+
auto Room::sendMessage(Event msg) const
-> PromiseT
{

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 27, 4:09 PM (10 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1238049
Default Alt Text
D296.1774652963.diff (3 KB)

Event Timeline