diff --git a/irc/accounts.go b/irc/accounts.go index b68b0f7f..85601d4a 100644 --- a/irc/accounts.go +++ b/irc/accounts.go @@ -5,7 +5,6 @@ package irc import ( "encoding/json" - "errors" "fmt" "net/smtp" "strconv" @@ -480,7 +479,7 @@ func (am *AccountManager) dispatchCallback(client *Client, casefoldedAccount str } else if callbackNamespace == "mailto" { return am.dispatchMailtoCallback(client, casefoldedAccount, callbackValue) } else { - return "", errors.New(fmt.Sprintf("Callback not implemented: %s", callbackNamespace)) + return "", fmt.Errorf("Callback not implemented: %s", callbackNamespace) } } @@ -1262,7 +1261,6 @@ func (am *AccountManager) Logout(client *Client) { } } am.accountToClients[casefoldedAccount] = remainingClients - return } var ( diff --git a/irc/channel.go b/irc/channel.go index 6bd15f4b..190060cc 100644 --- a/irc/channel.go +++ b/irc/channel.go @@ -1043,34 +1043,6 @@ func (channel *Channel) ShowMaskList(client *Client, mode modes.Mode, rb *Respon rb.Add(nil, client.server.name, rplendoflist, nick, channel.name, client.t("End of list")) } -func (channel *Channel) applyModeMask(client *Client, mode modes.Mode, op modes.ModeOp, mask string, rb *ResponseBuffer) bool { - list := channel.lists[mode] - if list == nil { - // This should never happen, but better safe than panicky. - return false - } - - if (op == modes.List) || (mask == "") { - channel.ShowMaskList(client, mode, rb) - return false - } - - if !channel.ClientIsAtLeast(client, modes.ChannelOperator) { - rb.Add(nil, client.server.name, ERR_CHANOPRIVSNEEDED, client.Nick(), channel.Name(), client.t("You're not a channel operator")) - return false - } - - if op == modes.Add { - return list.Add(mask) - } - - if op == modes.Remove { - return list.Remove(mask) - } - - return false -} - // Quit removes the given client from the channel func (channel *Channel) Quit(client *Client) { channelEmpty := func() bool { diff --git a/irc/client.go b/irc/client.go index 5e1ac12e..6544eef6 100644 --- a/irc/client.go +++ b/irc/client.go @@ -538,14 +538,12 @@ func (client *Client) tryResume() (success bool) { func (client *Client) tryResumeChannels() { details := client.resumeDetails - channels := make([]*Channel, len(details.Channels)) for _, name := range details.Channels { channel := client.server.channels.Get(name) if channel == nil { continue } channel.Resume(client, details.OldClient, details.Timestamp) - channels = append(channels, channel) } // replay direct PRIVSMG history diff --git a/irc/config.go b/irc/config.go index 437893b5..597b9309 100644 --- a/irc/config.go +++ b/irc/config.go @@ -393,7 +393,7 @@ func (conf *Config) OperatorClasses() (map[string]*OperClass, error) { // get inhereted info from other operclasses if len(info.Extends) > 0 { - einfo, _ := ocs[info.Extends] + einfo := ocs[info.Extends] for capab := range einfo.Capabilities { oc.Capabilities[capab] = true diff --git a/irc/handlers.go b/irc/handlers.go index d47d4569..ccb37094 100644 --- a/irc/handlers.go +++ b/irc/handlers.go @@ -1184,20 +1184,14 @@ func inviteHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Re func isonHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool { var nicks = msg.Params - var err error - var casefoldedNick string - ison := make([]string, 0) + ison := make([]string, 0, len(msg.Params)) for _, nick := range nicks { - casefoldedNick, err = CasefoldName(nick) - if err != nil { - continue - } - if iclient := server.clients.Get(casefoldedNick); iclient != nil { - ison = append(ison, iclient.nick) + if iclient := server.clients.Get(nick); iclient != nil { + ison = append(ison, iclient.Nick()) } } - rb.Add(nil, server.name, RPL_ISON, client.nick, strings.Join(nicks, " ")) + rb.Add(nil, server.name, RPL_ISON, client.nick, strings.Join(ison, " ")) return false } @@ -2099,7 +2093,7 @@ func npcaHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp // OPER func operHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool { - if client.HasMode(modes.Operator) == true { + if client.HasMode(modes.Operator) { rb.Add(nil, server.name, ERR_UNKNOWNERROR, client.Nick(), "OPER", client.t("You're already opered-up!")) return false } diff --git a/irc/modes/modes.go b/irc/modes/modes.go index 0aca61c6..05e93938 100644 --- a/irc/modes/modes.go +++ b/irc/modes/modes.go @@ -170,7 +170,7 @@ func SplitChannelMembershipPrefixes(target string) (prefixes string, name string prefixes = target[:i+1] name = target[i+1:] default: - break + return } } diff --git a/irc/semaphores.go b/irc/semaphores.go index d6008c58..1ee4df2c 100644 --- a/irc/semaphores.go +++ b/irc/semaphores.go @@ -36,5 +36,4 @@ func (serversem *ServerSemaphores) Initialize() { capacity = MaxServerSemaphoreCapacity } serversem.ClientDestroy.Initialize(capacity) - return } diff --git a/irc/server.go b/irc/server.go index d4200253..bd615bd5 100644 --- a/irc/server.go +++ b/irc/server.go @@ -24,7 +24,6 @@ import ( "github.com/goshuirc/irc-go/ircfmt" "github.com/oragono/oragono/irc/caps" "github.com/oragono/oragono/irc/connection_limits" - "github.com/oragono/oragono/irc/isupport" "github.com/oragono/oragono/irc/logger" "github.com/oragono/oragono/irc/modes" "github.com/oragono/oragono/irc/sno" @@ -73,12 +72,10 @@ type Server struct { ctime time.Time dlines *DLineManager helpIndexManager HelpIndexManager - isupport *isupport.List klines *KLineManager listeners map[string]*ListenerWrapper logger *logger.Manager monitorManager *MonitorManager - motdLines []string name string nameCasefolded string rehashMutex sync.Mutex // tier 4 @@ -176,13 +173,6 @@ func (config *Config) generateISupport() (err error) { return } -func loadChannelList(channel *Channel, list string, maskMode modes.Mode) { - if list == "" { - return - } - channel.lists[maskMode].AddAll(strings.Split(list, " ")) -} - // Shutdown shuts down the server. func (server *Server) Shutdown() { //TODO(dan): Make sure we disallow new nicks @@ -518,9 +508,7 @@ func (client *Client) getWhoisOf(target *Client, rb *ResponseBuffer) { tLanguages := target.Languages() if 0 < len(tLanguages) { params := []string{cnick, tnick} - for _, str := range client.server.Languages().Codes(tLanguages) { - params = append(params, str) - } + params = append(params, client.server.Languages().Codes(tLanguages)...) params = append(params, client.t("can speak these languages")) rb.Add(nil, client.server.name, RPL_WHOISLANGUAGE, params...) } diff --git a/irc/snomanager.go b/irc/snomanager.go index 38ab8d6c..d6f3b657 100644 --- a/irc/snomanager.go +++ b/irc/snomanager.go @@ -52,7 +52,7 @@ func (m *SnoManager) RemoveMasks(client *Client, masks ...sno.Mask) { for _, mask := range masks { currentClientList := m.sendLists[mask] - if currentClientList == nil || len(currentClientList) == 0 { + if len(currentClientList) == 0 { continue } @@ -70,7 +70,7 @@ func (m *SnoManager) RemoveClient(client *Client) { for mask := range m.sendLists { currentClientList := m.sendLists[mask] - if currentClientList == nil || len(currentClientList) == 0 { + if len(currentClientList) == 0 { continue } @@ -87,7 +87,7 @@ func (m *SnoManager) Send(mask sno.Mask, content string) { currentClientList := m.sendLists[mask] - if currentClientList == nil || len(currentClientList) == 0 { + if len(currentClientList) == 0 { return }