diff --git a/docs/specs/edit-message.md b/docs/specs/edit-message.md index bb7b1d3..3f3a01e 100644 --- a/docs/specs/edit-message.md +++ b/docs/specs/edit-message.md @@ -37,9 +37,9 @@ If the server has any persistent history store for the type of message that is e ### Message deletion -To delete a message, clients send a `DELETEMSG` message to the channel or user that the original message was sent to. The message MUST have a `draft/delete-message` tag with the msgid to delete. The message MAY have a second parameter, which is the reason for deletion. +To delete a message, clients send a `DELETEMSG` message to the channel or user that the original message was sent to. The message MUST have a `delete-message` tag with the msgid to delete. The message MAY have a second parameter, which is the reason for deletion. -Clients who receive a `DELETEMSG` with the `draft/delete-message` tag MUST remove all displayed content from the specified `msgid`. If the original message is ephemeral, clients SHOULD remove it entirely; otherwise they MUST replace the content with the deletion reason or a generic substitute. +Clients who receive a `DELETEMSG` with the `delete-message` tag MUST remove all displayed content from the specified `msgid`. If the original message is ephemeral, clients SHOULD remove it entirely; otherwise they MUST replace the content with the deletion reason or a generic substitute. Servers MUST ensure that the user requesting deletion has sufficient privileges to delete the specified message. Servers MUST remove the content of the original message from all persistent history stores, and MAY replace the content with the deletion reason or a generic deletion message if needed. diff --git a/src/Client.ts b/src/Client.ts index a27b12a..bbad7b0 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -21,6 +21,8 @@ export class Client { ["batch", ""], ["draft/channel-rename", ""], ["echo-message", ""], + ["reflectionircd.chat/edit-message", ""], + ["reflectionircd.chat/extended-invite", ""], ["extended-join", ""], ["invite-notify", ""], ["labeled-response", ""], @@ -202,7 +204,7 @@ export class Client { if (!this.checkIfRegistered() || !this.checkMinParams(message, 1)) return; const targetChannel = this.getChannel(message.params[0]); - const eventId = message.tags.get("draft/delete-message"); + const eventId = message.tags.get("reflectionircd.chat/delete-message"); if (!this.user || !targetChannel || !eventId) return; if (!this.checkIfInChannel(targetChannel)) return; const data = { @@ -587,8 +589,8 @@ export class Client { ['account', 'account-tag'], ['label', 'labeled-response'], ['msgid', 'message-tags'], - ['draft/delete-message', 'draft/edit-message'], - ['draft/edit-message', 'draft/edit-message'], + ['reflectionircd.chat/delete-message', 'reflectionircd.chat/edit-message'], + ['reflectionircd.chat/edit-message', 'reflectionircd.chat/edit-message'], ['time', 'server-time'], ]) const ourTags: Map = new Map(); diff --git a/src/Message.ts b/src/Message.ts index e641a37..9ae39d4 100644 --- a/src/Message.ts +++ b/src/Message.ts @@ -66,8 +66,8 @@ function encodeTag(value: string): string { function addToTags(key: string): boolean { const tagsToPass = [ 'batch', - 'draft/delete-message', - 'draft/edit-message', + 'reflectionircd.chat/delete-message', + 'reflectionircd.chat/edit-message', 'label', ] return (tagsToPass.includes(key) || key.startsWith('+')); diff --git a/src/Server.ts b/src/Server.ts index 0d23378..2999d20 100644 --- a/src/Server.ts +++ b/src/Server.ts @@ -343,7 +343,7 @@ export class Server { const reason = content["reason"]; this.clients.forEach(c => { if (c.enabledCaps.has('invite-notify')) { - if (c.enabledCaps.has('draft/extended-invite')) { + if (c.enabledCaps.has('reflectionircd.chat/extended-invite')) { c.sendMessage(sourceUser.getMask(), 'INVITE', [targetUser.nick, targetChannel.name, reason], messageTags) } else { c.sendMessage(sourceUser.getMask(), 'INVITE', [targetUser.nick, targetChannel.name], messageTags) @@ -512,11 +512,11 @@ export class Server { } const reason = event["content"]?.["reason"] || ""; const tags: Map = new Map(); - tags.set('draft/delete-message', event["redacts"]); + tags.set('reflectionircd.chat/delete-message', event["redacts"]); tags.set('account', sourceUser.accountName); tags.set('time', new Date(event["origin_server_ts"]).toISOString()) this.clients.forEach((client) => { - if (client.enabledCaps.has("draft/edit-message")) + if (client.enabledCaps.has("reflectionircd.chat/edit-message")) client.sendMessage(sourceUser.getMask(), 'DELETEMSG', [targetChannel.name, reason], tags); }); }