summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-02-14 18:57:18 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-02-14 21:36:32 (GMT)
commitcb05f5a908e20006c954ce38755c2e422ecc2388 (patch)
treea793551a5fe279a57d4330119560e8542f745484 /Swiften/Disco
parentcad974b45c0fb9355e68d9728e42c9ae3dbcebc7 (diff)
downloadswift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.zip
swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.tar.bz2
Removed Swift::String.
Diffstat (limited to 'Swiften/Disco')
-rw-r--r--Swiften/Disco/CapsFileStorage.cpp10
-rw-r--r--Swiften/Disco/CapsFileStorage.h8
-rw-r--r--Swiften/Disco/CapsInfoGenerator.cpp14
-rw-r--r--Swiften/Disco/CapsInfoGenerator.h6
-rw-r--r--Swiften/Disco/CapsManager.cpp12
-rw-r--r--Swiften/Disco/CapsManager.h12
-rw-r--r--Swiften/Disco/CapsMemoryStorage.h8
-rw-r--r--Swiften/Disco/CapsProvider.h6
-rw-r--r--Swiften/Disco/CapsStorage.h6
-rw-r--r--Swiften/Disco/ClientDiscoManager.cpp2
-rw-r--r--Swiften/Disco/ClientDiscoManager.h4
-rw-r--r--Swiften/Disco/DiscoInfoResponder.cpp8
-rw-r--r--Swiften/Disco/DiscoInfoResponder.h6
-rw-r--r--Swiften/Disco/EntityCapsManager.cpp16
-rw-r--r--Swiften/Disco/EntityCapsManager.h4
-rw-r--r--Swiften/Disco/GetDiscoInfoRequest.h4
-rw-r--r--Swiften/Disco/JIDDiscoInfoResponder.cpp8
-rw-r--r--Swiften/Disco/JIDDiscoInfoResponder.h6
-rw-r--r--Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp10
-rw-r--r--Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp4
-rw-r--r--Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp6
-rw-r--r--Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp4
22 files changed, 82 insertions, 82 deletions
diff --git a/Swiften/Disco/CapsFileStorage.cpp b/Swiften/Disco/CapsFileStorage.cpp
index 107cf28..2334acf 100644
--- a/Swiften/Disco/CapsFileStorage.cpp
+++ b/Swiften/Disco/CapsFileStorage.cpp
@@ -21,7 +21,7 @@ namespace Swift {
CapsFileStorage::CapsFileStorage(const boost::filesystem::path& path) : path(path) {
}
-DiscoInfo::ref CapsFileStorage::getDiscoInfo(const String& hash) const {
+DiscoInfo::ref CapsFileStorage::getDiscoInfo(const std::string& hash) const {
boost::filesystem::path capsPath(getCapsPath(hash));
if (boost::filesystem::exists(capsPath)) {
ByteArray data;
@@ -29,7 +29,7 @@ DiscoInfo::ref CapsFileStorage::getDiscoInfo(const String& hash) const {
DiscoInfoParser parser;
PayloadParserTester tester(&parser);
- tester.parse(String(data.getData(), data.getSize()));
+ tester.parse(std::string(data.getData(), data.getSize()));
return boost::dynamic_pointer_cast<DiscoInfo>(parser.getPayload());
}
else {
@@ -37,7 +37,7 @@ DiscoInfo::ref CapsFileStorage::getDiscoInfo(const String& hash) const {
}
}
-void CapsFileStorage::setDiscoInfo(const String& hash, DiscoInfo::ref discoInfo) {
+void CapsFileStorage::setDiscoInfo(const std::string& hash, DiscoInfo::ref discoInfo) {
boost::filesystem::path capsPath(getCapsPath(hash));
if (!boost::filesystem::exists(capsPath.parent_path())) {
try {
@@ -54,8 +54,8 @@ void CapsFileStorage::setDiscoInfo(const String& hash, DiscoInfo::ref discoInfo)
file.close();
}
-boost::filesystem::path CapsFileStorage::getCapsPath(const String& hash) const {
- return path / (Hexify::hexify(Base64::decode(hash)) + ".xml").getUTF8String();
+boost::filesystem::path CapsFileStorage::getCapsPath(const std::string& hash) const {
+ return path / (Hexify::hexify(Base64::decode(hash)) + ".xml");
}
}
diff --git a/Swiften/Disco/CapsFileStorage.h b/Swiften/Disco/CapsFileStorage.h
index ea1b1a2..5faf08b 100644
--- a/Swiften/Disco/CapsFileStorage.h
+++ b/Swiften/Disco/CapsFileStorage.h
@@ -9,18 +9,18 @@
#include <boost/filesystem.hpp>
#include "Swiften/Disco/CapsStorage.h"
-#include "Swiften/Base/String.h"
+#include <string>
namespace Swift {
class CapsFileStorage : public CapsStorage {
public:
CapsFileStorage(const boost::filesystem::path& path);
- virtual DiscoInfo::ref getDiscoInfo(const String& hash) const;
- virtual void setDiscoInfo(const String& hash, DiscoInfo::ref discoInfo);
+ virtual DiscoInfo::ref getDiscoInfo(const std::string& hash) const;
+ virtual void setDiscoInfo(const std::string& hash, DiscoInfo::ref discoInfo);
private:
- boost::filesystem::path getCapsPath(const String& hash) const;
+ boost::filesystem::path getCapsPath(const std::string& hash) const;
private:
boost::filesystem::path path;
diff --git a/Swiften/Disco/CapsInfoGenerator.cpp b/Swiften/Disco/CapsInfoGenerator.cpp
index 94f2a7a..5c0e9a7 100644
--- a/Swiften/Disco/CapsInfoGenerator.cpp
+++ b/Swiften/Disco/CapsInfoGenerator.cpp
@@ -22,11 +22,11 @@ namespace {
namespace Swift {
-CapsInfoGenerator::CapsInfoGenerator(const String& node) : node_(node) {
+CapsInfoGenerator::CapsInfoGenerator(const std::string& node) : node_(node) {
}
CapsInfo CapsInfoGenerator::generateCapsInfo(const DiscoInfo& discoInfo) const {
- String serializedCaps;
+ std::string serializedCaps;
std::vector<DiscoInfo::Identity> identities(discoInfo.getIdentities());
std::sort(identities.begin(), identities.end());
@@ -34,9 +34,9 @@ CapsInfo CapsInfoGenerator::generateCapsInfo(const DiscoInfo& discoInfo) const {
serializedCaps += identity.getCategory() + "/" + identity.getType() + "/" + identity.getLanguage() + "/" + identity.getName() + "<";
}
- std::vector<String> features(discoInfo.getFeatures());
+ std::vector<std::string> features(discoInfo.getFeatures());
std::sort(features.begin(), features.end());
- foreach (const String& feature, features) {
+ foreach (const std::string& feature, features) {
serializedCaps += feature + "<";
}
@@ -49,15 +49,15 @@ CapsInfo CapsInfoGenerator::generateCapsInfo(const DiscoInfo& discoInfo) const {
continue;
}
serializedCaps += field->getName() + "<";
- std::vector<String> values(field->getRawValues());
+ std::vector<std::string> values(field->getRawValues());
std::sort(values.begin(), values.end());
- foreach(const String& value, values) {
+ foreach(const std::string& value, values) {
serializedCaps += value + "<";
}
}
}
- String version(Base64::encode(SHA1::getHash(serializedCaps)));
+ std::string version(Base64::encode(SHA1::getHash(serializedCaps)));
return CapsInfo(node_, version, "sha-1");
}
diff --git a/Swiften/Disco/CapsInfoGenerator.h b/Swiften/Disco/CapsInfoGenerator.h
index cc32bbd..41a1d94 100644
--- a/Swiften/Disco/CapsInfoGenerator.h
+++ b/Swiften/Disco/CapsInfoGenerator.h
@@ -6,7 +6,7 @@
#pragma once
-#include "Swiften/Base/String.h"
+#include <string>
#include "Swiften/Elements/CapsInfo.h"
namespace Swift {
@@ -14,11 +14,11 @@ namespace Swift {
class CapsInfoGenerator {
public:
- CapsInfoGenerator(const String& node);
+ CapsInfoGenerator(const std::string& node);
CapsInfo generateCapsInfo(const DiscoInfo& discoInfo) const;
private:
- String node_;
+ std::string node_;
};
}
diff --git a/Swiften/Disco/CapsManager.cpp b/Swiften/Disco/CapsManager.cpp
index 1c785e5..63166e6 100644
--- a/Swiften/Disco/CapsManager.cpp
+++ b/Swiften/Disco/CapsManager.cpp
@@ -26,7 +26,7 @@ void CapsManager::handlePresenceReceived(boost::shared_ptr<Presence> presence) {
if (!capsInfo || capsInfo->getHash() != "sha-1" || presence->getPayload<ErrorPayload>()) {
return;
}
- String hash = capsInfo->getVersion();
+ std::string hash = capsInfo->getVersion();
if (capsStorage->getDiscoInfo(hash)) {
return;
}
@@ -48,16 +48,16 @@ void CapsManager::handleStanzaChannelAvailableChanged(bool available) {
}
}
-void CapsManager::handleDiscoInfoReceived(const JID& from, const String& hash, DiscoInfo::ref discoInfo, ErrorPayload::ref error) {
+void CapsManager::handleDiscoInfoReceived(const JID& from, const std::string& hash, DiscoInfo::ref discoInfo, ErrorPayload::ref error) {
requestedDiscoInfos.erase(hash);
if (error || CapsInfoGenerator("").generateCapsInfo(*discoInfo.get()).getVersion() != hash) {
if (warnOnInvalidHash && !error) {
std::cerr << "Warning: Caps from " << from.toString() << " do not verify" << std::endl;
}
failingCaps.insert(std::make_pair(from, hash));
- std::map<String, std::set< std::pair<JID, String> > >::iterator i = fallbacks.find(hash);
+ std::map<std::string, std::set< std::pair<JID, std::string> > >::iterator i = fallbacks.find(hash);
if (i != fallbacks.end() && !i->second.empty()) {
- std::pair<JID,String> fallbackAndNode = *i->second.begin();
+ std::pair<JID,std::string> fallbackAndNode = *i->second.begin();
i->second.erase(i->second.begin());
requestDiscoInfo(fallbackAndNode.first, fallbackAndNode.second, hash);
}
@@ -68,14 +68,14 @@ void CapsManager::handleDiscoInfoReceived(const JID& from, const String& hash, D
onCapsAvailable(hash);
}
-void CapsManager::requestDiscoInfo(const JID& jid, const String& node, const String& hash) {
+void CapsManager::requestDiscoInfo(const JID& jid, const std::string& node, const std::string& hash) {
GetDiscoInfoRequest::ref request = GetDiscoInfoRequest::create(jid, node + "#" + hash, iqRouter);
request->onResponse.connect(boost::bind(&CapsManager::handleDiscoInfoReceived, this, jid, hash, _1, _2));
requestedDiscoInfos.insert(hash);
request->send();
}
-DiscoInfo::ref CapsManager::getCaps(const String& hash) const {
+DiscoInfo::ref CapsManager::getCaps(const std::string& hash) const {
return capsStorage->getDiscoInfo(hash);
}
diff --git a/Swiften/Disco/CapsManager.h b/Swiften/Disco/CapsManager.h
index 842f2be..961dae8 100644
--- a/Swiften/Disco/CapsManager.h
+++ b/Swiften/Disco/CapsManager.h
@@ -26,7 +26,7 @@ namespace Swift {
public:
CapsManager(CapsStorage*, StanzaChannel*, IQRouter*);
- DiscoInfo::ref getCaps(const String&) const;
+ DiscoInfo::ref getCaps(const std::string&) const;
// Mainly for testing purposes
void setWarnOnInvalidHash(bool b) {
@@ -36,15 +36,15 @@ namespace Swift {
private:
void handlePresenceReceived(boost::shared_ptr<Presence>);
void handleStanzaChannelAvailableChanged(bool);
- void handleDiscoInfoReceived(const JID&, const String& hash, DiscoInfo::ref, ErrorPayload::ref);
- void requestDiscoInfo(const JID& jid, const String& node, const String& hash);
+ void handleDiscoInfoReceived(const JID&, const std::string& hash, DiscoInfo::ref, ErrorPayload::ref);
+ void requestDiscoInfo(const JID& jid, const std::string& node, const std::string& hash);
private:
IQRouter* iqRouter;
CapsStorage* capsStorage;
bool warnOnInvalidHash;
- std::set<String> requestedDiscoInfos;
- std::set< std::pair<JID, String> > failingCaps;
- std::map<String, std::set< std::pair<JID, String> > > fallbacks;
+ std::set<std::string> requestedDiscoInfos;
+ std::set< std::pair<JID, std::string> > failingCaps;
+ std::map<std::string, std::set< std::pair<JID, std::string> > > fallbacks;
};
}
diff --git a/Swiften/Disco/CapsMemoryStorage.h b/Swiften/Disco/CapsMemoryStorage.h
index 71bd5d5..1e2d7be 100644
--- a/Swiften/Disco/CapsMemoryStorage.h
+++ b/Swiften/Disco/CapsMemoryStorage.h
@@ -9,7 +9,7 @@
#include <boost/shared_ptr.hpp>
#include <map>
-#include "Swiften/Base/String.h"
+#include <string>
#include "Swiften/Disco/CapsStorage.h"
namespace Swift {
@@ -17,7 +17,7 @@ namespace Swift {
public:
CapsMemoryStorage() {}
- virtual DiscoInfo::ref getDiscoInfo(const String& hash) const {
+ virtual DiscoInfo::ref getDiscoInfo(const std::string& hash) const {
CapsMap::const_iterator i = caps.find(hash);
if (i != caps.end()) {
return i->second;
@@ -27,12 +27,12 @@ namespace Swift {
}
}
- virtual void setDiscoInfo(const String& hash, DiscoInfo::ref discoInfo) {
+ virtual void setDiscoInfo(const std::string& hash, DiscoInfo::ref discoInfo) {
caps[hash] = discoInfo;
}
private:
- typedef std::map<String, DiscoInfo::ref> CapsMap;
+ typedef std::map<std::string, DiscoInfo::ref> CapsMap;
CapsMap caps;
};
}
diff --git a/Swiften/Disco/CapsProvider.h b/Swiften/Disco/CapsProvider.h
index 815391a..71e2741 100644
--- a/Swiften/Disco/CapsProvider.h
+++ b/Swiften/Disco/CapsProvider.h
@@ -11,14 +11,14 @@
#include "Swiften/Elements/CapsInfo.h"
namespace Swift {
- class String;
+
class CapsProvider {
public:
virtual ~CapsProvider() {}
- virtual DiscoInfo::ref getCaps(const String&) const = 0;
+ virtual DiscoInfo::ref getCaps(const std::string&) const = 0;
- boost::signal<void (const String&)> onCapsAvailable;
+ boost::signal<void (const std::string&)> onCapsAvailable;
};
}
diff --git a/Swiften/Disco/CapsStorage.h b/Swiften/Disco/CapsStorage.h
index e4ff945..f0a71a3 100644
--- a/Swiften/Disco/CapsStorage.h
+++ b/Swiften/Disco/CapsStorage.h
@@ -11,13 +11,13 @@
#include "Swiften/Elements/DiscoInfo.h"
namespace Swift {
- class String;
+
class CapsStorage {
public:
virtual ~CapsStorage();
- virtual DiscoInfo::ref getDiscoInfo(const String&) const = 0;
- virtual void setDiscoInfo(const String&, DiscoInfo::ref) = 0;
+ virtual DiscoInfo::ref getDiscoInfo(const std::string&) const = 0;
+ virtual void setDiscoInfo(const std::string&, DiscoInfo::ref) = 0;
};
}
diff --git a/Swiften/Disco/ClientDiscoManager.cpp b/Swiften/Disco/ClientDiscoManager.cpp
index 6753df2..fb7cce9 100644
--- a/Swiften/Disco/ClientDiscoManager.cpp
+++ b/Swiften/Disco/ClientDiscoManager.cpp
@@ -24,7 +24,7 @@ ClientDiscoManager::~ClientDiscoManager() {
delete discoInfoResponder;
}
-void ClientDiscoManager::setCapsNode(const String& node) {
+void ClientDiscoManager::setCapsNode(const std::string& node) {
capsNode = node;
}
diff --git a/Swiften/Disco/ClientDiscoManager.h b/Swiften/Disco/ClientDiscoManager.h
index b997374..3771044 100644
--- a/Swiften/Disco/ClientDiscoManager.h
+++ b/Swiften/Disco/ClientDiscoManager.h
@@ -41,7 +41,7 @@ namespace Swift {
/**
* Needs to be called before calling setDiscoInfo().
*/
- void setCapsNode(const String& node);
+ void setCapsNode(const std::string& node);
/**
* Sets the capabilities of the client.
@@ -61,7 +61,7 @@ namespace Swift {
private:
PayloadAddingPresenceSender* presenceSender;
DiscoInfoResponder* discoInfoResponder;
- String capsNode;
+ std::string capsNode;
CapsInfo::ref capsInfo;
};
}
diff --git a/Swiften/Disco/DiscoInfoResponder.cpp b/Swiften/Disco/DiscoInfoResponder.cpp
index 0254ad9..7ba044e 100644
--- a/Swiften/Disco/DiscoInfoResponder.cpp
+++ b/Swiften/Disco/DiscoInfoResponder.cpp
@@ -22,18 +22,18 @@ void DiscoInfoResponder::setDiscoInfo(const DiscoInfo& info) {
info_ = info;
}
-void DiscoInfoResponder::setDiscoInfo(const String& node, const DiscoInfo& info) {
+void DiscoInfoResponder::setDiscoInfo(const std::string& node, const DiscoInfo& info) {
DiscoInfo newInfo(info);
newInfo.setNode(node);
nodeInfo_[node] = newInfo;
}
-bool DiscoInfoResponder::handleGetRequest(const JID& from, const JID&, const String& id, boost::shared_ptr<DiscoInfo> info) {
- if (info->getNode().isEmpty()) {
+bool DiscoInfoResponder::handleGetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<DiscoInfo> info) {
+ if (info->getNode().empty()) {
sendResponse(from, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo(info_)));
}
else {
- std::map<String,DiscoInfo>::const_iterator i = nodeInfo_.find(info->getNode());
+ std::map<std::string,DiscoInfo>::const_iterator i = nodeInfo_.find(info->getNode());
if (i != nodeInfo_.end()) {
sendResponse(from, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo((*i).second)));
}
diff --git a/Swiften/Disco/DiscoInfoResponder.h b/Swiften/Disco/DiscoInfoResponder.h
index 3861ffd..f114a21 100644
--- a/Swiften/Disco/DiscoInfoResponder.h
+++ b/Swiften/Disco/DiscoInfoResponder.h
@@ -20,13 +20,13 @@ namespace Swift {
void clearDiscoInfo();
void setDiscoInfo(const DiscoInfo& info);
- void setDiscoInfo(const String& node, const DiscoInfo& info);
+ void setDiscoInfo(const std::string& node, const DiscoInfo& info);
private:
- virtual bool handleGetRequest(const JID& from, const JID& to, const String& id, boost::shared_ptr<DiscoInfo> payload);
+ virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<DiscoInfo> payload);
private:
DiscoInfo info_;
- std::map<String, DiscoInfo> nodeInfo_;
+ std::map<std::string, DiscoInfo> nodeInfo_;
};
}
diff --git a/Swiften/Disco/EntityCapsManager.cpp b/Swiften/Disco/EntityCapsManager.cpp
index 26e0594..3f2e3d7 100644
--- a/Swiften/Disco/EntityCapsManager.cpp
+++ b/Swiften/Disco/EntityCapsManager.cpp
@@ -26,8 +26,8 @@ void EntityCapsManager::handlePresenceReceived(boost::shared_ptr<Presence> prese
if (!capsInfo || capsInfo->getHash() != "sha-1" || presence->getPayload<ErrorPayload>()) {
return;
}
- String hash = capsInfo->getVersion();
- std::map<JID, String>::iterator i = caps.find(from);
+ std::string hash = capsInfo->getVersion();
+ std::map<JID, std::string>::iterator i = caps.find(from);
if (i == caps.end() || i->second != hash) {
caps.insert(std::make_pair(from, hash));
DiscoInfo::ref disco = capsProvider->getCaps(hash);
@@ -41,7 +41,7 @@ void EntityCapsManager::handlePresenceReceived(boost::shared_ptr<Presence> prese
}
}
else {
- std::map<JID, String>::iterator i = caps.find(from);
+ std::map<JID, std::string>::iterator i = caps.find(from);
if (i != caps.end()) {
caps.erase(i);
onCapsChanged(from);
@@ -51,17 +51,17 @@ void EntityCapsManager::handlePresenceReceived(boost::shared_ptr<Presence> prese
void EntityCapsManager::handleStanzaChannelAvailableChanged(bool available) {
if (available) {
- std::map<JID, String> capsCopy;
+ std::map<JID, std::string> capsCopy;
capsCopy.swap(caps);
- for (std::map<JID,String>::const_iterator i = capsCopy.begin(); i != capsCopy.end(); ++i) {
+ for (std::map<JID,std::string>::const_iterator i = capsCopy.begin(); i != capsCopy.end(); ++i) {
onCapsChanged(i->first);
}
}
}
-void EntityCapsManager::handleCapsAvailable(const String& hash) {
+void EntityCapsManager::handleCapsAvailable(const std::string& hash) {
// TODO: Use Boost.Bimap ?
- for (std::map<JID,String>::const_iterator i = caps.begin(); i != caps.end(); ++i) {
+ for (std::map<JID,std::string>::const_iterator i = caps.begin(); i != caps.end(); ++i) {
if (i->second == hash) {
onCapsChanged(i->first);
}
@@ -69,7 +69,7 @@ void EntityCapsManager::handleCapsAvailable(const String& hash) {
}
DiscoInfo::ref EntityCapsManager::getCaps(const JID& jid) const {
- std::map<JID, String>::const_iterator i = caps.find(jid);
+ std::map<JID, std::string>::const_iterator i = caps.find(jid);
if (i != caps.end()) {
return capsProvider->getCaps(i->second);
}
diff --git a/Swiften/Disco/EntityCapsManager.h b/Swiften/Disco/EntityCapsManager.h
index f507a1d..190f876 100644
--- a/Swiften/Disco/EntityCapsManager.h
+++ b/Swiften/Disco/EntityCapsManager.h
@@ -36,10 +36,10 @@ namespace Swift {
private:
void handlePresenceReceived(boost::shared_ptr<Presence>);
void handleStanzaChannelAvailableChanged(bool);
- void handleCapsAvailable(const String&);
+ void handleCapsAvailable(const std::string&);
private:
CapsProvider* capsProvider;
- std::map<JID, String> caps;
+ std::map<JID, std::string> caps;
};
}
diff --git a/Swiften/Disco/GetDiscoInfoRequest.h b/Swiften/Disco/GetDiscoInfoRequest.h
index 2298b5c..5cec530 100644
--- a/Swiften/Disco/GetDiscoInfoRequest.h
+++ b/Swiften/Disco/GetDiscoInfoRequest.h
@@ -18,7 +18,7 @@ namespace Swift {
return ref(new GetDiscoInfoRequest(jid, router));
}
- static ref create(const JID& jid, const String& node, IQRouter* router) {
+ static ref create(const JID& jid, const std::string& node, IQRouter* router) {
return ref(new GetDiscoInfoRequest(jid, node, router));
}
@@ -27,7 +27,7 @@ namespace Swift {
GenericRequest<DiscoInfo>(IQ::Get, jid, boost::shared_ptr<DiscoInfo>(new DiscoInfo()), router) {
}
- GetDiscoInfoRequest(const JID& jid, const String& node, IQRouter* router) :
+ GetDiscoInfoRequest(const JID& jid, const std::string& node, IQRouter* router) :
GenericRequest<DiscoInfo>(IQ::Get, jid, boost::shared_ptr<DiscoInfo>(new DiscoInfo()), router) {
getPayloadGeneric()->setNode(node);
}
diff --git a/Swiften/Disco/JIDDiscoInfoResponder.cpp b/Swiften/Disco/JIDDiscoInfoResponder.cpp
index 311447f..1298e5a 100644
--- a/Swiften/Disco/JIDDiscoInfoResponder.cpp
+++ b/Swiften/Disco/JIDDiscoInfoResponder.cpp
@@ -22,21 +22,21 @@ void JIDDiscoInfoResponder::setDiscoInfo(const JID& jid, const DiscoInfo& discoI
i->second.discoInfo = discoInfo;
}
-void JIDDiscoInfoResponder::setDiscoInfo(const JID& jid, const String& node, const DiscoInfo& discoInfo) {
+void JIDDiscoInfoResponder::setDiscoInfo(const JID& jid, const std::string& node, const DiscoInfo& discoInfo) {
JIDDiscoInfoMap::iterator i = info.insert(std::make_pair(jid, JIDDiscoInfo())).first;
DiscoInfo newInfo(discoInfo);
newInfo.setNode(node);
i->second.nodeDiscoInfo[node] = newInfo;
}
-bool JIDDiscoInfoResponder::handleGetRequest(const JID& from, const JID& to, const String& id, boost::shared_ptr<DiscoInfo> discoInfo) {
+bool JIDDiscoInfoResponder::handleGetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<DiscoInfo> discoInfo) {
JIDDiscoInfoMap::const_iterator i = info.find(to);
if (i != info.end()) {
- if (discoInfo->getNode().isEmpty()) {
+ if (discoInfo->getNode().empty()) {
sendResponse(from, to, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo(i->second.discoInfo)));
}
else {
- std::map<String,DiscoInfo>::const_iterator j = i->second.nodeDiscoInfo.find(discoInfo->getNode());
+ std::map<std::string,DiscoInfo>::const_iterator j = i->second.nodeDiscoInfo.find(discoInfo->getNode());
if (j != i->second.nodeDiscoInfo.end()) {
sendResponse(from, to, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo(j->second)));
}
diff --git a/Swiften/Disco/JIDDiscoInfoResponder.h b/Swiften/Disco/JIDDiscoInfoResponder.h
index aac43de..d532d0f 100644
--- a/Swiften/Disco/JIDDiscoInfoResponder.h
+++ b/Swiften/Disco/JIDDiscoInfoResponder.h
@@ -21,15 +21,15 @@ namespace Swift {
void clearDiscoInfo(const JID& jid);
void setDiscoInfo(const JID& jid, const DiscoInfo& info);
- void setDiscoInfo(const JID& jid, const String& node, const DiscoInfo& info);
+ void setDiscoInfo(const JID& jid, const std::string& node, const DiscoInfo& info);
private:
- virtual bool handleGetRequest(const JID& from, const JID& to, const String& id, boost::shared_ptr<DiscoInfo> payload);
+ virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<DiscoInfo> payload);
private:
struct JIDDiscoInfo {
DiscoInfo discoInfo;
- std::map<String, DiscoInfo> nodeDiscoInfo;
+ std::map<std::string, DiscoInfo> nodeDiscoInfo;
};
typedef std::map<JID, JIDDiscoInfo> JIDDiscoInfoMap;
JIDDiscoInfoMap info;
diff --git a/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp b/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp
index aec3a92..d4cb331 100644
--- a/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp
+++ b/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp
@@ -30,9 +30,9 @@ class CapsInfoGeneratorTest : public CppUnit::TestFixture {
CapsInfoGenerator testling("http://code.google.com/p/exodus");
CapsInfo result = testling.generateCapsInfo(discoInfo);
- CPPUNIT_ASSERT_EQUAL(String("http://code.google.com/p/exodus"), result.getNode());
- CPPUNIT_ASSERT_EQUAL(String("sha-1"), result.getHash());
- CPPUNIT_ASSERT_EQUAL(String("QgayPKawpkPSDYmwT/WM94uAlu0="), result.getVersion());
+ CPPUNIT_ASSERT_EQUAL(std::string("http://code.google.com/p/exodus"), result.getNode());
+ CPPUNIT_ASSERT_EQUAL(std::string("sha-1"), result.getHash());
+ CPPUNIT_ASSERT_EQUAL(std::string("QgayPKawpkPSDYmwT/WM94uAlu0="), result.getVersion());
}
void testGenerate_XEP0115ComplexExample() {
@@ -48,7 +48,7 @@ class CapsInfoGeneratorTest : public CppUnit::TestFixture {
FormField::ref field = HiddenFormField::create("urn:xmpp:dataforms:softwareinfo");
field->setName("FORM_TYPE");
extension->addField(field);
- std::vector<String> ipVersions;
+ std::vector<std::string> ipVersions;
ipVersions.push_back("ipv6");
ipVersions.push_back("ipv4");
field = ListMultiFormField::create(ipVersions);
@@ -77,7 +77,7 @@ class CapsInfoGeneratorTest : public CppUnit::TestFixture {
CapsInfoGenerator testling("http://psi-im.org");
CapsInfo result = testling.generateCapsInfo(discoInfo);
- CPPUNIT_ASSERT_EQUAL(String("q07IKJEyjvHSyhy//CH0CxmKi8w="), result.getVersion());
+ CPPUNIT_ASSERT_EQUAL(std::string("q07IKJEyjvHSyhy//CH0CxmKi8w="), result.getVersion());
}
};
diff --git a/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp b/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp
index 988065f..bccf0d4 100644
--- a/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp
+++ b/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp
@@ -45,7 +45,7 @@ class DiscoInfoResponderTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size()));
boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>());
CPPUNIT_ASSERT(payload);
- CPPUNIT_ASSERT_EQUAL(String(""), payload->getNode());
+ CPPUNIT_ASSERT_EQUAL(std::string(""), payload->getNode());
CPPUNIT_ASSERT(payload->hasFeature("foo"));
testling.stop();
@@ -68,7 +68,7 @@ class DiscoInfoResponderTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size()));
boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>());
CPPUNIT_ASSERT(payload);
- CPPUNIT_ASSERT_EQUAL(String("bar-node"), payload->getNode());
+ CPPUNIT_ASSERT_EQUAL(std::string("bar-node"), payload->getNode());
CPPUNIT_ASSERT(payload->hasFeature("bar"));
testling.stop();
diff --git a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp
index 0a498cf..544bdad 100644
--- a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp
+++ b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp
@@ -159,15 +159,15 @@ class EntityCapsManagerTest : public CppUnit::TestFixture {
private:
struct DummyCapsProvider : public CapsProvider {
- virtual DiscoInfo::ref getCaps(const String& hash) const {
- std::map<String, DiscoInfo::ref>::const_iterator i = caps.find(hash);
+ virtual DiscoInfo::ref getCaps(const std::string& hash) const {
+ std::map<std::string, DiscoInfo::ref>::const_iterator i = caps.find(hash);
if (i != caps.end()) {
return i->second;
}
return DiscoInfo::ref();
}
- std::map<String, DiscoInfo::ref> caps;
+ std::map<std::string, DiscoInfo::ref> caps;
};
private:
diff --git a/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp b/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp
index 03a3ee8..ef61afa 100644
--- a/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp
+++ b/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp
@@ -46,7 +46,7 @@ class JIDDiscoInfoResponderTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size()));
boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>());
CPPUNIT_ASSERT(payload);
- CPPUNIT_ASSERT_EQUAL(String(""), payload->getNode());
+ CPPUNIT_ASSERT_EQUAL(std::string(""), payload->getNode());
CPPUNIT_ASSERT(payload->hasFeature("foo"));
testling.stop();
@@ -69,7 +69,7 @@ class JIDDiscoInfoResponderTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size()));
boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>());
CPPUNIT_ASSERT(payload);
- CPPUNIT_ASSERT_EQUAL(String("bar-node"), payload->getNode());
+ CPPUNIT_ASSERT_EQUAL(std::string("bar-node"), payload->getNode());
CPPUNIT_ASSERT(payload->hasFeature("bar"));
testling.stop();