summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/jabbercapabilitiesmanager.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
commit47c8a359c5276062c4bc17f0e82410f29081b502 (patch)
tree2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/protocols/jabber/jabbercapabilitiesmanager.cpp
parent6f82532777a35e0e60bbd2b290b2e93e646f349b (diff)
downloadtdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz
tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/jabber/jabbercapabilitiesmanager.cpp')
-rw-r--r--kopete/protocols/jabber/jabbercapabilitiesmanager.cpp148
1 files changed, 74 insertions, 74 deletions
diff --git a/kopete/protocols/jabber/jabbercapabilitiesmanager.cpp b/kopete/protocols/jabber/jabbercapabilitiesmanager.cpp
index e570d241..9d9dd770 100644
--- a/kopete/protocols/jabber/jabbercapabilitiesmanager.cpp
+++ b/kopete/protocols/jabber/jabbercapabilitiesmanager.cpp
@@ -19,12 +19,12 @@
*/
#include "jabbercapabilitiesmanager.h"
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qtimer.h>
-#include <qpair.h>
-#include <qdom.h>
-#include <qtextstream.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
+#include <tqtimer.h>
+#include <tqpair.h>
+#include <tqdom.h>
+#include <tqtextstream.h>
#include <kstandarddirs.h>
#include <kdebug.h>
@@ -40,21 +40,21 @@ using namespace XMPP;
JabberCapabilitiesManager::Capabilities::Capabilities()
{}
-JabberCapabilitiesManager::Capabilities::Capabilities(const QString& node, const QString& version, const QString& extensions)
+JabberCapabilitiesManager::Capabilities::Capabilities(const TQString& node, const TQString& version, const TQString& extensions)
: m_node(node), m_version(version), m_extensions(extensions)
{}
-const QString& JabberCapabilitiesManager::Capabilities::node() const
+const TQString& JabberCapabilitiesManager::Capabilities::node() const
{
return m_node;
}
-const QString& JabberCapabilitiesManager::Capabilities::version() const
+const TQString& JabberCapabilitiesManager::Capabilities::version() const
{
return m_version;
}
-const QString& JabberCapabilitiesManager::Capabilities::extensions() const
+const TQString& JabberCapabilitiesManager::Capabilities::extensions() const
{
return m_extensions;
}
@@ -64,8 +64,8 @@ JabberCapabilitiesManager::CapabilitiesList JabberCapabilitiesManager::Capabilit
CapabilitiesList capsList;
capsList.append( Capabilities(node(), version(), version()) );
- QStringList extensionList = QStringList::split(" ",extensions());
- QStringList::ConstIterator it, itEnd = extensionList.constEnd();
+ TQStringList extensionList = TQStringList::split(" ",extensions());
+ TQStringList::ConstIterator it, itEnd = extensionList.constEnd();
for(it = extensionList.constBegin(); it != itEnd; ++it)
{
capsList.append( Capabilities(node(),version(),*it) );
@@ -99,7 +99,7 @@ JabberCapabilitiesManager::CapabilitiesInformation::CapabilitiesInformation()
updateLastSeen();
}
-const QStringList& JabberCapabilitiesManager::CapabilitiesInformation::features() const
+const TQStringList& JabberCapabilitiesManager::CapabilitiesInformation::features() const
{
return m_features;
}
@@ -109,14 +109,14 @@ const DiscoItem::Identities& JabberCapabilitiesManager::CapabilitiesInformation:
return m_identities;
}
-QStringList JabberCapabilitiesManager::CapabilitiesInformation::jids() const
+TQStringList JabberCapabilitiesManager::CapabilitiesInformation::jids() const
{
- QStringList jids;
+ TQStringList jids;
- QValueList<QPair<QString,JabberAccount*> >::ConstIterator it = m_jids.constBegin(), itEnd = m_jids.constEnd();
+ TQValueList<QPair<TQString,JabberAccount*> >::ConstIterator it = m_jids.constBegin(), itEnd = m_jids.constEnd();
for( ; it != itEnd; ++it)
{
- QString jid( (*it).first );
+ TQString jid( (*it).first );
if( !jids.contains(jid) )
jids.push_back(jid);
}
@@ -143,12 +143,12 @@ void JabberCapabilitiesManager::CapabilitiesInformation::reset()
void JabberCapabilitiesManager::CapabilitiesInformation::removeAccount(JabberAccount *account)
{
- QValueList<QPair<QString,JabberAccount*> >::Iterator it = m_jids.begin();
+ TQValueList<QPair<TQString,JabberAccount*> >::Iterator it = m_jids.begin();
while( it != m_jids.end() )
{
if( (*it).second == account)
{
- QValueList<QPair<QString,JabberAccount*> >::Iterator otherIt = it;
+ TQValueList<QPair<TQString,JabberAccount*> >::Iterator otherIt = it;
it++;
m_jids.remove(otherIt);
}
@@ -161,7 +161,7 @@ void JabberCapabilitiesManager::CapabilitiesInformation::removeAccount(JabberAcc
void JabberCapabilitiesManager::CapabilitiesInformation::addJid(const Jid& jid, JabberAccount* account)
{
- QPair<QString,JabberAccount*> jidAccountPair(jid.full(),account);
+ QPair<TQString,JabberAccount*> jidAccountPair(jid.full(),account);
if( !m_jids.contains(jidAccountPair) )
{
@@ -172,14 +172,14 @@ void JabberCapabilitiesManager::CapabilitiesInformation::addJid(const Jid& jid,
void JabberCapabilitiesManager::CapabilitiesInformation::removeJid(const Jid& jid)
{
- kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Unregistering " << QString(jid.full()).replace('%',"%%") << endl;
+ kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Unregistering " << TQString(jid.full()).replace('%',"%%") << endl;
- QValueList<QPair<QString,JabberAccount*> >::Iterator it = m_jids.begin();
+ TQValueList<QPair<TQString,JabberAccount*> >::Iterator it = m_jids.begin();
while( it != m_jids.end() )
{
if( (*it).first == jid.full() )
{
- QValueList<QPair<QString,JabberAccount*> >::Iterator otherIt = it;
+ TQValueList<QPair<TQString,JabberAccount*> >::Iterator otherIt = it;
it++;
m_jids.remove(otherIt);
}
@@ -194,7 +194,7 @@ QPair<Jid,JabberAccount*> JabberCapabilitiesManager::CapabilitiesInformation::ne
{
kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Looking for next JID" << endl;
- QValueList<QPair<QString,JabberAccount*> >::ConstIterator it = m_jids.constBegin(), itEnd = m_jids.constEnd();
+ TQValueList<QPair<TQString,JabberAccount*> >::ConstIterator it = m_jids.constBegin(), itEnd = m_jids.constEnd();
for( ; it != itEnd; ++it)
{
if( (*it).first == jid.full() && (*it).second->client()->rootTask() == t)
@@ -233,26 +233,26 @@ void JabberCapabilitiesManager::CapabilitiesInformation::setIdentities(const Dis
m_identities = identities;
}
-void JabberCapabilitiesManager::CapabilitiesInformation::setFeatures(const QStringList& featureList)
+void JabberCapabilitiesManager::CapabilitiesInformation::setFeatures(const TQStringList& featureList)
{
m_features = featureList;
}
void JabberCapabilitiesManager::CapabilitiesInformation::updateLastSeen()
{
- m_lastSeen = QDate::currentDate();
+ m_lastSeen = TQDate::currentDate();
}
-QDomElement JabberCapabilitiesManager::CapabilitiesInformation::toXml(QDomDocument *doc) const
+TQDomElement JabberCapabilitiesManager::CapabilitiesInformation::toXml(TQDomDocument *doc) const
{
- QDomElement info = doc->createElement("info");
+ TQDomElement info = doc->createElement("info");
//info.setAttribute("last-seen",lastSeen_.toString(Qt::ISODate));
// Identities
DiscoItem::Identities::ConstIterator discoIt = m_identities.constBegin(), discoItEnd = m_identities.constEnd();
for( ; discoIt != discoItEnd; ++discoIt )
{
- QDomElement identity = doc->createElement("identity");
+ TQDomElement identity = doc->createElement("identity");
identity.setAttribute("category",(*discoIt).category);
identity.setAttribute("name",(*discoIt).name);
identity.setAttribute("type",(*discoIt).type);
@@ -260,10 +260,10 @@ QDomElement JabberCapabilitiesManager::CapabilitiesInformation::toXml(QDomDocume
}
// Features
- QStringList::ConstIterator featuresIt = m_features.constBegin(), featuresItEnd = m_features.constEnd();
+ TQStringList::ConstIterator featuresIt = m_features.constBegin(), featuresItEnd = m_features.constEnd();
for( ; featuresIt != featuresItEnd; ++featuresIt )
{
- QDomElement feature = doc->createElement("feature");
+ TQDomElement feature = doc->createElement("feature");
feature.setAttribute("node",*featuresIt);
info.appendChild(feature);
}
@@ -271,7 +271,7 @@ QDomElement JabberCapabilitiesManager::CapabilitiesInformation::toXml(QDomDocume
return info;
}
-void JabberCapabilitiesManager::CapabilitiesInformation::fromXml(const QDomElement &element)
+void JabberCapabilitiesManager::CapabilitiesInformation::fromXml(const TQDomElement &element)
{
if( element.tagName() != "info")
{
@@ -280,11 +280,11 @@ void JabberCapabilitiesManager::CapabilitiesInformation::fromXml(const QDomEleme
}
//if (!e.attribute("last-seen").isEmpty())
- // lastSeen_ = QDate::fromString(e.attribute("last-seen"),Qt::ISODate);
+ // lastSeen_ = TQDate::fromString(e.attribute("last-seen"),Qt::ISODate);
- for(QDomNode node = element.firstChild(); !node.isNull(); node = node.nextSibling())
+ for(TQDomNode node = element.firstChild(); !node.isNull(); node = node.nextSibling())
{
- QDomElement infoElement = node.toElement();
+ TQDomElement infoElement = node.toElement();
if( infoElement.isNull() )
{
kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Null element" << endl;
@@ -321,9 +321,9 @@ public:
{}
// Map a full jid to a capabilities
- QMap<QString,Capabilities> jidCapabilitiesMap;
+ TQMap<TQString,Capabilities> jidCapabilitiesMap;
// Map a capabilities to its detail information
- QMap<Capabilities,CapabilitiesInformation> capabilitiesInformationMap;
+ TQMap<Capabilities,CapabilitiesInformation> capabilitiesInformationMap;
};
//END Private(d-ptr)
@@ -342,9 +342,9 @@ void JabberCapabilitiesManager::removeAccount(JabberAccount *account)
{
kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Removing account " << account->accountId() << endl;
- QValueList<CapabilitiesInformation> info = d->capabilitiesInformationMap.values();
+ TQValueList<CapabilitiesInformation> info = d->capabilitiesInformationMap.values();
- QValueList<CapabilitiesInformation>::Iterator it, itEnd = info.end();
+ TQValueList<CapabilitiesInformation>::Iterator it, itEnd = info.end();
for(it = info.begin(); it != info.end(); ++it)
{
(*it).removeAccount(account);
@@ -362,7 +362,7 @@ void JabberCapabilitiesManager::updateCapabilities(JabberAccount *account, const
if( jid.compare(account->client()->jid(), false) )
return;
- QString node = status.capsNode(), version = status.capsVersion(), extensions = status.capsExt();
+ TQString node = status.capsNode(), version = status.capsVersion(), extensions = status.capsExt();
Capabilities capabilities( node, version, extensions );
// Check if the capabilities was really updated(i.e the content is different)
@@ -400,7 +400,7 @@ void JabberCapabilitiesManager::updateCapabilities(JabberAccount *account, const
{
if( !d->capabilitiesInformationMap[*newCapsIt].discovered() && d->capabilitiesInformationMap[*newCapsIt].pendingRequests() == 0 )
{
- kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << QString("Sending disco request to %1, node=%2").arg(QString(jid.full()).replace('%',"%%")).arg(node + "#" + (*newCapsIt).extensions()) << endl;
+ kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << TQString("Sending disco request to %1, node=%2").arg(TQString(jid.full()).replace('%',"%%")).arg(node + "#" + (*newCapsIt).extensions()) << endl;
d->capabilitiesInformationMap[*newCapsIt].setPendingRequests(1);
requestDiscoInfo(account, jid, node + "#" + (*newCapsIt).extensions());
@@ -410,7 +410,7 @@ void JabberCapabilitiesManager::updateCapabilities(JabberAccount *account, const
else
{
// Remove all caps specifications
- kdDebug(JABBER_DEBUG_GLOBAL) << QString("Illegal caps info from %1: node=%2, ver=%3").arg(QString(jid.full()).replace('%',"%%")).arg(node).arg(version) << endl;
+ kdDebug(JABBER_DEBUG_GLOBAL) << TQString("Illegal caps info from %1: node=%2, ver=%3").arg(TQString(jid.full()).replace('%',"%%")).arg(node).arg(version) << endl;
d->jidCapabilitiesMap.remove( jid.full() );
}
@@ -427,13 +427,13 @@ void JabberCapabilitiesManager::updateCapabilities(JabberAccount *account, const
}
}
-void JabberCapabilitiesManager::requestDiscoInfo(JabberAccount *account, const Jid& jid, const QString& node)
+void JabberCapabilitiesManager::requestDiscoInfo(JabberAccount *account, const Jid& jid, const TQString& node)
{
if( !account->client()->rootTask() )
return;
JT_DiscoInfo *discoInfo = new JT_DiscoInfo(account->client()->rootTask());
- connect(discoInfo, SIGNAL(finished()), SLOT(discoRequestFinished()));
+ connect(discoInfo, TQT_SIGNAL(finished()), TQT_SLOT(discoRequestFinished()));
discoInfo->get(jid, node);
//pending_++;
//timer_.start(REQUEST_TIMEOUT,true);
@@ -448,14 +448,14 @@ void JabberCapabilitiesManager::discoRequestFinished()
DiscoItem item = discoInfo->item();
Jid jid = discoInfo->jid();
- kdDebug(JABBER_DEBUG_GLOBAL) << QString("Disco response from %1, node=%2, success=%3").arg(QString(jid.full()).replace('%',"%%")).arg(discoInfo->node()).arg(discoInfo->success()) << endl;
+ kdDebug(JABBER_DEBUG_GLOBAL) << TQString("Disco response from %1, node=%2, success=%3").arg(TQString(jid.full()).replace('%',"%%")).arg(discoInfo->node()).arg(discoInfo->success()) << endl;
- QStringList tokens = QStringList::split("#",discoInfo->node());
+ TQStringList tokens = TQStringList::split("#",discoInfo->node());
// Update features
Q_ASSERT(tokens.count() == 2);
- QString node = tokens[0];
- QString extensions = tokens[1];
+ TQString node = tokens[0];
+ TQString extensions = tokens[1];
Capabilities jidCapabilities = d->jidCapabilitiesMap[jid.full()];
if( jidCapabilities.node() == node )
@@ -474,8 +474,8 @@ void JabberCapabilitiesManager::discoRequestFinished()
saveInformation();
// Notify affected jids.
- QStringList jids = d->capabilitiesInformationMap[capabilities].jids();
- QStringList::ConstIterator jidsIt = jids.constBegin(), jidsItEnd = jids.constEnd();
+ TQStringList jids = d->capabilitiesInformationMap[capabilities].jids();
+ TQStringList::ConstIterator jidsIt = jids.constBegin(), jidsItEnd = jids.constEnd();
for( ; jidsIt != jidsItEnd; ++jidsItEnd )
{
emit capabilitiesChanged(*jidsIt);
@@ -486,7 +486,7 @@ void JabberCapabilitiesManager::discoRequestFinished()
QPair<Jid,JabberAccount*> jidAccountPair = d->capabilitiesInformationMap[capabilities].nextJid(jid,discoInfo->parent());
if( jidAccountPair.second )
{
- kdDebug(JABBER_DEBUG_GLOBAL) << QString("Falling back on %1.").arg(QString(jidAccountPair.first.full()).replace('%',"%%")) << endl;
+ kdDebug(JABBER_DEBUG_GLOBAL) << TQString("Falling back on %1.").arg(TQString(jidAccountPair.first.full()).replace('%',"%%")) << endl;
requestDiscoInfo( jidAccountPair.second, jidAccountPair.first, discoInfo->node() );
}
else
@@ -497,7 +497,7 @@ void JabberCapabilitiesManager::discoRequestFinished()
}
}
else
- kdDebug(JABBER_DEBUG_GLOBAL) << QString("Current client node '%1' does not match response '%2'").arg(jidCapabilities.node()).arg(node) << endl;
+ kdDebug(JABBER_DEBUG_GLOBAL) << TQString("Current client node '%1' does not match response '%2'").arg(jidCapabilities.node()).arg(node) << endl;
//for (unsigned int i = 0; i < item.features().list().count(); i++)
// printf(" Feature: %s\n",item.features().list()[i].latin1());
@@ -512,12 +512,12 @@ void JabberCapabilitiesManager::discoRequestFinished()
void JabberCapabilitiesManager::loadCachedInformation()
{
- QString capsFileName;
- capsFileName = locateLocal("appdata", QString::fromUtf8("jabber-capabilities-cache.xml"));
+ TQString capsFileName;
+ capsFileName = locateLocal("appdata", TQString::fromUtf8("jabber-capabilities-cache.xml"));
// Load settings
- QDomDocument doc;
- QFile cacheFile(capsFileName);
+ TQDomDocument doc;
+ TQFile cacheFile(capsFileName);
if( !cacheFile.open(IO_ReadOnly) )
{
kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Could not open the Capabilities cache from disk." << endl;
@@ -530,17 +530,17 @@ void JabberCapabilitiesManager::loadCachedInformation()
}
cacheFile.close();
- QDomElement caps = doc.documentElement();
+ TQDomElement caps = doc.documentElement();
if( caps.tagName() != "capabilities" )
{
kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Invalid capabilities element." << endl;
return;
}
- QDomNode node;
+ TQDomNode node;
for(node = caps.firstChild(); !node.isNull(); node = node.nextSibling())
{
- QDomElement element = node.toElement();
+ TQDomElement element = node.toElement();
if( element.isNull() )
{
kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Found a null element." << endl;
@@ -568,7 +568,7 @@ bool JabberCapabilitiesManager::capabilitiesEnabled(const Jid &jid) const
XMPP::Features JabberCapabilitiesManager::features(const Jid& jid) const
{
- QStringList featuresList;
+ TQStringList featuresList;
if( capabilitiesEnabled(jid) )
{
@@ -583,12 +583,12 @@ XMPP::Features JabberCapabilitiesManager::features(const Jid& jid) const
return Features(featuresList);
}
-QString JabberCapabilitiesManager::clientName(const Jid& jid) const
+TQString JabberCapabilitiesManager::clientName(const Jid& jid) const
{
if( capabilitiesEnabled(jid) )
{
Capabilities caps = d->jidCapabilitiesMap[jid.full()];
- QString name = d->capabilitiesInformationMap[Capabilities(caps.node(),caps.version(),caps.version())].identities().first().name;
+ TQString name = d->capabilitiesInformationMap[Capabilities(caps.node(),caps.version(),caps.version())].identities().first().name;
// Try to be intelligent about the name
/*if (name.isEmpty()) {
@@ -609,28 +609,28 @@ QString JabberCapabilitiesManager::clientName(const Jid& jid) const
}
else
{
- return QString();
+ return TQString();
}
}
-QString JabberCapabilitiesManager::clientVersion(const Jid& jid) const
+TQString JabberCapabilitiesManager::clientVersion(const Jid& jid) const
{
- return (capabilitiesEnabled(jid) ? d->jidCapabilitiesMap[jid.full()].version() : QString());
+ return (capabilitiesEnabled(jid) ? d->jidCapabilitiesMap[jid.full()].version() : TQString());
}
void JabberCapabilitiesManager::saveInformation()
{
- QString capsFileName;
- capsFileName = locateLocal("appdata", QString::fromUtf8("jabber-capabilities-cache.xml"));
+ TQString capsFileName;
+ capsFileName = locateLocal("appdata", TQString::fromUtf8("jabber-capabilities-cache.xml"));
// Generate XML
- QDomDocument doc;
- QDomElement capabilities = doc.createElement("capabilities");
+ TQDomDocument doc;
+ TQDomElement capabilities = doc.createElement("capabilities");
doc.appendChild(capabilities);
- QMap<Capabilities,CapabilitiesInformation>::ConstIterator it = d->capabilitiesInformationMap.constBegin(), itEnd = d->capabilitiesInformationMap.constEnd();
+ TQMap<Capabilities,CapabilitiesInformation>::ConstIterator it = d->capabilitiesInformationMap.constBegin(), itEnd = d->capabilitiesInformationMap.constEnd();
for( ; it != itEnd; ++it )
{
- QDomElement info = it.data().toXml(&doc);
+ TQDomElement info = it.data().toXml(&doc);
info.setAttribute("node",it.key().node());
info.setAttribute("ver",it.key().version());
info.setAttribute("ext",it.key().extensions());
@@ -638,16 +638,16 @@ void JabberCapabilitiesManager::saveInformation()
}
// Save
- QFile capsFile(capsFileName);
+ TQFile capsFile(capsFileName);
if( !capsFile.open(IO_WriteOnly) )
{
kdDebug(JABBER_DEBUG_GLOBAL ) << k_funcinfo << "Error while opening Capabilities cache file." << endl;
return;
}
- QTextStream textStream;
+ TQTextStream textStream;
textStream.setDevice(&capsFile);
- textStream.setEncoding(QTextStream::UnicodeUTF8);
+ textStream.setEncoding(TQTextStream::UnicodeUTF8);
textStream << doc.toString();
textStream.unsetDevice();
capsFile.close();