New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add empty tag-only message support and an increased size limit for tags #287
Conversation
core/message-tags-3.3.md
Outdated
### Size limit | ||
|
||
The size limit for message tags is increased to 512 to 4096 bytes, including the leading | ||
`@` and trailing space characters, leaving 3094 bytes for tags themselves. The size limit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/3094/4094/
core/message-tags-3.3.md
Outdated
@@ -96,6 +96,9 @@ no message body is provided. These events MUST NOT be delivered to clients who h | |||
negotiated the message tags capability. If neither client-only tags nor a message body | |||
are provided, servers MAY respond with a standard `ERR_NOTEXTTOSEND` error. | |||
|
|||
Clients that receive empty events MUST not display empty messages as-is in the message history |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/not/NOT/
core/message-tags-3.3.md
Outdated
An alternate form of an empty message sent by a client with the `+example-client-tag` client-only tag, where the last parameter is omitted | ||
|
||
``` | ||
@+example-client-tag=example-value PRIVMSG #channel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows omitting the last parameter of PRIVMSG.
What other commands can omit it now?
Note that this change is pretty far away from tags themselves.
I don't think clients should be allowed to send empty messages at all, even if the actual message is not in last parameter anymore, but in the tag. That way old clients have some way to show the conversation. Clients which use such tag should duplicate the message in the text... which makes the new tag useless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned above in the diff, the only other command is NOTICE.
even if the actual message is not in last parameter anymore, but in the tag
This isn't about moving the actual message to a tag. If it's a message that has to be displayed as such, it still belongs in the last parameter. This is about opening another channel of communication that is only visible to clients that support this spec and won't share the same behavior of public messages. See for example #289, about reactions. Another example is typing notifications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DarthGandalf other than the mentioned use cases for content-less messages, is your objection that this is allowing PRIVMSG #channel
rather than PRIVMSG #channel :
?
I could change it to require the last param but allow it to be empty. But since it's allowing that param to effectively be ignored, I'm not sure it's needed.
I see the reason for allowing this change is so that servers can keep the standard PRIVMSG/NOTICE routing for message delivery to channels/users, and use them for pure tag delivery. Another alternative is to define a new message type that just carries tags, but since empty messages aren't allowed/useful normally, it makes sense to use them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another alternative is to define a new message type that just carries tags,
I'll start the bikeshedding for the name: METAMSG
Any more input on this? |
core/message-tags-3.3.md
Outdated
|
||
--- | ||
|
||
An alternate form of an empty message sent by a client with the `+example-client-tag` client-only tag, where the last parameter is omitted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this should be the only form allowed. Theres no point adding alternative methods just for the sake of adding alternatives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for only allowing one form
The version of the draft cap should be bumped so early implementations can discover if a server is capable of empty PRIVMSG support |
core/message-tags-3.3.md
Outdated
|
||
### Size limit | ||
|
||
The size limit for message tags is increased from 512 to 4096 bytes, including the leading |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid that this creates an incentive for third parties to create custom extensions which move text of message to @example.com/text
, to workaround the limit of 512
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be in direct contravention of the recommendation in the spec.
There is no guarantee that other clients will support or display the client-only tags they receive, so these tags should only be used to enhance messages with non-critical information. Messages should still make sense to clients with no support for tags.
If clients do that with their own prefixed tags, then they should expect it not to be widely adopted. I don't see it as a very effective incentive.
core/message-tags-3.3.md
Outdated
error. | ||
|
||
Clients that receive events without a message text MUST NOT display empty messages as-is | ||
in the message history unless they are using the attached tags according to their own |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't parse this, sorry. Who are "their own"? tags? clients? messages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tags. I can try rewriting it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But... how else can they use those tags? According to specs of some other unrelated tags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this make more sense? 8667e48
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it does.
core/message-tags-3.3.md
Outdated
@@ -80,6 +89,24 @@ Individual tag keys MUST only be used a maximum of once per message. Clients | |||
receiving messages with more than one occurrence of a tag key SHOULD discard all | |||
but the final occurrence. | |||
|
|||
### Empty tagged messages | |||
|
|||
Servers MUST accept `PRIVMSG` and `NOTICE` events sent with client-only tags even if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference between PRIVMSG
and NOTICE
is whether bots should reply to the message.
Should reactions be as PRIVMSG
or NOTICE
?
I prefer @SaberUK 's new METAMSG
verb and not to change syntax of widely used PRIVMSG
/NOTICE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there's a CAP to enable this behaviour, I think it's OK. Bots that enable it can make sure they don't reply (and there'll be no text to reply to anyway).
A key benefit of using PRIVMSG/NOTICE is that servers already route them appropriately. Adding another verb feels heavyweight to me, but happy to discuss further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
servers already route them appropriately
That's the exact problem. I think the majority of server implementations assume that there is a text for PRIVMSG. For example, https://github.com/znc/znc/blob/master/include/znc/Message.h#L297 has such assumption.
By adding a new verb, old code which handles PRIVMSG can continue assuming that there is always a text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear, I'm not suggesting servers won't have to update their code to allow this. Whether it's by making PRIVMSG/NOTICE accept empty messages or by adding a new verb to be routed in exactly the same way as those two messages is the question. I feel like the former would be simpler, but maybe not in your case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm indifferent about this. Strictly speaking on the protocol level there is no reason to introduce a new verb. Servers have to apply nearly the same restriction checks for tag-only messages as for normal messages e.g. callerid, reg only speak, flood checks, mute on channels, etc. so code that interacts with tag-only messages will need to be reviewed to ensure it handles them correctly regardless of the actual protocol used.
Another thing to consider is echo-message being already defined for PRIVMSG but adding a new verb requires either changing the definition of echo-message to support it or define it with "built-in" echo. The latter will create a new corner case with self METAMSG in labeled responses that will need addressing. None of these are huge changes, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SRV→ZNC: @tags :n!u@h PRIVMSG #chan
ZNC→CLI: @tags :n!u@h PRIVMSG #chan :
The requirement to not render the message for the client won't apply anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. This was my original motivation for allowing both forms. So either I can restore that or we can make the empty but present last param the only allowed form (which will probably attract comments that it seems unnecessary)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for "the empty but present last param the only allowed form"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How's this? 304a03c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for "the empty but present last param the only allowed form"
How's this? 304a03c
I'm fine with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Why do you want to use tags instead of a verb for these? |
So features like what you quoted won't depend on server updates once client to client tags are supported. |
Message deletion and seen notifications will have to be supported by the server, for #292, and maybe faving too. I'm worried about the two possibilities discussed here, because not having a command would break one the most basic conventions of IRC, and using a content-less PRIVMSG would strip PRIVMSG of its meaning (why PRIVMSG and not NOTICE or MODE?). From a less philosophical point of view, I am worried that using an empty PRIVMSG would either break third-party plugins of my bot which do not handle that case (if the bot negotiates the capability) or prevent other plugins from using the empty PRIVMSG from usin the feature (if the bot does not negotiate it). What would you think of adding new verb(s?) for the sole purpose of carrying tags, on a channel, user-to-user, or from a network admin to all the users? |
|
1. Can you explain why deletion/seen/faving would require server support? The chathistory can just store the empty messages and clients can replay them as normal.
For deletion, I think users would assume the message is deleted from the server, and that clients connecting afterward will not display the message, even if it does not support message deletion.
Nevermind for seen and faving.
2. What does this mean?
> not having a command would break one the most basic conventions of IRC
Just that calling IRC a protocol where messages may have no command feels weird.
3. If you're concerned, your bot plugin framework could require plugins to enable support for the CAP via some internal config, and then you can forward/filter them to individual plugins as necessary.
I have thought about that when considering `echo-message`, but I'm afraid it will lead to growing boilerplate config being copied to new plugins to support IRC features as they come.
4. Reasons for not adding a new verb have been discussed a few times already in this thread (search in page for "METAMSG")
I missed that, sorry.
A key benefit of using PRIVMSG/NOTICE is that servers already route them appropriately. Adding another verb feels heavyweight to me, but happy to discuss further.
Don't servers already factor code for PRIVMSG and NOTICE? If yes, adding a third verb routed exactly like them shouldn't be a problem
|
@progval I don't understand the issue. The bot can have two events, one for regular PRIVMSG the other one for tag only PRIVMSG. Pass regular PRIVMSGs to the first, tag only PRIVMSGs to the second. Exactly as you would do with a third verb. Did I miss something? |
Yes, I could do that. I am not sure how I would name them, because all callbacks have the name of the command, so I can't have two callbacks for the same command with this naming scheme. That's why I would prefer a new verb. |
Added some examples and links. If there are no further comments, I'll merge this on Monday. |
@attilamolnar happy to approve these changes? |
@jwheare Please add 2 more examples with TAGMSG interacting with labeled-response and echo-message Edit: there is already an example for echo-message, never mind that part of my comment. |
core/message-tags-3.3.md
Outdated
These events MUST NOT be delivered to clients that haven't negotiated the message tags | ||
capability and MAY be rejected if no tags are included. | ||
|
||
If this event is sent without any tags, servers SHOULD reject it with a standard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that important, but any reason this is not a MUST? i.e. if servers choose to disallow tagless TAGMSG then they must use the given numeric for that. As currently stands servers are allowed to do whatever they want with a tagless TAGMSG making this a useless requirement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a SHOULD in case servers don't want to bother to check the tags on TAGMSG for simplicity, since clients receiving them would be a no-op anyway.
How about this:
If this event is sent without any tags, servers SHOULD reject it. If they do, the standard
ERR_NEEDMOREPARAMS
error numeric MUST be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually no, I hadn't re-read the previous paragraph, I'll find a better wording.
core/message-tags-3.3.md
Outdated
capability and MAY be rejected if no tags are included. | ||
|
||
If this event is sent without any tags, servers SHOULD reject it with a standard | ||
`ERR_NEEDMOREPARAMS` error numeric. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please expand the examples to demonstrate the correct server behavior or behaviors in this corner case.
core/message-tags-3.3.md
Outdated
These events MUST NOT be delivered to clients that haven't negotiated the message tags | ||
capability and MAY be rejected if no tags are included. | ||
|
||
If this event is sent without any tags, servers SHOULD reject it with a standard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is what I had in mind.
Is a repetition of the label/echo/self messages examples really needed here? The labeled-response spec is not specific to PRIVMSG/NOTICE, but should apply to all messages. I don't think we need to document it on every new event we define. |
I added a |
TODO
|
… ERR_INPUTTOOLONG 417 is from ircu and derivatives. This avoids ambiguity around truncating in the middle of the tag space
|
For a sec I thought this was #281, where requiring that numeric may or may not happen. But it seems uncontroversial in the context of the new message-tags, with all its new required behaviors, and particularly about exceeding the tag length limit. So yeah, sure. I think @DanielOaks was interested in reviewing the usage of that numeric first. |
I've discovered a slightly edge casey issue while implementing the The server could respond with the numeric anyway, but there are a few problems:
Because of this, we have a situation where tags might again need to be truncated unexpectedly. One solution is to allow for truncation in the spec, perhaps adding a Another idea is that we separate the limits. So, for example the total limit could be 4608, with 512 reserved for server tags and 4096 for client tags. It allows input parsing to remain simpler, safe and at the edges for both client and server with no unexpected data loss due to truncation. Any issues with that? Also, any thoughts on the numbers? Perhaps we still need more than 512 for server tags, but client tags are the main motivation for increasing the limit. |
Added the split limit details in dba7cd5 |
draft/message-tags-0.2