1
0
Fork 0
forked from External/ergo

refactor the rehash implementation

This commit is contained in:
Shivaram Lingamneni 2017-09-28 01:30:53 -04:00
parent eae04e8c51
commit e8b1870067
7 changed files with 324 additions and 252 deletions

View file

@ -530,10 +530,10 @@ Oragono supports the following channel membership prefixes:
}
// HelpIndex contains the list of all help topics for regular users.
var HelpIndex = "list of all help topics for regular users"
var HelpIndex string
// HelpIndexOpers contains the list of all help topics for opers.
var HelpIndexOpers = "list of all help topics for opers"
var HelpIndexOpers string
// GenerateHelpIndex is used to generate HelpIndex.
func GenerateHelpIndex(forOpers bool) string {
@ -582,6 +582,25 @@ Information:
return newHelpIndex
}
func GenerateHelpIndices() error {
if HelpIndex != "" && HelpIndexOpers != "" {
return nil
}
// startup check that we have HELP entries for every command
for name := range Commands {
_, exists := Help[strings.ToLower(name)]
if !exists {
return fmt.Errorf("Help entry does not exist for command %s", name)
}
}
// generate help indexes
HelpIndex = GenerateHelpIndex(false)
HelpIndexOpers = GenerateHelpIndex(true)
return nil
}
// sendHelp sends the client help of the given string.
func (client *Client) sendHelp(name string, text string) {
splitName := strings.Split(name, " ")