diff options
Diffstat (limited to 'kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp')
-rw-r--r-- | kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp | 406 |
1 files changed, 203 insertions, 203 deletions
diff --git a/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp b/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp index 4c937dd0..95f61e69 100644 --- a/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp +++ b/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp @@ -27,23 +27,23 @@ //#include"xmpp_types.h" #include"xmpp_vcard.h" -#include<qregexp.h> -#include<qvaluelist.h> +#include<tqregexp.h> +#include<tqvaluelist.h> using namespace XMPP; -static QString lineEncode(QString str) +static TQString lineEncode(TQString str) { - str.replace(QRegExp("\\\\"), "\\\\"); // backslash to double-backslash - str.replace(QRegExp("\\|"), "\\p"); // pipe to \p - str.replace(QRegExp("\n"), "\\n"); // newline to \n + str.replace(TQRegExp("\\\\"), "\\\\"); // backslash to double-backslash + str.replace(TQRegExp("\\|"), "\\p"); // pipe to \p + str.replace(TQRegExp("\n"), "\\n"); // newline to \n return str; } -static QString lineDecode(const QString &str) +static TQString lineDecode(const TQString &str) { - QString ret; + TQString ret; for(unsigned int n = 0; n < str.length(); ++n) { if(str.at(n) == '\\') { @@ -66,12 +66,12 @@ static QString lineDecode(const QString &str) return ret; } -static Roster xmlReadRoster(const QDomElement &q, bool push) +static Roster xmlReadRoster(const TQDomElement &q, bool push) { Roster r; - for(QDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement i = n.toElement(); + for(TQDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement i = n.toElement(); if(i.isNull()) continue; @@ -115,24 +115,24 @@ JT_Register::~JT_Register() delete d; } -void JT_Register::reg(const QString &user, const QString &pass) +void JT_Register::reg(const TQString &user, const TQString &pass) { d->type = 0; to = client()->host(); iq = createIQ(doc(), "set", to.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:register"); iq.appendChild(query); query.appendChild(textTag(doc(), "username", user)); query.appendChild(textTag(doc(), "password", pass)); } -void JT_Register::changepw(const QString &pass) +void JT_Register::changepw(const TQString &pass) { d->type = 1; to = client()->host(); iq = createIQ(doc(), "set", to.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:register"); iq.appendChild(query); query.appendChild(textTag(doc(), "username", client()->user())); @@ -144,7 +144,7 @@ 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"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:register"); iq.appendChild(query); @@ -160,7 +160,7 @@ void JT_Register::getForm(const Jid &j) d->type = 3; to = j; iq = createIQ(doc(), "get", to.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:register"); iq.appendChild(query); } @@ -170,7 +170,7 @@ void JT_Register::setForm(const Form &form) d->type = 4; to = form.jid(); iq = createIQ(doc(), "set", to.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:register"); iq.appendChild(query); @@ -195,7 +195,7 @@ void JT_Register::onGo() send(iq); } -bool JT_Register::take(const QDomElement &x) +bool JT_Register::take(const TQDomElement &x) { if(!iqVerify(x, to, id())) return false; @@ -206,9 +206,9 @@ bool JT_Register::take(const QDomElement &x) d->form.clear(); d->form.setJid(from); - QDomElement q = queryTag(x); - for(QDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement i = n.toElement(); + TQDomElement q = queryTag(x); + for(TQDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement i = n.toElement(); if(i.isNull()) continue; @@ -270,7 +270,7 @@ void JT_UnRegister::onGo() d->jt_reg = new JT_Register(this); d->jt_reg->getForm(d->j); - connect(d->jt_reg, SIGNAL(finished()), SLOT(getFormFinished())); + connect(d->jt_reg, TQT_SIGNAL(finished()), TQT_SLOT(getFormFinished())); d->jt_reg->go(false); } @@ -279,7 +279,7 @@ void JT_UnRegister::getFormFinished() disconnect(d->jt_reg, 0, this, 0); d->jt_reg->unreg(d->j); - connect(d->jt_reg, SIGNAL(finished()), SLOT(unregFinished())); + connect(d->jt_reg, TQT_SIGNAL(finished()), TQT_SLOT(unregFinished())); d->jt_reg->go(false); } @@ -303,7 +303,7 @@ public: Private() {} Roster roster; - QValueList<QDomElement> itemList; + TQValueList<TQDomElement> itemList; }; JT_Roster::JT_Roster(Task *parent) @@ -323,20 +323,20 @@ void JT_Roster::get() type = 0; //to = client()->host(); iq = createIQ(doc(), "get", to.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:roster"); iq.appendChild(query); } -void JT_Roster::set(const Jid &jid, const QString &name, const QStringList &groups) +void JT_Roster::set(const Jid &jid, const TQString &name, const TQStringList &groups) { type = 1; //to = client()->host(); - QDomElement item = doc()->createElement("item"); + TQDomElement item = doc()->createElement("item"); item.setAttribute("jid", jid.full()); if(!name.isEmpty()) item.setAttribute("name", name); - for(QStringList::ConstIterator it = groups.begin(); it != groups.end(); ++it) + for(TQStringList::ConstIterator it = groups.begin(); it != groups.end(); ++it) item.appendChild(textTag(doc(), "group", *it)); d->itemList += item; } @@ -345,7 +345,7 @@ void JT_Roster::remove(const Jid &jid) { type = 1; //to = client()->host(); - QDomElement item = doc()->createElement("item"); + TQDomElement item = doc()->createElement("item"); item.setAttribute("jid", jid.full()); item.setAttribute("subscription", "remove"); d->itemList += item; @@ -358,10 +358,10 @@ void JT_Roster::onGo() else if(type == 1) { //to = client()->host(); iq = createIQ(doc(), "set", to.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:roster"); iq.appendChild(query); - for(QValueList<QDomElement>::ConstIterator it = d->itemList.begin(); it != d->itemList.end(); ++it) + for(TQValueList<TQDomElement>::ConstIterator it = d->itemList.begin(); it != d->itemList.end(); ++it) query.appendChild(*it); send(iq); } @@ -372,25 +372,25 @@ const Roster & JT_Roster::roster() const return d->roster; } -QString JT_Roster::toString() const +TQString JT_Roster::toString() const { if(type != 1) return ""; - QDomElement i = doc()->createElement("request"); + TQDomElement i = doc()->createElement("request"); i.setAttribute("type", "JT_Roster"); - for(QValueList<QDomElement>::ConstIterator it = d->itemList.begin(); it != d->itemList.end(); ++it) + for(TQValueList<TQDomElement>::ConstIterator it = d->itemList.begin(); it != d->itemList.end(); ++it) i.appendChild(*it); return lineEncode(Stream::xmlToString(i)); return ""; } -bool JT_Roster::fromString(const QString &str) +bool JT_Roster::fromString(const TQString &str) { - QDomDocument *dd = new QDomDocument; + TQDomDocument *dd = new QDomDocument; if(!dd->setContent(lineDecode(str).utf8())) return false; - QDomElement e = doc()->importNode(dd->documentElement(), true).toElement(); + TQDomElement e = doc()->importNode(dd->documentElement(), true).toElement(); delete dd; if(e.tagName() != "request" || e.attribute("type") != "JT_Roster") @@ -398,8 +398,8 @@ bool JT_Roster::fromString(const QString &str) type = 1; d->itemList.clear(); - for(QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement i = n.toElement(); + for(TQDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement i = n.toElement(); if(i.isNull()) continue; d->itemList += i; @@ -408,7 +408,7 @@ bool JT_Roster::fromString(const QString &str) return true; } -bool JT_Roster::take(const QDomElement &x) +bool JT_Roster::take(const TQDomElement &x) { if(!iqVerify(x, client()->host(), id())) return false; @@ -416,7 +416,7 @@ bool JT_Roster::take(const QDomElement &x) // get if(type == 0) { if(x.attribute("type") == "result") { - QDomElement q = queryTag(x); + TQDomElement q = queryTag(x); d->roster = xmlReadRoster(q, false); setSuccess(); } @@ -457,7 +457,7 @@ JT_PushRoster::~JT_PushRoster() { } -bool JT_PushRoster::take(const QDomElement &e) +bool JT_PushRoster::take(const TQDomElement &e) { // must be an iq-set tag if(e.tagName() != "iq" || e.attribute("type") != "set") @@ -504,21 +504,21 @@ void JT_Presence::pres(const Status &s) if(!s.status().isEmpty()) tag.appendChild(textTag(doc(), "status", s.status())); - tag.appendChild( textTag(doc(), "priority", QString("%1").arg(s.priority()) ) ); + tag.appendChild( textTag(doc(), "priority", TQString("%1").arg(s.priority()) ) ); if(!s.keyID().isEmpty()) { - QDomElement x = textTag(doc(), "x", s.keyID()); + TQDomElement x = textTag(doc(), "x", s.keyID()); x.setAttribute("xmlns", "http://jabber.org/protocol/e2e"); tag.appendChild(x); } if(!s.xsigned().isEmpty()) { - QDomElement x = textTag(doc(), "x", s.xsigned()); + TQDomElement x = textTag(doc(), "x", s.xsigned()); x.setAttribute("xmlns", "jabber:x:signed"); tag.appendChild(x); } if(!s.capsNode().isEmpty() && !s.capsVersion().isEmpty()) { - QDomElement c = doc()->createElement("c"); + TQDomElement c = doc()->createElement("c"); c.setAttribute("xmlns","http://jabber.org/protocol/caps"); c.setAttribute("node",s.capsNode()); c.setAttribute("ver",s.capsVersion()); @@ -535,7 +535,7 @@ void JT_Presence::pres(const Jid &to, const Status &s) tag.setAttribute("to", to.full()); } -void JT_Presence::sub(const Jid &to, const QString &subType) +void JT_Presence::sub(const Jid &to, const TQString &subType) { type = 1; @@ -563,7 +563,7 @@ JT_PushPresence::~JT_PushPresence() { } -bool JT_PushPresence::take(const QDomElement &e) +bool JT_PushPresence::take(const TQDomElement &e) { if(e.tagName() != "presence") return false; @@ -572,12 +572,12 @@ bool JT_PushPresence::take(const QDomElement &e) Status p; if(e.hasAttribute("type")) { - QString type = e.attribute("type"); + TQString type = e.attribute("type"); if(type == "unavailable") { p.setIsAvailable(false); } else if(type == "error") { - QString str = ""; + TQString str = ""; int code = 0; getErrorFromElement(e, &code, &str); p.setError(code, str); @@ -588,7 +588,7 @@ bool JT_PushPresence::take(const QDomElement &e) } } - QDomElement tag; + TQDomElement tag; bool found; tag = findSubTag(e, "status", &found); @@ -601,23 +601,23 @@ bool JT_PushPresence::take(const QDomElement &e) if(found) p.setPriority(tagContent(tag).toInt()); - for(QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement i = n.toElement(); + for(TQDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement i = n.toElement(); if(i.isNull()) continue; if(i.tagName() == "x" && i.attribute("xmlns") == "jabber:x:delay") { if(i.hasAttribute("stamp")) { - QDateTime dt; + TQDateTime dt; if(stamp2TS(i.attribute("stamp"), &dt)) dt = dt.addSecs(client()->timeZoneOffset() * 3600); p.setTimeStamp(dt); } } else if(i.tagName() == "x" && i.attribute("xmlns") == "gabber:x:music:info") { - QDomElement t; + TQDomElement t; bool found; - QString title, state; + TQString title, state; t = findSubTag(i, "title", &found); if(found) @@ -651,17 +651,17 @@ bool JT_PushPresence::take(const QDomElement &e) //---------------------------------------------------------------------------- // JT_Message //---------------------------------------------------------------------------- -static QDomElement oldStyleNS(const QDomElement &e) +static TQDomElement oldStyleNS(const TQDomElement &e) { // find closest parent with a namespace - QDomNode par = e.parentNode(); + TQDomNode par = e.parentNode(); while(!par.isNull() && par.namespaceURI().isNull()) par = par.parentNode(); bool noShowNS = false; if(!par.isNull() && par.namespaceURI() == e.namespaceURI()) noShowNS = true; - QDomElement i; + TQDomElement i; uint x; //if(noShowNS) i = e.ownerDocument().createElement(e.tagName()); @@ -669,7 +669,7 @@ static QDomElement oldStyleNS(const QDomElement &e) // i = e.ownerDocument().createElementNS(e.namespaceURI(), e.tagName()); // copy attributes - QDomNamedNodeMap al = e.attributes(); + TQDomNamedNodeMap al = e.attributes(); for(x = 0; x < al.count(); ++x) i.setAttributeNode(al.item(x).cloneNode().toAttr()); @@ -677,9 +677,9 @@ static QDomElement oldStyleNS(const QDomElement &e) i.setAttribute("xmlns", e.namespaceURI()); // copy children - QDomNodeList nl = e.childNodes(); + TQDomNodeList nl = e.childNodes(); for(x = 0; x < nl.count(); ++x) { - QDomNode n = nl.item(x); + TQDomNode n = nl.item(x); if(n.isElement()) i.appendChild(oldStyleNS(n.toElement())); else @@ -702,7 +702,7 @@ JT_Message::~JT_Message() void JT_Message::onGo() { Stanza s = m.toStanza(&(client()->stream())); - QDomElement e = oldStyleNS(s.element()); + TQDomElement e = oldStyleNS(s.element()); send(e); setSuccess(); } @@ -711,41 +711,41 @@ void JT_Message::onGo() //---------------------------------------------------------------------------- // JT_PushMessage //---------------------------------------------------------------------------- -static QDomElement addCorrectNS(const QDomElement &e) +static TQDomElement addCorrectNS(const TQDomElement &e) { uint x; // grab child nodes - /*QDomDocumentFragment frag = e.ownerDocument().createDocumentFragment(); - QDomNodeList nl = e.childNodes(); + /*TQDomDocumentFragment frag = e.ownerDocument().createDocumentFragment(); + TQDomNodeList nl = e.childNodes(); for(x = 0; x < nl.count(); ++x) frag.appendChild(nl.item(x).cloneNode());*/ // find closest xmlns - QDomNode n = e; + TQDomNode n = e; while(!n.isNull() && !n.toElement().hasAttribute("xmlns")) n = n.parentNode(); - QString ns; + TQString ns; if(n.isNull() || !n.toElement().hasAttribute("xmlns")) ns = "jabber:client"; else ns = n.toElement().attribute("xmlns"); // make a new node - QDomElement i = e.ownerDocument().createElementNS(ns, e.tagName()); + TQDomElement i = e.ownerDocument().createElementNS(ns, e.tagName()); // copy attributes - QDomNamedNodeMap al = e.attributes(); + TQDomNamedNodeMap al = e.attributes(); for(x = 0; x < al.count(); ++x) { - QDomAttr a = al.item(x).toAttr(); + TQDomAttr a = al.item(x).toAttr(); if(a.name() != "xmlns") i.setAttributeNodeNS(al.item(x).cloneNode().toAttr()); } // copy children - QDomNodeList nl = e.childNodes(); + TQDomNodeList nl = e.childNodes(); for(x = 0; x < nl.count(); ++x) { - QDomNode n = nl.item(x); + TQDomNode n = nl.item(x); if(n.isElement()) i.appendChild(addCorrectNS(n.toElement())); else @@ -765,7 +765,7 @@ JT_PushMessage::~JT_PushMessage() { } -bool JT_PushMessage::take(const QDomElement &e) +bool JT_PushMessage::take(const TQDomElement &e) { if(e.tagName() != "message") return false; @@ -796,7 +796,7 @@ public: Private() {} int seconds; - QString message; + TQString message; }; JT_GetLastActivity::JT_GetLastActivity(Task *parent) @@ -814,7 +814,7 @@ void JT_GetLastActivity::get(const Jid &j) { jid = j; iq = createIQ(doc(), "get", jid.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:last"); iq.appendChild(query); } @@ -824,7 +824,7 @@ int JT_GetLastActivity::seconds() const return d->seconds; } -const QString &JT_GetLastActivity::message() const +const TQString &JT_GetLastActivity::message() const { return d->message; } @@ -834,13 +834,13 @@ void JT_GetLastActivity::onGo() send(iq); } -bool JT_GetLastActivity::take(const QDomElement &x) +bool JT_GetLastActivity::take(const TQDomElement &x) { if(!iqVerify(x, jid, id())) return false; if(x.attribute("type") == "result") { - QDomElement q = queryTag(x); + TQDomElement q = queryTag(x); d->message = q.text(); bool ok; @@ -869,7 +869,7 @@ void JT_GetServices::get(const Jid &j) jid = j; iq = createIQ(doc(), "get", jid.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:agents"); iq.appendChild(query); } @@ -884,17 +884,17 @@ void JT_GetServices::onGo() send(iq); } -bool JT_GetServices::take(const QDomElement &x) +bool JT_GetServices::take(const TQDomElement &x) { if(!iqVerify(x, jid, id())) return false; if(x.attribute("type") == "result") { - QDomElement q = queryTag(x); + TQDomElement q = queryTag(x); // agents - for(QDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement i = n.toElement(); + for(TQDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement i = n.toElement(); if(i.isNull()) continue; @@ -903,7 +903,7 @@ bool JT_GetServices::take(const QDomElement &x) a.setJid(Jid(i.attribute("jid"))); - QDomElement tag; + TQDomElement tag; bool found; tag = findSubTag(i, "name", &found); @@ -911,7 +911,7 @@ bool JT_GetServices::take(const QDomElement &x) a.setName(tagContent(tag)); // determine which namespaces does item support - QStringList ns; + TQStringList ns; tag = findSubTag(i, "register", &found); if(found) @@ -950,7 +950,7 @@ class JT_VCard::Private public: Private() {} - QDomElement iq; + TQDomElement iq; Jid jid; VCard vcard; }; @@ -972,7 +972,7 @@ void JT_VCard::get(const Jid &_jid) type = 0; d->jid = _jid; d->iq = createIQ(doc(), "get", d->jid.full(), id()); - QDomElement v = doc()->createElement("vCard"); + TQDomElement v = doc()->createElement("vCard"); v.setAttribute("xmlns", "vcard-temp"); v.setAttribute("version", "2.0"); v.setAttribute("prodid", "-//HandGen//NONSGML vGen v1.0//EN"); @@ -1003,7 +1003,7 @@ void JT_VCard::onGo() send(d->iq); } -bool JT_VCard::take(const QDomElement &x) +bool JT_VCard::take(const TQDomElement &x) { Jid to = d->jid; if (to.userHost() == client()->jid().userHost()) @@ -1013,8 +1013,8 @@ bool JT_VCard::take(const QDomElement &x) if(x.attribute("type") == "result") { if(type == 0) { - for(QDomNode n = x.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement q = n.toElement(); + for(TQDomNode n = x.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement q = n.toElement(); if(q.isNull()) continue; @@ -1052,7 +1052,7 @@ public: Jid jid; Form form; - QValueList<SearchResult> resultList; + TQValueList<SearchResult> resultList; }; JT_Search::JT_Search(Task *parent) @@ -1072,7 +1072,7 @@ void JT_Search::get(const Jid &jid) type = 0; d->jid = jid; iq = createIQ(doc(), "get", d->jid.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:search"); iq.appendChild(query); } @@ -1082,7 +1082,7 @@ void JT_Search::set(const Form &form) type = 1; d->jid = form.jid(); iq = createIQ(doc(), "set", d->jid.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:search"); iq.appendChild(query); @@ -1102,7 +1102,7 @@ const Form & JT_Search::form() const return d->form; } -const QValueList<SearchResult> & JT_Search::results() const +const TQValueList<SearchResult> & JT_Search::results() const { return d->resultList; } @@ -1112,7 +1112,7 @@ void JT_Search::onGo() send(iq); } -bool JT_Search::take(const QDomElement &x) +bool JT_Search::take(const TQDomElement &x) { if(!iqVerify(x, d->jid, id())) return false; @@ -1123,9 +1123,9 @@ bool JT_Search::take(const QDomElement &x) d->form.clear(); d->form.setJid(from); - QDomElement q = queryTag(x); - for(QDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement i = n.toElement(); + TQDomElement q = queryTag(x); + for(TQDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement i = n.toElement(); if(i.isNull()) continue; @@ -1145,16 +1145,16 @@ bool JT_Search::take(const QDomElement &x) else { d->resultList.clear(); - QDomElement q = queryTag(x); - for(QDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement i = n.toElement(); + TQDomElement q = queryTag(x); + for(TQDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement i = n.toElement(); if(i.isNull()) continue; if(i.tagName() == "item") { SearchResult r(Jid(i.attribute("jid"))); - QDomElement tag; + TQDomElement tag; bool found; tag = findSubTag(i, "nick", &found); @@ -1196,7 +1196,7 @@ void JT_ClientVersion::get(const Jid &jid) { j = jid; iq = createIQ(doc(), "get", j.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:version"); iq.appendChild(query); } @@ -1206,15 +1206,15 @@ void JT_ClientVersion::onGo() send(iq); } -bool JT_ClientVersion::take(const QDomElement &x) +bool JT_ClientVersion::take(const TQDomElement &x) { if(!iqVerify(x, j, id())) return false; if(x.attribute("type") == "result") { bool found; - QDomElement q = queryTag(x); - QDomElement tag; + TQDomElement q = queryTag(x); + TQDomElement tag; tag = findSubTag(q, "name", &found); if(found) v_name = tagContent(tag); @@ -1239,17 +1239,17 @@ const Jid & JT_ClientVersion::jid() const return j; } -const QString & JT_ClientVersion::name() const +const TQString & JT_ClientVersion::name() const { return v_name; } -const QString & JT_ClientVersion::version() const +const TQString & JT_ClientVersion::version() const { return v_ver; } -const QString & JT_ClientVersion::os() const +const TQString & JT_ClientVersion::os() const { return v_os; } @@ -1263,7 +1263,7 @@ const QString & JT_ClientVersion::os() const { j = _j; iq = createIQ("get", j.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:time"); iq.appendChild(query); } @@ -1273,15 +1273,15 @@ void JT_ClientTime::go() send(iq); } -bool JT_ClientTime::take(const QDomElement &x) +bool JT_ClientTime::take(const TQDomElement &x) { if(x.attribute("id") != id()) return FALSE; if(x.attribute("type") == "result") { bool found; - QDomElement q = queryTag(x); - QDomElement tag; + TQDomElement q = queryTag(x); + TQDomElement tag; tag = findSubTag(q, "utc", &found); if(found) stamp2TS(tagContent(tag), &utc); @@ -1316,15 +1316,15 @@ JT_ServInfo::~JT_ServInfo() { } -bool JT_ServInfo::take(const QDomElement &e) +bool JT_ServInfo::take(const TQDomElement &e) { if(e.tagName() != "iq" || e.attribute("type") != "get") return false; - QString ns = queryNS(e); + TQString ns = queryNS(e); if(ns == "jabber:iq:version") { - QDomElement iq = createIQ(doc(), "result", e.attribute("from"), e.attribute("id")); - QDomElement query = doc()->createElement("query"); + TQDomElement iq = createIQ(doc(), "result", e.attribute("from"), e.attribute("id")); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:version"); iq.appendChild(query); query.appendChild(textTag(doc(), "name", client()->clientName())); @@ -1334,29 +1334,29 @@ bool JT_ServInfo::take(const QDomElement &e) return true; } //else if(ns == "jabber:iq:time") { - // QDomElement iq = createIQ("result", e.attribute("from"), e.attribute("id")); - // QDomElement query = doc()->createElement("query"); + // TQDomElement iq = createIQ("result", e.attribute("from"), e.attribute("id")); + // TQDomElement query = doc()->createElement("query"); // query.setAttribute("xmlns", "jabber:iq:time"); // iq.appendChild(query); - // QDateTime local = QDateTime::currentDateTime(); - // QDateTime utc = local.addSecs(-getTZOffset() * 3600); - // QString str = getTZString(); + // TQDateTime local = TQDateTime::currentDateTime(); + // TQDateTime utc = local.addSecs(-getTZOffset() * 3600); + // TQString str = getTZString(); // query.appendChild(textTag("utc", TS2stamp(utc))); // query.appendChild(textTag("tz", str)); - // query.appendChild(textTag("display", QString("%1 %2").arg(local.toString()).arg(str))); + // query.appendChild(textTag("display", TQString("%1 %2").arg(local.toString()).arg(str))); // send(iq); // return TRUE; //} else if(ns == "http://jabber.org/protocol/disco#info") { // Find out the node - QString node; + TQString node; bool found; - QDomElement q = findSubTag(e, "query", &found); + TQDomElement q = findSubTag(e, "query", &found); if(found) // NOTE: Should always be true, since a NS was found above node = q.attribute("node"); - QDomElement iq = createIQ(doc(), "result", e.attribute("from"), e.attribute("id")); - QDomElement query = doc()->createElement("query"); + TQDomElement iq = createIQ(doc(), "result", e.attribute("from"), e.attribute("id")); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "http://jabber.org/protocol/disco#info"); if (!node.isEmpty()) query.setAttribute("node", node); @@ -1364,7 +1364,7 @@ bool JT_ServInfo::take(const QDomElement &e) // Identity DiscoItem::Identity identity = client()->identity(); - QDomElement id = doc()->createElement("identity"); + TQDomElement id = doc()->createElement("identity"); if (!identity.category.isEmpty() && !identity.type.isEmpty()) { id.setAttribute("category",identity.category); id.setAttribute("type",identity.type); @@ -1379,7 +1379,7 @@ bool JT_ServInfo::take(const QDomElement &e) } query.appendChild(id); - QDomElement feature; + TQDomElement feature; if (node.isEmpty() || node == client()->capsNode() + "#" + client()->capsVersion()) { // Standard features feature = doc()->createElement("feature"); @@ -1404,10 +1404,10 @@ bool JT_ServInfo::take(const QDomElement &e) if (node.isEmpty()) { // Extended features - QStringList exts = client()->extensions(); - for (QStringList::ConstIterator i = exts.begin(); i != exts.end(); ++i) { - const QStringList& l = client()->extension(*i).list(); - for ( QStringList::ConstIterator j = l.begin(); j != l.end(); ++j ) { + TQStringList exts = client()->extensions(); + for (TQStringList::ConstIterator i = exts.begin(); i != exts.end(); ++i) { + const TQStringList& l = client()->extension(*i).list(); + for ( TQStringList::ConstIterator j = l.begin(); j != l.end(); ++j ) { feature = doc()->createElement("feature"); feature.setAttribute("var", *j); query.appendChild(feature); @@ -1416,10 +1416,10 @@ bool JT_ServInfo::take(const QDomElement &e) } } else if (node.startsWith(client()->capsNode() + "#")) { - QString ext = node.right(node.length()-client()->capsNode().length()-1); + TQString ext = node.right(node.length()-client()->capsNode().length()-1); if (client()->extensions().contains(ext)) { - const QStringList& l = client()->extension(ext).list(); - for ( QStringList::ConstIterator it = l.begin(); it != l.end(); ++it ) { + const TQStringList& l = client()->extension(ext).list(); + for ( TQStringList::ConstIterator it = l.begin(); it != l.end(); ++it ) { feature = doc()->createElement("feature"); feature.setAttribute("var", *it); query.appendChild(feature); @@ -1455,18 +1455,18 @@ void JT_Gateway::get(const Jid &jid) type = 0; v_jid = jid; iq = createIQ(doc(), "get", v_jid.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:gateway"); iq.appendChild(query); } -void JT_Gateway::set(const Jid &jid, const QString &prompt) +void JT_Gateway::set(const Jid &jid, const TQString &prompt) { type = 1; v_jid = jid; v_prompt = prompt; iq = createIQ(doc(), "set", v_jid.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:gateway"); iq.appendChild(query); query.appendChild(textTag(doc(), "prompt", v_prompt)); @@ -1482,26 +1482,26 @@ Jid JT_Gateway::jid() const return v_jid; } -QString JT_Gateway::desc() const +TQString JT_Gateway::desc() const { return v_desc; } -QString JT_Gateway::prompt() const +TQString JT_Gateway::prompt() const { return v_prompt; } -bool JT_Gateway::take(const QDomElement &x) +bool JT_Gateway::take(const TQDomElement &x) { if(!iqVerify(x, v_jid, id())) return false; if(x.attribute("type") == "result") { if(type == 0) { - QDomElement query = queryTag(x); + TQDomElement query = queryTag(x); bool found; - QDomElement tag; + TQDomElement tag; tag = findSubTag(query, "desc", &found); if(found) v_desc = tagContent(tag); @@ -1510,9 +1510,9 @@ bool JT_Gateway::take(const QDomElement &x) v_prompt = tagContent(tag); } else { - QDomElement query = queryTag(x); + TQDomElement query = queryTag(x); bool found; - QDomElement tag; + TQDomElement tag; tag = findSubTag(query, "prompt", &found); if(found) v_prompt = tagContent(tag); @@ -1533,7 +1533,7 @@ bool JT_Gateway::take(const QDomElement &x) class JT_Browse::Private { public: - QDomElement iq; + TQDomElement iq; Jid jid; AgentList agentList; AgentItem root; @@ -1556,7 +1556,7 @@ void JT_Browse::get (const Jid &j) d->jid = j; d->iq = createIQ(doc(), "get", d->jid.full(), id()); - QDomElement query = doc()->createElement("item"); + TQDomElement query = doc()->createElement("item"); query.setAttribute("xmlns", "jabber:iq:browse"); d->iq.appendChild(query); } @@ -1576,7 +1576,7 @@ void JT_Browse::onGo () send(d->iq); } -AgentItem JT_Browse::browseHelper (const QDomElement &i) +AgentItem JT_Browse::browseHelper (const TQDomElement &i) { AgentItem a; @@ -1598,9 +1598,9 @@ AgentItem JT_Browse::browseHelper (const QDomElement &i) a.setType ( i.attribute("type") ); - QStringList ns; - for(QDomNode n = i.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement i = n.toElement(); + TQStringList ns; + for(TQDomNode n = i.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement i = n.toElement(); if(i.isNull()) continue; @@ -1618,21 +1618,21 @@ AgentItem JT_Browse::browseHelper (const QDomElement &i) return a; } -bool JT_Browse::take(const QDomElement &x) +bool JT_Browse::take(const TQDomElement &x) { if(!iqVerify(x, d->jid, id())) return false; if(x.attribute("type") == "result") { - for(QDomNode n = x.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement i = n.toElement(); + for(TQDomNode n = x.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement i = n.toElement(); if(i.isNull()) continue; d->root = browseHelper (i); - for(QDomNode nn = i.firstChild(); !nn.isNull(); nn = nn.nextSibling()) { - QDomElement e = nn.toElement(); + for(TQDomNode nn = i.firstChild(); !nn.isNull(); nn = nn.nextSibling()) { + TQDomElement e = nn.toElement(); if ( e.isNull() ) continue; if ( e.tagName() == "ns" ) @@ -1659,7 +1659,7 @@ class JT_DiscoItems::Private public: Private() { } - QDomElement iq; + TQDomElement iq; Jid jid; DiscoList items; }; @@ -1680,13 +1680,13 @@ void JT_DiscoItems::get(const DiscoItem &item) get(item.jid(), item.node()); } -void JT_DiscoItems::get (const Jid &j, const QString &node) +void JT_DiscoItems::get (const Jid &j, const TQString &node) { d->items.clear(); d->jid = j; d->iq = createIQ(doc(), "get", d->jid.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "http://jabber.org/protocol/disco#items"); if ( !node.isEmpty() ) @@ -1705,16 +1705,16 @@ void JT_DiscoItems::onGo () send(d->iq); } -bool JT_DiscoItems::take(const QDomElement &x) +bool JT_DiscoItems::take(const TQDomElement &x) { if(!iqVerify(x, d->jid, id())) return false; if(x.attribute("type") == "result") { - QDomElement q = queryTag(x); + TQDomElement q = queryTag(x); - for(QDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement e = n.toElement(); + for(TQDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement e = n.toElement(); if( e.isNull() ) continue; @@ -1747,9 +1747,9 @@ class JT_DiscoInfo::Private public: Private() { } - QDomElement iq; + TQDomElement iq; Jid jid; - QString node; + TQString node; DiscoItem item; }; @@ -1772,21 +1772,21 @@ void JT_DiscoInfo::get(const DiscoItem &item) get(item.jid(), item.node(), id); } -void JT_DiscoInfo::get (const Jid &j, const QString &node, DiscoItem::Identity ident) +void JT_DiscoInfo::get (const Jid &j, const TQString &node, DiscoItem::Identity ident) { d->item = DiscoItem(); // clear item d->jid = j; d->node = node; d->iq = createIQ(doc(), "get", d->jid.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "http://jabber.org/protocol/disco#info"); if ( !node.isEmpty() ) query.setAttribute("node", node); if ( !ident.category.isEmpty() && !ident.type.isEmpty() ) { - QDomElement i = doc()->createElement("item"); + TQDomElement i = doc()->createElement("item"); i.setAttribute("category", ident.category); i.setAttribute("type", ident.type); @@ -1816,7 +1816,7 @@ const Jid& JT_DiscoInfo::jid() const * Is here because sometimes the responder does not include this information * in the reply. */ -const QString& JT_DiscoInfo::node() const +const TQString& JT_DiscoInfo::node() const { return d->node; } @@ -1833,24 +1833,24 @@ void JT_DiscoInfo::onGo () send(d->iq); } -bool JT_DiscoInfo::take(const QDomElement &x) +bool JT_DiscoInfo::take(const TQDomElement &x) { if(!iqVerify(x, d->jid, id())) return false; if(x.attribute("type") == "result") { - QDomElement q = queryTag(x); + TQDomElement q = queryTag(x); DiscoItem item; item.setJid( d->jid ); item.setNode( q.attribute("node") ); - QStringList features; + TQStringList features; DiscoItem::Identities identities; - for(QDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement e = n.toElement(); + for(TQDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement e = n.toElement(); if( e.isNull() ) continue; @@ -1890,7 +1890,7 @@ class JT_DiscoPublish::Private public: Private() { } - QDomElement iq; + TQDomElement iq; Jid jid; DiscoList list; }; @@ -1912,7 +1912,7 @@ void JT_DiscoPublish::set(const Jid &j, const DiscoList &list) d->jid = j; d->iq = createIQ(doc(), "set", d->jid.full(), id()); - QDomElement query = doc()->createElement("query"); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "http://jabber.org/protocol/disco#items"); // FIXME: unsure about this @@ -1921,7 +1921,7 @@ void JT_DiscoPublish::set(const Jid &j, const DiscoList &list) DiscoList::ConstIterator it = list.begin(); for ( ; it != list.end(); ++it) { - QDomElement w = doc()->createElement("item"); + TQDomElement w = doc()->createElement("item"); w.setAttribute("jid", (*it).jid().full()); if ( !(*it).name().isEmpty() ) @@ -1941,7 +1941,7 @@ void JT_DiscoPublish::onGo () send(d->iq); } -bool JT_DiscoPublish::take(const QDomElement &x) +bool JT_DiscoPublish::take(const TQDomElement &x) { if(!iqVerify(x, d->jid, id())) return false; @@ -1988,21 +1988,21 @@ void JT_MucPresence::pres(const Status &s) if(!s.status().isEmpty()) tag.appendChild(textTag(doc(), "status", s.status())); - tag.appendChild( textTag(doc(), "priority", QString("%1").arg(s.priority()) ) ); + tag.appendChild( textTag(doc(), "priority", TQString("%1").arg(s.priority()) ) ); if(!s.keyID().isEmpty()) { - QDomElement x = textTag(doc(), "x", s.keyID()); + TQDomElement x = textTag(doc(), "x", s.keyID()); x.setAttribute("xmlns", "http://jabber.org/protocol/e2e"); tag.appendChild(x); } if(!s.xsigned().isEmpty()) { - QDomElement x = textTag(doc(), "x", s.xsigned()); + TQDomElement x = textTag(doc(), "x", s.xsigned()); x.setAttribute("xmlns", "jabber:x:signed"); tag.appendChild(x); } if(!s.capsNode().isEmpty() && !s.capsVersion().isEmpty()) { - QDomElement c = doc()->createElement("c"); + TQDomElement c = doc()->createElement("c"); c.setAttribute("xmlns","http://jabber.org/protocol/caps"); c.setAttribute("node",s.capsNode()); c.setAttribute("ver",s.capsVersion()); @@ -2013,11 +2013,11 @@ void JT_MucPresence::pres(const Status &s) } } -void JT_MucPresence::pres(const Jid &to, const Status &s, const QString &password) +void JT_MucPresence::pres(const Jid &to, const Status &s, const TQString &password) { pres(s); tag.setAttribute("to", to.full()); - QDomElement x = textTag(doc(), "x", s.xsigned()); + TQDomElement x = textTag(doc(), "x", s.xsigned()); x.setAttribute("xmlns", "http://jabber.org/protocol/muc"); x.appendChild( textTag(doc(), "password", password.latin1()) ); tag.appendChild(x); @@ -2038,8 +2038,8 @@ class JT_PrivateStorage::Private public: Private() : type(-1) {} - QDomElement iq; - QDomElement elem; + TQDomElement iq; + TQDomElement elem; int type; }; @@ -2054,27 +2054,27 @@ JT_PrivateStorage::~JT_PrivateStorage() delete d; } -void JT_PrivateStorage::get(const QString& tag, const QString& xmlns) +void JT_PrivateStorage::get(const TQString& tag, const TQString& xmlns) { d->type = 0; - d->iq = createIQ(doc(), "get" , QString() , id() ); - QDomElement query = doc()->createElement("query"); + d->iq = createIQ(doc(), "get" , TQString() , id() ); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:private"); d->iq.appendChild(query); - QDomElement s = doc()->createElement(tag); + TQDomElement s = doc()->createElement(tag); if(!xmlns.isEmpty()) s.setAttribute("xmlns", xmlns); query.appendChild(s); } -void JT_PrivateStorage::set(const QDomElement& element) +void JT_PrivateStorage::set(const TQDomElement& element) { d->type = 1; d->elem=element; - QDomNode n=doc()->importNode(element,true); + TQDomNode n=doc()->importNode(element,true); - d->iq = createIQ(doc(), "set" , QString() , id() ); - QDomElement query = doc()->createElement("query"); + d->iq = createIQ(doc(), "set" , TQString() , id() ); + TQDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:private"); d->iq.appendChild(query); query.appendChild(n); @@ -2085,17 +2085,17 @@ void JT_PrivateStorage::onGo() send(d->iq); } -bool JT_PrivateStorage::take(const QDomElement &x) +bool JT_PrivateStorage::take(const TQDomElement &x) { - QString to = client()->host(); + TQString to = client()->host(); if(!iqVerify(x, to, id())) return false; if(x.attribute("type") == "result") { if(d->type == 0) { - QDomElement q = queryTag(x); - for(QDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement i = n.toElement(); + TQDomElement q = queryTag(x); + for(TQDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement i = n.toElement(); if(i.isNull()) continue; d->elem=i; @@ -2113,7 +2113,7 @@ bool JT_PrivateStorage::take(const QDomElement &x) } -QDomElement JT_PrivateStorage::element( ) +TQDomElement JT_PrivateStorage::element( ) { return d->elem; } |