mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
add ClientDetails struct for getting a snapshot of client state
This commit is contained in:
parent
c2b2559ab4
commit
960d51159c
7 changed files with 53 additions and 39 deletions
|
|
@ -22,15 +22,6 @@ type WhoWasList struct {
|
|||
accessMutex sync.RWMutex // tier 1
|
||||
}
|
||||
|
||||
// WhoWas is an entry in the WhoWasList.
|
||||
type WhoWas struct {
|
||||
nicknameCasefolded string
|
||||
nickname string
|
||||
username string
|
||||
hostname string
|
||||
realname string
|
||||
}
|
||||
|
||||
// NewWhoWasList returns a new WhoWasList
|
||||
func NewWhoWasList(size int) *WhoWasList {
|
||||
return &WhoWasList{
|
||||
|
|
@ -82,7 +73,7 @@ func (list *WhoWasList) Find(nickname string, limit int) (results []WhoWas) {
|
|||
// iterate backwards through the ring buffer
|
||||
pos := list.prev(list.end)
|
||||
for limit == 0 || len(results) < limit {
|
||||
if casefoldedNickname == list.buffer[pos].nicknameCasefolded {
|
||||
if casefoldedNickname == list.buffer[pos].nickCasefolded {
|
||||
results = append(results, list.buffer[pos])
|
||||
}
|
||||
if pos == list.start {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue