bool StandardContactList::load_contacts(const QDomElement& contacts)
{
    QDomNodeList list = contacts.elementsByTagName("contact");
    for(int i = 0; i < list.size(); i++) {
        QDomElement el = list.at(i).toElement();
        int id = el.attribute("id").toInt();
        ContactPtr c = createContact(id);
        if(!c->deserialize(el))
            return false;
        addContact(c);
    }
    return true;
}
bool StandardContactList::load_old_dispatch(ParserState& state)
{
    if(state.contactId != -1)
    {
        ContactPtr c = contact(state.contactId);
        if(!c)
            return false;
        if(state.dataname.isEmpty())
        {
            c->deserialize(state.data);
        }
        else
        {
            if(state.dataname.indexOf('.') >= 0)
            {
                ClientPtr client = getClientManager()->client(state.dataname);
                if(!client)
                    return false;
                IMContactPtr imcontact = client->createIMContact();
                imcontact->deserialize(state.data);
                c->addClientContact(imcontact);
                if(c->name().isEmpty())
                    c->setName(imcontact->name());
            }
            else if(!state.dataname.isEmpty())
            {
                deserializeLines(c->userdata(), state.dataname, state.data);
            }
            else
            {
                c->deserialize(state.data);
            }
        }
    }
    else if(state.groupId != -1)
    {
        GroupPtr gr = group(state.groupId);
        if(!gr)
            return false;
        if(state.dataname.isEmpty())
        {
            gr->deserialize(state.data);
        }
        else
        {
            if(state.dataname.indexOf('.') >= 0)
            {
                ClientPtr client = getClientManager()->client(state.dataname);
                if(!client)
                    return false;
                IMGroupPtr imgroup = client->createIMGroup();
                imgroup->deserialize(state.data);
                gr->addClientGroup(imgroup);
            }
            else
            {
                deserializeLines(gr->userdata(), state.dataname, state.data);
            }
        }
    }

    return true;
}