Bug 1611444 - Fix sending of Matrix messages. r=clokep
authorKhushil Mistry <khushil324@gmail.com>
Fri, 20 Mar 2020 11:21:33 +1300
changeset 38539 ba0be99cb7702128a827d597aa80f4ea33deaccc
parent 38538 22309738f263347581c0852841334abb7f39df6e
child 38540 3528b15b3c008d410a37abdb2c363fc85954a051
push id400
push userclokep@gmail.com
push dateMon, 04 May 2020 18:56:09 +0000
reviewersclokep
bugs1611444
Bug 1611444 - Fix sending of Matrix messages. r=clokep
chat/protocols/matrix/matrix.jsm
--- a/chat/protocols/matrix/matrix.jsm
+++ b/chat/protocols/matrix/matrix.jsm
@@ -78,17 +78,33 @@ MatrixParticipant.prototype = {
  *  setRoomTopic
  */
 function MatrixConversation(aAccount, aName, aNick) {
   this._init(aAccount, aName, aNick);
 }
 MatrixConversation.prototype = {
   __proto__: GenericConvChatPrototype,
   sendMsg(aMsg) {
-    this._account._client.sendTextMessage(this._roomId, aMsg);
+    let content = {
+      body: aMsg,
+      msgtype: "m.text",
+    };
+    this._account._client.sendEvent(
+      this._roomId,
+      "m.room.message",
+      content,
+      "",
+      (err, res) => {
+        if (err) {
+          this._account.ERROR("Failed to send message to: " + this._roomId);
+        } else {
+          // If there's no error, display the message to the user.
+        }
+      }
+    );
   },
   get room() {
     return this._account._client.getRoom(this._roomId);
   },
   addParticipant(aRoomMember) {
     if (this._participants.has(aRoomMember.userId)) {
       return;
     }