atrooney-online-2/include/aopacket.h
Crystalwarrior 7b88d4be95
Never send an unencoded packet to the server (#719)
* never send an unencoded packet to the server

* oops

* Improve packet validation to remove segfaults

* WARNING: commit breaks connecting to servers, need help
start fixing omniwhy caused by single fuckin string packets (AAAAAAAAAAAAAAAAA)

* Fix failed connections to servers (Thanks to @Iuvee for helping me figure this out!)

* Fix demoserver

* who the fuck still uses goto

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* ANOTHER GOTO????

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* braces

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* good bot Update src/packet_distribution.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix demoserver harder

* Improve demo logging

* Fix memory leakage by deleting the packet
Fix useless demoserver wait packet creation when none of that packet is used

Co-authored-by: stonedDiscord <Tukz@gmx.de>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Salanto <62221668+Salanto@users.noreply.github.com>
2022-07-30 18:42:22 +02:00

29 lines
627 B
C++

#ifndef AOPACKET_H
#define AOPACKET_H
#include <QDebug>
#include <QString>
#include <QStringList>
class AOPacket {
public:
AOPacket(QString header) : m_header(header){}
AOPacket(QString header, QStringList p_contents) : m_header(header), m_contents(p_contents){}
QString get_header() { return m_header; }
QStringList &get_contents() { return m_contents; }
QString to_string(bool encoded = false);
void net_encode();
void net_decode();
static void escape(QStringList &contents);
static void unescape(QStringList &contents);
private:
QString m_header;
QStringList m_contents;
};
#endif // AOPACKET_H