diff options
author | Wim <wim@42.be> | 2018-05-09 22:48:39 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2018-05-09 22:48:39 +0200 |
commit | 521a7ed7b0b70d886f5863d453963dc35bc0c850 (patch) | |
tree | 3fbc5ebdff573fc4bfd8941895959672f8931b4b /vendor/github.com/lrstanley/girc/state.go | |
parent | 529b188164b7b0f18ca31a43410898e73a22ed03 (diff) | |
download | matterbridge-msglm-521a7ed7b0b70d886f5863d453963dc35bc0c850.tar.gz matterbridge-msglm-521a7ed7b0b70d886f5863d453963dc35bc0c850.tar.bz2 matterbridge-msglm-521a7ed7b0b70d886f5863d453963dc35bc0c850.zip |
Update vendor lrstanley/girc
Diffstat (limited to 'vendor/github.com/lrstanley/girc/state.go')
-rw-r--r-- | vendor/github.com/lrstanley/girc/state.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/vendor/github.com/lrstanley/girc/state.go b/vendor/github.com/lrstanley/girc/state.go index 7c537028..36dcc82b 100644 --- a/vendor/github.com/lrstanley/girc/state.go +++ b/vendor/github.com/lrstanley/girc/state.go @@ -132,6 +132,10 @@ func (u User) Channels(c *Client) []*Channel { // Copy returns a deep copy of the user which can be modified without making // changes to the actual state. func (u *User) Copy() *User { + if u == nil { + return nil + } + nu := &User{} *nu = *u @@ -148,7 +152,7 @@ func (u *User) addChannel(name string) { } u.ChannelList = append(u.ChannelList, ToRFC1459(name)) - sort.StringsAreSorted(u.ChannelList) + sort.Strings(u.ChannelList) u.Perms.set(name, Perms{}) } @@ -321,6 +325,10 @@ func (ch *Channel) deleteUser(nick string) { // Copy returns a deep copy of a given channel. func (ch *Channel) Copy() *Channel { + if ch == nil { + return nil + } + nc := &Channel{} *nc = *ch @@ -483,6 +491,9 @@ func (s *state) renameUser(from, to string) { for j := 0; j < len(s.channels[user.ChannelList[i]].UserList); j++ { if s.channels[user.ChannelList[i]].UserList[j] == from { s.channels[user.ChannelList[i]].UserList[j] = ToRFC1459(to) + + sort.Strings(s.channels[user.ChannelList[i]].UserList) + break } } } |