From 5936ed7370106b2e43033da97544042115c807d0 Mon Sep 17 00:00:00 2001 From: Justin T <37750742+jtieri@users.noreply.github.com> Date: Mon, 9 Dec 2019 21:20:16 -0600 Subject: [PATCH] return outgoing packet as string adding a method for returning the bytes in an outgoing packets buffer as a string --- habbgo/server/protocol/packets/outgoing.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/habbgo/server/protocol/packets/outgoing.go b/habbgo/server/protocol/packets/outgoing.go index a960e1d..8d489a6 100644 --- a/habbgo/server/protocol/packets/outgoing.go +++ b/habbgo/server/protocol/packets/outgoing.go @@ -62,6 +62,11 @@ func (packet *OutgoingPacket) WriteDelim(key []byte, delim []byte) { packet.Payload.Write(delim) } +// String returns the remaining bytes in the packets buffer as a string. +func (packet *OutgoingPacket) String() string { + return string(packet.Payload.Bytes()) +} + // Finish writes byte 0x01 to the packets buffer to signal the ending of a packet. func (packet *OutgoingPacket) Finish() { packet.Payload.WriteByte(1) // FUSEv0.2.0 server->client packet ending marker