finally add support for encryption :DDD

This commit is contained in:
Ashley 2024-08-25 18:37:24 +00:00
parent 99e0b86d50
commit 9291d930b4
5 changed files with 37 additions and 21 deletions

View file

@ -23,8 +23,10 @@ export default function(client) {
}
client.reply = function(event, text, html) {
var content = event.getContent();
var mcontent = {
body: "> <" + event.sender.userId + "> " + event.event.content.body.split("\n")[0] + "\n\n" + text.trim(),
body: "> <" + event.sender.userId + "> " + content.body.split("\n")[0] + "\n\n" + text.trim(),
msgtype: "m.notice",
"m.relates_to": {
"m.in_reply_to": {
@ -32,13 +34,15 @@ export default function(client) {
}
}
};
if(html) {
mcontent = {
format: "org.matrix.custom.html",
formatted_body: "<mx-reply><blockquote><a href=\"https://m.posm.gay/#/" + event.event.room_id + "/" + event.event.event_id + "?via=possum.city\">In reply to</a> <a href=\"https://m.posm.gay/#/" + event.sender.userId + "\">" + event.sender.userId + "</a><br>" + encode(event.event.content.body.split("\n")[0]) + "</blockquote></mx-reply>" + html.trim(),
formatted_body: "<mx-reply><blockquote><a href=\"https://m.posm.gay/#/" + event.event.room_id + "/" + event.event.event_id + "?via=possum.city\">In reply to</a> <a href=\"https://m.posm.gay/#/" + event.sender.userId + "\">" + event.sender.userId + "</a><br>" + encode(content.body.split("\n")[0]) + "</blockquote></mx-reply>" + html.trim(),
...mcontent
}
}
client.sendEvent(event.event.room_id, "m.room.message", mcontent, "", (err, res) => {
console.log(err);
});