Skip to content

Instantly share code, notes, and snippets.

@jesopo
Last active September 28, 2021 23:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jesopo/ef44e928aeb1c893e722909608960b1b to your computer and use it in GitHub Desktop.
Save jesopo/ef44e928aeb1c893e722909608960b1b to your computer and use it in GitHub Desktop.
draft/edit and draft/delete IRCv3 message-tag proposal

editmsg proposal

Rationale

firstly, almost every other chat platform supports editable/deletable messages as a user convenience - a convenience that people grow to expect.

secondly, moderation often needs ability to edit or delete messages (think NSFW urls)

Technical details and examples

this spec provides a draft/editmsg CAP as the fallback functionality requires server intervention.

Editing messages

(with echo-message enabled)

c->s PRIVMSG #channel :hell owhats up
c<-s @msgid=123 :jess!u@h PRIVMSG #channel :hell owhats up
c->s @draft/edit=123;draft/edit-text=hello\swhats\sup TAGMSG #channel
c<-s @msgid=124;draft/edit=123;draft/edit-text=hello\swhats\sup :jess!u@h TAGMSG #channel

Deleting messages

(with echo-message enabled)

c->s PRIVMSG #channel :hell owhats up
c<-s @msgid=123 :jess!u@h PRIVMSG #channel :hell owhats up
c->s @draft/delete=123 TAGMSG #channel
c<-s @msgid=124;draft/delete=123 :jess!u@h TAGMSG #channel

Authorisation

the server will be responsible for deciding who can edit or delete a message - this is because is it not possible to exhaustively convey to a client all the (possibly changable) criteria under which a user has permission to edit or delete a given message; e.g. channel ops, network opers, services, bots with special permissions, etc.

to allow users to always delete their own messages, you might assume that necessitates indefinite history storage server-server but there is suggestion that you can embed an opaque representation of the user/account in every msgid so that, when a client tries to edit or delete a message, the ID they are referencing is decoded serverside and it checks if the opaque user/account identifier is compared against the current user/account. if the msgid they are referencing doesn't exist, it doesn't matter; the account still matches and the TAGMSG can still be disseminated to other clients without risk.

Degradation

this part is very tricky and subject to heavy debate; many, understandably, desire to not leave older clients contextless for two resaon;

  1. this could behave as a backchannel of communication that only people using newer clients can use. this could be used to e.g. insult other users without them seeing or bypass moderation oversight
  2. edits to messages can change significantly change the context of a conversation

I propose leaving degradation up to server implementers; as long as we leave this open, they are free to express to users this information however they feel is more legible etc.

Non-normative implementation

there's some less-than-universally-legible suggestions to combat this; e.g. sending a sed-formatted explanation of the change. this has two issues:

  1. the server has to figure out backwards what the sed would be
  2. users that don't understand sed (which is a lot of people) will be lost.

the solution i propose is one that is very noisy and imprecise but, i believe, is the only one that solves these issues because users without support can manually scroll back to find the original.

user editing message:

c->s PRIVMSG #channel :hell owhats up
c<-s @msgid=123 :jess!u@h PRIVMSG #channel :hell owhats up
c->s @draft/edit=123;draft/edit-text=hello\swhats\sup TAGMSG #channel

fallback message to other client

:server.irc.network NOTICE #channel :jess edited 1 message(s) ago: hello whats up
@nillkitty
Copy link

My concerns with this are:

  1. There is no mention or even suggestion of a channel or user mode to prevent users from editing or deleting messages. For this achieve acceptance there should at least be a server-side mechanism to block this, as well as potentially rate limit edits. As we've seen on other platforms such as Telegram and Discord, message editing can be (ab)used to create "real time" messages that update perpetually (once per second/minute for several minutes or hours after it was originally sent). Also as seen on other platforms, when editing messages is universally supported, it causes Bot developers to make cleaner UI's in which informational messages auto-delete or overwrite to reduce excessive non-chat clutter in the chat.

  2. This proposal treats the editing and deletion of messages as purely a client-to-client request (potentially also being interpreted by Bouncer software) for other's clients to ammend or hide the text in question whereas I think a future certainly exists where servers will keep state on messages. Imagine the feature sets that are possible if the protocol treats messages as first class objects beyond merely an opaque message ID that clients track:

  • Replay of messages received while offline or AWAY
  • Replay of messages when a client crashes or loses state
  • Ability to inline REPLY to messages (popular chat feature of the 201x's)
  • Ability to FORWARD messages (runner up in popularity to REPLY)
  • Ability to report abuse referencing specific messages
  • Ability to PIN messages
  • Ability to track sent/delivered/seen status
  • Message-targeted moderation capabilities, such as message approval

That's why, in my opinion:

  • Message IDs should either be required in a namespace that doesn't overlap other nick/channel identifiers (e.g. always starts with a digit) or should have a sigil/prefix that allows them to be referenced canonically
  • Changing the text of a message should be a metadata/property set operation on it (or at least something that allows for something besides its TEXT to be changed in the future); there will be other things in the future besides the TEXT of a message that we would want to read or write (e.g. visibility, color, approval, services-induced-origin-change, services-induced-timestamp-change, etc...)

Back of napkin proposals:

Proposal A (dedicated command):
   C: PRIVMSG #channel :i'm feeling gray
   S: @msgid=123 :c0!u@h PRIVMSG #channel :i'm feeling gray

   C: EDIT #channel 123 TEXT :i'm feeling great
   S (to capable clients): :c0!u@h EDIT #channel 123 TEXT :i'm feeling great 
   S (to legacy clients):  :c0!u@h PRIVMSG #channel :[Edit] i'm feeling great
   
Proposal B (first class globally unique message IDs or OIDs):
   C: PRIVMSG #channel :i'm feeling gray
   S: @msgid=049F84A8B :c0!u@h PRIVMSG #channel :i'm feeling gray

   C: PROP 049F84A8B TEXT :i'm feeling great
   S (to capable clients): :c0!u@h PROP 049F84A8B TEXT :i'm feeling great 
   S (to legacy clients):  :c0!u@h PRIVMSG #channel :[Edit] i'm feeling great

   C: PROP 049F84A8B
   S: :server 818 c0 049F84A8B TEXT :i'm feeling great
   S: :server 818 c0 049F84A8B ORIGINALTEXT :i'm feeling gray
   S: :server 818 c0 049F84A8B CREATION 1038483892
   S: :server 818 c0 049F84A8B MODIFIED 1038583994
   S: :server 818 c0 049F84A8B FROM :c0!u@h
   S: :server 818 c0 049F84A8B DESTINATION :#channel
   S: :server 818 c0 049F84A8B SENTTO :c0 c1 c2 c3 c4 c5
   S: :server 818 c0 049F84A8B SEENBY :c0 c2 c5
   S: :server 819 c0 049F84A8B :End of property list
   

Written with StackEdit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment