Line data Source code
1 : /* Copyright (C) 2021 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/utf8.h"
23 : #include "lobby/XmppClient.h"
24 : #include "scriptinterface/ScriptConversions.h"
25 :
26 0 : template<> void Script::ToJSVal<glooxwrapper::string>(const ScriptRequest& rq, JS::MutableHandleValue ret, const glooxwrapper::string& val)
27 : {
28 0 : ToJSVal(rq, ret, wstring_from_utf8(val.to_string()));
29 0 : }
30 :
31 0 : template<> void Script::ToJSVal<gloox::Presence::PresenceType>(const ScriptRequest& rq, JS::MutableHandleValue ret, const gloox::Presence::PresenceType& val)
32 : {
33 0 : ToJSVal(rq, ret, XmppClient::GetPresenceString(val));
34 0 : }
35 :
36 0 : template<> void Script::ToJSVal<gloox::MUCRoomRole>(const ScriptRequest& rq, JS::MutableHandleValue ret, const gloox::MUCRoomRole& val)
37 : {
38 0 : ToJSVal(rq, ret, XmppClient::GetRoleString(val));
39 0 : }
40 :
41 0 : template<> void Script::ToJSVal<gloox::StanzaError>(const ScriptRequest& rq, JS::MutableHandleValue ret, const gloox::StanzaError& val)
42 : {
43 0 : ToJSVal(rq, ret, wstring_from_utf8(XmppClient::StanzaErrorToString(val)));
44 0 : }
45 :
46 0 : template<> void Script::ToJSVal<gloox::ConnectionError>(const ScriptRequest& rq, JS::MutableHandleValue ret, const gloox::ConnectionError& val)
47 : {
48 0 : ToJSVal(rq, ret, wstring_from_utf8(XmppClient::ConnectionErrorToString(val)));
49 0 : }
50 :
51 0 : template<> void Script::ToJSVal<gloox::RegistrationResult>(const ScriptRequest& rq, JS::MutableHandleValue ret, const gloox::RegistrationResult& val)
52 : {
53 0 : ToJSVal(rq, ret, wstring_from_utf8(XmppClient::RegistrationResultToString(val)));
54 0 : }
55 :
56 0 : template<> void Script::ToJSVal<gloox::CertStatus>(const ScriptRequest& rq, JS::MutableHandleValue ret, const gloox::CertStatus& val)
57 : {
58 0 : ToJSVal(rq, ret, wstring_from_utf8(XmppClient::CertificateErrorToString(val)));
59 3 : }
60 :
61 : #endif // CONFIG2_LOBBY
|