aboutsummaryrefslogtreecommitdiff
path: root/jobs
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-04-13 20:21:04 +0300
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-04-14 19:36:23 +0300
commit336b66edcc02cbf29f119107777c5bfc6d751c3d (patch)
tree481d7c59e9785e6acfcf419dd7eca23384b026bd /jobs
parentb5f3a57840986d3ebdc9bb81d73e0c4d6e876071 (diff)
downloadlibquotient-336b66edcc02cbf29f119107777c5bfc6d751c3d.tar.gz
libquotient-336b66edcc02cbf29f119107777c5bfc6d751c3d.zip
Enable PostMessageJob to send rich text messages
Diffstat (limited to 'jobs')
-rw-r--r--jobs/postmessagejob.cpp18
-rw-r--r--jobs/postmessagejob.h9
2 files changed, 22 insertions, 5 deletions
diff --git a/jobs/postmessagejob.cpp b/jobs/postmessagejob.cpp
index 23c2214c..69cc814d 100644
--- a/jobs/postmessagejob.cpp
+++ b/jobs/postmessagejob.cpp
@@ -31,12 +31,24 @@ class PostMessageJob::Private
QString eventId; // unused yet
};
-PostMessageJob::PostMessageJob(ConnectionData* connection, QString roomId,
- QString type, QString message)
+PostMessageJob::PostMessageJob(ConnectionData* connection, const QString& roomId,
+ const QString& type, const QString& plainText)
: BaseJob(connection, HttpVerb::Post, "PostMessageJob",
QString("_matrix/client/r0/rooms/%1/send/m.room.message").arg(roomId),
Query(),
- Data({ { "msgtype", type }, { "body", message } }))
+ Data({ { "msgtype", type }, { "body", plainText } }) )
+ , d(new Private)
+{ }
+
+PostMessageJob::PostMessageJob(ConnectionData* connection, const QString& roomId,
+ const QString& type, const QString& plainText,
+ const QString& richText)
+ : BaseJob(connection, HttpVerb::Post, "PostMessageJob",
+ QStringLiteral("_matrix/client/r0/rooms/%1/send/m.room.message").arg(roomId),
+ Query(),
+ Data({ { "msgtype", type }, { "body", plainText }
+ , { "format", QStringLiteral("org.matrix.custom.html") }
+ , { "formatted_body", richText } }) )
, d(new Private)
{ }
diff --git a/jobs/postmessagejob.h b/jobs/postmessagejob.h
index eba3da51..14de52f0 100644
--- a/jobs/postmessagejob.h
+++ b/jobs/postmessagejob.h
@@ -25,8 +25,13 @@ namespace QMatrixClient
class PostMessageJob: public BaseJob
{
public:
- PostMessageJob(ConnectionData* connection, QString roomId,
- QString type, QString message);
+ /** Constructs a plain text message job */
+ PostMessageJob(ConnectionData* connection, const QString& roomId,
+ const QString& type, const QString& plainText);
+ /** Constructs a rich text message job */
+ PostMessageJob(ConnectionData* connection, const QString& roomId,
+ const QString& type, const QString& plainText,
+ const QString& richText);
virtual ~PostMessageJob();
//bool success();