Skip to content
Permalink
Browse files

Add request info & abort functions (#660)

This fixes #370.

Adds the following functions:
- getRemoteRequest
- getRemoteRequestInfo
- abortRemoteRequest

Squashed commit of the following:

commit e1d89b6
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Sun Jul 14 00:11:29 2019 +0200

    Add includeHeaders parameter, clean up few lines of code and also modified postDataLenght parameter to either return EVERYTHING (-1) or a specific length (> 0)

commit 31c8943
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Mon Jul 8 15:58:10 2019 +0200

    Add postDataLength parameter

commit 50ea25b
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Mon Jul 8 15:45:52 2019 +0200

    Remove query_string parameters from URL

commit e733b37
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Mon Jul 8 15:38:49 2019 +0200

    Use GetTickCount64_() instead of current unix timestamp

commit 0c7d989
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Mon Jul 8 15:17:35 2019 +0200

    Revert 'Server/mods/deathmatch/logic/CRemoteCalls.cpp' to 284bf73

commit de9111a
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Mon Jul 8 14:59:25 2019 +0200

    Resolve merge errors introduced in e77c8cd

commit 284bf73
Merge: 39b0489 3418ceb
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Mon Jul 8 14:23:58 2019 +0200

    Merge branch 'master' into 'enhancements/callFetchRemote'

commit 39b0489
Merge: 3b7e0ab 764664d
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Sun Jul 7 15:17:43 2019 +0200

    Merge branch 'master' into enhancements/callFetchRemote

commit 3b7e0ab
Merge: f231d85 a87468d
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Mon May 13 04:45:08 2019 +0200

    Merge branch 'master' into enhancements/callFetchRemote

commit f231d85
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Sun May 12 03:24:25 2019 +0200

    Fixed some more serversided stuff and cleanup clientside

commit 9e6e366
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Sun May 12 03:11:00 2019 +0200

    Cleanup Serversided stuff

commit 011583c
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Sun May 12 01:02:33 2019 +0200

    Fixed luaVM not being used in GetRemoteRequests

commit db20652
Merge: c05c364 b061dfd
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Tue Mar 5 18:21:11 2019 +0100

    Merge remote-tracking branch 'origin/master' into enhancements/callFetchRemote

commit c05c364
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Wed Jan 16 17:05:20 2019 +0100

    Remove RemoteCall when aborted

commit 86b43c2
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Wed Jan 16 16:57:29 2019 +0100

    Renamed post_data -> postData
    Renamed connection_(attempts/total) -> connection(Attempts/Total)

commit 5830890
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Wed Jan 16 16:55:18 2019 +0100

    Renamed bytes_received -> bytesReceives
    Renamed bytes_total -> bytesTotal
    Added currentAttempt (0 = queued, 1+ = Downloading)

commit 0c77aa4
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Wed Jan 16 16:36:46 2019 +0100

    Rename getNetworkRequests to getRemoteRequests
    Rename getNetworkRequestInfo to getRemoteRequestInfo
    Rename abortNetworkRequest to abortRemoteRequest

commit 683a299
Merge: fb7b551 e11685c
Author: Luxy.c <8040605+xLuxy@users.noreply.github.com>
Date:   Sun Jan 13 21:47:00 2019 +0100

    Merge branch 'master' into enhancements/callFetchRemote

commit fb7b551
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Sun Jan 13 21:28:30 2019 +0100

    Only allow getNetworkRequestInfo for its own resource clientsided

commit b03bb68
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Sun Jan 13 21:09:56 2019 +0100

    Addendum to previous commit - also removed clientsided debug message

commit 3d02892
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Sun Jan 13 21:08:04 2019 +0100

    Remove Bad argument @ message from getNetworkRequestInfo

commit dd91606
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Sun Jan 13 21:04:33 2019 +0100

    Add ACL permission check for getNetworkRequestInfo

commit 58cd3df
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Sun Jan 13 17:58:55 2019 +0100

    Testfix 2 for "invalid use of incomplete type" CRemoteCalls

commit e2c5a9e
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Sun Jan 13 17:45:30 2019 +0100

    Testfix for "invalid use of incomplete type" CRemoteCalls

commit a6b6bfb
Merge: ca89123 27c654a
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Sun Jan 13 14:39:46 2019 +0100

    Merge branch 'master' into enhancements/callFetchRemote

commit ca89123
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Sun Jan 6 13:35:36 2019 +0100

    Added missing return in CallRemote

commit c8fe209
Merge: 8a76398 22e9ca1
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Sun Jan 6 13:00:22 2019 +0100

    Merge branch 'master' into enhancements/callFetchRemote

commit 8a76398
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Fri Jan 4 14:50:31 2019 +0100

    WIP: Added bytes_received / bytes_total to getNetworkRequestInfo

commit c107463
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Fri Jan 4 13:40:15 2019 +0100

    Removed unnessesary checks

commit 67500ac
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Fri Jan 4 13:28:53 2019 +0100

    Added CallExists checks to CLuaFunctionParseHelpers::UserDataCast

commit 73daa94
Merge: 0a635f9 9e6aace
Author: Marek Kulik <mk.botder@gmail.com>
Date:   Thu Jan 3 11:31:17 2019 +0100

    Merge branch 'master'

commit 0a635f9
Author: xLuxy <luxorion1905@gmail.com>
Date:   Tue Oct 30 01:15:12 2018 +0100

    Add shared abortNetworkRequest

commit e512792
Author: xLuxy <luxorion1905@gmail.com>
Date:   Tue Oct 30 00:16:37 2018 +0100

    Add clientsided getNetworkRequests & getNetworkRequestInfo

commit 139fc32
Author: xLuxy <luxorion1905@gmail.com>
Date:   Mon Oct 29 23:11:13 2018 +0100

    Fixed errors from previous commit

commit 34cc52e
Author: xLuxy <luxorion1905@gmail.com>
Date:   Mon Oct 29 22:37:23 2018 +0100

    Fix line spacing

commit d5a3a55
Merge: 9c17b5e 8dfb99e
Author: Luxy.c <8040605+xLuxy@users.noreply.github.com>
Date:   Tue Oct 23 22:58:12 2018 +0200

    Merge branch 'master' into enhancements/callFetchRemote

commit 9c17b5e
Merge: 8dc1b9d 54dc6b0
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Wed Oct 17 17:28:15 2018 +0200

    Merge branch 'enhancements/callFetchRemote' of https://github.com/xLuxy/mtasa-blue into enhancements/callFetchRemote

commit 8dc1b9d
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Wed Oct 17 17:27:31 2018 +0200

    - Add table getNetworkRequests([string/resource resource])
    - Add table/false getNetworkRequestInfo(userdata requestHandler)
    - Made fetch/callRemote return userdata of CRemoteCall

commit 54dc6b0
Author: Luxy.c <luxorion1905@gmail.com>
Date:   Wed Oct 17 17:27:31 2018 +0200

    - Add table getNetworkRequests([string/resource resource])
    - Add table/false getNetworkRequestInfo(userdata requestHandler)
    - Made fetch/callRemote return userdata of CRemoteCall
  • Loading branch information...
xLuxy authored and qaisjp committed Oct 4, 2019
1 parent 73bacf3 commit 8e9d1c6cb2cf5dd8c05966ad2701de5aab1a4d53
@@ -28,34 +28,50 @@ CRemoteCalls::~CRemoteCalls()
m_calls.clear();
}

