mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 21:39:25 +01:00
HELP: Check topics exist at startup, fix a bug
This commit is contained in:
parent
a7949b6cb4
commit
194fa9af9f
@ -19,6 +19,7 @@ New release of Oragono!
|
|||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
* Fixed bug where `HELP` wouldn't correctly display for operators, and added more help topics.
|
||||||
|
|
||||||
|
|
||||||
## [0.3.0] - 2016-10-23
|
## [0.3.0] - 2016-10-23
|
||||||
|
92
irc/help.go
92
irc/help.go
@ -18,7 +18,7 @@ type HelpEntry struct {
|
|||||||
// used for duplicates
|
// used for duplicates
|
||||||
var (
|
var (
|
||||||
cmodeHelpText = `== Channel Modes ==
|
cmodeHelpText = `== Channel Modes ==
|
||||||
|
|
||||||
Oragono supports the following channel modes:
|
Oragono supports the following channel modes:
|
||||||
|
|
||||||
= Type A - list modes =
|
= Type A - list modes =
|
||||||
@ -38,7 +38,7 @@ Oragono supports the following channel modes:
|
|||||||
+m | Moderated mode, only privileged clients can talk on 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 the channel messages.
|
+n | No-outside-messages mode, only users that are on the channel can send the channel messages.
|
||||||
+t | Only channel opers can modify the topic.
|
+t | Only channel opers can modify the topic.
|
||||||
+s | Secret mode, channel won't show up in /LIST or whois replies.
|
+s | Secret mode, channel won't show up in /LIST or whois replies.
|
||||||
|
|
||||||
= Prefixes =
|
= Prefixes =
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ Oragono supports the following channel modes:
|
|||||||
+h (%) | Halfop channel mode.
|
+h (%) | Halfop channel mode.
|
||||||
+v (+) | Voice channel mode.`
|
+v (+) | Voice channel mode.`
|
||||||
umodeHelpText = `== User Modes ==
|
umodeHelpText = `== User Modes ==
|
||||||
|
|
||||||
Oragono supports the following user modes:
|
Oragono supports the following user modes:
|
||||||
|
|
||||||
+a | User is marked as being away. This mode is set with the /AWAY command.
|
+a | User is marked as being away. This mode is set with the /AWAY command.
|
||||||
@ -62,7 +62,7 @@ var Help = map[string]HelpEntry{
|
|||||||
// Commands
|
// Commands
|
||||||
"authenticate": {
|
"authenticate": {
|
||||||
text: `AUTHENTICATE
|
text: `AUTHENTICATE
|
||||||
|
|
||||||
Used during SASL authentication. See the IRCv3 specs for more info:
|
Used during SASL authentication. See the IRCv3 specs for more info:
|
||||||
http://ircv3.net/specs/extensions/sasl-3.1.html`,
|
http://ircv3.net/specs/extensions/sasl-3.1.html`,
|
||||||
},
|
},
|
||||||
@ -74,7 +74,7 @@ longer away.`,
|
|||||||
},
|
},
|
||||||
"cap": {
|
"cap": {
|
||||||
text: `CAP <subcommand> [:<capabilities>]
|
text: `CAP <subcommand> [:<capabilities>]
|
||||||
|
|
||||||
Used in capability negotiation. See the IRCv3 specs for more info:
|
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.1.html
|
||||||
http://ircv3.net/specs/core/capability-negotiation-3.2.html`,
|
http://ircv3.net/specs/core/capability-negotiation-3.2.html`,
|
||||||
@ -82,7 +82,7 @@ http://ircv3.net/specs/core/capability-negotiation-3.2.html`,
|
|||||||
"debug": {
|
"debug": {
|
||||||
oper: true,
|
oper: true,
|
||||||
text: `DEBUG <option>
|
text: `DEBUG <option>
|
||||||
|
|
||||||
Prints debug information about the IRCd. <option> can be one of:
|
Prints debug information about the IRCd. <option> can be one of:
|
||||||
|
|
||||||
* GCSTATS: Garbage control statistics.
|
* GCSTATS: Garbage control statistics.
|
||||||
@ -90,6 +90,11 @@ Prints debug information about the IRCd. <option> can be one of:
|
|||||||
* STARTCPUPROFILE: Starts the CPU profiler.
|
* STARTCPUPROFILE: Starts the CPU profiler.
|
||||||
* STOPCPUPROFILE: Stops the CPU profiler.
|
* STOPCPUPROFILE: Stops the CPU profiler.
|
||||||
* PROFILEHEAP: Writes out the CPU profiler info.`,
|
* PROFILEHEAP: Writes out the CPU profiler info.`,
|
||||||
|
},
|
||||||
|
"help": {
|
||||||
|
text: `HELP <argument>
|
||||||
|
|
||||||
|
Get an explanation of <argument>.`,
|
||||||
},
|
},
|
||||||
"invite": {
|
"invite": {
|
||||||
text: `INVITE <nickname> <channel>
|
text: `INVITE <nickname> <channel>
|
||||||
@ -99,7 +104,7 @@ appropriate channel privs.`,
|
|||||||
},
|
},
|
||||||
"ison": {
|
"ison": {
|
||||||
text: `ISON <nickname>{ <nickname>}
|
text: `ISON <nickname>{ <nickname>}
|
||||||
|
|
||||||
Returns whether the given nicks exist on the network.`,
|
Returns whether the given nicks exist on the network.`,
|
||||||
},
|
},
|
||||||
"join": {
|
"join": {
|
||||||
@ -111,55 +116,76 @@ parts all channels instead.`,
|
|||||||
},
|
},
|
||||||
"kick": {
|
"kick": {
|
||||||
text: `KICK <channel> <user> [reason]
|
text: `KICK <channel> <user> [reason]
|
||||||
|
|
||||||
Removes the user from the given channel, so long as you have the appropriate
|
Removes the user from the given channel, so long as you have the appropriate
|
||||||
channel privs.`,
|
channel privs.`,
|
||||||
},
|
},
|
||||||
"kill": {
|
"kill": {
|
||||||
oper: true,
|
oper: true,
|
||||||
text: `KILL <nickname> [reason]
|
text: `KILL <nickname> [reason]
|
||||||
|
|
||||||
Removes the given user from the network, showing them the reason if it is
|
Removes the given user from the network, showing them the reason if it is
|
||||||
supplied.`,
|
supplied.`,
|
||||||
},
|
},
|
||||||
"list": {
|
"list": {
|
||||||
text: `LIST [<channel>{,<channel>}] [<elistcond>{,<elistcond>}]
|
text: `LIST [<channel>{,<channel>}] [<elistcond>{,<elistcond>}]
|
||||||
|
|
||||||
Shows information on the given channels (or if none are given, then on all
|
Shows information on the given channels (or if none are given, then on all
|
||||||
channels). <elistcond>s modify how the channels are selected.`,
|
channels). <elistcond>s modify how the channels are selected.`,
|
||||||
//TODO(dan): Explain <elistcond>s in more specific detail
|
//TODO(dan): Explain <elistcond>s in more specific detail
|
||||||
},
|
},
|
||||||
"mode": {
|
"mode": {
|
||||||
text: `MODE <target> [<modestring> [<mode arguments>...]]
|
text: `MODE <target> [<modestring> [<mode arguments>...]]
|
||||||
|
|
||||||
Sets and removes modes from the given target. For more specific information on
|
Sets and removes modes from the given target. For more specific information on
|
||||||
mode characters, see the help for "cmode" and "umode".`,
|
mode characters, see the help for "cmode" and "umode".`,
|
||||||
|
},
|
||||||
|
"monitor": {
|
||||||
|
text: `MONITOR <subcmd>
|
||||||
|
|
||||||
|
Allows the monitoring of nicknames, for alerts when they are online and
|
||||||
|
offline. The subcommands are:
|
||||||
|
|
||||||
|
MONITOR + target{,target}
|
||||||
|
Adds the given names to your list of monitored nicknames.
|
||||||
|
|
||||||
|
MONITOR - target{,target}
|
||||||
|
Removes the given names from your list of monitored nicknames.
|
||||||
|
|
||||||
|
MONITOR C
|
||||||
|
Clears your list of monitored nicknames.
|
||||||
|
|
||||||
|
MONITOR L
|
||||||
|
Lists all the nicknames you are currently monitoring.
|
||||||
|
|
||||||
|
MONITOR S
|
||||||
|
Lists whether each nick in your MONITOR list is online or offline.`,
|
||||||
},
|
},
|
||||||
"motd": {
|
"motd": {
|
||||||
text: `MOTD [server]
|
text: `MOTD [server]
|
||||||
|
|
||||||
Returns the message of the day for this, or the given, server.`,
|
Returns the message of the day for this, or the given, server.`,
|
||||||
},
|
},
|
||||||
"names": {
|
"names": {
|
||||||
text: `NAMES [<channel>{,<channel>}]
|
text: `NAMES [<channel>{,<channel>}]
|
||||||
|
|
||||||
Views the clients joined to a channel and their channel membership prefixes. To
|
Views the clients joined to a channel and their channel membership prefixes. To
|
||||||
view the channel membership prefixes supported by this server, see the help for
|
view the channel membership prefixes supported by this server, see the help for
|
||||||
"PREFIX".`,
|
"PREFIX".`,
|
||||||
},
|
},
|
||||||
"nick": {
|
"nick": {
|
||||||
text: `NICK <newnick>
|
text: `NICK <newnick>
|
||||||
|
|
||||||
Sets your nickname to the new given one.`,
|
Sets your nickname to the new given one.`,
|
||||||
},
|
},
|
||||||
"notice": {
|
"notice": {
|
||||||
text: `NOTICE <target>{,<target>} <text to be sent>
|
text: `NOTICE <target>{,<target>} <text to be sent>
|
||||||
|
|
||||||
Sends the text to the given targets as a NOTICE.`,
|
Sends the text to the given targets as a NOTICE.`,
|
||||||
},
|
},
|
||||||
"oper": {
|
"oper": {
|
||||||
text: `OPER <name> <password>
|
text: `OPER <name> <password>
|
||||||
|
|
||||||
If the correct details are given, gives you IRCop privs.`,
|
If the correct details are given, gives you IRCop privs.`,
|
||||||
},
|
},
|
||||||
"part": {
|
"part": {
|
||||||
@ -169,23 +195,23 @@ Leaves the given channels and shows people the given reason.`,
|
|||||||
},
|
},
|
||||||
"pass": {
|
"pass": {
|
||||||
text: `PASS <password>
|
text: `PASS <password>
|
||||||
|
|
||||||
When the server requires a connection password to join, used to send us the
|
When the server requires a connection password to join, used to send us the
|
||||||
password.`,
|
password.`,
|
||||||
},
|
},
|
||||||
"ping": {
|
"ping": {
|
||||||
text: `PING <args>...
|
text: `PING <args>...
|
||||||
|
|
||||||
Requests a PONG. Used to check link connectivity.`,
|
Requests a PONG. Used to check link connectivity.`,
|
||||||
},
|
},
|
||||||
"pong": {
|
"pong": {
|
||||||
text: `PONG <args>...
|
text: `PONG <args>...
|
||||||
|
|
||||||
Replies to a PING. Used to check link connectivity.`,
|
Replies to a PING. Used to check link connectivity.`,
|
||||||
},
|
},
|
||||||
"privmsg": {
|
"privmsg": {
|
||||||
text: `PRIVMSG <target>{,<target>} <text to be sent>
|
text: `PRIVMSG <target>{,<target>} <text to be sent>
|
||||||
|
|
||||||
Sends the text to the given targets as a PRIVMSG.`,
|
Sends the text to the given targets as a PRIVMSG.`,
|
||||||
},
|
},
|
||||||
"sanick": {
|
"sanick": {
|
||||||
@ -196,7 +222,7 @@ Gives the given user a new nickname.`,
|
|||||||
},
|
},
|
||||||
"quit": {
|
"quit": {
|
||||||
text: `QUIT [reason]
|
text: `QUIT [reason]
|
||||||
|
|
||||||
Indicates that you're leaving the server, and shows everyone the given reason.`,
|
Indicates that you're leaving the server, and shows everyone the given reason.`,
|
||||||
},
|
},
|
||||||
"reg": {
|
"reg": {
|
||||||
@ -205,27 +231,33 @@ REG VERIFY <accountname> <auth_code>
|
|||||||
|
|
||||||
Used in account registration. See the relevant specs for more info:
|
Used in account registration. See the relevant specs for more info:
|
||||||
https://github.com/DanielOaks/ircv3-specifications/blob/register-and-verify/extensions/reg-core-3.3.md`,
|
https://github.com/DanielOaks/ircv3-specifications/blob/register-and-verify/extensions/reg-core-3.3.md`,
|
||||||
|
},
|
||||||
|
"rehash": {
|
||||||
|
oper: true,
|
||||||
|
text: `REHASH
|
||||||
|
|
||||||
|
Reloads the config file and updates TLS certificates on listeners`,
|
||||||
},
|
},
|
||||||
"time": {
|
"time": {
|
||||||
text: `TIME [server]
|
text: `TIME [server]
|
||||||
|
|
||||||
Shows the time of the current, or the given, server.`,
|
Shows the time of the current, or the given, server.`,
|
||||||
},
|
},
|
||||||
"topic": {
|
"topic": {
|
||||||
text: `TOPIC <channel> [topic]
|
text: `TOPIC <channel> [topic]
|
||||||
|
|
||||||
If [topic] is given, sets the topic in the channel to that. If [topic] is not
|
If [topic] is given, sets the topic in the channel to that. If [topic] is not
|
||||||
given, views the current topic on the channel.`,
|
given, views the current topic on the channel.`,
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
text: `USER <username> 0 * <realname>
|
text: `USER <username> 0 * <realname>
|
||||||
|
|
||||||
Used in connection registration, sets your username and realname to the given
|
Used in connection registration, sets your username and realname to the given
|
||||||
values (though your username may also be looked up with Ident).`,
|
values (though your username may also be looked up with Ident).`,
|
||||||
},
|
},
|
||||||
"version": {
|
"version": {
|
||||||
text: `VERSION [server]
|
text: `VERSION [server]
|
||||||
|
|
||||||
Views the version of software and the RPL_ISUPPORT tokens for the given server.`,
|
Views the version of software and the RPL_ISUPPORT tokens for the given server.`,
|
||||||
},
|
},
|
||||||
"who": {
|
"who": {
|
||||||
@ -235,12 +267,12 @@ Returns information for the given user.`,
|
|||||||
},
|
},
|
||||||
"whois": {
|
"whois": {
|
||||||
text: `WHOIS <client>{,<client>}
|
text: `WHOIS <client>{,<client>}
|
||||||
|
|
||||||
Returns information for the given user(s).`,
|
Returns information for the given user(s).`,
|
||||||
},
|
},
|
||||||
"whowas": {
|
"whowas": {
|
||||||
text: `WHOWAS <nickname>
|
text: `WHOWAS <nickname>
|
||||||
|
|
||||||
Returns historical information on the last user with the given nickname.`,
|
Returns historical information on the last user with the given nickname.`,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -261,7 +293,7 @@ Returns historical information on the last user with the given nickname.`,
|
|||||||
// RPL_ISUPPORT
|
// RPL_ISUPPORT
|
||||||
"casemapping": {
|
"casemapping": {
|
||||||
text: `RPL_ISUPPORT CASEMAPPING
|
text: `RPL_ISUPPORT CASEMAPPING
|
||||||
|
|
||||||
Oragono supports an experimental unicode casemapping designed for extended
|
Oragono supports an experimental unicode casemapping designed for extended
|
||||||
Unicode support. This casemapping is based off RFC 7700 and the draft rfc7700
|
Unicode support. This casemapping is based off RFC 7700 and the draft rfc7700
|
||||||
casemapping spec here:
|
casemapping spec here:
|
||||||
@ -305,14 +337,14 @@ func helpHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
|||||||
|
|
||||||
if len(argument) < 1 {
|
if len(argument) < 1 {
|
||||||
client.sendHelp("HELP", `HELP <argument>
|
client.sendHelp("HELP", `HELP <argument>
|
||||||
|
|
||||||
Get an explanation of <argument>.`)
|
Get an explanation of <argument>.`)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
helpHandler, exists := Help[argument]
|
helpHandler, exists := Help[argument]
|
||||||
|
|
||||||
if exists && (!client.flags[Operator] || (helpHandler.oper && client.flags[Operator])) {
|
if exists && (!helpHandler.oper || (helpHandler.oper && client.flags[Operator])) {
|
||||||
client.sendHelp(strings.ToUpper(argument), helpHandler.text)
|
client.sendHelp(strings.ToUpper(argument), helpHandler.text)
|
||||||
} else {
|
} else {
|
||||||
args := msg.Params
|
args := msg.Params
|
||||||
|
@ -114,6 +114,14 @@ func NewServer(configFilename string, config *Config) *Server {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// startup check that we have HELP entries for every command
|
||||||
|
for name := range Commands {
|
||||||
|
_, exists := Help[strings.ToLower(name)]
|
||||||
|
if !exists {
|
||||||
|
log.Fatal("Help entry does not exist for ", name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if config.AuthenticationEnabled {
|
if config.AuthenticationEnabled {
|
||||||
SupportedCapabilities[SASL] = true
|
SupportedCapabilities[SASL] = true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user