From 7b50f64d7e1bedda8f99edd2daeb47091662ef9a Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Fri, 14 Oct 2016 20:56:44 +1000 Subject: [PATCH] help: Add new /HELP command --- CHANGELOG.md | 1 + irc/commands.go | 4 + irc/help.go | 331 ++++++++++++++++++++++++++++++++++++++++++++++++ irc/numerics.go | 4 + 4 files changed, 340 insertions(+) create mode 100644 irc/help.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 813c7f83..2dab6d26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Improved compatibility, more features, etc. ### Security ### Added +* Add integrated help. * Support for IRCv3 capability [`account-notify`](http://ircv3.net/specs/extensions/account-notify-3.1.html) ### Changed diff --git a/irc/commands.go b/irc/commands.go index 66e1ff79..3edf3762 100644 --- a/irc/commands.go +++ b/irc/commands.go @@ -67,6 +67,10 @@ var Commands = map[string]Command{ handler: debugHandler, minParams: 1, }, + "HELP": { + handler: helpHandler, + minParams: 0, + }, "INVITE": { handler: inviteHandler, minParams: 2, diff --git a/irc/help.go b/irc/help.go new file mode 100644 index 00000000..2203a281 --- /dev/null +++ b/irc/help.go @@ -0,0 +1,331 @@ +// Copyright (c) 2016- Daniel Oaks +// released under the MIT license + +package irc + +import ( + "strings" + + "github.com/DanielOaks/girc-go/ircmsg" +) + +// HelpEntry represents an entry in the Help map. +type HelpEntry struct { + oper bool + text string +} + +// used for duplicates +var ( + cmodeHelpText = `== Channel Modes == + +Oragono supports the following channel modes: + += Type A - list modes = + + +b | Client masks that are banned from the channel. + +e | Client masks that are exempted from bans. + +I | Client masks that are exempted from the invite-only flag. + += Type C - setting modes with a parameter = + + +l | Client join limit for the channel. + +k | Key required when joining the channel. + += Type D - flag modes = + + +i | Invite-only mode, only invited clients can join the channel. + +m | Moderated mode, only priviledged clients can talk on the channel. + +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. + +s | Secret mode, channel won't show up in /LIST or whois replies. + += 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. + +Z | User is connected via TLS.` +) + +// Help contains the help strings distributed with the IRCd. +var Help = map[string]HelpEntry{ + // Commands + "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.`, + }, + "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`, + }, + "debug": { + oper: true, + text: `DEBUG