Example #1
0
// Sets the inbox associated with a device.
void pyAgeVault::SetDeviceInbox( const char * deviceName, const char * inboxName, PyObject * cbObject, uint32_t cbContext )
{
    pyVaultNode::pyVaultNodeOperationCallback * cb = new pyVaultNode::pyVaultNodeOperationCallback( cbObject );
    cb->VaultOperationStarted( cbContext );

    wchar_t wDev[MAX_PATH];
    StrToUnicode(wDev, deviceName, arrsize(wDev));
    wchar_t wInb[MAX_PATH];
    StrToUnicode(wInb, inboxName, arrsize(wInb));
    
    if (RelVaultNode * rvn = VaultAgeSetDeviceInboxAndWaitIncRef(wDev, wInb)) {
        cb->SetNode(rvn);
        rvn->UnRef();
    }

    cb->VaultOperationComplete( cbContext, cb->GetNode() ? hsOK : hsFail ); // cbHolder deletes itself here.
}
void pyVaultTextNoteNode::SetDeviceInbox( const char * devName, PyObject * cbObject, uint32_t cbContext )
{
    if (!fNode)
        return;

    pyVaultNode::pyVaultNodeOperationCallback * cb = NEWZERO(pyVaultNode::pyVaultNodeOperationCallback)( cbObject );
    cb->VaultOperationStarted( cbContext );

    wchar_t wDev[MAX_PATH];
    StrToUnicode(wDev, devName, arrsize(wDev));
    
    if (RelVaultNode * rvn = VaultAgeSetDeviceInboxAndWaitIncRef(wDev, DEFAULT_DEVICE_INBOX)) {
        cb->SetNode(rvn);
        rvn->DecRef();
    }

    cb->VaultOperationComplete( cbContext, cb->GetNode() ? hsOK : hsFail ); // cbHolder deletes itself here.
}