test intercept setting

This commit is contained in:
shoopea 2020-02-10 10:03:56 +08:00
parent fdffad7532
commit d2b0ab0da3
2 changed files with 28 additions and 17 deletions

View File

@ -29,7 +29,10 @@ func loadClients() error {
muxClients.Lock() muxClients.Lock()
for _, c := range clts { for _, c := range clts {
cx := ChirpClient{} cx := ChirpClient{
Config: ChirpConfig{
InterceptPillage: true,
}}
copier.Copy(&cx, &c) copier.Copy(&cx, &c)
cx.Active = false cx.Active = false
/* /*
@ -183,6 +186,9 @@ func getLockedClient(id int64, createMissing bool) (*ChirpClient, bool) {
c := ChirpClient{ c := ChirpClient{
TGUserID64: id, TGUserID64: id,
Active: false, Active: false,
Config: ChirpConfig{
InterceptPillage: true,
},
} }
c.Mux.Lock() c.Mux.Lock()
muxClients.RUnlock() muxClients.RUnlock()

5
def.go
View File

@ -78,6 +78,10 @@ type MQClient struct {
Queue amqp.Queue `json:"-"` Queue amqp.Queue `json:"-"`
} }
type ChirpConfig struct {
InterceptPillage bool `json:"intercept_pillage"`
}
type ChirpClient struct { type ChirpClient struct {
HeartBeat time.Time `json:"heart_beat"` HeartBeat time.Time `json:"heart_beat"`
Login string `json:"nickname"` Login string `json:"nickname"`
@ -95,6 +99,7 @@ type ChirpClient struct {
GameIdle bool `json:"game_idle"` GameIdle bool `json:"game_idle"`
BotIdle bool `json:"bot_idle"` BotIdle bool `json:"bot_idle"`
Mux sync.Mutex `json:"-"` Mux sync.Mutex `json:"-"`
Config *ChirpConfig `json:"config"`
} }
type MQKeepAlive struct { type MQKeepAlive struct {