コード例 #1
0
ファイル: HostPool.cpp プロジェクト: Aico/mudlet
bool HostPool::addNewHost( QString hostname, QString port, QString login, QString pass )
{
    QMutexLocker locker(&mPoolLock);

    // make sure this is really a new host
    if( mHostPool.find( hostname ) != mHostPool.end() )
    {
        return false;
    }
    if( hostname.size() < 1 )
        return false;

    int portnumber = 23;
    if( port.size() >= 1 )
    {
        portnumber = port.toInt();
    }

    int id = createNewHostID();
    Host * pNewHost = new Host( portnumber, hostname, login, pass, id );

    if( pNewHost == 0 ) //enough memory?
    {
        return false;
    }

    mHostPool[hostname] = pNewHost;
    return true;
}
コード例 #2
0
ファイル: HostPool.cpp プロジェクト: alex-games/a1
bool HostPool::addNewHost( QString hostname, QString port, QString login, QString pass )
{
    QMutexLocker locker(&mPoolLock);

    // make sure this is really a new host
    if( mHostPool.find( hostname ) != mHostPool.end() )
    {
        return false;
    }
    if( hostname.size() < 1 )
        return false;

    int portnumber = 23;
    if( port.size() >= 1 )
    {
        portnumber = port.toInt();
    }

    int id = createNewHostID();
    QSharedPointer<Host> pNewHost( new Host( portnumber, hostname, login, pass, id ) );

    mHostPool.insert( hostname, pNewHost );
    return true;
}