diff options
Diffstat (limited to 'kopete/protocols/jabber/libiris/iris/xmpp-core/protocol.cpp')
-rw-r--r-- | kopete/protocols/jabber/libiris/iris/xmpp-core/protocol.cpp | 322 |
1 files changed, 161 insertions, 161 deletions
diff --git a/kopete/protocols/jabber/libiris/iris/xmpp-core/protocol.cpp b/kopete/protocols/jabber/libiris/iris/xmpp-core/protocol.cpp index fd1e6cdc..76d3c781 100644 --- a/kopete/protocols/jabber/libiris/iris/xmpp-core/protocol.cpp +++ b/kopete/protocols/jabber/libiris/iris/xmpp-core/protocol.cpp @@ -40,13 +40,13 @@ using namespace XMPP; // This function prints out an array of bytes as latin characters, converting // non-printable bytes into hex values as necessary. Useful for displaying // QByteArrays for debugging purposes. -static QString printArray(const QByteArray &a) +static TQString printArray(const TQByteArray &a) { - QString s; + TQString s; for(uint n = 0; n < a.size(); ++n) { unsigned char c = (unsigned char)a[(int)n]; if(c < 32 || c >= 127) { - QString str; + TQString str; str.sprintf("[%02x]", c); s += str; } @@ -59,13 +59,13 @@ static QString printArray(const QByteArray &a) // firstChildElement // // Get an element's first child element -static QDomElement firstChildElement(const QDomElement &e) +static TQDomElement firstChildElement(const TQDomElement &e) { - for(QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { + for(TQDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { if(n.isElement()) return n.toElement(); } - return QDomElement(); + return TQDomElement(); } //---------------------------------------------------------------------------- @@ -159,30 +159,30 @@ void BasicProtocol::reset() XmlProtocol::reset(); init(); - to = QString(); - from = QString(); - id = QString(); - lang = QString(); + to = TQString(); + from = TQString(); + id = TQString(); + lang = TQString(); version = Version(1,0); - errText = QString(); - errAppSpec = QDomElement(); - otherHost = QString(); + errText = TQString(); + errAppSpec = TQDomElement(); + otherHost = TQString(); spare.resize(0); - sasl_mech = QString(); + sasl_mech = TQString(); sasl_mechlist.clear(); sasl_step.resize(0); - stanzaToRecv = QDomElement(); + stanzaToRecv = TQDomElement(); sendList.clear(); } -void BasicProtocol::sendStanza(const QDomElement &e) +void BasicProtocol::sendStanza(const TQDomElement &e) { SendItem i; i.stanzaToSend = e; sendList += i; } -void BasicProtocol::sendDirect(const QString &s) +void BasicProtocol::sendDirect(const TQString &s) { SendItem i; i.stringToSend = s; @@ -196,10 +196,10 @@ void BasicProtocol::sendWhitespace() sendList += i; } -QDomElement BasicProtocol::recvStanza() +TQDomElement BasicProtocol::recvStanza() { - QDomElement e = stanzaToRecv; - stanzaToRecv = QDomElement(); + TQDomElement e = stanzaToRecv; + stanzaToRecv = TQDomElement(); return e; } @@ -208,7 +208,7 @@ void BasicProtocol::shutdown() doShutdown = true; } -void BasicProtocol::shutdownWithError(int cond, const QString &str) +void BasicProtocol::shutdownWithError(int cond, const TQString &str) { otherHost = str; delayErrorAndClose(cond); @@ -224,28 +224,28 @@ void BasicProtocol::setReady(bool b) ready = b; } -QString BasicProtocol::saslMech() const +TQString BasicProtocol::saslMech() const { return sasl_mech; } -QByteArray BasicProtocol::saslStep() const +TQByteArray BasicProtocol::saslStep() const { return sasl_step; } -void BasicProtocol::setSASLMechList(const QStringList &list) +void BasicProtocol::setSASLMechList(const TQStringList &list) { sasl_mechlist = list; } -void BasicProtocol::setSASLFirst(const QString &mech, const QByteArray &step) +void BasicProtocol::setSASLFirst(const TQString &mech, const TQByteArray &step) { sasl_mech = mech; sasl_step = step; } -void BasicProtocol::setSASLNext(const QByteArray &step) +void BasicProtocol::setSASLNext(const TQByteArray &step) { sasl_step = step; } @@ -255,7 +255,7 @@ void BasicProtocol::setSASLAuthed() sasl_authed = true; } -int BasicProtocol::stringToSASLCond(const QString &s) +int BasicProtocol::stringToSASLCond(const TQString &s) { for(int n = 0; saslCondTable[n].str; ++n) { if(s == saslCondTable[n].str) @@ -264,7 +264,7 @@ int BasicProtocol::stringToSASLCond(const QString &s) return -1; } -int BasicProtocol::stringToStreamCond(const QString &s) +int BasicProtocol::stringToStreamCond(const TQString &s) { for(int n = 0; streamCondTable[n].str; ++n) { if(s == streamCondTable[n].str) @@ -273,30 +273,30 @@ int BasicProtocol::stringToStreamCond(const QString &s) return -1; } -QString BasicProtocol::saslCondToString(int x) +TQString BasicProtocol::saslCondToString(int x) { for(int n = 0; saslCondTable[n].str; ++n) { if(x == saslCondTable[n].cond) return saslCondTable[n].str; } - return QString(); + return TQString(); } -QString BasicProtocol::streamCondToString(int x) +TQString BasicProtocol::streamCondToString(int x) { for(int n = 0; streamCondTable[n].str; ++n) { if(x == streamCondTable[n].cond) return streamCondTable[n].str; } - return QString(); + return TQString(); } -void BasicProtocol::extractStreamError(const QDomElement &e) +void BasicProtocol::extractStreamError(const TQDomElement &e) { - QString text; - QDomElement appSpec; + TQString text; + TQDomElement appSpec; - QDomElement t = firstChildElement(e); + TQDomElement t = firstChildElement(e); if(t.isNull() || t.namespaceURI() != NS_STREAMS) { // probably old-style error errCond = -1; @@ -314,9 +314,9 @@ void BasicProtocol::extractStreamError(const QDomElement &e) text = t.text(); // find first non-standard namespaced element - QDomNodeList nl = e.childNodes(); + TQDomNodeList nl = e.childNodes(); for(uint n = 0; n < nl.count(); ++n) { - QDomNode i = nl.item(n); + TQDomNode i = nl.item(n); if(i.isElement() && i.namespaceURI() != NS_STREAMS) { appSpec = i.toElement(); break; @@ -328,20 +328,20 @@ void BasicProtocol::extractStreamError(const QDomElement &e) } } -void BasicProtocol::send(const QDomElement &e, bool clip) +void BasicProtocol::send(const TQDomElement &e, bool clip) { writeElement(e, TypeElement, false, clip); } -void BasicProtocol::sendStreamError(int cond, const QString &text, const QDomElement &appSpec) +void BasicProtocol::sendStreamError(int cond, const TQString &text, const TQDomElement &appSpec) { - QDomElement se = doc.createElementNS(NS_ETHERX, "stream:error"); - QDomElement err = doc.createElementNS(NS_STREAMS, streamCondToString(cond)); + TQDomElement se = doc.createElementNS(NS_ETHERX, "stream:error"); + TQDomElement err = doc.createElementNS(NS_STREAMS, streamCondToString(cond)); if(!otherHost.isEmpty()) err.appendChild(doc.createTextNode(otherHost)); se.appendChild(err); if(!text.isEmpty()) { - QDomElement te = doc.createElementNS(NS_STREAMS, "text"); + TQDomElement te = doc.createElementNS(NS_STREAMS, "text"); te.setAttributeNS(NS_XML, "xml:lang", "en"); te.appendChild(doc.createTextNode(text)); se.appendChild(te); @@ -351,15 +351,15 @@ void BasicProtocol::sendStreamError(int cond, const QString &text, const QDomEle writeElement(se, 100, false); } -void BasicProtocol::sendStreamError(const QString &text) +void BasicProtocol::sendStreamError(const TQString &text) { - QDomElement se = doc.createElementNS(NS_ETHERX, "stream:error"); + TQDomElement se = doc.createElementNS(NS_ETHERX, "stream:error"); se.appendChild(doc.createTextNode(text)); writeElement(se, 100, false); } -bool BasicProtocol::errorAndClose(int cond, const QString &text, const QDomElement &appSpec) +bool BasicProtocol::errorAndClose(int cond, const TQString &text, const TQDomElement &appSpec) { closeError = true; errCond = cond; @@ -376,7 +376,7 @@ bool BasicProtocol::error(int code) return true; } -void BasicProtocol::delayErrorAndClose(int cond, const QString &text, const QDomElement &appSpec) +void BasicProtocol::delayErrorAndClose(int cond, const TQString &text, const TQDomElement &appSpec) { errorCode = ErrStream; errCond = cond; @@ -391,21 +391,21 @@ void BasicProtocol::delayError(int code) delayedError = true; } -QDomElement BasicProtocol::docElement() +TQDomElement BasicProtocol::docElement() { // create the root element - QDomElement e = doc.createElementNS(NS_ETHERX, "stream:stream"); + TQDomElement e = doc.createElementNS(NS_ETHERX, "stream:stream"); - QString defns = defaultNamespace(); - QStringList list = extraNamespaces(); + TQString defns = defaultNamespace(); + TQStringList list = extraNamespaces(); // HACK: using attributes seems to be the only way to get additional namespaces in here if(!defns.isEmpty()) e.setAttribute("xmlns", defns); - for(QStringList::ConstIterator it = list.begin(); it != list.end();) { - QString prefix = *(it++); - QString uri = *(it++); - e.setAttribute(QString("xmlns:") + prefix, uri); + for(TQStringList::ConstIterator it = list.begin(); it != list.end();) { + TQString prefix = *(it++); + TQString uri = *(it++); + e.setAttribute(TQString("xmlns:") + prefix, uri); } // additional attributes @@ -418,7 +418,7 @@ QDomElement BasicProtocol::docElement() if(!lang.isEmpty()) e.setAttributeNS(NS_XML, "xml:lang", lang); if(version.major > 0 || version.minor > 0) - e.setAttribute("version", QString::number(version.major) + '.' + QString::number(version.minor)); + e.setAttribute("version", TQString::number(version.major) + '.' + TQString::number(version.minor)); return e; } @@ -433,12 +433,12 @@ void BasicProtocol::handleDocOpen(const Parser::Event &pe) } if(pe.namespaceURI() == NS_ETHERX && pe.localName() == "stream") { - QXmlAttributes atts = pe.atts(); + TQXmlAttributes atts = pe.atts(); // grab the version int major = 0; int minor = 0; - QString verstr = atts.value("version"); + TQString verstr = atts.value("version"); if(!verstr.isEmpty()) { int n = verstr.find('.'); if(n != -1) { @@ -454,7 +454,7 @@ void BasicProtocol::handleDocOpen(const Parser::Event &pe) if(isIncoming()) { to = atts.value("to"); - QString peerLang = atts.value(NS_XML, "lang"); + TQString peerLang = atts.value(NS_XML, "lang"); if(!peerLang.isEmpty()) lang = peerLang; } @@ -495,7 +495,7 @@ bool BasicProtocol::handleCloseFinished() return true; } -bool BasicProtocol::doStep(const QDomElement &e) +bool BasicProtocol::doStep(const TQDomElement &e) { // handle pending error if(delayedError) { @@ -530,7 +530,7 @@ bool BasicProtocol::doStep(const QDomElement &e) if(!sendList.isEmpty()) { SendItem i; { - QValueList<SendItem>::Iterator it = sendList.begin(); + TQValueList<SendItem>::Iterator it = sendList.begin(); i = (*it); sendList.remove(it); } @@ -571,16 +571,16 @@ void BasicProtocol::itemWritten(int id, int) } } -QString BasicProtocol::defaultNamespace() +TQString BasicProtocol::defaultNamespace() { // default none - return QString(); + return TQString(); } -QStringList BasicProtocol::extraNamespaces() +TQStringList BasicProtocol::extraNamespaces() { // default none - return QStringList(); + return TQStringList(); } void BasicProtocol::handleStreamOpen(const Parser::Event &) @@ -612,7 +612,7 @@ void CoreProtocol::init() // settings jid = Jid(); - password = QString(); + password = TQString(); oldOnly = false; allowPlain = false; doTLS = true; @@ -620,8 +620,8 @@ void CoreProtocol::init() doBinding = true; // input - user = QString(); - host = QString(); + user = TQString(); + host = TQString(); // status old = false; @@ -649,14 +649,14 @@ void CoreProtocol::startClientOut(const Jid &_jid, bool _oldOnly, bool tlsActive startConnect(); } -void CoreProtocol::startServerOut(const QString &_to) +void CoreProtocol::startServerOut(const TQString &_to) { server = true; to = _to; startConnect(); } -void CoreProtocol::startDialbackOut(const QString &_to, const QString &_from) +void CoreProtocol::startDialbackOut(const TQString &_to, const TQString &_from) { server = true; dialback = true; @@ -665,7 +665,7 @@ void CoreProtocol::startDialbackOut(const QString &_to, const QString &_from) startConnect(); } -void CoreProtocol::startDialbackVerifyOut(const QString &_to, const QString &_from, const QString &id, const QString &key) +void CoreProtocol::startDialbackVerifyOut(const TQString &_to, const TQString &_from, const TQString &id, const TQString &key) { server = true; dialback = true; @@ -677,20 +677,20 @@ void CoreProtocol::startDialbackVerifyOut(const QString &_to, const QString &_fr startConnect(); } -void CoreProtocol::startClientIn(const QString &_id) +void CoreProtocol::startClientIn(const TQString &_id) { id = _id; startAccept(); } -void CoreProtocol::startServerIn(const QString &_id) +void CoreProtocol::startServerIn(const TQString &_id) { server = true; id = _id; startAccept(); } -void CoreProtocol::setLang(const QString &s) +void CoreProtocol::setLang(const TQString &s) { lang = s; } @@ -710,17 +710,17 @@ void CoreProtocol::setAllowPlain(bool b) allowPlain = b; } -void CoreProtocol::setPassword(const QString &s) +void CoreProtocol::setPassword(const TQString &s) { password = s; } -void CoreProtocol::setFrom(const QString &s) +void CoreProtocol::setFrom(const TQString &s) { from = s; } -void CoreProtocol::setDialbackKey(const QString &s) +void CoreProtocol::setDialbackKey(const TQString &s) { dialback_key = s; } @@ -734,18 +734,18 @@ bool CoreProtocol::loginComplete() return true; } -int CoreProtocol::getOldErrorCode(const QDomElement &e) +int CoreProtocol::getOldErrorCode(const TQDomElement &e) { - QDomElement err = e.elementsByTagNameNS(NS_CLIENT, "error").item(0).toElement(); + TQDomElement err = e.elementsByTagNameNS(NS_CLIENT, "error").item(0).toElement(); if(err.isNull() || !err.hasAttribute("code")) return -1; return err.attribute("code").toInt(); } -/*QString CoreProtocol::xmlToString(const QDomElement &e, bool clip) +/*TQString CoreProtocol::xmlToString(const TQDomElement &e, bool clip) { // determine an appropriate 'fakeNS' to use - QString ns; + TQString ns; if(e.prefix() == "stream") ns = NS_ETHERX; else if(e.prefix() == "db") @@ -781,21 +781,21 @@ bool CoreProtocol::stepRequiresElement() const return false; } -void CoreProtocol::stringSend(const QString &s) +void CoreProtocol::stringSend(const TQString &s) { #ifdef XMPP_TEST TD::outgoingTag(s); #endif } -void CoreProtocol::stringRecv(const QString &s) +void CoreProtocol::stringRecv(const TQString &s) { #ifdef XMPP_TEST TD::incomingTag(s); #endif } -QString CoreProtocol::defaultNamespace() +TQString CoreProtocol::defaultNamespace() { if(server) return NS_SERVER; @@ -803,9 +803,9 @@ QString CoreProtocol::defaultNamespace() return NS_CLIENT; } -QStringList CoreProtocol::extraNamespaces() +TQStringList CoreProtocol::extraNamespaces() { - QStringList list; + TQStringList list; if(dialback) { list += "db"; list += NS_DIALBACK; @@ -816,8 +816,8 @@ QStringList CoreProtocol::extraNamespaces() void CoreProtocol::handleStreamOpen(const Parser::Event &pe) { if(isIncoming()) { - QString ns = pe.nsprefix(); - QString db; + TQString ns = pe.nsprefix(); + TQString db; if(server) { db = pe.nsprefix("db"); if(!db.isEmpty()) @@ -846,21 +846,21 @@ void CoreProtocol::handleStreamOpen(const Parser::Event &pe) } } -void CoreProtocol::elementSend(const QDomElement &e) +void CoreProtocol::elementSend(const TQDomElement &e) { #ifdef XMPP_TEST TD::outgoingXml(e); #endif } -void CoreProtocol::elementRecv(const QDomElement &e) +void CoreProtocol::elementRecv(const TQDomElement &e) { #ifdef XMPP_TEST TD::incomingXml(e); #endif } -bool CoreProtocol::doStep2(const QDomElement &e) +bool CoreProtocol::doStep2(const TQDomElement &e) { if(dialback) return dialbackStep(e); @@ -868,9 +868,9 @@ bool CoreProtocol::doStep2(const QDomElement &e) return normalStep(e); } -bool CoreProtocol::isValidStanza(const QDomElement &e) const +bool CoreProtocol::isValidStanza(const TQDomElement &e) const { - QString s = e.tagName(); + TQString s = e.tagName(); if(e.namespaceURI() == (server ? NS_SERVER : NS_CLIENT) && (s == "message" || s == "presence" || s == "iq")) return true; else @@ -879,7 +879,7 @@ bool CoreProtocol::isValidStanza(const QDomElement &e) const bool CoreProtocol::grabPendingItem(const Jid &to, const Jid &from, int type, DBItem *item) { - for(QValueList<DBItem>::Iterator it = dbpending.begin(); it != dbpending.end(); ++it) { + for(TQValueList<DBItem>::Iterator it = dbpending.begin(); it != dbpending.end(); ++it) { const DBItem &i = *it; if(i.type == type && i.to.compare(to) && i.from.compare(from)) { const DBItem &i = (*it); @@ -891,7 +891,7 @@ bool CoreProtocol::grabPendingItem(const Jid &to, const Jid &from, int type, DBI return false; } -bool CoreProtocol::dialbackStep(const QDomElement &e) +bool CoreProtocol::dialbackStep(const TQDomElement &e) { if(step == Start) { setReady(true); @@ -904,12 +904,12 @@ bool CoreProtocol::dialbackStep(const QDomElement &e) // process a request DBItem i; { - QValueList<DBItem>::Iterator it = dbrequests.begin(); + TQValueList<DBItem>::Iterator it = dbrequests.begin(); i = (*it); dbrequests.remove(it); } - QDomElement r; + TQDomElement r; if(i.type == DBItem::ResultRequest) { r = doc.createElementNS(NS_DIALBACK, "db:result"); r.setAttribute("to", i.to.full()); @@ -959,7 +959,7 @@ bool CoreProtocol::dialbackStep(const QDomElement &e) to.set(e.attribute("to"), ""); from.set(e.attribute("from"), ""); if(isIncoming()) { - QString key = e.text(); + TQString key = e.text(); // TODO: report event } else { @@ -982,9 +982,9 @@ bool CoreProtocol::dialbackStep(const QDomElement &e) Jid to, from; to.set(e.attribute("to"), ""); from.set(e.attribute("from"), ""); - QString id = e.attribute("id"); + TQString id = e.attribute("id"); if(isIncoming()) { - QString key = e.text(); + TQString key = e.text(); // TODO: report event } else { @@ -1019,7 +1019,7 @@ bool CoreProtocol::dialbackStep(const QDomElement &e) return false; } -bool CoreProtocol::normalStep(const QDomElement &e) +bool CoreProtocol::normalStep(const TQDomElement &e) { if(step == Start) { if(isIncoming()) { @@ -1043,7 +1043,7 @@ bool CoreProtocol::normalStep(const QDomElement &e) else if(step == HandleFeatures) { // deal with TLS? if(doTLS && !tls_started && !sasl_authed && features.tls_supported) { - QDomElement e = doc.createElementNS(NS_TLS, "starttls"); + TQDomElement e = doc.createElementNS(NS_TLS, "starttls"); send(e, true); event = ESend; @@ -1084,15 +1084,15 @@ bool CoreProtocol::normalStep(const QDomElement &e) return true; } - QDomElement e = doc.createElement("iq"); + TQDomElement e = doc.createElement("iq"); e.setAttribute("type", "set"); e.setAttribute("id", "bind_1"); - QDomElement b = doc.createElementNS(NS_BIND, "bind"); + TQDomElement b = doc.createElementNS(NS_BIND, "bind"); // request specific resource? - QString resource = jid.resource(); + TQString resource = jid.resource(); if(!resource.isEmpty()) { - QDomElement r = doc.createElement("resource"); + TQDomElement r = doc.createElement("resource"); r.appendChild(doc.createTextNode(jid.resource())); b.appendChild(r); } @@ -1105,11 +1105,11 @@ bool CoreProtocol::normalStep(const QDomElement &e) return true; } else if(step == GetSASLFirst) { - QDomElement e = doc.createElementNS(NS_SASL, "auth"); + TQDomElement e = doc.createElementNS(NS_SASL, "auth"); e.setAttribute("mechanism", sasl_mech); if(!sasl_step.isEmpty()) { #ifdef XMPP_TEST - TD::msg(QString("SASL OUT: [%1]").arg(printArray(sasl_step))); + TD::msg(TQString("SASL OUT: [%1]").arg(printArray(sasl_step))); #endif e.appendChild(doc.createTextNode(Base64::arrayToString(sasl_step))); } @@ -1122,15 +1122,15 @@ bool CoreProtocol::normalStep(const QDomElement &e) else if(step == GetSASLNext) { if(isIncoming()) { if(sasl_authed) { - QDomElement e = doc.createElementNS(NS_SASL, "success"); + TQDomElement e = doc.createElementNS(NS_SASL, "success"); writeElement(e, TypeElement, false, true); event = ESend; step = IncHandleSASLSuccess; return true; } else { - QByteArray stepData = sasl_step; - QDomElement e = doc.createElementNS(NS_SASL, "challenge"); + TQByteArray stepData = sasl_step; + TQDomElement e = doc.createElementNS(NS_SASL, "challenge"); if(!stepData.isEmpty()) e.appendChild(doc.createTextNode(Base64::arrayToString(stepData))); @@ -1141,11 +1141,11 @@ bool CoreProtocol::normalStep(const QDomElement &e) } } else { - QByteArray stepData = sasl_step; + TQByteArray stepData = sasl_step; #ifdef XMPP_TEST - TD::msg(QString("SASL OUT: [%1]").arg(printArray(sasl_step))); + TD::msg(TQString("SASL OUT: [%1]").arg(printArray(sasl_step))); #endif - QDomElement e = doc.createElementNS(NS_SASL, "response"); + TQDomElement e = doc.createElementNS(NS_SASL, "response"); if(!stepData.isEmpty()) e.appendChild(doc.createTextNode(Base64::arrayToString(stepData))); @@ -1162,12 +1162,12 @@ bool CoreProtocol::normalStep(const QDomElement &e) return false; } else if(step == HandleAuthGet) { - QDomElement e = doc.createElement("iq"); + TQDomElement e = doc.createElement("iq"); e.setAttribute("to", to); e.setAttribute("type", "get"); e.setAttribute("id", "auth_1"); - QDomElement q = doc.createElementNS("jabber:iq:auth", "query"); - QDomElement u = doc.createElement("username"); + TQDomElement q = doc.createElementNS("jabber:iq:auth", "query"); + TQDomElement u = doc.createElement("username"); u.appendChild(doc.createTextNode(jid.node())); q.appendChild(u); e.appendChild(q); @@ -1178,22 +1178,22 @@ bool CoreProtocol::normalStep(const QDomElement &e) return true; } else if(step == HandleAuthSet) { - QDomElement e = doc.createElement("iq"); + TQDomElement e = doc.createElement("iq"); e.setAttribute("to", to); e.setAttribute("type", "set"); e.setAttribute("id", "auth_2"); - QDomElement q = doc.createElementNS("jabber:iq:auth", "query"); - QDomElement u = doc.createElement("username"); + TQDomElement q = doc.createElementNS("jabber:iq:auth", "query"); + TQDomElement u = doc.createElement("username"); u.appendChild(doc.createTextNode(jid.node())); q.appendChild(u); - QDomElement p; + TQDomElement p; if(digest) { // need SHA1 here if(!QCA::isSupported(QCA::CAP_SHA1)) QCA::insertProvider(createProviderHash()); p = doc.createElement("digest"); - QCString cs = id.utf8() + password.utf8(); + TQCString cs = id.utf8() + password.utf8(); p.appendChild(doc.createTextNode(QCA::SHA1::hashToString(cs))); } else { @@ -1201,7 +1201,7 @@ bool CoreProtocol::normalStep(const QDomElement &e) p.appendChild(doc.createTextNode(password)); } q.appendChild(p); - QDomElement r = doc.createElement("resource"); + TQDomElement r = doc.createElement("resource"); r.appendChild(doc.createTextNode(jid.resource())); q.appendChild(r); e.appendChild(q); @@ -1213,22 +1213,22 @@ bool CoreProtocol::normalStep(const QDomElement &e) } // server else if(step == SendFeatures) { - QDomElement f = doc.createElementNS(NS_ETHERX, "stream:features"); + TQDomElement f = doc.createElementNS(NS_ETHERX, "stream:features"); if(!tls_started && !sasl_authed) { // don't offer tls if we are already sasl'd - QDomElement tls = doc.createElementNS(NS_TLS, "starttls"); + TQDomElement tls = doc.createElementNS(NS_TLS, "starttls"); f.appendChild(tls); } if(sasl_authed) { if(!server) { - QDomElement bind = doc.createElementNS(NS_BIND, "bind"); + TQDomElement bind = doc.createElementNS(NS_BIND, "bind"); f.appendChild(bind); } } else { - QDomElement mechs = doc.createElementNS(NS_SASL, "mechanisms"); - for(QStringList::ConstIterator it = sasl_mechlist.begin(); it != sasl_mechlist.end(); ++it) { - QDomElement m = doc.createElement("mechanism"); + TQDomElement mechs = doc.createElementNS(NS_SASL, "mechanisms"); + for(TQStringList::ConstIterator it = sasl_mechlist.begin(); it != sasl_mechlist.end(); ++it) { + TQDomElement m = doc.createElement("mechanism"); m.appendChild(doc.createTextNode(*it)); mechs.appendChild(m); } @@ -1261,25 +1261,25 @@ bool CoreProtocol::normalStep(const QDomElement &e) if(e.namespaceURI() == NS_ETHERX && e.tagName() == "features") { // extract features StreamFeatures f; - QDomElement s = e.elementsByTagNameNS(NS_TLS, "starttls").item(0).toElement(); + TQDomElement s = e.elementsByTagNameNS(NS_TLS, "starttls").item(0).toElement(); if(!s.isNull()) { f.tls_supported = true; f.tls_required = s.elementsByTagNameNS(NS_TLS, "required").count() > 0; } - QDomElement m = e.elementsByTagNameNS(NS_SASL, "mechanisms").item(0).toElement(); + TQDomElement m = e.elementsByTagNameNS(NS_SASL, "mechanisms").item(0).toElement(); if(!m.isNull()) { f.sasl_supported = true; - QDomNodeList l = m.elementsByTagNameNS(NS_SASL, "mechanism"); + TQDomNodeList l = m.elementsByTagNameNS(NS_SASL, "mechanism"); for(uint n = 0; n < l.count(); ++n) f.sasl_mechs += l.item(n).toElement().text(); } - QDomElement b = e.elementsByTagNameNS(NS_BIND, "bind").item(0).toElement(); + TQDomElement b = e.elementsByTagNameNS(NS_BIND, "bind").item(0).toElement(); if(!b.isNull()) f.bind_supported = true; if(f.tls_supported) { #ifdef XMPP_TEST - QString s = "STARTTLS is available"; + TQString s = "STARTTLS is available"; if(f.tls_required) s += " (required)"; TD::msg(s); @@ -1287,9 +1287,9 @@ bool CoreProtocol::normalStep(const QDomElement &e) } if(f.sasl_supported) { #ifdef XMPP_TEST - QString s = "SASL mechs:"; - for(QStringList::ConstIterator it = f.sasl_mechs.begin(); it != f.sasl_mechs.end(); ++it) - s += QString(" [%1]").arg((*it)); + TQString s = "SASL mechs:"; + for(TQStringList::ConstIterator it = f.sasl_mechs.begin(); it != f.sasl_mechs.end(); ++it) + s += TQString(" [%1]").arg((*it)); TD::msg(s); #endif } @@ -1339,9 +1339,9 @@ bool CoreProtocol::normalStep(const QDomElement &e) // waiting for sasl challenge/success/fail if(e.namespaceURI() == NS_SASL) { if(e.tagName() == "challenge") { - QByteArray a = Base64::stringToArray(e.text()); + TQByteArray a = Base64::stringToArray(e.text()); #ifdef XMPP_TEST - TD::msg(QString("SASL IN: [%1]").arg(printArray(a))); + TD::msg(TQString("SASL IN: [%1]").arg(printArray(a))); #endif sasl_step = a; need = NSASLNext; @@ -1355,7 +1355,7 @@ bool CoreProtocol::normalStep(const QDomElement &e) return true; } else if(e.tagName() == "failure") { - QDomElement t = firstChildElement(e); + TQDomElement t = firstChildElement(e); if(t.isNull() || t.namespaceURI() != NS_SASL) errCond = -1; else @@ -1374,15 +1374,15 @@ bool CoreProtocol::normalStep(const QDomElement &e) } else if(step == GetBindResponse) { if(e.namespaceURI() == NS_CLIENT && e.tagName() == "iq") { - QString type(e.attribute("type")); - QString id(e.attribute("id")); + TQString type(e.attribute("type")); + TQString id(e.attribute("id")); if(id == "bind_1" && (type == "result" || type == "error")) { if(type == "result") { - QDomElement b = e.elementsByTagNameNS(NS_BIND, "bind").item(0).toElement(); + TQDomElement b = e.elementsByTagNameNS(NS_BIND, "bind").item(0).toElement(); Jid j; if(!b.isNull()) { - QDomElement je = e.elementsByTagName("jid").item(0).toElement(); + TQDomElement je = e.elementsByTagName("jid").item(0).toElement(); j = je.text(); } if(!j.isValid()) { @@ -1396,20 +1396,20 @@ bool CoreProtocol::normalStep(const QDomElement &e) else { errCond = -1; - QDomElement err = e.elementsByTagNameNS(NS_CLIENT, "error").item(0).toElement(); + TQDomElement err = e.elementsByTagNameNS(NS_CLIENT, "error").item(0).toElement(); if(!err.isNull()) { // get error condition - QDomNodeList nl = err.childNodes(); - QDomElement t; + TQDomNodeList nl = err.childNodes(); + TQDomElement t; for(uint n = 0; n < nl.count(); ++n) { - QDomNode i = nl.item(n); + TQDomNode i = nl.item(n); if(i.isElement()) { t = i.toElement(); break; } } if(!t.isNull() && t.namespaceURI() == NS_STANZAS) { - QString cond = t.tagName(); + TQString cond = t.tagName(); if(cond == "not-allowed") errCond = BindNotAllowed; else if(cond == "conflict") @@ -1434,13 +1434,13 @@ bool CoreProtocol::normalStep(const QDomElement &e) // waiting for an iq if(e.namespaceURI() == NS_CLIENT && e.tagName() == "iq") { Jid from(e.attribute("from")); - QString type(e.attribute("type")); - QString id(e.attribute("id")); + TQString type(e.attribute("type")); + TQString id(e.attribute("id")); bool okfrom = (from.isEmpty() || from.compare(Jid(to))); if(okfrom && id == "auth_1" && (type == "result" || type == "error")) { if(type == "result") { - QDomElement q = e.elementsByTagNameNS("jabber:iq:auth", "query").item(0).toElement(); + TQDomElement q = e.elementsByTagNameNS("jabber:iq:auth", "query").item(0).toElement(); if(q.isNull() || q.elementsByTagName("username").item(0).isNull() || q.elementsByTagName("resource").item(0).isNull()) { event = EError; errorCode = ErrProtocol; @@ -1487,8 +1487,8 @@ bool CoreProtocol::normalStep(const QDomElement &e) // waiting for an iq if(e.namespaceURI() == NS_CLIENT && e.tagName() == "iq") { Jid from(e.attribute("from")); - QString type(e.attribute("type")); - QString id(e.attribute("id")); + TQString type(e.attribute("type")); + TQString id(e.attribute("id")); bool okfrom = (from.isEmpty() || from.compare(Jid(to))); if(okfrom && id == "auth_2" && (type == "result" || type == "error")) { @@ -1517,7 +1517,7 @@ bool CoreProtocol::normalStep(const QDomElement &e) if(e.namespaceURI() == NS_TLS && e.localName() == "starttls") { // TODO: don't let this be done twice - QDomElement e = doc.createElementNS(NS_TLS, "proceed"); + TQDomElement e = doc.createElementNS(NS_TLS, "proceed"); writeElement(e, TypeElement, false, true); event = ESend; step = HandleTLS; @@ -1546,16 +1546,16 @@ bool CoreProtocol::normalStep(const QDomElement &e) } } if(e.namespaceURI() == NS_CLIENT && e.tagName() == "iq") { - QDomElement b = e.elementsByTagNameNS(NS_BIND, "bind").item(0).toElement(); + TQDomElement b = e.elementsByTagNameNS(NS_BIND, "bind").item(0).toElement(); if(!b.isNull()) { - QDomElement res = b.elementsByTagName("resource").item(0).toElement(); - QString resource = res.text(); + TQDomElement res = b.elementsByTagName("resource").item(0).toElement(); + TQString resource = res.text(); - QDomElement r = doc.createElement("iq"); + TQDomElement r = doc.createElement("iq"); r.setAttribute("type", "result"); r.setAttribute("id", e.attribute("id")); - QDomElement bind = doc.createElementNS(NS_BIND, "bind"); - QDomElement jid = doc.createElement("jid"); + TQDomElement bind = doc.createElementNS(NS_BIND, "bind"); + TQDomElement jid = doc.createElement("jid"); Jid j = user + '@' + host + '/' + resource; jid.appendChild(doc.createTextNode(j.full())); bind.appendChild(jid); |