mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
initial persistent history implementation
This commit is contained in:
parent
0d5a4fd584
commit
33dac4c0ba
34 changed files with 2229 additions and 595 deletions
20
irc/stats.go
20
irc/stats.go
|
|
@ -26,15 +26,33 @@ func (s *Stats) Add() {
|
|||
s.mutex.Unlock()
|
||||
}
|
||||
|
||||
// Activates a registered client, e.g., for the initial attach to a persistent client
|
||||
func (s *Stats) AddRegistered(invisible, operator bool) {
|
||||
s.mutex.Lock()
|
||||
if invisible {
|
||||
s.Invisible += 1
|
||||
}
|
||||
if operator {
|
||||
s.Operators += 1
|
||||
}
|
||||
s.Total += 1
|
||||
s.setMax()
|
||||
s.mutex.Unlock()
|
||||
}
|
||||
|
||||
// Transition a client from unregistered to registered
|
||||
func (s *Stats) Register() {
|
||||
s.mutex.Lock()
|
||||
s.Unknown -= 1
|
||||
s.Total += 1
|
||||
s.setMax()
|
||||
s.mutex.Unlock()
|
||||
}
|
||||
|
||||
func (s *Stats) setMax() {
|
||||
if s.Max < s.Total {
|
||||
s.Max = s.Total
|
||||
}
|
||||
s.mutex.Unlock()
|
||||
}
|
||||
|
||||
// Modify the Invisible count
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue