Prevent duplicate users in ChannelStore

This commit is contained in:
Ken-Håvard Lieng 2016-01-22 04:45:41 +01:00
parent 924bd8fdb1
commit a3a934fff2
2 changed files with 9 additions and 0 deletions

View file

@ -51,6 +51,13 @@ func (c *ChannelStore) AddUser(user, server, channel string) {
}
if users, ok := c.users[server][channel]; ok {
for _, u := range users {
if u == user {
c.userLock.Unlock()
return
}
}
c.users[server][channel] = append(users, user)
} else {
c.users[server][channel] = []string{user}