Skip to content

Commit

Permalink
ConnectionInfo.RequestCloudID
Browse files Browse the repository at this point in the history
  • Loading branch information
emcifuntik committed Sep 16, 2023
1 parent 599c812 commit 1a26946
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions c-api/entities/connection_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ const char* ConnectionInfo_GetSocialName(alt::IConnectionInfo* connectionInfo, i
return AllocateString(connectionInfo->GetSocialName(), size);
}

const char* ConnectionInfo_GetCloudAuthHash(alt::IConnectionInfo* connectionInfo, int32_t& size)
void ConnectionInfo_RequestCloudID(alt::IConnectionInfo* connectionInfo, RequestAuthCallback_t delegate)
{
return AllocateString(connectionInfo->GetCloudAuthHash(), size);
connectionInfo->RequestCloudID([delegate](uint8_t ok, const std::string& result) {
delegate(ok, result.c_str());
});
}

uint8_t ConnectionInfo_IsAccepted(alt::IConnectionInfo* connectionInfo)
Expand Down
4 changes: 3 additions & 1 deletion c-api/entities/connection_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ EXPORT_SERVER const char* ConnectionInfo_GetCdnUrl(alt::IConnectionInfo* connect
EXPORT_SERVER uint64_t ConnectionInfo_GetPasswordHash(alt::IConnectionInfo* connectionInfo);
EXPORT_SERVER const char* ConnectionInfo_GetIp(alt::IConnectionInfo* connectionInfo, int32_t& size);
EXPORT_SERVER int64_t ConnectionInfo_GetDiscordUserID(alt::IConnectionInfo* connectionInfo);
EXPORT_SERVER const char* ConnectionInfo_GetCloudAuthHash(alt::IConnectionInfo* connectionInfo, int32_t& size);
EXPORT_SERVER const char* ConnectionInfo_GetText(alt::IConnectionInfo* connectionInfo, int32_t& size);
EXPORT_SERVER void ConnectionInfo_SetText(alt::IConnectionInfo* connectionInfo, const char* text);

typedef void (* RequestAuthCallback_t)(bool ok, const char* result);
EXPORT_SERVER void ConnectionInfo_RequestCloudID(alt::IConnectionInfo* connectionInfo, /** ServerEvents.RequestAuthCallbackDelegate */ RequestAuthCallback_t delegate);

EXPORT_SERVER void ConnectionInfo_Accept(alt::IConnectionInfo* connectionInfo, uint8_t sendNames);
EXPORT_SERVER void ConnectionInfo_Decline(alt::IConnectionInfo* connectionInfo, const char* reason);
EXPORT_SERVER uint8_t ConnectionInfo_IsAccepted(alt::IConnectionInfo* connectionInfo);

0 comments on commit 1a26946

Please sign in to comment.