mirror of https://github.com/ergochat/ergo.git
pointless optimization
This commit is contained in:
parent
5a348fe6f5
commit
d1485d6345
|
@ -1623,8 +1623,15 @@ func (channel *Channel) auditoriumFriends(client *Client) (friends []*Client) {
|
|||
}
|
||||
|
||||
// returns whether the client is visible to unprivileged users in the channel
|
||||
// (i.e., respecting auditorium mode)
|
||||
func (channel *Channel) clientIsVisible(client *Client) bool {
|
||||
// (i.e., respecting auditorium mode). note that this assumes that the client
|
||||
// is a member; if the client is not, it may return true anyway
|
||||
func (channel *Channel) memberIsVisible(client *Client) bool {
|
||||
// fast path, we assume they're a member so if this isn't an auditorium,
|
||||
// they're visible:
|
||||
if !channel.flags.HasMode(modes.Auditorium) {
|
||||
return true
|
||||
}
|
||||
|
||||
channel.stateMutex.RLock()
|
||||
defer channel.stateMutex.RUnlock()
|
||||
|
||||
|
@ -1632,9 +1639,6 @@ func (channel *Channel) clientIsVisible(client *Client) bool {
|
|||
if !found {
|
||||
return false
|
||||
}
|
||||
if !channel.flags.HasMode(modes.Auditorium) {
|
||||
return true
|
||||
}
|
||||
return clientData.modes.HighestChannelUserMode() != modes.Mode(0)
|
||||
}
|
||||
|
||||
|
|
|
@ -1324,7 +1324,7 @@ func (client *Client) destroy(session *Session) {
|
|||
friends := make(ClientSet)
|
||||
channels := client.Channels()
|
||||
for _, channel := range channels {
|
||||
if channel.clientIsVisible(client) {
|
||||
if channel.memberIsVisible(client) {
|
||||
quitHistoryChannels = append(quitHistoryChannels, channel)
|
||||
}
|
||||
for _, member := range channel.auditoriumFriends(client) {
|
||||
|
|
|
@ -120,7 +120,7 @@ func performNickChange(server *Server, client *Client, target *Client, session *
|
|||
}
|
||||
|
||||
for _, channel := range target.Channels() {
|
||||
if channel.clientIsVisible(client) {
|
||||
if channel.memberIsVisible(client) {
|
||||
channel.AddHistoryItem(histItem, details.account)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue