// ---------------------------------------------------------
// CMmsAttachmentHandler::IsValidFilename
// ---------------------------------------------------------
//
EXPORT_C TBool CMmsAttachmentHandler::IsValidFilename( RFs& aFs, const TPtrC& aFileName )
    {
    TBool validName = EFalse; //pessimist.
    
    if ( aFileName.Length() == 0 )
        {
        return EFalse;
        }

    // filename should not start with dot
    // or contain any control characters
    TInt i;
    // First character may not be . or space
    if ( aFileName[0] == 0x2e || aFileName[0] == 0x20 )
        {
        return EFalse;
        }

    for ( i = 0; i < aFileName.Length(); i++ )
        {
        // check for control characters - RFs does not do it.
        if ( aFileName[i] < 0x20 )
            {
            // found a control character - not allowed.
            return EFalse;
            }
        }
    validName = aFs.IsValidName( aFileName );

    return validName;
    }