// Package irc provides constants and utilities for the // IRC protocol, including numeric reply codes from // RFC 1459 and RFC 2812, and standard command names. package irc // Connection registration replies (001-005). const ( RplWelcome = 1 RplYourHost = 2 RplCreated = 3 RplMyInfo = 4 RplIsupport = 5 ) // Command responses (200-399). const ( RplUmodeIs = 221 RplLuserClient = 251 RplLuserOp = 252 RplLuserUnknown = 253 RplLuserChannels = 254 RplLuserMe = 255 RplAway = 301 RplUserHost = 302 RplIson = 303 RplUnaway = 305 RplNowAway = 306 RplWhoisUser = 311 RplWhoisServer = 312 RplWhoisOperator = 313 RplEndOfWho = 315 RplWhoisIdle = 317 RplEndOfWhois = 318 RplWhoisChannels = 319 RplList = 322 RplListEnd = 323 RplChannelModeIs = 324 RplCreationTime = 329 RplNoTopic = 331 RplTopic = 332 RplTopicWhoTime = 333 RplInviting = 341 RplWhoReply = 352 RplNamReply = 353 RplEndOfNames = 366 RplBanList = 367 RplEndOfBanList = 368 RplMotd = 372 RplMotdStart = 375 RplEndOfMotd = 376 ) // Error replies (400-599). const ( ErrNoSuchNick = 401 ErrNoSuchServer = 402 ErrNoSuchChannel = 403 ErrCannotSendToChan = 404 ErrTooManyChannels = 405 ErrNoRecipient = 411 ErrNoTextToSend = 412 ErrUnknownCommand = 421 ErrNoNicknameGiven = 431 ErrErroneusNickname = 432 ErrNicknameInUse = 433 ErrUserNotInChannel = 441 ErrNotOnChannel = 442 ErrNotRegistered = 451 ErrNeedMoreParams = 461 ErrAlreadyRegistered = 462 ErrChannelIsFull = 471 ErrInviteOnlyChan = 473 ErrBannedFromChan = 474 ErrBadChannelKey = 475 ErrChanOpPrivsNeeded = 482 ) // names maps numeric codes to their standard IRC names. // //nolint:gochecknoglobals var names = map[int]string{ RplWelcome: "RPL_WELCOME", RplYourHost: "RPL_YOURHOST", RplCreated: "RPL_CREATED", RplMyInfo: "RPL_MYINFO", RplIsupport: "RPL_ISUPPORT", RplUmodeIs: "RPL_UMODEIS", RplLuserClient: "RPL_LUSERCLIENT", RplLuserOp: "RPL_LUSEROP", RplLuserUnknown: "RPL_LUSERUNKNOWN", RplLuserChannels: "RPL_LUSERCHANNELS", RplLuserMe: "RPL_LUSERME", RplAway: "RPL_AWAY", RplUserHost: "RPL_USERHOST", RplIson: "RPL_ISON", RplUnaway: "RPL_UNAWAY", RplNowAway: "RPL_NOWAWAY", RplWhoisUser: "RPL_WHOISUSER", RplWhoisServer: "RPL_WHOISSERVER", RplWhoisOperator: "RPL_WHOISOPERATOR", RplEndOfWho: "RPL_ENDOFWHO", RplWhoisIdle: "RPL_WHOISIDLE", RplEndOfWhois: "RPL_ENDOFWHOIS", RplWhoisChannels: "RPL_WHOISCHANNELS", RplList: "RPL_LIST", RplListEnd: "RPL_LISTEND", //nolint:misspell RplChannelModeIs: "RPL_CHANNELMODEIS", RplCreationTime: "RPL_CREATIONTIME", RplNoTopic: "RPL_NOTOPIC", RplTopic: "RPL_TOPIC", RplTopicWhoTime: "RPL_TOPICWHOTIME", RplInviting: "RPL_INVITING", RplWhoReply: "RPL_WHOREPLY", RplNamReply: "RPL_NAMREPLY", RplEndOfNames: "RPL_ENDOFNAMES", RplBanList: "RPL_BANLIST", RplEndOfBanList: "RPL_ENDOFBANLIST", RplMotd: "RPL_MOTD", RplMotdStart: "RPL_MOTDSTART", RplEndOfMotd: "RPL_ENDOFMOTD", ErrNoSuchNick: "ERR_NOSUCHNICK", ErrNoSuchServer: "ERR_NOSUCHSERVER", ErrNoSuchChannel: "ERR_NOSUCHCHANNEL", ErrCannotSendToChan: "ERR_CANNOTSENDTOCHAN", ErrTooManyChannels: "ERR_TOOMANYCHANNELS", ErrNoRecipient: "ERR_NORECIPIENT", ErrNoTextToSend: "ERR_NOTEXTTOSEND", ErrUnknownCommand: "ERR_UNKNOWNCOMMAND", ErrNoNicknameGiven: "ERR_NONICKNAMEGIVEN", ErrErroneusNickname: "ERR_ERRONEUSNICKNAME", ErrNicknameInUse: "ERR_NICKNAMEINUSE", ErrUserNotInChannel: "ERR_USERNOTINCHANNEL", ErrNotOnChannel: "ERR_NOTONCHANNEL", ErrNotRegistered: "ERR_NOTREGISTERED", ErrNeedMoreParams: "ERR_NEEDMOREPARAMS", ErrAlreadyRegistered: "ERR_ALREADYREGISTERED", ErrChannelIsFull: "ERR_CHANNELISFULL", ErrInviteOnlyChan: "ERR_INVITEONLYCHAN", ErrBannedFromChan: "ERR_BANNEDFROMCHAN", ErrBadChannelKey: "ERR_BADCHANNELKEY", ErrChanOpPrivsNeeded: "ERR_CHANOPRIVSNEEDED", } // Name returns the standard IRC name for a numeric code // (e.g., Name(2) returns "RPL_YOURHOST"). Returns an // empty string if the code is unknown. func Name(code int) string { return names[code] }