2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

Let ptVault.setAgePublic accept ptVaultAgeInfoNode in addition to ptAgeInfoStruct.

In this case it now also works for non-owners of the age. Previously it only worked for owners because the ageInfoStruct does not contain the vault node ID, so it needed to be looked up somewhere, and that was in the AgesIOwnFolder.
This commit is contained in:
Christian Walther
2014-12-25 00:26:39 +01:00
parent 5f5dd2745f
commit ce5719c83f
5 changed files with 40 additions and 21 deletions

View File

@ -664,6 +664,11 @@ bool pyVault::SetAgePublic( const pyAgeInfoStruct * ageInfo, bool makePublic )
return VaultSetOwnedAgePublicAndWait(ageInfo->GetAgeInfo(), makePublic);
}
bool pyVault::SetAgePublic( const pyVaultAgeInfoNode * ageInfoNode, bool makePublic )
{
return VaultSetAgePublicAndWait(ageInfoNode->GetNode(), makePublic);
}
PyObject* pyVault::GetGlobalInbox( void )
{

View File

@ -176,6 +176,8 @@ public:
void CreateNeighborhood();
// set an age's public status. will fail if you aren't czar of age.
bool SetAgePublic( const pyAgeInfoStruct * ageInfo, bool makePublic );
// set an age's public status, also works for non-owners
bool SetAgePublic( const pyVaultAgeInfoNode * ageInfoNode, bool makePublic );
PyObject* GetGlobalInbox( void ); // returns pyVaultFolderNode
#ifdef GlobalInboxTestCode

View File

@ -43,6 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pyEnum.h"
#include "pyAgeInfoStruct.h"
#include "pyVaultNode.h"
#include "pyVaultAgeInfoNode.h"
#include "pySDL.h"
#include "pyAgeLinkStruct.h"
@ -451,16 +452,21 @@ PYTHON_METHOD_DEFINITION(ptVault, setAgePublic, args)
char makePublic;
if (!PyArg_ParseTuple(args, "Ob", &ageInfoObj, &makePublic))
{
PyErr_SetString(PyExc_TypeError, "setAgePublic expects a ptAgeInfoStruct and a boolean");
PyErr_SetString(PyExc_TypeError, "setAgePublic expects a ptAgeInfoStruct or ptVaultAgeInfoNode and a boolean");
PYTHON_RETURN_ERROR;
}
if (!pyAgeInfoStruct::Check(ageInfoObj))
if (pyAgeInfoStruct::Check(ageInfoObj))
{
PyErr_SetString(PyExc_TypeError, "setAgePublic expects a ptAgeInfoStruct and a boolean");
PYTHON_RETURN_ERROR;
pyAgeInfoStruct* ageInfo = pyAgeInfoStruct::ConvertFrom(ageInfoObj);
PYTHON_RETURN_BOOL(self->fThis->SetAgePublic(ageInfo, makePublic != 0));
}
pyAgeInfoStruct* ageInfo = pyAgeInfoStruct::ConvertFrom(ageInfoObj);
PYTHON_RETURN_BOOL(self->fThis->SetAgePublic(ageInfo, makePublic != 0));
else if (pyVaultAgeInfoNode::Check(ageInfoObj))
{
pyVaultAgeInfoNode* ageInfoNode = pyVaultAgeInfoNode::ConvertFrom(ageInfoObj);
PYTHON_RETURN_BOOL(self->fThis->SetAgePublic(ageInfoNode, makePublic != 0));
}
PyErr_SetString(PyExc_TypeError, "setAgePublic expects a ptAgeInfoStruct or ptVaultAgeInfoNode and a boolean");
PYTHON_RETURN_ERROR;
}
PYTHON_START_METHODS_TABLE(ptVault)