Ejemplo n.º 1
0
func NewServerMessageResponse(packet *network.InboundPacket) *ServerMessageResponse {
	messageType := "notice"

	if packet.Type == constants.PacketTypeServerErrorResponse {
		messageType = "error"
	}

	messageFields := make(map[string]string)

	for {
		field := packet.ReadString()
		if field == "" {
			break
		}

		fieldType := string([]byte(field)[0])
		fieldValue := string([]byte(field)[1:])

		messageFields[messageFieldMappings[fieldType]] = fieldValue
	}

	return &ServerMessageResponse{messageType, messageFields}
}
Ejemplo n.º 2
0
func NewParameterStatusResponse(packet *network.InboundPacket) *ParameterStatusResponse {
	key := packet.ReadString()
	value := packet.ReadString()

	return &ParameterStatusResponse{key, value}
}