void CRemoteCalls::Call(const char* szServerHost, const char* szResourceName, const char* szFunctionName, CLuaArguments* arguments, CLuaMain* luaMain,
CRemoteCall* CRemoteCalls::Call(const char* szServerHost, const char* szResourceName, const char* szFunctionName, CLuaArguments* arguments, CLuaMain* luaMain,
const CLuaFunctionRef& iFunction, const SString& strQueueName, uint uiConnectionAttempts, uint uiConnectTimeoutMs)
{
m_calls.push_back(
new CRemoteCall(szServerHost, szResourceName, szFunctionName, arguments, luaMain, iFunction, strQueueName, uiConnectionAttempts, uiConnectTimeoutMs));
CRemoteCall* pRemoteCall = new CRemoteCall(szServerHost, szResourceName, szFunctionName, arguments, luaMain, iFunction, strQueueName, uiConnectionAttempts, uiConnectTimeoutMs);

m_calls.push_back(pRemoteCall);
m_calls.back()->MakeCall();

return pRemoteCall;
}

void CRemoteCalls::Call(const char* szURL, CLuaArguments* arguments, CLuaMain* luaMain, const CLuaFunctionRef& iFunction, const SString& strQueueName,
uint uiConnectionAttempts, uint uiConnectTimeoutMs)
CRemoteCall* CRemoteCalls::Call(const char* szURL, CLuaArguments* arguments, CLuaMain* luaMain, const CLuaFunctionRef& iFunction, const SString& strQueueName,
uint uiConnectionAttempts, uint uiConnectTimeoutMs)
{
m_calls.push_back(new CRemoteCall(szURL, arguments, luaMain, iFunction, strQueueName, uiConnectionAttempts, uiConnectTimeoutMs));
CRemoteCall* pRemoteCall = new CRemoteCall(szURL, arguments, luaMain, iFunction, strQueueName, uiConnectionAttempts, uiConnectTimeoutMs);

m_calls.push_back(pRemoteCall);
m_calls.back()->MakeCall();

return pRemoteCall;
}

void CRemoteCalls::Call(const char* szURL, CLuaArguments* fetchArguments, const SString& strPostData, bool bPostBinary, CLuaMain* luaMain,
const CLuaFunctionRef& iFunction, const SString& strQueueName, uint uiConnectionAttempts, uint uiConnectTimeoutMs)
CRemoteCall* CRemoteCalls::Call(const char* szURL, CLuaArguments* fetchArguments, const SString& strPostData, bool bPostBinary, CLuaMain* luaMain,
const CLuaFunctionRef& iFunction, const SString& strQueueName, uint uiConnectionAttempts, uint uiConnectTimeoutMs)
{
m_calls.push_back(
new CRemoteCall(szURL, fetchArguments, strPostData, bPostBinary, luaMain, iFunction, strQueueName, uiConnectionAttempts, uiConnectTimeoutMs));
CRemoteCall* pRemoteCall =
new CRemoteCall(szURL, fetchArguments, strPostData, bPostBinary, luaMain, iFunction, strQueueName, uiConnectionAttempts, uiConnectTimeoutMs);

m_calls.push_back(pRemoteCall);
m_calls.back()->MakeCall();

return nullptr;
}

void CRemoteCalls::Call(const char* szURL, CLuaArguments* fetchArguments, CLuaMain* luaMain, const CLuaFunctionRef& iFunction, const SString& strQueueName,
CRemoteCall* CRemoteCalls::Call(const char* szURL, CLuaArguments* fetchArguments, CLuaMain* luaMain, const CLuaFunctionRef& iFunction,
const SString& strQueueName,
const SHttpRequestOptions& options)
{
m_calls.push_back(new CRemoteCall(szURL, fetchArguments, luaMain, iFunction, strQueueName, options));
CRemoteCall* pRemoteCall = new CRemoteCall(szURL, fetchArguments, luaMain, iFunction, strQueueName, options);

m_calls.push_back(pRemoteCall);
m_calls.back()->MakeCall();

return pRemoteCall;
}

void CRemoteCalls::Remove(CLuaMain* lua)
@@ -219,6 +235,8 @@ CRemoteCall::~CRemoteCall()

void CRemoteCall::MakeCall()
{
m_iStartTime = GetTickCount64_();

// GetDomainFromURL requires protocol://, but curl does not (defaults to http)
SString strDomain = g_pCore->GetWebCore()->GetDomainFromURL(m_strURL);
if (strDomain.empty())
@@ -11,7 +11,7 @@

#pragma once
#include "lua/CLuaArguments.h"
#define CALL_REMOTE_DEFAULT_QUEUE_NAME "default"
#define CALL_REMOTE_DEFAULT_QUEUE_NAME "default"

/*
This represents a single live remote call. Calls are live until the call returns
@@ -23,6 +23,7 @@ class CRemoteCall
bool m_bIsFetch;
class CLuaMain* m_VM;
CLuaFunctionRef m_iFunction;
long long m_iStartTime;
SString m_strURL;
SString m_strQueueName;
CLuaArguments m_FetchArguments;
@@ -40,14 +41,19 @@ class CRemoteCall
CRemoteCall(const char* szURL, CLuaArguments* fetchArguments, CLuaMain* luaMain, const CLuaFunctionRef& iFunction, const SString& strQueueName,
const SHttpRequestOptions& options);
~CRemoteCall();
void MakeCall();
static void DownloadFinishedCallback(const SHttpDownloadResult& result);
bool CancelDownload();
const SDownloadStatus& GetDownloadStatus();
CLuaMain* GetVM() { return m_VM; };
bool IsFetch() { return m_bIsFetch; }
bool IsLegacy() { return m_options.bIsLegacy; }
CLuaArguments& GetFetchArguments() { return m_FetchArguments; }
void MakeCall();
static void DownloadFinishedCallback(const SHttpDownloadResult& result);
bool CancelDownload(void);
const SDownloadStatus& GetDownloadStatus();

CLuaMain* GetVM() { return m_VM; };
long long GetStartTime() { return m_iStartTime; };
SString GetURL() { return m_strURL; };
SString GetQueueName() { return m_strQueueName; };
bool IsFetch() { return m_bIsFetch; }
bool IsLegacy() { return m_options.bIsLegacy; }
CLuaArguments& GetFetchArguments() { return m_FetchArguments; }
SHttpRequestOptions GetOptions() { return m_options; };
};

/*
@@ -65,18 +71,20 @@ class CRemoteCalls
CRemoteCalls();
~CRemoteCalls();

void Call(const char* szServerHost, const char* szResourceName, const char* szFunctionName, CLuaArguments* arguments, CLuaMain* luaMain,
CRemoteCall* Call(const char* szServerHost, const char* szResourceName, const char* szFunctionName, CLuaArguments* arguments, CLuaMain* luaMain,
const CLuaFunctionRef& iFunction, const SString& strQueueName, uint uiConnectionAttempts, uint uiConnectTimeoutMs);
void Call(const char* szURL, CLuaArguments* arguments, CLuaMain* luaMain, const CLuaFunctionRef& iFunction, const SString& strQueueName,
CRemoteCall* Call(const char* szURL, CLuaArguments* arguments, CLuaMain* luaMain, const CLuaFunctionRef& iFunction, const SString& strQueueName,
uint uiConnectionAttempts, uint uiConnectTimeoutMs);
void Call(const char* szURL, CLuaArguments* fetchArguments, const SString& strPostData, bool bPostBinary, CLuaMain* luaMain,
CRemoteCall* Call(const char* szURL, CLuaArguments* fetchArguments, const SString& strPostData, bool bPostBinary, CLuaMain* luaMain,
const CLuaFunctionRef& iFunction, const SString& strQueueName, uint uiConnectionAttempts, uint uiConnectTimeoutMs);
void Call(const char* szURL, CLuaArguments* fetchArguments, CLuaMain* luaMain, const CLuaFunctionRef& iFunction, const SString& strQueueName,
CRemoteCall* Call(const char* szURL, CLuaArguments* fetchArguments, CLuaMain* luaMain, const CLuaFunctionRef& iFunction, const SString& strQueueName,
const SHttpRequestOptions& options);
void Remove(CLuaMain* luaMain);
void Remove(CRemoteCall* call);
bool CallExists(CRemoteCall* call);
void ProcessQueuedFiles();
EDownloadModeType GetDownloadModeForQueueName(const SString& strQueueName, bool bAnyHost);
EDownloadModeType GetDownloadModeFromQueueIndex(uint uiIndex, bool bAnyHost);

std::list<CRemoteCall*> GetCalls() { return m_calls; }
};
@@ -1869,8 +1869,9 @@ int CLuaFunctionDefs::FetchRemote(lua_State* luaVM)
if (luaMain)
{
httpRequestOptions.bIsLegacy = true;
g_pClientGame->GetRemoteCalls()->Call(strURL, &callbackArguments, luaMain, iLuaFunction, strQueueName, httpRequestOptions);
lua_pushboolean(luaVM, true);
CRemoteCall* pRemoteCall = g_pClientGame->GetRemoteCalls()->Call(strURL, &callbackArguments, luaMain, iLuaFunction, strQueueName, httpRequestOptions);

lua_pushuserdata(luaVM, pRemoteCall);
return 1;
}
}
@@ -1907,8 +1908,9 @@ int CLuaFunctionDefs::FetchRemote(lua_State* luaVM)
CLuaMain* luaMain = m_pLuaManager->GetVirtualMachine(luaVM);
if (luaMain)
{
g_pClientGame->GetRemoteCalls()->Call(strURL, &callbackArguments, luaMain, iLuaFunction, strQueueName, httpRequestOptions);
lua_pushboolean(luaVM, true);
CRemoteCall* pRemoteCall = g_pClientGame->GetRemoteCalls()->Call(strURL, &callbackArguments, luaMain, iLuaFunction, strQueueName, httpRequestOptions);

lua_pushuserdata(luaVM, pRemoteCall);
return 1;
}
}
@@ -1920,3 +1922,155 @@ int CLuaFunctionDefs::FetchRemote(lua_State* luaVM)
lua_pushboolean(luaVM, false);
return 1;
}

// table getRemoteRequests([resource theResource = nil])
int CLuaFunctionDefs::GetRemoteRequests(lua_State* luaVM)
{
CScriptArgReader argStream(luaVM);
CResource* pResource = nullptr;
CLuaMain* pLuaMain = nullptr;
int iIndex = 0;

argStream.ReadUserData(pResource, NULL);

// Grab virtual machine
if (pResource)
pLuaMain = pResource->GetVM();

lua_newtable(luaVM);
for (const auto& request : g_pClientGame->GetRemoteCalls()->GetCalls())
{
if(!pLuaMain || request->GetVM() == pLuaMain)
{
lua_pushnumber(luaVM, ++iIndex);
lua_pushuserdata(luaVM, request);
lua_settable(luaVM, -3);
}
}

return 1;
}

// table getRemoteRequestInfo(element theRequest[, number postDataLength = 0[, bool includeHeaders = false]])
int CLuaFunctionDefs::GetRemoteRequestInfo(lua_State* luaVM)
{
CScriptArgReader argStream(luaVM);
CLuaArguments info, requestedHeaders;
CRemoteCall* pRemoteCall = nullptr;
CResource* pThisResource = g_pClientGame->GetResourceManager()->GetResourceFromLuaState(luaVM);
int iPostDataLength = 0;
bool bIncludeHeaders = false;

argStream.ReadUserData(pRemoteCall);
argStream.ReadNumber(iPostDataLength, 0);
argStream.ReadBool(bIncludeHeaders, false);

if (!argStream.HasErrors())
{
CResource* pResource = pRemoteCall->GetVM()->GetResource();
bool bExtendedInfo = (pResource == pThisResource);

info.PushString("type");
info.PushString((pRemoteCall->IsFetch() ? "fetch" : "call"));

// remove query_string from url when bExtendedInfo isn't set
SString sURL = pRemoteCall->GetURL();

if (!bExtendedInfo)
sURL = sURL.ReplaceI("%3F", "?").Replace("#", "?").SplitLeft("?");

info.PushString("url");
info.PushString(sURL);

info.PushString("queue");
info.PushString(pRemoteCall->GetQueueName());

info.PushString("resource");

if (pResource)
info.PushResource(pResource);
else
info.PushBoolean(false);

info.PushString("start");
info.PushNumber(pRemoteCall->GetStartTime());

if (bExtendedInfo)
{
if (iPostDataLength == -1 || iPostDataLength > 0)
{
SString sPostData = pRemoteCall->GetOptions().strPostData;

if (iPostDataLength > 0)
sPostData = sPostData.SubStr(0, iPostDataLength);

info.PushString("postData");
info.PushString(sPostData);
}

// requested headers
if (bIncludeHeaders)
{
info.PushString("headers");

for (auto const& header : pRemoteCall->GetOptions().requestHeaders)
{
requestedHeaders.PushString(header.first);
requestedHeaders.PushString(header.second);
}

info.PushTable(&requestedHeaders);
}
}

info.PushString("method");
info.PushString((pRemoteCall->GetOptions().strRequestMethod.length() >= 1 ? pRemoteCall->GetOptions().strRequestMethod.ToUpper().c_str() : "POST"));

info.PushString("connectionAttempts");
info.PushNumber(pRemoteCall->GetOptions().uiConnectionAttempts);

info.PushString("connectionTimeout");
info.PushNumber(pRemoteCall->GetOptions().uiConnectTimeoutMs);

// download info
const SDownloadStatus downloadInfo = pRemoteCall->GetDownloadStatus();

info.PushString("bytesReceived");
info.PushNumber(downloadInfo.uiBytesReceived);

info.PushString("bytesTotal");
info.PushNumber(downloadInfo.uiContentLength);

info.PushString("currentAttempt");
info.PushNumber(downloadInfo.uiAttemptNumber);

info.PushAsTable(luaVM);
return 1;
}

lua_pushboolean(luaVM, false);
return 1;
}

// bool abortRemoteRequest(element theRequest)
int CLuaFunctionDefs::AbortRemoteRequest(lua_State* luaVM)
{
CScriptArgReader argStream(luaVM);
CRemoteCall* pRemoteCall = nullptr;

argStream.ReadUserData(pRemoteCall);

if (!argStream.HasErrors())
{
lua_pushboolean(luaVM, pRemoteCall->CancelDownload());
g_pClientGame->GetRemoteCalls()->Remove(pRemoteCall);
return 1;
}
else
{
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
}

lua_pushboolean(luaVM, false);
return 1;
}
@@ -177,6 +177,9 @@ class CLuaFunctionDefs
LUA_DECLARE(SetFPSLimit);
LUA_DECLARE(GetFPSLimit);
LUA_DECLARE(FetchRemote);
LUA_DECLARE(GetRemoteRequests);
LUA_DECLARE(GetRemoteRequestInfo);
LUA_DECLARE(AbortRemoteRequest);

// Input functions
LUA_DECLARE(BindKey);
@@ -64,6 +64,8 @@ DECLARE_ENUM(eSurfaceWheelEffect);
DECLARE_ENUM(eSurfaceSkidMarkType);
DECLARE_ENUM(eSurfaceAdhesionGroup);

class CRemoteCall;

enum eDXHorizontalAlign
{
DX_ALIGN_LEFT = DT_LEFT,
@@ -216,6 +218,10 @@ inline SString GetClassTypeName(CClientPed*)
{
return "ped";
}
inline SString GetClassTypeName(CRemoteCall*)
{
return "remotecall";
}
inline SString GetClassTypeName(CClientProjectile*)
{
return "projectile";
@@ -528,6 +534,20 @@ CClientEntity* UserDataCast(CClientEntity*, void* ptr, lua_State*)
return pEntity;
}

//
// CRemoteCall from userdata
//
template <class T>
CRemoteCall* UserDataCast(CRemoteCall*, void* ptr, lua_State*)
{
CRemoteCall* pRemoteCall = (CRemoteCall*)ptr;

if (pRemoteCall && g_pClientGame->GetRemoteCalls()->CallExists(pRemoteCall))
return pRemoteCall;

return nullptr;
}

//
// CClientGUIElement ( CGUIElement )
//
@@ -389,7 +389,10 @@ void CLuaManager::LoadCFunctions()
{"addDebugHook", CLuaFunctionDefs::AddDebugHook},
{"removeDebugHook", CLuaFunctionDefs::RemoveDebugHook},
{"fetchRemote", CLuaFunctionDefs::FetchRemote},

{"getRemoteRequests", CLuaFunctionDefs::GetRemoteRequests},
{"getRemoteRequestInfo", CLuaFunctionDefs::GetRemoteRequestInfo},
{"abortRemoteRequest", CLuaFunctionDefs::AbortRemoteRequest},

// Version functions
{"getVersion", CLuaFunctionDefs::GetVersion},

0 comments on commit 8e9d1c6

Please sign in to comment.
You can’t perform that action at this time.