Пример #1
0
void DiscoInfoFactory::serialize(Payload *extension, QXmlStreamWriter *writer)
{
	Disco::Info *info = se_cast<Disco::Info*>(extension);
	if (!info)
		return;
	writer->writeStartElement(QLatin1String("query"));
	if (!info->node().isEmpty())
		writer->writeAttribute(QLatin1String("node"),info->node());
	writer->writeDefaultNamespace(NS_DISCO_INFO);
	foreach (const Disco::Identity &identity, info->identities()) {
		writer->writeEmptyElement(QLatin1String("identity"));
		writer->writeAttribute(QLatin1String("category"), identity.category());
		writer->writeAttribute(QLatin1String("type"), identity.type());
		writer->writeAttribute(QLatin1String("name"), identity.name());
		if (!identity.lang().isEmpty())
			writer->writeAttribute(QLatin1String("xml:lang"), identity.lang());
	}
	foreach (const QString &feature, info->features()) {
		writer->writeEmptyElement(QLatin1String("feature"));
		writer->writeAttribute(QLatin1String("var"), feature);
	}
	if (info->form())
		m_factory.serialize(info->form().data(), writer);
	writer->writeEndElement();
}
Пример #2
0
void TalkDiscoHandler::handleDiscoInfo(const JID& from, const Disco::Info& info, int context)
{
        ServerDiscoWindow* discowindow = Bodies::Get_Bodies().get_main_window().get_disco_window();

        if (NULL == discowindow)
                return ;


        const Disco::IdentityList& list = info.identities();

        Disco::IdentityList::const_iterator iter = list.begin();

        for (; iter != list.end(); ++iter) {
                if ((*iter)->category() == "server") {

                        discowindow->setLabel(from.full(), (*iter)->name());
                }
        }
}