bool Stanza::isFromServer() const { if (!to().isEmpty()) { Jid toJid = to(); Jid fromJid = from(); return fromJid.isEmpty() || fromJid==toJid || fromJid==toJid.bare() || fromJid==toJid.domain(); } return false; }
QList<IPresenceItem> Presence::presenceItems(const Jid &AItemJid) const { if (!AItemJid.isEmpty()) { QList<IPresenceItem> pitems; foreach(IPresenceItem pitem, FItems) if (AItemJid && pitem.itemJid) pitems.append(pitem); return pitems; }
bool Task::iqVerify(const QDomElement &x, const Jid &to, const QString &id, const QString &xmlns) { if(x.tagName() != "iq") return false; Jid from(x.attribute("from")); Jid local = client()->jid(); Jid server = client()->host(); // empty 'from' ? if(from.isEmpty()) { // allowed if we are querying the server if(!to.isEmpty() && !to.compare(server)) return false; } // from ourself? else if(from.compare(local, false)) { // allowed if we are querying ourself or the server if(!to.isEmpty() && !to.compare(local, false) && !to.compare(server)) return false; } // from anywhere else? else { if(!from.compare(to)) return false; } if(!id.isEmpty()) { if(x.attribute("id") != id) return false; } if(!xmlns.isEmpty()) { if(queryNS(x) != xmlns) return false; } return true; }
void JT_Register::unreg(const Jid &j) { d->type = 2; to = j.isEmpty() ? client()->host() : j.full(); iq = createIQ(doc(), "set", to.full(), id()); QDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:register"); iq.appendChild(query); // this may be useful if(!d->form.key().isEmpty()) query.appendChild(textTag(doc(), "key", d->form.key())); query.appendChild(doc()->createElement("remove")); }