Skip to content

Instantly share code, notes, and snippets.

@DanielOaks
Last active August 18, 2020 13:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save DanielOaks/a64a1b0e01609e6e0f86a6cf92973caa to your computer and use it in GitHub Desktop.
Save DanielOaks/a64a1b0e01609e6e0f86a6cf92973caa to your computer and use it in GitHub Desktop.

Parsing And Sending STATUSMSG Messages

STATUSMSG is a type of IRC private message / notice where the target of the private message is the members of a channel with at least a certain level of channel responsibility.

In other words, instead of the target of the message just being #ircv3, it may be @#ircv3 and only be send to the ops of the channel, rather than all members of the channel.

The STATUSMSG ISUPPORT Token

The STATUSMSG RPL_ISUPPORT token is used to note that the server supports sending private messages and notices with these special 'statusmsg targets' (the channel name prefixed by a given privilege level character such as +, %, @ or similar).

Specifically, this token notes which privilege level characters the server supports from clients that send these messages. For instance, here's an example token:

STATUSMSG=+@

The above means that the server supports channel targets prefixed by + or @. That is, clients can send a message to either +#ircv3 or @#ircv3 and it will be delivered to the right users (only those who have voice and above, and only those who have ops and above, respectively).

When sending messages out, clients should only send PRIVMSG or NOTICE messages with a statusmsg target if the privilege prefix on the message matches the above. That is, if the server supports these ISUPPORT tokens: "STATUSMSG=+@ PREFIX=(ohv)@%+", then they can send messages to +#ircv3 and @#ircv3, but messages sent to %#ircv3 will most likely fail.

When receiving messages, clients should assume that the server can send it any supported channel priv prefixes in a statusmsg target. This is because the STATUSMSG token may be missing or outdated, and simply because it's the most resilient behaviour. For example, if the server supports these ISUPPORT tokens: "STATUSMSG=+@ PREFIX=(ohv)@%+", then your client should not break if it receives a target of %#ircv3. Similarly, if no STATUSMSG token was sent in the above example, clients should accept targets of +#ircv3, %#ircv3 and @#ircv3.

Clients should also keep in mind the CHANTYPES ISUPPORT token. Take the characters from the PREFIX token, subtract all the characters in CHANTYPES, and then accept you can receive statusmsg targets with all of those characters. This is because certain networks like ircnet support both voice with the + character, and channels that start with +, meaning you can't just assume that a target starting with a character from PREFIX is a statusmsg.

Multiple Prefixes

Statusmsg targets can contain multiple prefixes, such as +@#ircv3 or similar. Servers that support STATUSMSG should parse this, and clients that implement STATUSMSG should parse this as well.

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