whitepaper.txt 37 KB

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