Exemple #1
0
func Logout(id int32) bool {
	defer _hub_err()
	req := hub.ID{}
	req.F_id = id
	ret := _call(packet.Pack(hub.Code["logout_req"], &req, nil))
	reader := packet.Reader(ret)
	tbl, err := hub.PKT_INT(reader)

	if err != nil || tbl.F_v == 0 {
		return false
	}

	return true
}
Exemple #2
0
func Protect(id int32, until time.Time) bool {
	defer _hub_err()

	req := hub.ID{}
	req.F_id = id
	ret := _call(packet.Pack(hub.Code["protect_req"], &req, nil))
	reader := packet.Reader(ret)
	tbl, err := hub.PKT_INT(reader)

	if err != nil || tbl.F_v == 0 {
		return false
	}

	return true
}
Exemple #3
0
func GetInfo(id int32) (info Info, flag bool) {
	defer _hub_err()

	req := hub.ID{}
	req.F_id = id
	ret := _call(packet.Pack(hub.Code["getinfo_req"], &req, nil))
	reader := packet.Reader(ret)
	tbl, _err := hub.PKT_INFO(reader)
	if _err == nil && tbl.F_flag {
		info.Id = tbl.F_id
		info.State = tbl.F_state
		info.Score = tbl.F_score
		info.ProtectTime = tbl.F_protecttime
		flag = true
		return
	}

	flag = false
	return
}