aboutsummaryrefslogtreecommitdiffstats
path: root/packet/command/finale/finale.go
diff options
context:
space:
mode:
Diffstat (limited to 'packet/command/finale/finale.go')
-rw-r--r--packet/command/finale/finale.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/packet/command/finale/finale.go b/packet/command/finale/finale.go
new file mode 100644
index 0000000..c49ec6d
--- /dev/null
+++ b/packet/command/finale/finale.go
@@ -0,0 +1,31 @@
+package finale
+
+import (
+ "github.com/osm/quake/common/buffer"
+ "github.com/osm/quake/common/context"
+ "github.com/osm/quake/protocol"
+)
+
+type Command struct {
+ String string
+}
+
+func (cmd *Command) Bytes() []byte {
+ buf := buffer.New()
+
+ buf.PutByte(protocol.SVCFinale)
+ buf.PutString(cmd.String)
+
+ return buf.Bytes()
+}
+
+func Parse(ctx *context.Context, buf *buffer.Buffer) (*Command, error) {
+ var err error
+ var cmd Command
+
+ if cmd.String, err = buf.GetString(); err != nil {
+ return nil, err
+ }
+
+ return &cmd, nil
+}