-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Post Event PendingEventItems #861
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -725,7 +725,7 @@ class QUOTIENT_API Room : public QObject { | |
//! | ||
//! This means MessageEventType Text, Emote or Notice. | ||
template<MessageEventType type = MessageEventType::Text> | ||
QString postText(const QString& plainText, | ||
const PendingEventItem& postText(const QString& plainText, | ||
const std::optional<QString>& html = std::nullopt, | ||
const std::optional<EventRelation>& relatesTo = std::nullopt) | ||
{ | ||
|
@@ -739,21 +739,21 @@ class QUOTIENT_API Room : public QObject { | |
if (html) { | ||
content = std::make_unique<EventContent::TextContent>(*html, u"text/html"_s); | ||
} | ||
return post<RoomMessageEvent>(plainText, type, std::move(content), relatesTo)->transactionId(); | ||
return post<RoomMessageEvent>(plainText, type, std::move(content), relatesTo); | ||
} | ||
|
||
//! Send a file with the given content | ||
QString postFile(const QString& plainText, | ||
const PendingEventItem& postFile(const QString& plainText, | ||
std::unique_ptr<EventContent::FileContentBase> fileContent, | ||
std::optional<EventRelation> relatesTo = std::nullopt); | ||
|
||
//! Send the given Json as a message | ||
QString postJson(const QString& matrixType, const QJsonObject& eventContent); | ||
const PendingEventItem& postJson(const QString& matrixType, const QJsonObject& eventContent); | ||
|
||
//! Send a reaction on a given event with a given key | ||
QString postReaction(const QString& eventId, const QString& key); | ||
const PendingEventItem& postReaction(const QString& eventId, const QString& key); | ||
|
||
PendingEventItem::future_type whenMessageMerged(QString txnId) const; | ||
PendingEventItem::merged_future_type whenMessageMerged(QString txnId) const; | ||
|
||
//! Send a request to update the room state with the given event | ||
SetRoomStateWithKeyJob* setState(const StateEvent& evt); | ||
|
@@ -850,7 +850,7 @@ public Q_SLOTS: | |
/// The event is about to be appended to the list of pending events | ||
void pendingEventAboutToAdd(Quotient::RoomEvent* event); | ||
/// An event has been appended to the list of pending events | ||
void pendingEventAdded(const Quotient::RoomEvent* event); | ||
void pendingEventAdded(const PendingEventItem& pendingItem); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure it's a good idea; for one, you cannot use a queued connection with this signal because a reference cannot be copied; and besides, this reference is at risk of dangling if any slot connected to |
||
/// The remote echo has arrived with the sync and will be merged | ||
/// with its local counterpart | ||
/** NB: Requires a sync loop to be emitted */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have code that would use it? Or at least can you give an idea of code that would use it? Futures are generally heavier than signal-slot connections.