Line data Source code
1 : /* Copyright (C) 2025 Wildfire Games. 2 : * This file is part of 0 A.D. 3 : * 4 : * 0 A.D. is free software: you can redistribute it and/or modify 5 : * it under the terms of the GNU General Public License as published by 6 : * the Free Software Foundation, either version 2 of the License, or 7 : * (at your option) any later version. 8 : * 9 : * 0 A.D. is distributed in the hope that it will be useful, 10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 : * GNU General Public License for more details. 13 : * 14 : * You should have received a copy of the GNU General Public License 15 : * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. 16 : */ 17 : #ifndef STANZAEXTENSIONS_H 18 : #define STANZAEXTENSIONS_H 19 : 20 : #include "lib/external_libraries/gloox.h" 21 : 22 : #include <string> 23 : #include <vector> 24 : 25 : /// Global Gamelist Extension 26 : #define EXTGAMELISTQUERY 1403 27 : #define XMLNS_GAMELIST "jabber:iq:gamelist" 28 : 29 : /// Global Boardlist Extension 30 : #define EXTBOARDLISTQUERY 1404 31 : #define XMLNS_BOARDLIST "jabber:iq:boardlist" 32 : 33 : /// Global Gamereport Extension 34 : #define EXTGAMEREPORT 1405 35 : #define XMLNS_GAMEREPORT "jabber:iq:gamereport" 36 : 37 : /// Global Profile Extension 38 : #define EXTPROFILEQUERY 1406 39 : #define XMLNS_PROFILE "jabber:iq:profile" 40 : 41 : /// Global Lobby Authentication Extension 42 : #define EXTLOBBYAUTH 1407 43 : #define XMLNS_LOBBYAUTH "jabber:iq:lobbyauth" 44 : 45 : #define EXTCONNECTIONDATA 1408 46 : #define XMLNS_CONNECTIONDATA "jabber:iq:connectiondata" 47 : 48 : class ConnectionData : public gloox::StanzaExtension 49 : { 50 : public: 51 : ConnectionData(const gloox::Tag* tag = 0); 52 : 53 : // Following four methods are all required by gloox 54 0 : StanzaExtension* newInstance(const gloox::Tag* tag) const override 55 : { 56 0 : return new ConnectionData(tag); 57 : } 58 : const std::string& filterString() const override; 59 : gloox::Tag* tag() const override; 60 : gloox::StanzaExtension* clone() const override; 61 : 62 : std::string m_Ip; 63 : std::string m_Port; 64 : std::string m_IsLocalIP; 65 : std::string m_Password; 66 : std::string m_ClientSalt; 67 : std::string m_Error; 68 : }; 69 : 70 : class GameReport : public gloox::StanzaExtension 71 : { 72 : public: 73 : GameReport(const gloox::Tag* tag = 0); 74 : 75 : // Following four methods are all required by gloox 76 0 : StanzaExtension* newInstance(const gloox::Tag* tag) const override 77 : { 78 0 : return new GameReport(tag); 79 : } 80 : const std::string& filterString() const override; 81 : gloox::Tag* tag() const override; 82 : gloox::StanzaExtension* clone() const override; 83 : 84 : std::vector<const gloox::Tag*> m_GameReport; 85 : }; 86 : 87 : class GameListQuery : public gloox::StanzaExtension 88 : { 89 : public: 90 : GameListQuery(const gloox::Tag* tag = 0); 91 : 92 : // Following four methods are all required by gloox 93 0 : StanzaExtension* newInstance(const gloox::Tag* tag) const override 94 : { 95 0 : return new GameListQuery(tag); 96 : } 97 : const std::string& filterString() const override; 98 : gloox::Tag* tag() const override; 99 : gloox::StanzaExtension* clone() const override; 100 : 101 : ~GameListQuery(); 102 : 103 : std::string m_Command; 104 : std::vector<const gloox::Tag*> m_GameList; 105 : }; 106 : 107 : class BoardListQuery : public gloox::StanzaExtension 108 : { 109 : public: 110 : BoardListQuery(const gloox::Tag* tag = 0); 111 : 112 : // Following four methods are all required by gloox 113 0 : StanzaExtension* newInstance(const gloox::Tag* tag) const override 114 : { 115 0 : return new BoardListQuery(tag); 116 : } 117 : const std::string& filterString() const override; 118 : gloox::Tag* tag() const override; 119 : gloox::StanzaExtension* clone() const override; 120 : 121 : ~BoardListQuery(); 122 : 123 : std::string m_Command; 124 : std::vector<const gloox::Tag*> m_StanzaBoardList; 125 : }; 126 : 127 : class ProfileQuery : public gloox::StanzaExtension 128 : { 129 : public: 130 : ProfileQuery(const gloox::Tag* tag = 0); 131 : 132 : // Following four methods are all required by gloox 133 0 : StanzaExtension* newInstance(const gloox::Tag* tag) const override 134 : { 135 0 : return new ProfileQuery(tag); 136 : } 137 : const std::string& filterString() const override; 138 : gloox::Tag* tag() const override; 139 : gloox::StanzaExtension* clone() const override; 140 : 141 : ~ProfileQuery(); 142 : 143 : std::string m_Command; 144 : std::vector<const gloox::Tag*> m_StanzaProfile; 145 : }; 146 : 147 : class LobbyAuth : public gloox::StanzaExtension 148 : { 149 : public: 150 : LobbyAuth(const gloox::Tag* tag = 0); 151 : 152 : // Following four methods are all required by gloox 153 0 : StanzaExtension* newInstance(const gloox::Tag* tag) const override 154 : { 155 0 : return new LobbyAuth(tag); 156 : } 157 : const std::string& filterString() const override; 158 : gloox::Tag* tag() const override; 159 : gloox::StanzaExtension* clone() const override; 160 : 161 : std::string m_Token; 162 : }; 163 : #endif // STANZAEXTENSIONS_H