bool JT_CheckTransportRegistration::take(const QDomElement &elem)
{
	if(!iqVerify(elem, _transport_jid, id()))
		return false;
	
	if(elem.attribute("type") == "result") {
		QDomElement q = queryTag(elem);
		QDomElement registered = q.firstChildElement("registered");
		QDomElement username = q.firstChildElement("username");
		
		_isRegistered = (!registered.isNull());
		_registeredUsername = (_isRegistered ? username.text() : "");
		
		setSuccess(true);
	}
	else {
		setError(elem);
	}
	
	return true;
}
Exemple #2
0
	bool take(const QDomElement& x) {
		if(!iqVerify(x, "", id()))
			return false;

		if(x.attribute("type") == "result") {
			QStringList mucIgnore = PsiOptions::instance()->getOption("options.muc.bookmarks.ignore-join").toStringList();
			QDomElement q = queryTag(x);
			for (QDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) {
				QDomElement e = n.toElement();
				if (!e.isNull() && e.tagName() == "storage" && e.attribute("xmlns") == "storage:bookmarks") {
					for (QDomNode m = e.firstChild(); !m.isNull(); m = m.nextSibling()) {
						QDomElement f = m.toElement();
						if (f.isNull())
							continue;

						if (f.tagName() == "url") {
							URLBookmark u(f);
							if (!u.isNull())
								urls_ += u;
						}
						else if (f.tagName() == "conference") {
							ConferenceBookmark c(f);
							if (!c.isNull()) {
								if (mucIgnore.contains(c.jid().bare())) {
									c.setAutoJoin(ConferenceBookmark::ExceptThisComputer);
								}
								conferences_ += c;
							}
						}
					}
				}
			}
			setSuccess();
		}
		else {
			setError(x);
		}
		return true;
	}