aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/room.cpp23
-rw-r--r--lib/room.h25
2 files changed, 27 insertions, 21 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index a3f7bda2..e99f9235 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -1197,11 +1197,6 @@ Room::PendingEvents::iterator Room::Private::findAsPending(
return std::find_if(unsyncedEvents.begin(), unsyncedEvents.end(), comp);
}
-QString Room::postMessage(const QString& type, const QString& plainText)
-{
- return d->sendEvent<RoomMessageEvent>(plainText, type);
-}
-
QString Room::retryMessage(const QString& txnId)
{
auto it = std::find_if(d->unsyncedEvents.begin(), d->unsyncedEvents.end(),
@@ -1228,14 +1223,24 @@ QString Room::postMessage(const QString& plainText, MessageEventType type)
return d->sendEvent<RoomMessageEvent>(plainText, type);
}
-QString Room::postHtmlMessage(const QString& plainText, const QString& htmlText,
+QString Room::postPlainText(const QString& plainText)
+{
+ return postMessage(plainText, MessageEventType::Text);
+}
+
+QString Room::postHtmlMessage(const QString& plainText, const QString& html,
MessageEventType type)
{
return d->sendEvent<RoomMessageEvent>(plainText, type,
- new EventContent::TextContent(htmlText, QStringLiteral("text/html")));
+ new EventContent::TextContent(html, QStringLiteral("text/html")));
+}
+
+QString Room::postHtmlText(const QString& plainText, const QString& html)
+{
+ return postHtmlMessage(plainText, html, MessageEventType::Text);
}
-QString Room::postMessage(RoomEvent* event)
+QString Room::postEvent(RoomEvent* event)
{
if (usesEncryption())
{
@@ -1245,7 +1250,7 @@ QString Room::postMessage(RoomEvent* event)
return d->sendEvent(RoomEventPtr(event));
}
-QString Room::postMessage(const QString& matrixType,
+QString Room::postJson(const QString& matrixType,
const QJsonObject& eventContent)
{
return d->sendEvent(loadEvent<RoomEvent>(basicEventJson(matrixType, eventContent)));
diff --git a/lib/room.h b/lib/room.h
index 5c7524d6..12884eb4 100644
--- a/lib/room.h
+++ b/lib/room.h
@@ -306,18 +306,19 @@ namespace QMatrixClient
void setJoinState( JoinState state );
public slots:
- QString postMessage(const QString& plainText,
- MessageEventType type = MessageEventType::Text);
- QString postHtmlMessage(
- const QString& plainText, const QString& htmlText,
- MessageEventType type = MessageEventType::Text);
- /** Post a pre-created room message event; takes ownership of the event */
- QString postMessage(RoomEvent* event);
- QString postMessage(const QString& matrixType,
- const QJsonObject& eventContent);
- /** @deprecated If you have a custom event type, construct the event
- * and pass it as a whole to postMessage() */
- QString postMessage(const QString& type, const QString& plainText);
+ QString postMessage(const QString& plainText, MessageEventType type);
+ QString postPlainText(const QString& plainText);
+ QString postHtmlMessage(const QString& plainText,
+ const QString& html, MessageEventType type);
+ QString postHtmlText(const QString& plainText, const QString& html);
+ /** Post a pre-created room message event
+ *
+ * Takes ownership of the event, deleting it once the matching one
+ * arrives with the sync
+ */
+ QString postEvent(RoomEvent* event);
+ QString postJson(const QString& matrixType,
+ const QJsonObject& eventContent);
QString retryMessage(const QString& txnId);
void discardMessage(const QString& txnId);
void setName(const QString& newName);