mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-07-25 12:08:30 +00:00
change global sub to ClientInfo, remove ip output
This commit is contained in:
parent
3802dea35c
commit
00175cad39
4 changed files with 57 additions and 18 deletions
|
@ -160,6 +160,38 @@ func RemoveFromSliceC(ary *[]chan<- ClientMessage, val chan<- ClientMessage) boo
|
|||
return true
|
||||
}
|
||||
|
||||
func AddToSliceCl(ary *[]*ClientInfo, val *ClientInfo) bool {
|
||||
slice := *ary
|
||||
for _, v := range slice {
|
||||
if v == val {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
slice = append(slice, val)
|
||||
*ary = slice
|
||||
return true
|
||||
}
|
||||
|
||||
func RemoveFromSliceCl(ary *[]*ClientInfo, val *ClientInfo) bool {
|
||||
slice := *ary
|
||||
var idx int = -1
|
||||
for i, v := range slice {
|
||||
if v == val {
|
||||
idx = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if idx == -1 {
|
||||
return false
|
||||
}
|
||||
|
||||
slice[idx] = slice[len(slice)-1]
|
||||
slice = slice[:len(slice)-1]
|
||||
*ary = slice
|
||||
return true
|
||||
}
|
||||
|
||||
func AddToSliceB(ary *[]bunchSubscriber, client *ClientInfo, mid int) bool {
|
||||
newSub := bunchSubscriber{Client: client, MessageID: mid}
|
||||
slice := *ary
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue