diff options
| author | 2026-02-16 16:31:54 -0500 | |
|---|---|---|
| committer | 2026-02-16 16:31:54 -0500 | |
| commit | ca90ebdfa8789654766c5d7969baa7afacd9ebd2 (patch) | |
| tree | 9693e0c7a5af6713f4c5e39372dcf22d05844ec3 /packet/command/qtvconnect | |
Diffstat (limited to 'packet/command/qtvconnect')
| -rw-r--r-- | packet/command/qtvconnect/qtvconnect.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/packet/command/qtvconnect/qtvconnect.go b/packet/command/qtvconnect/qtvconnect.go new file mode 100644 index 0000000..86adab3 --- /dev/null +++ b/packet/command/qtvconnect/qtvconnect.go @@ -0,0 +1,32 @@ +package qtvconnect + +import ( + "fmt" + + "github.com/osm/quake/common/buffer" + "github.com/osm/quake/common/infostring" +) + +type Command struct { + Version byte + Extensions uint32 + Source string + UserInfo *infostring.InfoString +} + +func (cmd *Command) Bytes() []byte { + buf := buffer.New() + + buf.PutBytes([]byte("QTV\n")) + buf.PutBytes([]byte(fmt.Sprintf("VERSION: %d\n", cmd.Version))) + buf.PutBytes([]byte(fmt.Sprintf("QTV_EZQUAKE_EXT: %d\n", cmd.Extensions))) + buf.PutBytes([]byte(fmt.Sprintf("SOURCE: %s\n", cmd.Source))) + + if cmd.UserInfo != nil { + buf.PutBytes([]byte(fmt.Sprintf("USERINFO: %s\n", string(cmd.UserInfo.Bytes())))) + } + + buf.PutBytes([]byte("\n")) + + return buf.Bytes() +} |
