void
LastFmTreeModel::queueAvatarsDownload ( const QMap<QString, QString>& urls )
{
    bool start = m_avatarQueue.isEmpty();
    m_avatarQueue.unite ( urls );

    QMutableMapIterator<QString, QString> i ( m_avatarQueue );
    while ( i.hasNext() )
    {
        i.next();

        QString const name = i.key();
        QString const url = i.value();

        //         if ( !KUrl( url ).host().startsWith( USER_AVATAR_HOST ) )
        //         {
        // Don't download avatar if it's just the default blank avatar!
        // but do if it's the current username since we have to show something at the top there
        //             if ( name != m_username )
        //                 i.remove();
        //         }
    }

    if ( start )
        downloadAvatar ( m_avatarQueue.keys().value ( 0 ), m_avatarQueue.values().value ( 0 ) );
}
void KristalliProtocolModule::PerformReconnection(QMutableMapIterator<unsigned short, Ptr(kNet::MessageConnection)> &iterator, unsigned short connection)
{
    if (iterator.value())
    {
        iterator.value()->Close();
//        network.CloseMessageConnection(serverConnection);
        iterator.value() = 0;
    }

    // Connect to the server.
    iterator.value() = network.Connect(serverIp_list_[connection].c_str(), serverPort_list_[connection], serverTransport_list_[connection], this);
    if (!iterator.value())
    {
        LogError("Unable to connect to " + serverIp_list_[connection] + ":" + ToString(serverPort_list_[connection]));
        return;
    }

    // For TCP mode sockets, set the TCP_NODELAY option to improve latency for the messages we send.
    if (iterator.value()->GetSocket() && iterator.value()->GetSocket()->TransportLayer() == kNet::SocketOverTCP)
        iterator.value()->GetSocket()->SetNaglesAlgorithmEnabled(false);
}