Beispiel #1
0
void vCardCache::loadFromFile()
{
    m_mapBareJidVcard.clear();

    QDir dirVCards(getSettingsDir(m_client->configuration().jidBare())+ "vCards/");
    if(dirVCards.exists())
    {
        QStringList list = dirVCards.entryList(QStringList("*.xml"));
        foreach(QString fileName, list)
        {
            QFile file(getSettingsDir(m_client->configuration().jidBare())+ "vCards/" + fileName);
            QString bareJid = fileName;
            bareJid.chop(4);
            if(file.open(QIODevice::ReadOnly))
            {
                QDomDocument doc;
                if(doc.setContent(&file, true))
                {
                    QXmppVCardIq vCardIq;
                    vCardIq.parse(doc.documentElement());
                    m_mapBareJidVcard[bareJid] = vCardIq;
                    QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
                }
            }
        }
Beispiel #2
0
bool QXmppVCardManager::handleStanza(const QDomElement &element)
{
    if(element.tagName() == "iq" && QXmppVCardIq::isVCard(element))
    {
        QXmppVCardIq vCardIq;
        vCardIq.parse(element);

        if(vCardIq.from().isEmpty())
        {
            m_clientVCard = vCardIq;
            m_isClientVCardReceived = true;
            emit clientVCardReceived();
        }

        emit vCardReceived(vCardIq);

        return true;
    }

    return false;
}