Dev:Message tags

'''NOTE: This is the technical explanation for UnrealIRCd (module) coders about message tags. It is not meant for end-users'''.

What are message tags?
Message tags are an IRCv3 invention to comunicate additional information with a protocol message, see the IRCv3 specification or just read on.

Examples
Here's an example: @time=2019-12-23T09:55:55.260Z;msgid=SwCgcPmSpX7sY2JnSfMpI8;account=Supervisor :nick!username@Clk-6C400E48 PRIVMSG #test :hello there! This IRC message contains two message tags:
 * time: which is defined by the server-time extension. It communicates the exact time at which the server received the message.
 * msgid: this is a network-wide unique id for this message. It is defined in the message-ids extension.
 * account: this shows the service account name of this user. It is defined in the account-tag extension.

How to use them in UnrealIRCd
In UnrealIRCd every command handler, and many other subfunctions, have an recv_mtags or mtags argument. This is of type MessageTag *, which is a linked list of message tags.

TBD: moremoremore

Rules

 * You must use new_message:
 * preferably for any message that originates from a person - so the account message tag (and other tags) are properly attached.
 * mandatory for all messages to a channel, eg sendto_channel - because channel messages can be played back in history it is especially important since it will contain time, msgid and optionally account tags.
 * some functions generate a message tag on their own, such as sendnotice and sendnumeric.
 * You may not re-use the same mtag for multiple messages
 * If you don't follow this rule then you can end up with two messages that will have the same msgid (PRIVMSG or some other protocol message). This, while msgid must be unique!
 * You can and should use the same mtag if you are relaying/broadcasting the same message to other servers, of course (eg a single MODE event), see next.
 * The same message must carry the same mtags on all servers if a command has a network-wide effect (eg: MODE, PRIVMSG to a channel, etc.)
 * Otherwise on one server the message would have 1 unique id, and on the other server the same message has another unique id, that is bad!