rpl.rs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /* This file is part of DarkFi (https://dark.fi)
  2. *
  3. * Copyright (C) 2020-2024 Dyne.org foundation
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU Affero General Public License as
  7. * published by the Free Software Foundation, either version 3 of the
  8. * License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Affero General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Affero General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. #![allow(clippy::zero_prefixed_literal)]
  19. /// The welcome message sent upon successful registration
  20. pub const WELCOME: &str = "Welcome to the DarkIRC network";
  21. /// The message sent to the client when they are not registered
  22. pub const NOT_REGISTERED: &str = "You have not registered";
  23. /// The message sent to the client when they are already registered
  24. pub const ALREADY_REGISTERED: &str = "You may not reregister";
  25. /// The message sent to the client when they enter wrong or no password
  26. pub const PASSWORD_MISMATCH: &str = "Password incorrect";
  27. /// The message sent to the client when command params could not parse
  28. pub const INVALID_SYNTAX: &str = "Syntax error";
  29. /// `<client> :Welcome to the DarkIRC network`
  30. ///
  31. /// The first message sent after client registration.
  32. pub const RPL_WELCOME: u16 = 001;
  33. /// `<client> :Your host is <servername>, running version <version>`
  34. ///
  35. /// Part of the post-registration greeting.
  36. pub const RPL_YOURHOST: u16 = 002;
  37. /// `<client> <user modes>`
  38. ///
  39. /// Sent to a client to inform that client of their currently-set user modes.
  40. pub const RPL_UMODEIS: u16 = 221;
  41. /// `<client> [<server>] :Administrative info`
  42. ///
  43. /// Sent as a reply to an ADMIN command, this numeric establishes the
  44. /// name of the server whose administrative info is being provided.
  45. pub const RPL_ADMINME: u16 = 256;
  46. /// `<client> :<info>`
  47. ///
  48. /// Sent as a reply to an ADMIN command. `<info>` is a string intended to
  49. /// provide information about the location of the server.
  50. pub const RPL_ADMINLOC1: u16 = 257;
  51. /// `<client> :<info>`
  52. ///
  53. /// Sent as a reply to an ADMIN command. `<info>` is a string intended to
  54. /// provide information about whoever runs the server.
  55. pub const RPL_ADMINLOC2: u16 = 258;
  56. /// `<client> :<info>`
  57. ///
  58. /// Sent as a reply to an ADMIN command. `<info>` MUST contain the email
  59. /// address to contact the administrator(s) of the server.
  60. pub const RPL_ADMINEMAIL: u16 = 259;
  61. /// `<client> Channel :Users Name`
  62. ///
  63. /// Sent as a reply to the LIST command, this numeric marks the start
  64. /// of a channel list.
  65. pub const RPL_LISTSTART: u16 = 321;
  66. /// `<client> <channel> <client count> :<topic>`
  67. ///
  68. /// Sent as a reply to the LIST command, this numeric sends information
  69. /// about a channel to the client. `<channel>` is the name of the channel.
  70. /// `<client count>` is an integer indicating how many clients are joined
  71. /// to that channel. `<topic>` is the channel’s topic.
  72. pub const RPL_LIST: u16 = 322;
  73. /// `<client> :End of /LIST`
  74. ///
  75. /// Sent as a reply to the LIST command, this numeric indicates the end
  76. /// of a LIST response.
  77. pub const RPL_LISTEND: u16 = 323;
  78. /// `<client> <channel> <modestring> <mode arguments>...`
  79. ///
  80. /// Sent to a client to inform them of the currently-set modes of a channel.
  81. /// `<channel>` is the name of the channel.
  82. pub const RPL_CHANNELMODEIS: u16 = 324;
  83. /// `<client> <channel> :No topic is set`
  84. ///
  85. /// Sent to a client when joining a channel to inform them that the channel
  86. /// with the name `<channel>` does not have any topic set.
  87. pub const RPL_NOTOPIC: u16 = 331;
  88. /// `<client> <channel> :<topic>`
  89. ///
  90. /// Sent to a client when joining the `<channel>` to inform them of the
  91. /// current topic of the channel.
  92. pub const RPL_TOPIC: u16 = 332;
  93. /// `<client> <version> <server> :<comments>`
  94. ///
  95. /// Sent as a reply to the VERSION command.
  96. pub const RPL_VERSION: u16 = 351;
  97. /// `<client> <symbol> <channel> :[prefix]<nick>{ [prefix]<nick>}`
  98. ///
  99. /// Sent as a reply to the NAMES command
  100. pub const RPL_NAMREPLY: u16 = 353;
  101. /// `<client> <channel> :End of /NAMES list`
  102. ///
  103. /// Sent as a reply to the NAMES command
  104. pub const RPL_ENDOFNAMES: u16 = 366;
  105. /// `<client> :<string>`
  106. ///
  107. /// Sent as the reply to the INFO command.
  108. pub const RPL_INFO: u16 = 371;
  109. /// `<client> :End of INFO list`
  110. ///
  111. /// Indicates the end of an INFO response.
  112. pub const RPL_ENDOFINFO: u16 = 374;
  113. /// `<client> :- <server> Message of the day -`
  114. ///
  115. /// Indicates the start of the Message of the Day to the client.
  116. pub const RPL_MOTDSTART: u16 = 375;
  117. /// `<client> :<line of the motd>`
  118. ///
  119. /// When sending the Message of the Day to the client, servers reply
  120. /// with each line of the MOTD as this numeric.
  121. pub const RPL_MOTD: u16 = 372;
  122. /// `<client> :End of /MOTD command.`
  123. ///
  124. /// Indicates the end of the Message of the Day to the client.
  125. pub const RPL_ENDOFMOTD: u16 = 376;
  126. /// `<client> <nickname> :No such nick/channel`
  127. ///
  128. /// Indicates that no client can be found for the supplied nickname.
  129. pub const ERR_NOSUCHNICK: u16 = 401;
  130. /// `<client> <channel> :No such channel`
  131. ///
  132. /// Indicates that no channel can be found for the supplied channel name.
  133. pub const ERR_NOSUCHCHANNEL: u16 = 403;
  134. /// `<client> :No origin specified`
  135. ///
  136. /// Indicates a PING or PONG message missing the originator parameter
  137. /// which is required by old IRC servers. Nowadays, this may be used by
  138. /// some servers when the PING `<token>` is empty.
  139. pub const ERR_NOORIGIN: u16 = 409;
  140. /// `<client> :No recipient given (<command>)`
  141. ///
  142. /// Returned by the PRIVMSG command to indicate the message wasn’t
  143. /// delivered because there was no recipient given.
  144. pub const ERR_NORECIPIENT: u16 = 411;
  145. /// `<client> :No text to send`
  146. ///
  147. /// Returned by the PRIVMSG command to indicate the message wasn’t
  148. /// delivered because there was no text to send.
  149. pub const ERR_NOTEXTTOSEND: u16 = 412;
  150. /// `<client> <nick> :Erroneus nickname`
  151. ///
  152. /// Returned when a NICK command cannot be successfully completed as
  153. /// the desired nickname contains characters that are disallowed by the server.
  154. pub const ERR_ERRONEOUSNICKNAME: u16 = 432;
  155. /// `<client> :You have not registered`
  156. ///
  157. /// Returned when a client command cannot be parsed because they are
  158. /// not registered.
  159. pub const ERR_NOTREGISTERED: u16 = 451;
  160. /// `<client> <command> :Not enough parameters`
  161. ///
  162. /// Returned when a client command cannot be parsed because not enough
  163. /// parameters were supplied.
  164. pub const ERR_NEEDMOREPARAMS: u16 = 461;
  165. /// `<client> :You may not reregister`
  166. ///
  167. /// Returned when a client tries to change a detail that can only be
  168. /// set during registration.
  169. pub const ERR_ALREADYREGISTERED: u16 = 462;
  170. /// `<client> :Password incorrect`
  171. ///
  172. /// Returned to indicate that the connection could not be registered
  173. /// as the password was either incorrect or not supplied.
  174. pub const ERR_PASSWDMISMATCH: u16 = 464;
  175. /// `<client> :Cant change mode for other users`
  176. ///
  177. /// Indicates that a MODE command affecting a user failed because they
  178. /// were trying to set or view modes for other users.
  179. pub const ERR_USERSDONTMATCH: u16 = 502;