예제 #1
0
bool JT_ServerVars::take(const QDomElement &elem)
{
	if(!iqVerify(elem, _jid, id()))
		return false;
	
	if(elem.attribute("type") == "result") {
		QDomElement q = queryTag(elem);
		
		// Save all the variables
		for(QDomElement var = q.firstChildElement("variable");
			!var.isNull();
			var = var.nextSiblingElement("variable"))
		{
			QString variableName = var.attribute("name");
			QString variableValue = var.text();
			
			// Save it
			_varsValues[variableName] = QVariant(variableValue);
		}
		
		setSuccess(true);
	}
	else {
		setError(elem);
	}
	
	return true;
}
예제 #2
0
	bool take(const QDomElement& x) {
		if(!iqVerify(x, myjid_, id()))  // , "urn:xmpp:ping"
			return false;

		if(x.attribute("type") == "result") {
			// something bad, we never reply to this stanza so someone
			// else got it.
			// FIXME seems to be no longer true
			//emit result(NotUs, id());
			emit result(LoggedIn, id());
			setSuccess();
		} else if(x.attribute("type") == "get") {
			// All went well!
			emit result(LoggedIn, id());
			setSuccess();
		} else {
			QDomElement tag = x.firstChildElement("error");
			if(tag.isNull()) {
				emit result(OtherErr, id());
			} else {
				XMPP::Stanza::Error err;
				err.fromXml(tag, client()->stream().baseNS());
				if (err.condition == XMPP::Stanza::Error::ItemNotFound) {
					emit result(NoSuch, id());
				} else if (err.condition == XMPP::Stanza::Error::NotAcceptable ) {
					emit result(NotOccupant, id());
				} else {
					emit result(OtherErr, id());
				}
				setSuccess();
			}
		}
		return true;
	}
예제 #3
0
	bool take(const QDomElement& x) {
		if(!iqVerify(x, "", id()))
			return false;

		if(x.attribute("type") == "result") {
			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())
								conferences_ += c;
						}
					}
				}
			}
			setSuccess();
		}
		else {
			setError(x);
		}
		return true;
	}
예제 #4
0
bool PEPPublishTask::take(const QDomElement &x)
{
    if (!iqVerify(x, QString(), id()))
        return false;

    if (x.attribute("type") == "result")
        setSuccess();
    else
        setError(x);

    return true;
}
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;
}
예제 #6
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;
	}