Documentation ¶
Overview ¶
Package proto defines convenience functions for IRC protocol requests.
Index ¶
- func Admin(w io.Writer, server ...string) error
- func Away(w io.Writer, message ...string) error
- func CNotice(w io.Writer, nickname, channel, message string) error
- func CPrivMsg(w io.Writer, nickname, channel, message string) error
- func Connect(w io.Writer, targetServer string, port int, remoteServer ...string) error
- func Die(w io.Writer) error
- func Info(w io.Writer, server ...string) error
- func Invite(w io.Writer, nickname, channel string) error
- func IsOn(w io.Writer, nicknames ...string) error
- func Join(w io.Writer, channels ...irc.Channel) (err error)
- func Kick(w io.Writer, channel, client string, reason ...string) error
- func Knock(w io.Writer, channel string, message ...string) error
- func List(w io.Writer, channels ...string) error
- func Mode(w io.Writer, target, mode string, argv ...string) error
- func Names(w io.Writer, channels ...string) error
- func Nick(w io.Writer, nickname string, password ...string) error
- func Notice(w io.Writer, target, f string, argv ...interface{}) error
- func Oper(w io.Writer, nickname, password string) error
- func Part(w io.Writer, channels ...irc.Channel) (err error)
- func Pass(w io.Writer, password string) error
- func Pong(w io.Writer, payload string) error
- func PrivMsg(w io.Writer, target, f string, argv ...interface{}) error
- func Quit(w io.Writer, message ...string) error
- func Raw(w io.Writer, msg string, argv ...interface{}) error
- func Recover(w io.Writer, nickname, password string) error
- func Rehash(w io.Writer, username string) error
- func Restart(w io.Writer, username string) error
- func SQuit(w io.Writer, server, message string) error
- func SetName(w io.Writer, name string) error
- func Silence(w io.Writer, masks ...string) error
- func Summon(w io.Writer, user, server, channel string) error
- func Time(w io.Writer, server ...string) error
- func Topic(w io.Writer, channel string, topic ...string) error
- func User(w io.Writer, username, mode, realname string) error
- func UserHost(w io.Writer, names ...string) error
- func UserIP(w io.Writer, nickname string) error
- func Users(w io.Writer, server ...string) error
- func Version(w io.Writer, server ...string) error
- func Wallops(w io.Writer, f string, argv ...interface{}) error
- func Watch(w io.Writer, masks ...string) error
- func Who(w io.Writer, name string, opOnly bool) error
- func Whois(w io.Writer, nickname string, server ...string) error
- func Whowas(w io.Writer, target string, server ...string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Admin ¶
Admin instructs the server to return information about the administrator of the server specified by <server>. If omitted, the current server is assumed.
func Away ¶
Away marks us as being away, provided there is an away message. If the away message is empty, the away status is removed.
func CNotice ¶
CNotice sends a channel NOTICE message to <nickname> on <channel> that bypasses flood protection limits. The target nickname must be in the same channel as the client issuing the command, and the client must be a channel operator.
Normally an IRC server will limit the number of different targets a client can send messages to within a certain time frame to prevent spammers or bots from mass-messaging users on the network, however this command can be used by channel operators to bypass that limit in their channel. For example, it is often used by help operators that may be communicating with a large number of users in a help channel at one time.
This command is not formally defined in an RFC, but is in use by some IRC networks. Support is indicated in a RPL_ISUPPORT reply (numeric 005) with the CNOTICE keyword.
func CPrivMsg ¶
CPrivMsg sends a private message to <nickname> on <channel> that bypasses flood protection limits. The target nickname must be in the same channel as the client issuing the command, and the client must be a channel operator.
Normally an IRC server will limit the number of different targets a client can send messages to within a certain time frame to prevent spammers or bots from mass-messaging users on the network, however this command can be used by channel operators to bypass that limit in their channel. For example, it is often used by help operators that may be communicating with a large number of users in a help channel at one time.
This command is not formally defined in an RFC, but is in use by some IRC networks. Support is indicated in a RPL_ISUPPORT reply (numeric 005) with the CPRIVMSG keyword.
func Connect ¶
Connect instructs the server <remote server> (or the current server, if <remote server> is omitted) to connect to <target server> on port <port>.
This command should only be available to IRC Operators.
func Info ¶
Info requests information about the target server, or the current server if <server> is omitted. Information returned includes the server's version, when it was compiled, the patch level, when it was started, and any other information which may be considered to be relevant.
func Invite ¶
Invite invites <nickname> to <channel>. <channel> does not have to exist, but if it does, only members of the channel are allowed to invite other clients. If the channel mode i is set, only channel operators may invite other clients.
func IsOn ¶
IsOn requests the server to see if the nicknames in the given list are currently on the network. The server returns only the nicknames which are on the network in a space-separated list. If none of the clients are on the network, it returns an empty list.
func Kick ¶
Kick forcibly removes <client> from <channel>. This command may only be issued by channel operators. The optional reason tells the client why they were kicked.
func Knock ¶
Knock sends a NOTICE to an invitation-only <channel> with an optional <message>, requesting an invite.
This command is not formally defined by an RFC, but is supported by most major IRC daemons. Support is indicated in a RPL_ISUPPORT reply (numeric 005) with the KNOCK keyword.
func List ¶
List requests all channels on the server. If the comma-separated list <channels> is given, it will return the channel topics.
func Mode ¶
Mode changes the mode for the given user or channel. Optionally with the given argument.
func Names ¶
Names queries users in the given list of <channels>, If <channels> is omitted, all users are shown, grouped by channel name with all users who are not on a channel being shown as part of channel "*". If <server> is specified, the command is sent to <server> for evaluation.
The response contains all nicknames in the channel, prefixed with the highest channel status prefix of that user, for example like this (with @ being the highest status prefix).
:irc.server.net 353 Phyre = #SomeChannel :@WiZ
If a client wants to receive all the channel status prefixes of a user and not only their current highest one, the IRCv3 multi-prefix extension can be enabled (@ is the channel operator prefix, and + the lower voice status prefix):
:irc.server.net 353 Phyre = #SomeChannel :@+WiZ
func Nick ¶
Nick allows a client to change their IRC nickname. The optional password is used to authenticate the user with nickserv.
func Notice ¶
Notice works similarly to PRIVMSG, except automatic replies must never be sent in reply to NOTICE messages.
func Pass ¶
Pass sets a connection password. This command must be sent before the NICK/USER registration combination. It is ignored if the given password is empty.
func PrivMsg ¶
PrivMsg sends the specified formatted message to the given target. The target may be a channel or nickname. If the previous message was sent less then a second ago, sending is delayed. This is to prevent disconnects because of excess flood.
func Raw ¶
Raw sends the given, raw message data.
The message being sent is reformatted to match the IRC specification. Meaning that it can not exceed 512 bytes and must end with `\r\n`. Any data beyond 512 bytes is simply discarded.
func Recover ¶
Recover attempts to re-authenticate our username, so we can regain the use of it. This is mostly useful after we received a NickInUse error and is only relevant if there is a nickserv. NOTE 10.07.2020 by mouz: This does not work. Neither does REGAIN
when connecting.
func Rehash ¶
Rehash causes the server to re-read and re-process its configuration file(s). This command can only be sent by IRC Operators
func SetName ¶
SetName allows a client to change the "real name" specified when registering a connection.
This command is not formally defined by an RFC, but is in use by some IRC daemons. Support is indicated in a RPL_ISUPPORT reply (numeric 005) with the SETNAME keyword
func Silence ¶
Silence adds or removes a host mask to a server-side ignore list that prevents matching users from sending the client messages. More than one mask may be specified. Each item prefixed with a "+" or "-" to designate whether it is being added or removed. Sending the command with no parameters returns the entries in the client's ignore list.
This command is not formally defined in an RFC, but is supported by most major IRC daemons. Support is indicated in a RPL_ISUPPORT reply (numeric 005) with the SILENCE keyword and the maximum number of entries a client may have in its ignore list. For example:
:irc.server.net 005 WiZ WALLCHOPS WATCH=128 SILENCE=15 MODES=12 CHANTYPES=#
func Summon ¶
Summon gives users who are on the same host as <server> a message asking them to join IRC. If server is omitted, the current server is assumed. Channel is optional and will request them to join that specific channel.
func Topic ¶
Topic allows the client to query or set the channel topic on <channel>. If channel mode +t is set, only a channel operator may set the topic.
func User ¶
User is used at the beginning of a connection to specify the username, hostname, real name and initial user modes of the connecting client. <realname> may contain spaces.
E.g.: USER joe 8 * :joe smith
func UserIP ¶
UserIP requests the direct IP address of the user with the specified nickname.
This command is often used to obtain the IP of an abusive user to more effectively perform a ban. It is unclear what, if any, privileges are required to execute this command on a server.
This command is not formally defined by an RFC, but is in use by some IRC daemons. Support is indicated in a RPL_ISUPPORT reply (numeric 005) with the USERIP keyword.
func Users ¶
Users requests a list of users and information about those users in a format similar to the UNIX commands who, rusers and finger. The command is optionally targeted at a specific server.
func Wallops ¶
Wallops sends a formatted message to all operators connected to the server or all users with user mode 'w' set.
func Watch ¶
Watch adds or removes a user to a client's server-side friends list. More than one nickname may be specified. Each item prefixed with a "+" or "-" to designate whether it is being added or removed. Sending the command with no parameters returns the entries in the client's friends list.
This command is not formally defined in an RFC, but is supported by most major IRC daemons. Support is indicated in a RPL_ISUPPORT reply (numeric 005) with the WATCH keyword and the maximum number of entries a client may have in its friends list. For example:
:irc.server.net 005 WiZ WALLCHOPS WATCH=128 SILENCE=15 MODES=12 CHANTYPES=#
func Who ¶
Who requests a list of users who match <name>. If opOnly is truen, the server will only return information about IRC Operators.
Types ¶
This section is empty.