585
585
if(!s.capsNode().isEmpty() && !s.capsVersion().isEmpty()) {
586
586
QDomElement c = doc()->createElement("c");
587
587
c.setAttribute("xmlns","http://jabber.org/protocol/caps");
588
if (!s.capsHashAlgorithm().isEmpty())
589
c.setAttribute("hash",s.capsHashAlgorithm());
588
590
c.setAttribute("node",s.capsNode());
589
591
c.setAttribute("ver",s.capsVersion());
590
592
if (!s.capsExt().isEmpty())
591
593
c.setAttribute("ext",s.capsExt());
592
if (!s.capsHash().isEmpty())
593
c.setAttribute("hash",s.capsHash());
594
594
tag.appendChild(c);
608
608
h.setAttribute("maxstanzas",s.mucHistoryMaxStanzas());
609
609
if (s.mucHistorySeconds() >= 0)
610
610
h.setAttribute("seconds",s.mucHistorySeconds());
611
if (!s.mucHistorySince().isNull())
612
h.setAttribute("since", s.mucHistorySince().toUTC().addSecs(1).toString(Qt::ISODate));
611
613
m.appendChild(h);
613
615
tag.appendChild(m);
697
699
else if(type == "subscribe" || type == "subscribed" || type == "unsubscribe" || type == "unsubscribed") {
700
QDomElement tag = findSubTag(e, "nick", &found);
701
if (found && tag.attribute("xmlns") == "http://jabber.org/protocol/nick") {
701
QDomElement tag = e.firstChildElement("nick");
702
if (!tag.isNull() && tag.attribute("xmlns") == "http://jabber.org/protocol/nick") {
702
703
nick = tagContent(tag);
704
705
subscription(j, type, nick);
712
tag = findSubTag(e, "status", &found);
712
tag = e.firstChildElement("status");
714
714
p.setStatus(tagContent(tag));
715
tag = findSubTag(e, "show", &found);
715
tag = e.firstChildElement("show");
717
717
p.setShow(tagContent(tag));
718
tag = findSubTag(e, "priority", &found);
718
tag = e.firstChildElement("priority");
720
720
p.setPriority(tagContent(tag).toInt());
739
739
else if(i.tagName() == "x" && i.attribute("xmlns") == "gabber:x:music:info") {
742
741
QString title, state;
744
t = findSubTag(i, "title", &found);
743
t = i.firstChildElement("title");
746
745
title = tagContent(t);
747
t = findSubTag(i, "state", &found);
746
t = i.firstChildElement("state");
749
748
state = tagContent(t);
751
750
if(!title.isEmpty() && state == "playing")
761
760
p.setCapsNode(i.attribute("node"));
762
761
p.setCapsVersion(i.attribute("ver"));
763
762
p.setCapsExt(i.attribute("ext"));
764
p.setCapsHash(i.attribute("hash"));
766
764
else if(i.tagName() == "x" && i.attribute("xmlns") == "vcard-temp:x:update") {
769
t = findSubTag(i, "photo", &found);
766
t = i.firstChildElement("photo");
771
768
p.setPhotoHash(tagContent(t));
773
770
p.setPhotoHash("");
954
951
a.setJid(Jid(i.attribute("jid")));
959
tag = findSubTag(i, "name", &found);
955
tag = i.firstChildElement("name");
961
957
a.setName(tagContent(tag));
963
959
// determine which namespaces does item support
966
tag = findSubTag(i, "register", &found);
962
tag = i.firstChildElement("register");
968
964
ns << "jabber:iq:register";
969
tag = findSubTag(i, "search", &found);
965
tag = i.firstChildElement("search");
971
967
ns << "jabber:iq:search";
972
tag = findSubTag(i, "groupchat", &found);
968
tag = i.firstChildElement("groupchat");
974
970
ns << "jabber:iq:conference";
975
tag = findSubTag(i, "transport", &found);
971
tag = i.firstChildElement("transport");
977
973
ns << "jabber:iq:gateway";
979
975
a.setFeatures(ns);
1245
1241
SearchResult r(Jid(i.attribute("jid")));
1247
1243
QDomElement tag;
1250
tag = findSubTag(i, "nick", &found);
1245
tag = i.firstChildElement("nick");
1252
1247
r.setNick(tagContent(tag));
1253
tag = findSubTag(i, "first", &found);
1248
tag = i.firstChildElement("first");
1255
1250
r.setFirst(tagContent(tag));
1256
tag = findSubTag(i, "last", &found);
1251
tag = i.firstChildElement("last");
1258
1253
r.setLast(tagContent(tag));
1259
tag = findSubTag(i, "email", &found);
1254
tag = i.firstChildElement("email");
1261
1256
r.setEmail(tagContent(tag));
1263
1258
d->resultList += r;
1308
1303
if(x.attribute("type") == "result") {
1310
1304
QDomElement q = queryTag(x);
1311
1305
QDomElement tag;
1312
tag = findSubTag(q, "name", &found);
1306
tag = q.firstChildElement("name");
1314
1308
v_name = tagContent(tag);
1315
tag = findSubTag(q, "version", &found);
1309
tag = q.firstChildElement("version");
1317
1311
v_ver = tagContent(tag);
1318
tag = findSubTag(q, "os", &found);
1312
tag = q.firstChildElement("os");
1320
1314
v_os = tagContent(tag);
1445
1439
// Find out the node
1446
1440
bool invalid_node = false;
1449
QDomElement q = findSubTag(e, "query", &found);
1450
if(found) // NOTE: Should always be true, since a NS was found above
1442
QDomElement q = e.firstChildElement("query");
1443
if(!q.isNull()) // NOTE: Should always be true, since a NS was found above
1451
1444
node = q.attribute("node");
1453
1446
QDomElement iq = createIQ(doc(), "result", e.attribute("from"), e.attribute("id"));
1477
1470
QDomElement feature;
1478
1471
if (node.isEmpty() || node == client()->capsNode() + "#" + client()->capsVersion()) {
1479
// Standard features
1480
feature = doc()->createElement("feature");
1481
feature.setAttribute("var", "http://jabber.org/protocol/bytestreams");
1482
query.appendChild(feature);
1484
feature = doc()->createElement("feature");
1485
feature.setAttribute("var", "http://jabber.org/protocol/ibb");
1486
query.appendChild(feature);
1488
feature = doc()->createElement("feature");
1489
feature.setAttribute("var", "http://jabber.org/protocol/si");
1490
query.appendChild(feature);
1492
feature = doc()->createElement("feature");
1493
feature.setAttribute("var", "http://jabber.org/protocol/si/profile/file-transfer");
1494
query.appendChild(feature);
1472
if (client()->fileTransferManager()) {
1473
// Standard features
1474
feature = doc()->createElement("feature");
1475
feature.setAttribute("var", "http://jabber.org/protocol/bytestreams");
1476
query.appendChild(feature);
1478
feature = doc()->createElement("feature");
1479
feature.setAttribute("var", "http://jabber.org/protocol/ibb");
1480
query.appendChild(feature);
1482
feature = doc()->createElement("feature");
1483
feature.setAttribute("var", "http://jabber.org/protocol/si");
1484
query.appendChild(feature);
1486
feature = doc()->createElement("feature");
1487
feature.setAttribute("var", "http://jabber.org/protocol/si/profile/file-transfer");
1488
query.appendChild(feature);
1496
1491
feature = doc()->createElement("feature");
1497
1492
feature.setAttribute("var", "http://jabber.org/protocol/disco#info");
1636
1631
if(x.attribute("type") == "result") {
1637
1632
if(type == 0) {
1638
1633
QDomElement query = queryTag(x);
1640
1634
QDomElement tag;
1641
tag = findSubTag(query, "desc", &found);
1635
tag = query.firstChildElement("desc");
1636
if (!tag.isNull()) {
1643
1637
v_desc = tagContent(tag);
1645
tag = findSubTag(query, "prompt", &found);
1639
tag = query.firstChildElement("prompt");
1640
if (!tag.isNull()) {
1647
1641
v_prompt = tagContent(tag);
1651
1645
QDomElement query = queryTag(x);
1653
1646
QDomElement tag;
1654
tag = findSubTag(query, "jid", &found);
1647
tag = query.firstChildElement("jid");
1648
if (!tag.isNull()) {
1656
1649
v_translatedJid = tagContent(tag);
1658
1651
// we used to read 'prompt' in the past
1659
1652
// and some gateways still send it
1660
tag = findSubTag(query, "prompt", &found);
1653
tag = query.firstChildElement("prompt");
1654
if (!tag.isNull()) {
1662
1655
v_prompt = tagContent(tag);
2092
2085
if (e.tagName() != "iq" || e.attribute("type") != "get")
2096
QDomElement ping = findSubTag(e, "ping", &found);
2097
if (found && ping.attribute("xmlns") == "urn:xmpp:ping") {
2088
QDomElement ping = e.firstChildElement("ping");
2089
if (!e.isNull() && ping.attribute("xmlns") == "urn:xmpp:ping") {
2098
2090
QDomElement iq = createIQ(doc(), "result", e.attribute("from"), e.attribute("id"));