15
15
* You should have received a copy of the GNU Lesser General Public
16
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1006
1021
d->iq = createIQ(doc(), "get", type == 1 ? Jid().full() : d->jid.full(), id());
1007
1022
QDomElement v = doc()->createElement("vCard");
1008
1023
v.setAttribute("xmlns", "vcard-temp");
1009
v.setAttribute("version", "2.0");
1010
v.setAttribute("prodid", "-//HandGen//NONSGML vGen v1.0//EN");
1011
1024
d->iq.appendChild(v);
1466
1479
query.appendChild(feature);
1468
1481
feature = doc()->createElement("feature");
1482
feature.setAttribute("var", "http://jabber.org/protocol/ibb");
1483
query.appendChild(feature);
1485
feature = doc()->createElement("feature");
1469
1486
feature.setAttribute("var", "http://jabber.org/protocol/si");
1470
1487
query.appendChild(feature);
1477
1494
feature.setAttribute("var", "http://jabber.org/protocol/disco#info");
1478
1495
query.appendChild(feature);
1497
feature = doc()->createElement("feature");
1498
feature.setAttribute("var", "urn:xmpp:bob");
1499
query.appendChild(feature);
1480
1501
// Client-specific features
1481
1502
QStringList clientFeatures = client()->features().list();
1482
1503
for (QStringList::ConstIterator i = clientFeatures.begin(); i != clientFeatures.end(); ++i) {
1955
// ---------------------------------------------------------
1957
// ---------------------------------------------------------
1958
JT_BoBServer::JT_BoBServer(Task *parent)
1964
bool JT_BoBServer::take(const QDomElement &e)
1966
if (e.tagName() != "iq" || e.attribute("type") != "get")
1969
QDomElement data = e.firstChildElement("data");
1970
if (data.attribute("xmlns") == "urn:xmpp:bob") {
1972
BoBData bd = client()->bobManager()->bobData(data.attribute("cid"));
1974
iq = createIQ(client()->doc(), "error",
1975
e.attribute("from"), e.attribute("id"));
1976
Stanza::Error error(Stanza::Error::Cancel,
1977
Stanza::Error::ItemNotFound);
1978
iq.appendChild(error.toXml(*doc(), client()->stream().baseNS()));
1981
iq = createIQ(doc(), "result", e.attribute("from"), e.attribute("id"));
1982
iq.appendChild(bd.toXml(doc()));
1991
//----------------------------------------------------------------------------
1993
//----------------------------------------------------------------------------
1994
class JT_BitsOfBinary::Private
2005
JT_BitsOfBinary::JT_BitsOfBinary(Task *parent)
2011
JT_BitsOfBinary::~JT_BitsOfBinary()
2016
void JT_BitsOfBinary::get(const Jid &j, const QString &cid)
2021
d->data = client()->bobManager()->bobData(cid);
2022
if (d->data.isNull()) {
2023
d->iq = createIQ(doc(), "get", d->jid.full(), id());
2024
QDomElement data = doc()->createElement("data");
2025
data.setAttribute("xmlns", "urn:xmpp:bob");
2026
data.setAttribute("cid", cid);
2027
d->iq.appendChild(data);
2031
void JT_BitsOfBinary::onGo()
2033
if (d->data.isNull()) {
2041
bool JT_BitsOfBinary::take(const QDomElement &x)
2043
if (!iqVerify(x, d->jid, id())) {
2047
if (x.attribute("type") == "result") {
2048
QDomElement data = x.firstChildElement("data");
2050
if (!data.isNull() && data.attribute("cid") == d->cid) { // check xmlns?
2051
d->data.fromXml(data);
2052
client()->bobManager()->append(d->data);
2064
BoBData JT_BitsOfBinary::data()