Line data Source code
1 : /* Copyright (C) 2026 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 : 18 : #include "precompiled.h" 19 : 20 : #include "lib/config2.h" 21 : #if CONFIG2_LOBBY 22 : #include "lib/external_libraries/gloox.h" 23 : #include "lib/utf8.h" 24 : #include "lobby/GlooxConversion.h" 25 : #include "scriptinterface/Conversions.h" 26 : 27 : #include <js/RootingAPI.h> 28 : #include <js/TypeDecls.h> 29 : #include <string> 30 : 31 : namespace Script { class Request; } 32 : 33 0 : template<> void Script::ToJSVal<gloox::Presence::PresenceType>(const Script::Request& rq, JS::MutableHandleValue ret, const gloox::Presence::PresenceType& val) 34 : { 35 0 : ToJSVal(rq, ret, GetPresenceString(val)); 36 0 : } 37 : 38 0 : template<> void Script::ToJSVal<gloox::MUCRoomRole>(const Script::Request& rq, JS::MutableHandleValue ret, const gloox::MUCRoomRole& val) 39 : { 40 0 : ToJSVal(rq, ret, GetRoleString(val)); 41 0 : } 42 : 43 0 : template<> void Script::ToJSVal<gloox::StanzaError>(const Script::Request& rq, JS::MutableHandleValue ret, const gloox::StanzaError& val) 44 : { 45 0 : ToJSVal(rq, ret, wstring_from_utf8(StanzaErrorToString(val))); 46 0 : } 47 : 48 0 : template<> void Script::ToJSVal<gloox::ConnectionError>(const Script::Request& rq, JS::MutableHandleValue ret, const gloox::ConnectionError& val) 49 : { 50 0 : ToJSVal(rq, ret, wstring_from_utf8(ConnectionErrorToString(val))); 51 0 : } 52 : 53 0 : template<> void Script::ToJSVal<gloox::RegistrationResult>(const Script::Request& rq, JS::MutableHandleValue ret, const gloox::RegistrationResult& val) 54 : { 55 0 : ToJSVal(rq, ret, wstring_from_utf8(RegistrationResultToString(val))); 56 0 : } 57 : 58 0 : template<> void Script::ToJSVal<gloox::CertStatus>(const Script::Request& rq, JS::MutableHandleValue ret, const gloox::CertStatus& val) 59 : { 60 0 : ToJSVal(rq, ret, wstring_from_utf8(CertificateErrorToString(val))); 61 0 : } 62 : 63 : #endif // CONFIG2_LOBBY