whitepaper.xml 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.miek.nl" -->
  3. <rfc version="3" ipr="none" docName="internet-delay-chat" submissionType="independent" category="info" xml:lang="en" xmlns:xi="http://www.w3.org/2001/XInclude" indexInclude="true">
  4. <front>
  5. <title abbrev="Internet Delay Chat Protocol">Internet Delay Chat Protocol</title><seriesInfo value="internet-delay-chat" stream="independent" status="informational" name="Internet-Draft"></seriesInfo>
  6. <author initials="A." surname="Yu" fullname="Andrew Yu"><organization></organization><address><postal><street></street>
  7. </postal><email>andrew@andrewyu.org</email>
  8. </address></author><author initials="T." surname="User" fullname="Test_User"><organization></organization><address><postal><street></street>
  9. </postal><email>hax@andrewyu.org</email>
  10. </address></author><author initials="F." surname="EL HAFIDI" fullname="Ferass EL HAFIDI"><organization></organization><address><postal><street></street>
  11. </postal><email>vitali64pmemail@protonmail.com</email>
  12. </address></author><date/>
  13. <area>Internet</area>
  14. <workgroup>IDC Working Group</workgroup>
  15. <keyword>messaging</keyword>
  16. <keyword>protocol</keyword>
  17. <abstract>
  18. <t>Documentation is usually out of date. It is updated every few weeks.
  19. Please reference the Python Trio server implementation.</t>
  20. <t>This document specifies a new Internet Protocol for messaging over the Internet.</t>
  21. </abstract>
  22. </front>
  23. <middle>
  24. <section anchor="introduction"><name>Introduction</name>
  25. <t>The IDC (Internet Delay Chat) protocol has been designed over a number of months for federated multimedia conferencing. This document describes the current IDC protocol.</t>
  26. <t>IDC itself is a messaging system, which (through the use of the client-server and server-to-server model) is well-suited to running on many machines in a distributed fashion. A typical setup involves multiple servers each with multiple clients, that connect to each other in order to exchange messages, in a multi-centered fashion.</t>
  27. <t>Existing protocols are limited. The Internet Relay Chat Protocol as described in RFC 1459 is a very simple protocol for teleconferencing system. Later updates such as RFC 2812 have been badly accepted.</t>
  28. <t>When a client disconnects, the IRC network no longer recognizes the client, and messages during the client's downtime are not saved. This renders IRC unfit for instant messaging, where clients are forced to disconnect but messages are to be read later.</t>
  29. <t>IRC is also not federated, causing most people to be on the few large networks which may lead to privacy and stability issues (for example, the freenode takeover [citation needed]). Though IRC is technically multi-centered, it is not politically, as servers fully trust other servers, and thus are typically run by the same organization.</t>
  30. <t>Most modern IRC networks use dedicated &quot;services&quot; servers for user, channel, and group management and dedicated client bots for extensible channel management. Compared with these features built into the server, this is ineffective. Features such as timed mutes should be handled server-side rather than by a clientbot.</t>
  31. <t>The Extensible Messaging and Presence Protocol, also known as XMPP or Jabber, was designed for presense, instant messaging, and conferences. However, it is based on XML, and implementations are large and buggy. XML is inherently bloated and causes unnecessary spam in the network. XMPP is not multicast either, messages are slow and especially inefficent with multi user chats. IRC, on the other hand, is a simple text-oriented protocol, where implementing is more straightforward and is harder to write bugs into.</t>
  32. <t>The Discord messaging platform is a proprietary platform for team, community and personal communications. It is very popular and widely used among gamers, but it's controlled by a single entity with bad privacy records, making it unfit for many communications. Unlike other Free protocols (such as Matrix and XMPP), messages aren't encrypted, which means that the people behind Discord are able to see every message that you type. They also actively block Tor users, which have to give Discord their phone number in order to use the platform. Their client is also proprietary and they disallow alternative clients made with the bot API. This is a platform that is very bad for privacy and security. You also cannot host your own server (unlike Matrix, XMPP, and IRC). You have to rely on centralised servers controlled by Discord themselves.</t>
  33. <t>The Matrix protocol is a Free protocol that has encrypted messages, spaces (like Discord's &quot;guilds&quot;), and some more features. The people behind Matrix also maintain the Element.io client which looks a lot like Discord. However, that client is quite big and most other clients either lack features or are unstable. The Matrix server software, Synapse, is also very big and uses lots of resources. Matrix is federated however, but most people prefer using the Matrix.org homeserver, due to the instability and inefficency of its server-to-server protocol, with only a handful of people self-hosting their own. While it is very user-friendly, Synapse is so slow that most people prefer using Matrix.org. So one of the many issues of IRC is also there: most people join big instances, which is bad for privacy as this is one point of failure. Matrix also uses a so-called &quot;identity&quot; server. Most people use the vector.im identity server, which is also bad for privacy.</t>
  34. <t>Guilds</t>
  35. <t>IDC aims to solve these problems progressively. The current version of IDC is a text-based non-federated protocol where users may have multiple connections and are not destroyed when all connections are destroyed, and servers save messages when the user is offline. Future versions will be federated, and may be distributed in the far future.</t>
  36. <section anchor="servers"><name>Servers</name>
  37. <t>The server forms the backbone of IDC, providing a point to which clients may connect to to talk to each other, and a point for other servers to connect to, forming the global IDC network. The typical network configuration for IDC servers MUST BE that of a mesh where each server connects to other servers directly, except in cases where a server is unable to connect to another server, where then servers SHOULD utilize servers in between as routing.</t>
  38. </section>
  39. <section anchor="clients"><name>Clients</name>
  40. <t>A client is anything connecting to a server that is not another server. Each client is distinguished from other clients by a unique CID having a length of 9 characters, private to each server.</t>
  41. </section>
  42. <section anchor="users"><name>Users</name>
  43. <t>Each client is associated with a user. Users are identified by a UID, in the form of user@host, where host is either (1) the FQDN of the server the user resides on or (2) a domain with a SRV record to the actual server. The UID is unique in the Internet. Messages are directed at users, which are then sent to all connected clients of the said user. If the user has no connected clients, i.e. the user is offline, the message SHOULD be kept until the user reconnects.</t>
  44. <section anchor="administrators"><name>Administrators</name>
  45. <t>To allow a reasonable amount of order to be kept within a server, a special class of users (administrators) is allowed to perform general maintenance functions on the server. Although the powers granted to an administrator can be considered as 'dangerous', they are nonetheless required. Administrators should be able to perform basic network tasks such as disconnecting and reconnecting servers as needed to prevent long-term use of bad network routing. In recognition of this need, the protocol discussed herein provides for operators only to be able to perform such functions.</t>
  46. <t>A system where independent users vote to decide on server actions MAY be implemented.</t>
  47. </section>
  48. </section>
  49. <section anchor="spaces"><name>Spaces</name>
  50. <t>A space is a identified group of one of more users. The space is created explicitly by a user on a server, and ceases to exist when the last user leaves it. While the space exists, any user can reference the space using the identifier of the space.</t>
  51. <t>Space identifiers are strings with the form &quot;&amp;name@server&quot;, where <em>name</em> is an alphanumeric string of length up to 128 characters and <em>server</em> is the server name of which the founder of the space resides on.</t>
  52. <t>To create a new space or become part of an existing space, a user is required to JOIN the space. If the space doesn't exist prior to joining, the space is created under the server the user is on and the creating user becomes the space operator. If the space already exists, whether or not the request to JOIN that space is honoured depends on the current options of the space. For example, if the space is invite-only, (<tt>+INVITE_ONLY</tt>), then the user may only join if invited. As part of the protocol, a user may be a part of several spaces at once.</t>
  53. <t>A user may have a nickname for use within the space, independent of their nickname when used outside of spaces, which is an alphanumeric of length up to 128 characters. A space may not have two users with the same nickname. In these cases, the user joined later (according to packet receiving order by the space's hosting server) will have a underscore appended to per nickname until it no longer collides with any other nickname in the space. If during this process the nickname exceeds 128 characters, the user is required to choose another nickname.</t>
  54. <t>Note: We'd need to define what &quot;packet&quot; is, since they're not lines in TCP, or datagrams in UDP, but something custom.</t>
  55. </section>
  56. <section anchor="channels"><name>Channels</name>
  57. <t>Channels are a group of users in a space who have permissions for reading the channel. Channel identifiers are strings, appending a '#' character and a name, where the name is an alphanumeric string of up to 128 characters, to the space that the channel is in.</t>
  58. </section>
  59. </section>
  60. <section anchor="permission-system"><name>Permission System</name>
  61. <section anchor="permissions"><name>Permissions</name>
  62. <t>Permissions allow users to perform actions that do not interfere with
  63. the permissions other users.</t>
  64. <ul spacing="compact">
  65. <li>talk :: allow the user to talk</li>
  66. <li>read :: allow the user to read the chat</li>
  67. </ul>
  68. </section>
  69. <section anchor="anti-permissions"><name>Anti-permissions</name>
  70. <t>Anti-permissions cause the user to be unable to exercise a matching
  71. permission, even if their role contains the said permission. There
  72. exists an anti-permission for each permission, with the name of the
  73. permission preceeded by a &quot;-&quot; (ASCII 0x2D HYPHEN-MINUS) character.</t>
  74. <ul spacing="compact">
  75. <li>-talk :: causes the user to be unable to talk</li>
  76. <li>-read :: causes the user to be deafened</li>
  77. </ul>
  78. </section>
  79. <section anchor="roles"><name>Roles</name>
  80. <t>Roles are sets of permissions, anti-permissions and management permissions (as defined in section 4). Users may have multiple roles and must at least have one role. All permissions, anti-permissions, and management permissions are granted via roles; users who have a role with a given permission have the permission, and users who don't have any roles containing a permission don't have the permission. Roles are ranked linearly, and may be set to self-deroleable.</t>
  81. <t>Note that the examples below note an example setup. Those with the &quot;roles&quot; management permission may customize these, as noted in section 4.</t>
  82. <ul spacing="compact">
  83. <li>1 administrator :: talk, read, mute, deafen, kick, ban, react</li>
  84. <li>2 teacher :: talk, read, mute, deafen, ban, react</li>
  85. <li>3 student :: talk, read, react</li>
  86. <li>0 default :: talk, read</li>
  87. <li>-1 spammer :: -talk, read, -react</li>
  88. </ul>
  89. </section>
  90. <section anchor="management-permissions"><name>Management Permissions</name>
  91. <t>Management permissions allow managing roles.</t>
  92. <t>There exists a management permission for each permission, and thus, each anti-permission.</t>
  93. <t>A user may give a user of a role, if all of the following conditions are met:
  94. - The user affected has a lower role than the actor;
  95. - The role given is lower or equal to the actor's role;
  96. - The actor has all corresponding management permissions for the permissions and anti-permissions of the role given.</t>
  97. <t>(how does granting management permissions work again)</t>
  98. </section>
  99. </section>
  100. <section anchor="the-idc-specification"><name>The IDC Specification</name>
  101. <section anchor="overview"><name>Overview</name>
  102. <t>The protocol as described herein is for use both with server to server and client to server connections. There are similiar restrictions on server connections as for client connections as this is a federated protocol.</t>
  103. </section>
  104. <section anchor="character-codes"><name>Character codes</name>
  105. <t>The character encoding for IDC is UTF-8.</t>
  106. </section>
  107. <section anchor="messages"><name>Messages</name>
  108. <t>Servers and clients send eachother messages which may or may not generate a reply. If the message contains a valid command, as described in later sections, the client should expect a reply as specified but it is not advised to wait forever for the reply; client to server and server to server communication is essentially asynchronous in nature.</t>
  109. <t>Each IDC message may consist of up to three main parts: the prefix (optional), the command, and the command parameters (of which there may be up to 30). The prefix, command, and all parameters are separated by one (or more) ASCII space character(s) (0x20).</t>
  110. <t>The presence of a prefix is indicated with a single leading ASCII colon character (':', 0x3b), which must be the first character of the message itself. There must be no gap (whitespace) between the colon and the prefix. The prefix is used by servers to indicate the true origin of the message. If the prefix is missing from the message, it is assumed to have originated from the connection from which it was received. Clients should not use prefix when sending a message from themselves; if they use a prefix, the only valid prefix is the registered nickname associated with the client. If the source identified by the prefix cannot be found from the server's internal database, or if the source is registered from a different link than from which the message arrived, the server must ignore the message with an error message.</t>
  111. <t>The command must be a valid IDC command.</t>
  112. <t>IDC messages are always lines of characters terminated with a CR-LF (Carriage Return - Line Feed) pair, and these messages shall not exceed 65536 characters in length, counting all characters including the trailing CR-LF. Thus, there are 65534 characters maximum allowed for the command and its parameters. There is no provision for continuation message lines. See section &lt;++&gt; for more details about current implementations.</t>
  113. <t>The protocol messages must be extracted from the contiguous stream of data. The current solution is to designate two characters, CR and LF, as message separators. Empty messages are silently ignored, which permits use of the sequence CR-LF between messages without extra problems.</t>
  114. <t>The extracted message is parsed into the components &lt;prefix&gt;,
  115. &lt;command&gt; and list of parameters matched either by &lt;middle&gt; or
  116. &lt;trailing&gt; components.</t>
  117. <t>The BNF representation for this is:</t>
  118. <artwork>&lt;message&gt; ::= [':' &lt;prefix&gt; &lt;SPACE&gt; ] &lt;command&gt; &lt;params&gt; &lt;crlf&gt;
  119. &lt;prefix&gt; ::= &lt;servername&gt; | &lt;nick&gt; [ '!' &lt;user&gt; ] [ '@' &lt;host&gt; ]
  120. &lt;command&gt; ::= &lt;letter&gt; { &lt;letter&gt; } | &lt;number&gt; &lt;number&gt; &lt;number&gt;
  121. &lt;SPACE&gt; ::= ' ' { ' ' }
  122. &lt;params&gt; ::= &lt;SPACE&gt; [ ':' &lt;trailing&gt; | &lt;middle&gt; &lt;params&gt; ]
  123. &lt;middle&gt; ::= &lt;Any *non-empty* sequence of octets not including SPACE
  124. or NUL or CR or LF, the first of which may not be ':'&gt;
  125. &lt;trailing&gt; ::= &lt;Any, possibly *empty*, sequence of octets not including
  126. NUL or CR or LF&gt;
  127. &lt;crlf&gt; ::= CR LF
  128. </artwork>
  129. <t>NOTES:</t>
  130. <ol spacing="compact">
  131. <li>&lt;SPACE&gt; is consists only of SPACE character(s) (0x20). Specially notice that TABULATION, and all other control characters are considered NON-WHITE-SPACE.</li>
  132. <li>After extracting the parameter list, all parameters are equal, whether matched by &lt;middle&gt; or &lt;trailing&gt;. &lt;Trailing&gt; is just a syntactic trick to allow SPACE within parameter.</li>
  133. <li>The fact that CR and LF cannot appear in parameter strings is just artifact of the message framing.</li>
  134. <li>The NUL character is not special in message framing, and basically could end up inside a parameter, but as it would cause extra complexities in normal C string handling. Therefore NUL is not allowed within messages.</li>
  135. <li>The last parameter may be an empty string.</li>
  136. <li>Use of the extended prefix (['!' &lt;user&gt; ] ['@' &lt;host&gt; ]) must not be used in server to server communications and is only intended for server to client messages in order to provide clients with more useful information about who a message is from without the need for additional queries.</li>
  137. </ol>
  138. <t>Most protocol messages specify additional semantics and syntax for
  139. the extracted parameter strings dictated by their position in the
  140. list. For example, many server commands will assume that the first
  141. parameter after the command is the list of targets, which can be
  142. described with:</t>
  143. <artwork>&lt;target&gt; ::= &lt;to&gt; [ &quot;,&quot; &lt;target&gt; ]
  144. &lt;to&gt; ::= &lt;channel&gt; | &lt;user&gt; '@' &lt;server&gt; | &lt;mask&gt;
  145. &lt;channel&gt; ::= ('#') &lt;chstring&gt;
  146. &lt;servername&gt; ::= &lt;host&gt;
  147. &lt;host&gt; ::= see RFC 952 [DNS:4] for details on allowed hostnames
  148. &lt;uid&gt; ::= &lt;letter&gt; { &lt;letter&gt; | &lt;number&gt; }
  149. &lt;mask&gt; ::= ('#' | '$') &lt;chstring&gt;
  150. &lt;chstring&gt; ::= &lt;any 8bit code except SPACE, BELL, NUL, CR, LF and
  151. comma (',')&gt;
  152. </artwork>
  153. <t>Other parameter syntaxes are:</t>
  154. <artwork>&lt;user&gt; ::= &lt;nonwhite&gt; { &lt;nonwhite&gt; }
  155. &lt;letter&gt; ::= 'a' ... 'z' | 'A' ... 'Z'
  156. &lt;number&gt; ::= '0' ... '9'
  157. &lt;special&gt; ::= '-' | '[' | ']' | '\' | '`' | '^' | '{' | '}'
  158. </artwork>
  159. <artwork>&lt;nonwhite&gt; ::= &lt;any 8bit code except SPACE (0x20), NUL (0x0), CR
  160. (0xd), and LF (0xa)&gt;
  161. </artwork>
  162. </section>
  163. </section>
  164. <section anchor="idc-concepts"><name>IDC Concepts.</name>
  165. <t>This section is devoted to describing the actual concepts behind the organization of the IDC protocol and how the current implementations deliver different classes of messages.</t>
  166. <section anchor="one-to-one-communication"><name>One-to-one communication</name>
  167. <t>Communication on a one-to-one basis is usually only performed by clients, since most server-server traffic is not a result of servers talking only to each other. To provide a secure means for clients to talk to each other, it is required that all servers be able to send a message to any other server.</t>
  168. </section>
  169. <section anchor="one-to-many"><name>One-to-many</name>
  170. <t>The main goal of IRC is to provide a forum which allows easy and
  171. efficient conferencing (one to many conversations). IRC offers
  172. several means to achieve this, each serving its own purpose.</t>
  173. <section anchor="to-a-list"><name>To a list</name>
  174. <t>The least efficient style of one-to-many conversation is through clients talking to a 'list' of users. How this is done is almost self explanatory: the client gives a list of destinations to which the message is to be delivered and the server breaks it up and dispatches a separate copy of the message to each given destination. This isn't as efficient as using a group since the destination list is broken up and the dispatch sent without checking to make sure duplicates aren't sent down each path.</t>
  175. </section>
  176. <section anchor="to-a-channel"><name>To a channel</name>
  177. <t>In IRC the channel has a role equivalent to that of the multicast group; their existence is dynamic (coming and going as people join and leave channels) and the actual conversation carried out on a channel is only sent to servers which are supporting users on a given channel. If there are multiple users on a server in the same channel, the message text is sent only once to that server and then sent to each client on the channel. This action is then repeated for each client-server combination until the original message has fanned out and reached each member of the channel.</t>
  178. </section>
  179. </section>
  180. </section>
  181. <section anchor="message-details"><name>Message details</name>
  182. <t>On the following pages are descriptions of each message recognized by the IRC server and client. All commands described in this section must be implemented by any server for this protocol.</t>
  183. <t>Where the reply ERR_NOSUCHSERVER is listed, it means that the &lt;server&gt; parameter could not be found. The server must not send any other replies after this for that command.</t>
  184. <t>The server to which a client is connected is required to parse the complete message, returning any appropriate errors. If the server encounters a fatal error while parsing a message, an error must be sent back to the client and the parsing terminated. A fatal error may be considered to be incorrect command, a destination which is otherwise unknown (server, user or channel names fit this category), not enough parameters or incorrect privileges.</t>
  185. <t>If a full set of parameters is presented, then each must be checked for validity and appropriate responses sent back to the client. In the case of messages which use parameter lists using the comma as an item separator, a reply must be sent for each item.</t>
  186. <t>In the examples below, some messages appear using the full format:</t>
  187. <artwork>:Name COMMAND parameter list
  188. </artwork>
  189. <t>Such examples represent a message from &quot;Name&quot; in transit between servers, where it is essential to include the name of the original sender of the message so remote servers may send back a reply along the correct path.</t>
  190. <section anchor="connection-registration"><name>Connection Registration</name>
  191. <t>The commands described here are used to register a connection with an IRC server as either a user or a server as well as correctly disconnect.</t>
  192. <t>A &quot;PASS&quot; command is not required for either client or server connection to be registered, but it must precede the server message or the latter of the NICK/USER combination. It is strongly recommended that all server connections have a password in order to give some level of security to the actual connections. The recommended order for a client to register is as follows:</t>
  193. <ol spacing="compact">
  194. <li>Pass message</li>
  195. <li>Nick message</li>
  196. <li>User message</li>
  197. </ol>
  198. <section anchor="password-message"><name>Password message</name>
  199. <artwork> Command: PASS
  200. </artwork>
  201. <t>Parameters: &lt;password&gt;</t>
  202. <t>The PASS command is used to set a 'connection password'. The password can and must be set before any attempt to register the connection is made. Currently this requires that clients send a PASS command before sending the NICK/USER combination and servers <em>must</em> send a PASS command before any SERVER command. The password supplied must match the one contained in the C/N lines (for servers) or I lines (for clients). It is possible to send multiple PASS commands before registering but only the last one sent is used for verification and it may not be changed once registered.</t>
  203. <t>Replies:</t>
  204. <artwork> ERR_NEEDMOREPARAMS ERR_ALREADYREGISTRED
  205. </artwork>
  206. <t>Example:</t>
  207. <artwork> PASS secretpasswordhere
  208. </artwork>
  209. </section>
  210. <section anchor="nick-message"><name>Nick message</name>
  211. <artwork> Command: NICK
  212. </artwork>
  213. <t>Parameters: &lt;nickname&gt;</t>
  214. <t>NICK message is used to give user a nickname or change the previous one.</t>
  215. <t>Numeric Replies:</t>
  216. <artwork> ERR_NONICKNAMEGIVEN ERR_ERRONEUSNICKNAME
  217. </artwork>
  218. </section>
  219. <section anchor="user-message"><name>User message</name>
  220. <artwork> Command: USER
  221. </artwork>
  222. <t>Parameters: &lt;UID&gt; &lt;realname&gt;</t>
  223. <t>The USER message is used at the beginning of connection to specify the username, hostname, servername and realname of s new user. It is also used in communication between servers to indicate new user arriving on IDC, since only after both USER and NICK have been received from a client does a user become registered.</t>
  224. <t>Between servers USER must to be prefixed with client's UID. Note that hostname and servername are normally ignored by the IRC server when the USER command comes from a directly connected client for security reasons, but they are used in server to server communication.</t>
  225. <t>It must be noted that realname parameter must be the last parameter, because it may contain space characters and must be prefixed with a colon (':') to make sure this is recognised as such.</t>
  226. <t>Replies:</t>
  227. <artwork> ERR_NEEDMOREPARAMS ERR_ALREADYREGISTRED
  228. </artwork>
  229. <t>Examples:</t>
  230. <artwork>USER andrew@andrewyu.org :Andrew Yu
  231. </artwork>
  232. </section>
  233. <section anchor="server-message"><name>Server message</name>
  234. <artwork> Command: SERVER
  235. </artwork>
  236. <t>Parameters: &lt;servername&gt; &lt;server description&gt;</t>
  237. <t>The SERVER message must only be accepted from a connection which is yet to be registered and is attempting to register as a server.</t>
  238. <t>Most errors that occur with the receipt of a SERVER command result in the connection being terminated by the destination host (target SERVER). Error replies are usually sent using the &quot;ERROR&quot; command rather than the numeric since the ERROR command has several useful properties which make it useful here.</t>
  239. </section>
  240. <section anchor="quit"><name>Quit</name>
  241. <artwork> Command: QUIT
  242. </artwork>
  243. <t>Parameters: [&lt;Quit message&gt;]</t>
  244. <t>A client session is ended with a quit message. The server must close the connection to a client which sends a QUIT message. If a &quot;Quit Message&quot; is given, this will be sent instead of the default message, the nickname.</t>
  245. <t>If, for some other reason, a client connection is closed without the client issuing a QUIT command (e.g. client dies and EOF occurs on socket), the server is required to fill in the quit message with some sort of message reflecting the nature of the event which caused it to happen.</t>
  246. </section>
  247. <section anchor="server-quit-message"><name>Server quit message</name>
  248. <artwork> Command: SQUIT
  249. </artwork>
  250. <t>Parameters: &lt;server&gt; &lt;comment&gt;</t>
  251. <t>The SQUIT message is needed to tell about quitting servers. If a server wishes to break the connection to another server it must send a SQUIT message to the other server, using the the name of the other server as the server parameter, which then closes its connection to the quitting server.</t>
  252. <t>This command is also available operators to help keep a network of IRC servers connected in an orderly fashion. Administrators may also issue an SQUIT message for a remote server connection.</t>
  253. <t>The &lt;comment&gt; should be supplied by all administrator who execute a SQUIT for a remote server (that is not connected to the server they are currently on) so that other administrators are aware for the reason of this action. The &lt;comment&gt; is also filled in by servers which may place an error or similar message here.</t>
  254. <t>Replies:</t>
  255. <artwork> ERR_NOPRIVILEGES ERR_NOSUCHSERVER
  256. </artwork>
  257. </section>
  258. </section>
  259. <section anchor="channel-operations"><name>Channel operations</name>
  260. <t>This group of messages is concerned with manipulating channels, their properties (channel modes), and their contents (typically users). In implementing these, a number of race conditions are inevitable when users send commands which will ultimately clash.</t>
  261. <section anchor="join-message"><name>Join message</name>
  262. <t>Command: JOIN
  263. Parameters: &lt;channel&gt;{,&lt;channel&gt;} [&lt;key&gt;{,&lt;key&gt;}]</t>
  264. <t>The JOIN command is used by user to start listening a specific
  265. channel. Whether or not a user is allowed to join a channel is
  266. checked by the server hosting the channel.</t>
  267. <t>The conditions of joining are as follows:</t>
  268. <ol spacing="compact">
  269. <li>the user must be invited if the channel is invite-only;</li>
  270. <li>the user's UID and per server must not match any active bans;</li>
  271. <li>the correct key (password) must be correct if it is set.</li>
  272. </ol>
  273. <t>These are discussed in more detail under the MODE command (see
  274. section 4.2.3 for more details).</t>
  275. <t>Once a user has joined a channel, they receive notice about all commands their server receives which affect the channel. This includes MODE, KICK, PART, QUIT and of course PRIVMSG/NOTICE. The JOIN command needs to be broadcast to all servers where a user thereof is on the said channel so that each server knows where to find the users who are on the channel. This allows optimal delivery of PRIVMSG/NOTICE messages to the channel.</t>
  276. <t>If a JOIN is successful, the user is then sent the channel's topic (using RPL_TOPIC) and the list of users who are on the channel (using RPL_NAMREPLY), which must include the user joining.</t>
  277. <t>Replies:</t>
  278. <artwork> ERR_NEEDMOREPARAMS ERR_BANNEDFROMCHAN
  279. ERR_INVITEONLYCHAN ERR_BADCHANNELKEY
  280. ERR_CHANNELISFULL ERR_BADCHANMASK
  281. ERR_NOSUCHCHANNEL ERR_TOOMANYCHANNELS
  282. RPL_TOPIC
  283. </artwork>
  284. </section>
  285. <section anchor="part-message"><name>Part message</name>
  286. <t>Command: PART
  287. Parameters: &lt;channel&gt;{,&lt;channel&gt;}</t>
  288. <t>The PART message causes the client sending the message to be removed from the list of active users for all given channels listed in the parameter string.</t>
  289. <t>Replies:</t>
  290. <artwork> ERR_NEEDMOREPARAMS ERR_NOSUCHCHANNEL
  291. ERR_NOTONCHANNEL
  292. </artwork>
  293. </section>
  294. <section anchor="mode-message"><name>Mode message</name>
  295. <t>Command: MODE</t>
  296. <t>The MODE command is a dual-purpose command in IDC. It allows both usernames and channels to have their mode changed.</t>
  297. <t>When parsing MODE messages, it is recommended that the entire message be parsed first and then the changes which resulted then passed on.</t>
  298. <section anchor="channel-modes"><name>Channel modes</name>
  299. <t>Parameters: &lt;channel&gt; {[+|-]|&lt;modes&gt;} [&lt;param&gt;]</t>
  300. <t>The MODE command is provided so that channel operators may change the characteristics of `their' channel. It is also required that servers be able to change channel modes so that channel operators may be created.</t>
  301. <t>The various modes available for channels are as follows:</t>
  302. <t>OPERATOR - give/take channel operator privileges;
  303. SECRET - secret channel flag;
  304. INVITE_ONLY - invite-only channel flag;
  305. TOPIC_OPERATOR_ONLY - topic settable by channel operator only flag;
  306. NO_EXTERNAL_MESSAGES - no messages to channel from clients on the outside;
  307. MODERATED - moderated channel;
  308. BAN - set a ban mask to keep users out;
  309. QUIET - set a quiet mask to keep users silent;
  310. VOICE - give/take the ability to speak on a moderated channel;
  311. KEY - set a channel key (password).</t>
  312. </section>
  313. <section anchor="user-modes"><name>User modes</name>
  314. <t>Parameters: &lt;nickname&gt; {[+|-]|&lt;modes&gt;} [&lt;param&gt;]</t>
  315. <t>The user MODEs are typically changes which affect either how the
  316. client is seen by others or what 'extra' messages the client is sent.
  317. A user MODE command may only be accepted if both the sender of the
  318. message and the nickname given as a parameter are both the same.</t>
  319. <t>The available modes are as follows:</t>
  320. <artwork> SERVER_NOTICES - marks a user for receipt of server notices;
  321. ADMINISTRATOR - operator flag.
  322. </artwork>
  323. <t>If a user attempts to make themselves an administrator using the &quot;+ADMINISTRATOR&quot; flag, the attempt should return ERR_NOPRIVILEGES. There is no restriction, however, on anyone `deadministratoring' themselves (using &quot;-ADMINISTRATOR&quot;).</t>
  324. <t>Replies:</t>
  325. <artwork> ERR_NEEDMOREPARAMS RPL_CHANNELMODEIS
  326. ERR_CHANOPRIVSNEEDED ERR_NOSUCHNICK
  327. ERR_NOTONCHANNEL ERR_KEYSET
  328. RPL_BANLIST RPL_ENDOFBANLIST
  329. ERR_UNKNOWNMODE ERR_NOSUCHCHANNEL
  330. ERR_USERSDONTMATCH RPL_UMODEIS
  331. ERR_UMODEUNKNOWNFLAG
  332. </artwork>
  333. </section>
  334. <section anchor="topic-message"><name>Topic message</name>
  335. <t>Command: TOPIC
  336. Parameters: &lt;channel&gt; [&lt;topic&gt;]</t>
  337. <t>The TOPIC message is used to change or view the topic of a channel. The topic for channel &lt;channel&gt; is returned if there is no &lt;topic&gt; given. If the &lt;topic&gt; parameter is present, the topic for that channel will be changed, if the channel modes permit this action.</t>
  338. <t>Replies:</t>
  339. <artwork> ERR_NEEDMOREPARAMS ERR_NOTONCHANNEL
  340. RPL_NOTOPIC RPL_TOPIC
  341. ERR_CHANOPRIVSNEEDED
  342. </artwork>
  343. </section>
  344. <section anchor="names-message"><name>Names message</name>
  345. <t>Command: NAMES
  346. Parameters: [&lt;channel&gt;{,&lt;channel&gt;}]</t>
  347. <t>By using the NAMES command, a user can list all nicknames that are visible to them on any channel that they can see. Channel names which they can see are those which aren't secret (+s) or those which they are actually on. The &lt;channel&gt; parameter specifies which channel(s) to return information about if valid. There is no error reply for bad channel names.</t>
  348. <t>If no &lt;channel&gt; parameter is given, a list of all channels and their
  349. occupants is returned. At the end of this list, a list of users who are
  350. visible but either not on any channel or not on a visible channel are
  351. listed as being on 'channel' &quot;*&quot;.</t>
  352. <t>Numerics:</t>
  353. <artwork> RPL_NAMREPLY RPL_ENDOFNAMES
  354. </artwork>
  355. </section>
  356. <section anchor="invite-message"><name>Invite message</name>
  357. <t>Command: INVITE
  358. Parameters: &lt;nickname&gt; &lt;channel&gt;</t>
  359. <t>The INVITE message is used to invite users to a channel. The parameter &lt;nickname&gt; is the nickname of the person to be invited to the target channel &lt;channel&gt;. The target user is being invited to must exist or be a valid channel. To invite a user to a channel which is invite only (MODE +i), the client sending the invite must be recognised as being a channel operator on the given channel.</t>
  360. <t>Replies:</t>
  361. <artwork> ERR_NEEDMOREPARAMS ERR_NOSUCHNICK
  362. ERR_NOTONCHANNEL ERR_USERONCHANNEL
  363. ERR_CHANOPRIVSNEEDED
  364. RPL_INVITING RPL_AWAY
  365. </artwork>
  366. </section>
  367. <section anchor="kick-command"><name>Kick command</name>
  368. <t>Command: KICK
  369. Parameters: &lt;channel&gt; &lt;user&gt; [&lt;comment&gt;]</t>
  370. <t>The KICK command can be used to forcibly remove a user from a
  371. channel. It 'kicks them out' of the channel (forced PART).</t>
  372. <t>Only a channel operator may kick another user out of a channel.
  373. Each server that receives a KICK message checks that it is valid
  374. (ie the sender is actually a channel operator) before removing
  375. the victim from the channel.</t>
  376. <t>Replies:</t>
  377. <artwork> ERR_NEEDMOREPARAMS ERR_NOSUCHCHANNEL
  378. ERR_BADCHANMASK ERR_CHANOPRIVSNEEDED
  379. ERR_NOTONCHANNEL
  380. </artwork>
  381. </section>
  382. </section>
  383. </section>
  384. <section anchor="server-queries-and-commands"><name>Server queries and commands</name>
  385. </section>
  386. </section>
  387. <section anchor="iana-considerations"><name>IANA Considerations</name>
  388. </section>
  389. <section anchor="security-considerations"><name>Security Considerations</name>
  390. </section>
  391. </middle>
  392. <back>
  393. <section anchor="acknowledgements"><name>Acknowledgements</name>
  394. <t>This document has multiple ideas suggested by luk3yx.</t>
  395. </section>
  396. </back>
  397. </rfc>