// Copyright (c) 2016-2017 Daniel Oaks // released under the MIT license package irc import ( "fmt" "sort" "strings" "sync" "github.com/oragono/oragono/irc/languages" ) // HelpEntryType represents the different sorts of help entries that can exist. type HelpEntryType int const ( // CommandHelpEntry is a help entry explaining a client command. CommandHelpEntry HelpEntryType = iota // InformationHelpEntry is a help entry explaining general server info. InformationHelpEntry // ISupportHelpEntry is a help entry explaining a specific RPL_ISUPPORT token. ISupportHelpEntry ) // HelpEntry represents an entry in the Help map. type HelpEntry struct { oper bool text string textGenerator func(*Client) string helpType HelpEntryType duplicate bool } // used for duplicates var ( cmodeHelpText = `== Channel Modes == Oragono supports the following channel modes: +b | Client masks that are banned from the channel (e.g. *!*@127.0.0.1) +e | Client masks that are exempted from bans. +I | Client masks that are exempted from the invite-only flag. +i | Invite-only mode, only invited clients can join the channel. +k | Key required when joining the channel. +l | Client join limit for the channel. +m | Moderated mode, only privileged clients can talk on the channel. +n | No-outside-messages mode, only users that are on the channel can send | messages to it. +R | Only registered users can join the channel. +s | Secret mode, channel won't show up in /LIST or whois replies. +t | Only channel opers can modify the topic. = Prefixes = +q (~) | Founder channel mode. +a (&) | Admin channel mode. +o (@) | Operator channel mode. +h (%) | Halfop channel mode. +v (+) | Voice channel mode.` umodeHelpText = `== User Modes == Oragono supports the following user modes: +a | User is marked as being away. This mode is set with the /AWAY command. +i | User is marked as invisible (their channels are hidden from whois replies). +o | User is an IRC operator. +R | User only accepts messages from other registered users. +s | Server Notice Masks (see help with /HELPOP snomasks). +Z | User is connected via TLS.` snomaskHelpText = `== Server Notice Masks == Oragono supports the following server notice masks for operators: a | Local announcements. c | Local client connections. j | Local channel actions. k | Local kills. n | Local nick changes. o | Local oper actions. q | Local quits. t | Local /STATS usage. u | Local client account actions. x | Local X-lines (DLINE/KLINE/etc). v | Local vhost changes. To set a snomask, do this with your nickname: /MODE +s For instance, this would set the kill, oper, account and xline snomasks on dan: /MODE dan +s koux` ) // Help contains the help strings distributed with the IRCd. var Help = map[string]HelpEntry{ // Commands "acc": { text: `ACC LS ACC REGISTER [callback_namespace:] [cred_type] : ACC VERIFY Used in account registration. See the relevant specs for more info: https://oragono.io/specs.html`, }, "ambiance": { text: `AMBIANCE The AMBIANCE command is used to send a scene notification to the given target.`, }, "authenticate": { text: `AUTHENTICATE Used during SASL authentication. See the IRCv3 specs for more info: http://ircv3.net/specs/extensions/sasl-3.1.html`, }, "away": { text: `AWAY [message] If [message] is sent, marks you away. If [message] is not sent, marks you no longer away.`, }, "batch": { text: `BATCH {+,-}reference-tag type [params...] BATCH initiates an IRCv3 client-to-server batch. You should never need to issue this command manually.`, }, "brb": { text: `BRB [message] Disconnects you from the server, while instructing the server to keep you present for a short time window. During this window, you can either resume or reattach to your nickname. If [message] is sent, it is used as your away message (and as your quit message if you don't return in time).`, }, "cap": { text: `CAP [:] Used in capability negotiation. See the IRCv3 specs for more info: http://ircv3.net/specs/core/capability-negotiation-3.1.html http://ircv3.net/specs/core/capability-negotiation-3.2.html`, }, "chathistory": { text: `CHATHISTORY [params] CHATHISTORY is a history replay command associated with the IRCv3 specification draft/chathistory. See this document: https://github.com/ircv3/ircv3-specifications/pull/393`, }, "debug": { oper: true, text: `DEBUG