mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Fix plVaultClientApi to work with new NetVaultNode
This commit is contained in:
@ -63,6 +63,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#pragma warning(push, 0)
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "hsStringTokenizer.h"
|
||||
#include "hsGeometry3.h"
|
||||
#include "plSDL/plSDL.h"
|
||||
|
@ -74,17 +74,6 @@ struct INotifyAfterDownload : THashKeyVal<unsigned> {
|
||||
{}
|
||||
};
|
||||
|
||||
struct DeviceInbox : CHashKeyStr {
|
||||
HASHLINK(DeviceInbox) link;
|
||||
wchar_t inboxName[kMaxVaultNodeStringLength];
|
||||
|
||||
DeviceInbox (const wchar_t device[], const wchar_t inbox[])
|
||||
: CHashKeyStr(device)
|
||||
{
|
||||
StrCopy(inboxName, inbox, arrsize(inboxName));
|
||||
}
|
||||
};
|
||||
|
||||
// A RelVaultNodeLink may be either stored in the global table,
|
||||
// or stored in an IRelVaultNode's parents or children table.
|
||||
struct RelVaultNodeLink : THashKeyVal<unsigned> {
|
||||
@ -293,11 +282,7 @@ static HASHTABLEDECL(
|
||||
link
|
||||
) s_notifyAfterDownload;
|
||||
|
||||
static HASHTABLEDECL(
|
||||
DeviceInbox,
|
||||
CHashKeyStr,
|
||||
link
|
||||
) s_ageDeviceInboxes;
|
||||
static std::unordered_map<plString, plString, plString::hash> s_ageDeviceInboxes;
|
||||
|
||||
static bool s_processPlayerInbox = false;
|
||||
|
||||
@ -553,13 +538,13 @@ static void VaultNodeFetched (
|
||||
// Add to global node table
|
||||
RelVaultNodeLink * link = s_nodes.Find(node->GetNodeId());
|
||||
if (!link) {
|
||||
link = new RelVaultNodeLink(false, 0, node->GetNodeId(), new RelVaultNode);
|
||||
link = new RelVaultNodeLink(false, 0, node->GetNodeId(), new RelVaultNode());
|
||||
link->node->SetNodeId_NoDirty(node->GetNodeId());
|
||||
s_nodes.Add(link);
|
||||
}
|
||||
link->node->CopyFrom(node, NetVaultNode::kCopyOverwrite);
|
||||
link->node->CopyFrom(node);
|
||||
InitFetchedNode(link->node);
|
||||
|
||||
|
||||
link->node->Print(L"Fetched", LogDumpProc, 0);
|
||||
}
|
||||
|
||||
@ -602,7 +587,7 @@ static void VaultNodeChanged (
|
||||
|
||||
// We are the party responsible for the change, so we already have the
|
||||
// latest version of the node; no need to fetch it.
|
||||
if (link->node->revisionId == revisionId)
|
||||
if (link->node->GetRevision() == revisionId)
|
||||
return;
|
||||
|
||||
// We have the node and we weren't the one that changed it, so fetch it.
|
||||
@ -726,12 +711,7 @@ static void SaveDirtyNodes () {
|
||||
for (RelVaultNodeLink * link = s_nodes.Head(); link; link = s_nodes.Next(link)) {
|
||||
if (bytesWritten >= kMaxBytesPerSaveUpdate)
|
||||
break;
|
||||
if (link->node->GetDirtyFlags()) {
|
||||
|
||||
// Auth server needs the name of the sdl record
|
||||
if (link->node->GetNodeType() == plVault::kNodeType_SDL)
|
||||
link->node->SetDirtyFlags(VaultSDLNode::kSDLName);
|
||||
|
||||
if (link->node->IsDirty()) {
|
||||
if (unsigned bytes = NetCliAuthVaultNodeSave(link->node, nil, nil)) {
|
||||
bytesWritten += bytes;
|
||||
link->node->Print(L"Saving", LogDumpProc, 0);
|
||||
@ -1428,12 +1408,12 @@ static bool IStrSqlEscape (const T src[], T * dst, unsigned dstChars) {
|
||||
}
|
||||
|
||||
static void IGetStringFieldValue (
|
||||
const wchar_t * value,
|
||||
wchar_t * dst,
|
||||
size_t dstChars
|
||||
const plString & value,
|
||||
wchar_t * dst,
|
||||
size_t dstChars
|
||||
) {
|
||||
wchar_t * tmp = (wchar_t*)malloc(sizeof(wchar_t) * dstChars);
|
||||
IStrSqlEscape(value, tmp, dstChars);
|
||||
IStrSqlEscape(value.ToWchar().GetData(), tmp, dstChars);
|
||||
swprintf(dst, dstChars, L"'%s'", tmp);
|
||||
free(tmp);
|
||||
}
|
||||
@ -1875,18 +1855,18 @@ void VaultDeleteNode (
|
||||
//============================================================================
|
||||
void VaultPublishNode (
|
||||
unsigned nodeId,
|
||||
const wchar_t deviceName[]
|
||||
const plString& deviceName
|
||||
) {
|
||||
hsRef<RelVaultNode> rvn;
|
||||
|
||||
|
||||
rvn = VaultAgeGetDeviceInbox(deviceName);
|
||||
if (!rvn) {
|
||||
LogMsg(kLogDebug, L"Failed to find inbox for device %s, adding it on-the-fly", deviceName);
|
||||
LogMsg(kLogDebug, L"Failed to find inbox for device %S, adding it on-the-fly", deviceName.c_str());
|
||||
VaultAgeSetDeviceInboxAndWait(deviceName, DEFAULT_DEVICE_INBOX);
|
||||
|
||||
rvn = VaultAgeGetDeviceInbox(deviceName);
|
||||
if (!rvn) {
|
||||
LogMsg(kLogDebug, L"Failed to add inbox to device %s on-the-fly", deviceName);
|
||||
LogMsg(kLogDebug, L"Failed to add inbox to device %S on-the-fly", deviceName.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1914,10 +1894,8 @@ void VaultCreateNode (
|
||||
|
||||
if (hsRef<RelVaultNode> age = VaultGetAgeNode()) {
|
||||
VaultAgeNode access(age);
|
||||
if (!(templateNode->GetFieldFlags() & NetVaultNode::kCreateAgeName))
|
||||
templateNode->SetCreateAgeName(access.GetAgeName());
|
||||
if (!(templateNode->GetFieldFlags() & NetVaultNode::kCreateAgeUuid))
|
||||
templateNode->SetCreateAgeUuid(access.GetAgeInstanceGuid());
|
||||
templateNode->SetCreateAgeName(access.GetAgeName());
|
||||
templateNode->SetCreateAgeUuid(access.GetAgeInstanceGuid());
|
||||
}
|
||||
|
||||
NetCliAuthVaultNodeCreate(
|
||||
@ -2297,9 +2275,7 @@ bool VaultGetLinkToMyNeighborhood (plAgeLinkStruct * link) {
|
||||
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeInfo);
|
||||
VaultAgeInfoNode ageInfo(templateNode);
|
||||
wchar_t str[MAX_PATH];
|
||||
StrToUnicode(str, kNeighborhoodAgeFilename, arrsize(str));
|
||||
ageInfo.SetAgeFilename(str);
|
||||
ageInfo.SetAgeFilename(kNeighborhoodAgeFilename);
|
||||
|
||||
hsRef<RelVaultNode> node;
|
||||
if (node = rvnFldr->GetChildNode(templateNode, 2)) {
|
||||
@ -2320,9 +2296,7 @@ bool VaultGetLinkToMyPersonalAge (plAgeLinkStruct * link) {
|
||||
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeInfo);
|
||||
VaultAgeInfoNode ageInfo(templateNode);
|
||||
wchar_t str[MAX_PATH];
|
||||
StrToUnicode(str, kPersonalAgeFilename, arrsize(str));
|
||||
ageInfo.SetAgeFilename(str);
|
||||
ageInfo.SetAgeFilename(kPersonalAgeFilename);
|
||||
|
||||
hsRef<RelVaultNode> node;
|
||||
if (node = rvnFldr->GetChildNode(templateNode, 2)) {
|
||||
@ -2343,9 +2317,7 @@ bool VaultGetLinkToCity (plAgeLinkStruct * link) {
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeInfo);
|
||||
|
||||
VaultAgeInfoNode ageInfo(templateNode);
|
||||
wchar_t str[MAX_PATH];
|
||||
StrToUnicode(str, kCityAgeFilename, arrsize(str));
|
||||
ageInfo.SetAgeFilename(str);
|
||||
ageInfo.SetAgeFilename(kCityAgeFilename);
|
||||
|
||||
hsRef<RelVaultNode> node;
|
||||
if (node = rvnFldr->GetChildNode(templateNode, 2)) {
|
||||
@ -2368,16 +2340,14 @@ hsRef<RelVaultNode> VaultGetOwnedAgeLink (const plAgeInfoStruct * info) {
|
||||
|
||||
VaultAgeInfoNode ageInfo(templateNode);
|
||||
if (info->HasAgeFilename()) {
|
||||
wchar_t str[MAX_PATH];
|
||||
StrToUnicode(str, info->GetAgeFilename(), arrsize(str));
|
||||
ageInfo.SetAgeFilename(str);
|
||||
ageInfo.SetAgeFilename(info->GetAgeFilename());
|
||||
}
|
||||
if (info->HasAgeInstanceGuid()) {
|
||||
ageInfo.SetAgeInstanceGuid(*info->GetAgeInstanceGuid());
|
||||
}
|
||||
|
||||
if (hsRef<RelVaultNode> rvnInfo = rvnFldr->GetChildNode(templateNode, 2)) {
|
||||
templateNode->ClearFieldFlags();
|
||||
templateNode->Clear();
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeLink);
|
||||
rvnLink = rvnInfo->GetParentNode(templateNode, 1);
|
||||
}
|
||||
@ -2390,7 +2360,6 @@ hsRef<RelVaultNode> VaultGetOwnedAgeLink (const plAgeInfoStruct * info) {
|
||||
hsRef<RelVaultNode> VaultGetOwnedAgeInfo (const plAgeInfoStruct * info) {
|
||||
|
||||
hsRef<RelVaultNode> rvnInfo;
|
||||
|
||||
if (hsRef<RelVaultNode> rvnFldr = VaultGetAgesIOwnFolder()) {
|
||||
|
||||
hsRef<NetVaultNode> templateNode = new NetVaultNode;
|
||||
@ -2398,9 +2367,7 @@ hsRef<RelVaultNode> VaultGetOwnedAgeInfo (const plAgeInfoStruct * info) {
|
||||
|
||||
VaultAgeInfoNode ageInfo(templateNode);
|
||||
if (info->HasAgeFilename()) {
|
||||
wchar_t str[MAX_PATH];
|
||||
StrToUnicode(str, info->GetAgeFilename(), arrsize(str));
|
||||
ageInfo.SetAgeFilename(str);
|
||||
ageInfo.SetAgeFilename(info->GetAgeFilename());
|
||||
}
|
||||
if (info->HasAgeInstanceGuid()) {
|
||||
ageInfo.SetAgeInstanceGuid(*info->GetAgeInstanceGuid());
|
||||
@ -2408,7 +2375,6 @@ hsRef<RelVaultNode> VaultGetOwnedAgeInfo (const plAgeInfoStruct * info) {
|
||||
|
||||
rvnInfo = rvnFldr->GetChildNode(templateNode, 2);
|
||||
}
|
||||
|
||||
return rvnInfo;
|
||||
}
|
||||
|
||||
@ -2488,16 +2454,14 @@ bool VaultSetAgePublicAndWait (NetVaultNode * ageInfoNode, bool publicOrNot) {
|
||||
NetCliAuthSetAgePublic(ageInfoNode->GetNodeId(), publicOrNot);
|
||||
|
||||
VaultAgeInfoNode access(ageInfoNode);
|
||||
char ageName[MAX_PATH];
|
||||
StrToAnsi(ageName, access.GetAgeFilename(), arrsize(ageName));
|
||||
|
||||
|
||||
plVaultNotifyMsg * msg = new plVaultNotifyMsg;
|
||||
if (publicOrNot)
|
||||
msg->SetType(plVaultNotifyMsg::kPublicAgeCreated);
|
||||
else
|
||||
msg->SetType(plVaultNotifyMsg::kPublicAgeRemoved);
|
||||
msg->SetResultCode(true);
|
||||
msg->GetArgs()->AddString(plNetCommon::VaultTaskArgs::kAgeFilename, ageName);
|
||||
msg->GetArgs()->AddString(plNetCommon::VaultTaskArgs::kAgeFilename, access.GetAgeFilename().c_str());
|
||||
msg->Send();
|
||||
return true;
|
||||
}
|
||||
@ -2513,17 +2477,15 @@ hsRef<RelVaultNode> VaultGetVisitAgeLink (const plAgeInfoStruct * info) {
|
||||
|
||||
VaultAgeInfoNode ageInfo(templateNode);
|
||||
if (info->HasAgeFilename()) {
|
||||
wchar_t str[MAX_PATH];
|
||||
StrToUnicode(str, info->GetAgeFilename(), arrsize(str));
|
||||
ageInfo.SetAgeFilename(str);
|
||||
ageInfo.SetAgeFilename(info->GetAgeFilename());
|
||||
}
|
||||
if (info->HasAgeInstanceGuid()) {
|
||||
ageInfo.SetAgeInstanceGuid(*info->GetAgeInstanceGuid());
|
||||
}
|
||||
|
||||
if (hsRef<RelVaultNode> rvnInfo = rvnFldr->GetChildNode(templateNode, 2)) {
|
||||
templateNode->ClearFieldFlags();
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeLink);
|
||||
templateNode->Clear();
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeLink);
|
||||
rvnLink = rvnInfo->GetParentNode(templateNode, 1);
|
||||
}
|
||||
}
|
||||
@ -2539,7 +2501,6 @@ bool VaultGetVisitAgeLink (const plAgeInfoStruct * info, class plAgeLinkStruct *
|
||||
|
||||
VaultAgeLinkNode ageLink(rvn);
|
||||
ageLink.CopyTo(link);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3365,7 +3326,7 @@ bool VaultUnregisterVisitAgeAndWait (const plAgeInfoStruct * info) {
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
hsRef<RelVaultNode> VaultFindChronicleEntry (const wchar_t entryName[], int entryType) {
|
||||
hsRef<RelVaultNode> VaultFindChronicleEntry (const plString& entryName, int entryType) {
|
||||
|
||||
hsRef<RelVaultNode> result;
|
||||
if (hsRef<RelVaultNode> rvnFldr = GetChildFolderNode(GetPlayerNode(), plVault::kChronicleFolder, 1)) {
|
||||
@ -3382,7 +3343,7 @@ hsRef<RelVaultNode> VaultFindChronicleEntry (const wchar_t entryName[], int entr
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
bool VaultHasChronicleEntry (const wchar_t entryName[], int entryType) {
|
||||
bool VaultHasChronicleEntry (const plString& entryName, int entryType) {
|
||||
if (VaultFindChronicleEntry(entryName, entryType))
|
||||
return true;
|
||||
return false;
|
||||
@ -3390,9 +3351,9 @@ bool VaultHasChronicleEntry (const wchar_t entryName[], int entryType) {
|
||||
|
||||
//============================================================================
|
||||
void VaultAddChronicleEntryAndWait (
|
||||
const wchar_t entryName[],
|
||||
int entryType,
|
||||
const wchar_t entryValue[]
|
||||
const plString& entryName,
|
||||
int entryType,
|
||||
const plString& entryValue
|
||||
) {
|
||||
if (hsRef<RelVaultNode> rvnChrn = VaultFindChronicleEntry(entryName, entryType)) {
|
||||
VaultChronicleNode chrnNode(rvnChrn);
|
||||
@ -3526,7 +3487,7 @@ bool VaultAmOwnerOfCurrentAge () {
|
||||
VaultAgeInfoNode curAgeInfo(currentAgeInfoNode);
|
||||
|
||||
plAgeInfoStruct info;
|
||||
info.SetAgeFilename(plString::FromWchar(curAgeInfo.GetAgeFilename()));
|
||||
info.SetAgeFilename(curAgeInfo.GetAgeFilename());
|
||||
|
||||
if (hsRef<RelVaultNode> rvnLink = VaultGetOwnedAgeLink(&info)) {
|
||||
|
||||
@ -3778,13 +3739,11 @@ hsRef<RelVaultNode> VaultFindAgeSubAgeLink (const plAgeInfoStruct * info) {
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeInfo);
|
||||
|
||||
VaultAgeInfoNode ageInfo(templateNode);
|
||||
wchar_t str[MAX_PATH];
|
||||
StrToUnicode(str, info->GetAgeFilename(), arrsize(str));
|
||||
ageInfo.SetAgeFilename(str);
|
||||
ageInfo.SetAgeFilename(info->GetAgeFilename());
|
||||
|
||||
if (hsRef<RelVaultNode> rvnInfo = rvnFldr->GetChildNode(templateNode, 2)) {
|
||||
templateNode->ClearFieldFlags();
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeLink);
|
||||
templateNode->Clear();
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeLink);
|
||||
rvnLink = rvnInfo->GetParentNode(templateNode, 1);
|
||||
}
|
||||
}
|
||||
@ -3808,7 +3767,7 @@ void VaultAddAgeChronicleEntry (
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
hsRef<RelVaultNode> VaultAgeAddDeviceAndWait (const wchar_t deviceName[]) {
|
||||
hsRef<RelVaultNode> VaultAgeAddDeviceAndWait (const plString& deviceName) {
|
||||
if (hsRef<RelVaultNode> existing = VaultAgeGetDevice(deviceName))
|
||||
return existing;
|
||||
|
||||
@ -3836,7 +3795,7 @@ hsRef<RelVaultNode> VaultAgeAddDeviceAndWait (const wchar_t deviceName[]) {
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void VaultAgeRemoveDevice (const wchar_t deviceName[]) {
|
||||
void VaultAgeRemoveDevice (const plString& deviceName) {
|
||||
if (hsRef<RelVaultNode> folder = VaultGetAgeDevicesFolder()) {
|
||||
hsRef<NetVaultNode> templateNode = new NetVaultNode;
|
||||
templateNode->SetNodeType(plVault::kNodeType_TextNote);
|
||||
@ -3845,14 +3804,15 @@ void VaultAgeRemoveDevice (const wchar_t deviceName[]) {
|
||||
if (hsRef<RelVaultNode> device = folder->GetChildNode(templateNode, 1)) {
|
||||
VaultRemoveChildNode(folder->GetNodeId(), device->GetNodeId(), nil, nil);
|
||||
|
||||
if (DeviceInbox * deviceInbox = s_ageDeviceInboxes.Find(CHashKeyStr(deviceName)))
|
||||
delete device;
|
||||
auto it = s_ageDeviceInboxes.find(deviceName);
|
||||
if (it != s_ageDeviceInboxes.end())
|
||||
s_ageDeviceInboxes.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
bool VaultAgeHasDevice (const wchar_t deviceName[]) {
|
||||
bool VaultAgeHasDevice (const plString& deviceName) {
|
||||
bool found = false;
|
||||
if (hsRef<RelVaultNode> folder = VaultGetAgeDevicesFolder()) {
|
||||
hsRef<NetVaultNode> templateNode = new NetVaultNode;
|
||||
@ -3866,7 +3826,7 @@ bool VaultAgeHasDevice (const wchar_t deviceName[]) {
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
hsRef<RelVaultNode> VaultAgeGetDevice (const wchar_t deviceName[]) {
|
||||
hsRef<RelVaultNode> VaultAgeGetDevice (const plString& deviceName) {
|
||||
hsRef<RelVaultNode> result;
|
||||
if (hsRef<RelVaultNode> folder = VaultGetAgeDevicesFolder()) {
|
||||
hsRef<NetVaultNode> templateNode = new NetVaultNode;
|
||||
@ -3880,24 +3840,17 @@ hsRef<RelVaultNode> VaultAgeGetDevice (const wchar_t deviceName[]) {
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
hsRef<RelVaultNode> VaultAgeSetDeviceInboxAndWait (const wchar_t deviceName[], const wchar_t inboxName[]) {
|
||||
DeviceInbox * devInbox = s_ageDeviceInboxes.Find(CHashKeyStr(deviceName));
|
||||
if (devInbox) {
|
||||
StrCopy(devInbox->inboxName, inboxName, arrsize(devInbox->inboxName));
|
||||
}
|
||||
else {
|
||||
devInbox = new DeviceInbox(deviceName, inboxName);
|
||||
s_ageDeviceInboxes.Add(devInbox);
|
||||
}
|
||||
hsRef<RelVaultNode> VaultAgeSetDeviceInboxAndWait (const plString& deviceName, const plString& inboxName) {
|
||||
s_ageDeviceInboxes[deviceName] = inboxName;
|
||||
|
||||
// if we found the inbox or its a global inbox then return here, otherwise if its the default inbox and
|
||||
// it wasn't found then continue on and create the inbox
|
||||
hsRef<RelVaultNode> existing = VaultAgeGetDeviceInbox(deviceName);
|
||||
if (existing || StrCmp(inboxName, DEFAULT_DEVICE_INBOX) != 0)
|
||||
if (existing || inboxName == DEFAULT_DEVICE_INBOX)
|
||||
return existing;
|
||||
|
||||
hsRef<RelVaultNode> device, inbox;
|
||||
|
||||
|
||||
for (;;) {
|
||||
device = VaultAgeGetDevice(deviceName);
|
||||
if (!device)
|
||||
@ -3911,7 +3864,7 @@ hsRef<RelVaultNode> VaultAgeSetDeviceInboxAndWait (const wchar_t deviceName[], c
|
||||
VaultFolderNode access(inbox);
|
||||
access.SetFolderName(inboxName);
|
||||
access.SetFolderType(plVault::kDeviceInboxFolder);
|
||||
|
||||
|
||||
VaultAddChildNodeAndWait(device->GetNodeId(), inbox->GetNodeId(), 0);
|
||||
break;
|
||||
}
|
||||
@ -3920,28 +3873,26 @@ hsRef<RelVaultNode> VaultAgeSetDeviceInboxAndWait (const wchar_t deviceName[], c
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
hsRef<RelVaultNode> VaultAgeGetDeviceInbox (const wchar_t deviceName[]) {
|
||||
hsRef<RelVaultNode> VaultAgeGetDeviceInbox (const plString& deviceName) {
|
||||
hsRef<RelVaultNode> result;
|
||||
DeviceInbox * devInbox = s_ageDeviceInboxes.Find(CHashKeyStr(deviceName));
|
||||
auto it = s_ageDeviceInboxes.find(deviceName);
|
||||
|
||||
if (devInbox)
|
||||
{
|
||||
if (it != s_ageDeviceInboxes.end()) {
|
||||
hsRef<RelVaultNode> parentNode;
|
||||
const wchar_t * inboxName = nil;
|
||||
|
||||
if (StrCmp(devInbox->inboxName, DEFAULT_DEVICE_INBOX) == 0) {
|
||||
//if (StrCmp(devInbox->inboxName, DEFAULT_DEVICE_INBOX) == 0) {
|
||||
if (it->second == DEFAULT_DEVICE_INBOX)
|
||||
parentNode = VaultAgeGetDevice(deviceName);
|
||||
}
|
||||
else {
|
||||
else
|
||||
parentNode = VaultGetGlobalInbox();
|
||||
}
|
||||
|
||||
if (parentNode) {
|
||||
hsRef<NetVaultNode> templateNode = new NetVaultNode;
|
||||
templateNode->SetNodeType(plVault::kNodeType_Folder);
|
||||
VaultFolderNode access(templateNode);
|
||||
access.SetFolderType(plVault::kDeviceInboxFolder);
|
||||
access.SetFolderName(devInbox->inboxName);
|
||||
access.SetFolderName(it->second);
|
||||
result = parentNode->GetChildNode(templateNode, 1);
|
||||
}
|
||||
}
|
||||
@ -3950,9 +3901,7 @@ hsRef<RelVaultNode> VaultAgeGetDeviceInbox (const wchar_t deviceName[]) {
|
||||
|
||||
//============================================================================
|
||||
void VaultClearDeviceInboxMap () {
|
||||
while (DeviceInbox * inbox = s_ageDeviceInboxes.Head()) {
|
||||
delete inbox;
|
||||
}
|
||||
s_ageDeviceInboxes.clear();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -3998,13 +3947,11 @@ hsRef<RelVaultNode> VaultGetSubAgeLink (const plAgeInfoStruct * info) {
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeInfo);
|
||||
|
||||
VaultAgeInfoNode ageInfo(templateNode);
|
||||
wchar_t str[MAX_PATH];
|
||||
StrToUnicode(str, info->GetAgeFilename(), arrsize(str));
|
||||
ageInfo.SetAgeFilename(str);
|
||||
ageInfo.SetAgeFilename(info->GetAgeFilename());
|
||||
|
||||
if (hsRef<RelVaultNode> rvnInfo = rvnFldr->GetChildNode(templateNode, 2)) {
|
||||
templateNode->ClearFieldFlags();
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeLink);
|
||||
templateNode->Clear();
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeLink);
|
||||
rvnLink = rvnInfo->GetParentNode(templateNode, 1);
|
||||
}
|
||||
}
|
||||
@ -4438,13 +4385,11 @@ bool VaultAgeFindOrCreateChildAgeLinkAndWait (
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeInfo);
|
||||
|
||||
VaultAgeInfoNode ageInfo(templateNode);
|
||||
wchar_t str[MAX_PATH];
|
||||
StrToUnicode(str, info->GetAgeFilename(), arrsize(str));
|
||||
ageInfo.SetAgeFilename(str);
|
||||
ageInfo.SetAgeFilename(info->GetAgeFilename());
|
||||
|
||||
if (hsRef<RelVaultNode> rvnInfo = rvnChildAges->GetChildNode(templateNode, 2)) {
|
||||
templateNode->ClearFieldFlags();
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeLink);
|
||||
templateNode->Clear();
|
||||
templateNode->SetNodeType(plVault::kNodeType_AgeLink);
|
||||
rvnLink = rvnInfo->GetParentNode(templateNode, 1);
|
||||
}
|
||||
|
||||
@ -4684,14 +4629,11 @@ uint8_t VaultAgeFindOrCreateChildAgeLink(
|
||||
// Still here? Try to find the Child Ages folder
|
||||
uint8_t retval = hsFail;
|
||||
if (hsRef<RelVaultNode> rvnChildAges = rvnParentInfo->GetChildAgeInfoListNode(plVault::kChildAgesFolder, 1)) {
|
||||
wchar_t hack[MAX_PATH];
|
||||
StrToUnicode(hack, info->GetAgeFilename(), arrsize(hack));
|
||||
|
||||
// Search for our age
|
||||
hsRef<NetVaultNode> temp = new NetVaultNode;
|
||||
temp->SetNodeType(plVault::kNodeType_AgeInfo);
|
||||
VaultAgeInfoNode theAge(temp);
|
||||
theAge.SetAgeFilename(hack);
|
||||
theAge.SetAgeFilename(info->GetAgeFilename());
|
||||
|
||||
if (hsRef<RelVaultNode> rvnAgeInfo = rvnChildAges->GetChildNode(temp, 2)) {
|
||||
hsRef<RelVaultNode> rvnAgeLink = rvnAgeInfo->GetParentAgeLink();
|
||||
|
@ -246,7 +246,7 @@ void VaultDeleteNode (
|
||||
);
|
||||
void VaultPublishNode (
|
||||
unsigned nodeId,
|
||||
const wchar_t deviceName[]
|
||||
const plString& deviceName
|
||||
);
|
||||
void VaultSendNode (
|
||||
RelVaultNode* srcNode,
|
||||
@ -354,13 +354,13 @@ bool VaultRegisterVisitAgeAndWait(const plAgeLinkStruct * link);
|
||||
void VaultRegisterVisitAge(const plAgeLinkStruct* link);
|
||||
bool VaultUnregisterOwnedAgeAndWait(const plAgeInfoStruct * info);
|
||||
bool VaultUnregisterVisitAgeAndWait(const plAgeInfoStruct * info);
|
||||
hsRef<RelVaultNode> VaultFindChronicleEntry(const wchar_t entryName[], int entryType = -1);
|
||||
bool VaultHasChronicleEntry(const wchar_t entryName[], int entryType = -1);
|
||||
hsRef<RelVaultNode> VaultFindChronicleEntry(const plString& entryName, int entryType = -1);
|
||||
bool VaultHasChronicleEntry(const plString& entryName, int entryType = -1);
|
||||
// if entry of same name and type already exists, value is updated
|
||||
void VaultAddChronicleEntryAndWait (
|
||||
const wchar_t entryName[],
|
||||
int entryType,
|
||||
const wchar_t entryValue[]
|
||||
const plString& entryName,
|
||||
int entryType,
|
||||
const plString& entryValue
|
||||
);
|
||||
bool VaultAmIgnoringPlayer (unsigned playerId);
|
||||
unsigned VaultGetKILevel ();
|
||||
@ -388,7 +388,7 @@ void VaultProcessPlayerInbox ();
|
||||
*
|
||||
***/
|
||||
|
||||
#define DEFAULT_DEVICE_INBOX L"DevInbox"
|
||||
#define DEFAULT_DEVICE_INBOX "DevInbox"
|
||||
|
||||
hsRef<RelVaultNode> VaultGetAgeNode();
|
||||
hsRef<RelVaultNode> VaultGetAgeInfoNode();
|
||||
@ -410,12 +410,12 @@ void VaultAddAgeChronicleEntry (
|
||||
int entryType,
|
||||
const wchar_t entryValue[]
|
||||
);
|
||||
hsRef<RelVaultNode> VaultAgeAddDeviceAndWait(const wchar_t deviceName[]); // blocks until completion
|
||||
void VaultAgeRemoveDevice (const wchar_t deviceName[]);
|
||||
bool VaultAgeHasDevice (const wchar_t deviceName[]);
|
||||
hsRef<RelVaultNode> VaultAgeGetDevice(const wchar_t deviceName[]);
|
||||
hsRef<RelVaultNode> VaultAgeSetDeviceInboxAndWait(const wchar_t deviceName[], const wchar_t inboxName[]); // blocks until completion
|
||||
hsRef<RelVaultNode> VaultAgeGetDeviceInbox(const wchar_t deviceName[]);
|
||||
hsRef<RelVaultNode> VaultAgeAddDeviceAndWait(const plString& deviceName); // blocks until completion
|
||||
void VaultAgeRemoveDevice (const plString& deviceName);
|
||||
bool VaultAgeHasDevice (const plString& deviceName);
|
||||
hsRef<RelVaultNode> VaultAgeGetDevice(const plString& deviceName);
|
||||
hsRef<RelVaultNode> VaultAgeSetDeviceInboxAndWait(const plString& deviceName, const plString& inboxName); // blocks until completion
|
||||
hsRef<RelVaultNode> VaultAgeGetDeviceInbox(const plString& deviceName);
|
||||
void VaultClearDeviceInboxMap ();
|
||||
|
||||
bool VaultAgeGetAgeSDL (class plStateDataRecord * out);
|
||||
|
Reference in New Issue
Block a user