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/FileTransfer
parentcad974b45c0fb9355e68d9728e42c9ae3dbcebc7 (diff)
downloadswift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.zip
swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.tar.bz2
Removed Swift::String.
Diffstat (limited to 'Swiften/FileTransfer')
-rw-r--r--Swiften/FileTransfer/IBBReceiveSession.cpp4
-rw-r--r--Swiften/FileTransfer/IBBReceiveSession.h6
-rw-r--r--Swiften/FileTransfer/IBBSendSession.cpp2
-rw-r--r--Swiften/FileTransfer/IBBSendSession.h4
-rw-r--r--Swiften/FileTransfer/OutgoingFileTransfer.cpp2
-rw-r--r--Swiften/FileTransfer/OutgoingFileTransfer.h8
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp6
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamRegistry.h10
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServer.cpp6
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServer.h10
-rw-r--r--Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp10
-rw-r--r--Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp8
12 files changed, 38 insertions, 38 deletions
diff --git a/Swiften/FileTransfer/IBBReceiveSession.cpp b/Swiften/FileTransfer/IBBReceiveSession.cpp
index 9eed21d..5c90757 100644
--- a/Swiften/FileTransfer/IBBReceiveSession.cpp
+++ b/Swiften/FileTransfer/IBBReceiveSession.cpp
@@ -14,7 +14,7 @@
namespace Swift {
-IBBReceiveSession::IBBReceiveSession(const String& id, const JID& from, size_t size, WriteBytestream::ref bytestream, IQRouter* router) : SetResponder<IBB>(router), id(id), from(from), size(size), bytestream(bytestream), router(router), sequenceNumber(0), active(false), receivedSize(0) {
+IBBReceiveSession::IBBReceiveSession(const std::string& id, const JID& from, size_t size, WriteBytestream::ref bytestream, IQRouter* router) : SetResponder<IBB>(router), id(id), from(from), size(size), bytestream(bytestream), router(router), sequenceNumber(0), active(false), receivedSize(0) {
}
IBBReceiveSession::~IBBReceiveSession() {
@@ -36,7 +36,7 @@ void IBBReceiveSession::finish(boost::optional<FileTransferError> error) {
onFinished(error);
}
-bool IBBReceiveSession::handleSetRequest(const JID& from, const JID&, const String& id, IBB::ref ibb) {
+bool IBBReceiveSession::handleSetRequest(const JID& from, const JID&, const std::string& id, IBB::ref ibb) {
if (from == this->from && ibb->getStreamID() == id) {
if (ibb->getAction() == IBB::Data) {
if (sequenceNumber == ibb->getSequenceNumber()) {
diff --git a/Swiften/FileTransfer/IBBReceiveSession.h b/Swiften/FileTransfer/IBBReceiveSession.h
index b2399b6..6d936de 100644
--- a/Swiften/FileTransfer/IBBReceiveSession.h
+++ b/Swiften/FileTransfer/IBBReceiveSession.h
@@ -22,7 +22,7 @@ namespace Swift {
class IBBReceiveSession : public SetResponder<IBB> {
public:
- IBBReceiveSession(const String& id, const JID& from, size_t size, WriteBytestream::ref bytestream, IQRouter* router);
+ IBBReceiveSession(const std::string& id, const JID& from, size_t size, WriteBytestream::ref bytestream, IQRouter* router);
~IBBReceiveSession();
void start();
@@ -31,11 +31,11 @@ namespace Swift {
boost::signal<void (boost::optional<FileTransferError>)> onFinished;
private:
- bool handleSetRequest(const JID& from, const JID& to, const String& id, IBB::ref payload);
+ bool handleSetRequest(const JID& from, const JID& to, const std::string& id, IBB::ref payload);
void finish(boost::optional<FileTransferError>);
private:
- String id;
+ std::string id;
JID from;
size_t size;
WriteBytestream::ref bytestream;
diff --git a/Swiften/FileTransfer/IBBSendSession.cpp b/Swiften/FileTransfer/IBBSendSession.cpp
index 30f8836..0fb47d3 100644
--- a/Swiften/FileTransfer/IBBSendSession.cpp
+++ b/Swiften/FileTransfer/IBBSendSession.cpp
@@ -14,7 +14,7 @@
namespace Swift {
-IBBSendSession::IBBSendSession(const String& id, const JID& to, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* router) : id(id), to(to), bytestream(bytestream), router(router), blockSize(4096), sequenceNumber(0), active(false) {
+IBBSendSession::IBBSendSession(const std::string& id, const JID& to, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* router) : id(id), to(to), bytestream(bytestream), router(router), blockSize(4096), sequenceNumber(0), active(false) {
}
IBBSendSession::~IBBSendSession() {
diff --git a/Swiften/FileTransfer/IBBSendSession.h b/Swiften/FileTransfer/IBBSendSession.h
index e114b23..bef7bec 100644
--- a/Swiften/FileTransfer/IBBSendSession.h
+++ b/Swiften/FileTransfer/IBBSendSession.h
@@ -21,7 +21,7 @@ namespace Swift {
class IBBSendSession {
public:
- IBBSendSession(const String& id, const JID& to, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* router);
+ IBBSendSession(const std::string& id, const JID& to, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* router);
~IBBSendSession();
void start();
@@ -38,7 +38,7 @@ namespace Swift {
void finish(boost::optional<FileTransferError>);
private:
- String id;
+ std::string id;
JID to;
boost::shared_ptr<ReadBytestream> bytestream;
IQRouter* router;
diff --git a/Swiften/FileTransfer/OutgoingFileTransfer.cpp b/Swiften/FileTransfer/OutgoingFileTransfer.cpp
index 8e6f839..32f7e17 100644
--- a/Swiften/FileTransfer/OutgoingFileTransfer.cpp
+++ b/Swiften/FileTransfer/OutgoingFileTransfer.cpp
@@ -15,7 +15,7 @@
namespace Swift {
-OutgoingFileTransfer::OutgoingFileTransfer(const String& id, const JID& from, const JID& to, const String& name, int size, const String& description, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* iqRouter, SOCKS5BytestreamServer* socksServer) : id(id), from(from), to(to), name(name), size(size), description(description), bytestream(bytestream), iqRouter(iqRouter), socksServer(socksServer) {
+OutgoingFileTransfer::OutgoingFileTransfer(const std::string& id, const JID& from, const JID& to, const std::string& name, int size, const std::string& description, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* iqRouter, SOCKS5BytestreamServer* socksServer) : id(id), from(from), to(to), name(name), size(size), description(description), bytestream(bytestream), iqRouter(iqRouter), socksServer(socksServer) {
}
void OutgoingFileTransfer::start() {
diff --git a/Swiften/FileTransfer/OutgoingFileTransfer.h b/Swiften/FileTransfer/OutgoingFileTransfer.h
index 3ecef5d..a694c13 100644
--- a/Swiften/FileTransfer/OutgoingFileTransfer.h
+++ b/Swiften/FileTransfer/OutgoingFileTransfer.h
@@ -24,7 +24,7 @@ namespace Swift {
class OutgoingFileTransfer {
public:
- OutgoingFileTransfer(const String& id, const JID& from, const JID& to, const String& name, int size, const String& description, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* iqRouter, SOCKS5BytestreamServer* socksServer);
+ OutgoingFileTransfer(const std::string& id, const JID& from, const JID& to, const std::string& name, int size, const std::string& description, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* iqRouter, SOCKS5BytestreamServer* socksServer);
void start();
void stop();
@@ -38,12 +38,12 @@ namespace Swift {
void handleIBBSessionFinished(boost::optional<FileTransferError> error);
private:
- String id;
+ std::string id;
JID from;
JID to;
- String name;
+ std::string name;
int size;
- String description;
+ std::string description;
boost::shared_ptr<ReadBytestream> bytestream;
IQRouter* iqRouter;
SOCKS5BytestreamServer* socksServer;
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp
index a4715a0..7f889b1 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp
@@ -11,15 +11,15 @@ namespace Swift {
SOCKS5BytestreamRegistry::SOCKS5BytestreamRegistry() {
}
-void SOCKS5BytestreamRegistry::addBytestream(const String& destination, boost::shared_ptr<ReadBytestream> byteStream) {
+void SOCKS5BytestreamRegistry::addBytestream(const std::string& destination, boost::shared_ptr<ReadBytestream> byteStream) {
byteStreams[destination] = byteStream;
}
-void SOCKS5BytestreamRegistry::removeBytestream(const String& destination) {
+void SOCKS5BytestreamRegistry::removeBytestream(const std::string& destination) {
byteStreams.erase(destination);
}
-boost::shared_ptr<ReadBytestream> SOCKS5BytestreamRegistry::getBytestream(const String& destination) const {
+boost::shared_ptr<ReadBytestream> SOCKS5BytestreamRegistry::getBytestream(const std::string& destination) const {
BytestreamMap::const_iterator i = byteStreams.find(destination);
if (i != byteStreams.end()) {
return i->second;
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.h b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.h
index 1afd03f..7cee256 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.h
+++ b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.h
@@ -9,7 +9,7 @@
#include <boost/shared_ptr.hpp>
#include <map>
-#include "Swiften/Base/String.h"
+#include <string>
#include "Swiften/FileTransfer/ReadBytestream.h"
namespace Swift {
@@ -17,12 +17,12 @@ namespace Swift {
public:
SOCKS5BytestreamRegistry();
- boost::shared_ptr<ReadBytestream> getBytestream(const String& destination) const;
- void addBytestream(const String& destination, boost::shared_ptr<ReadBytestream> byteStream);
- void removeBytestream(const String& destination);
+ boost::shared_ptr<ReadBytestream> getBytestream(const std::string& destination) const;
+ void addBytestream(const std::string& destination, boost::shared_ptr<ReadBytestream> byteStream);
+ void removeBytestream(const std::string& destination);
private:
- typedef std::map<String, boost::shared_ptr<ReadBytestream> > BytestreamMap;
+ typedef std::map<std::string, boost::shared_ptr<ReadBytestream> > BytestreamMap;
BytestreamMap byteStreams;
};
}
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp
index 58506f3..9bc49ae 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp
@@ -25,15 +25,15 @@ void SOCKS5BytestreamServer::stop() {
connectionServer->onNewConnection.disconnect(boost::bind(&SOCKS5BytestreamServer::handleNewConnection, this, _1));
}
-void SOCKS5BytestreamServer::addBytestream(const String& id, const JID& from, const JID& to, boost::shared_ptr<ReadBytestream> byteStream) {
+void SOCKS5BytestreamServer::addBytestream(const std::string& id, const JID& from, const JID& to, boost::shared_ptr<ReadBytestream> byteStream) {
bytestreams.addBytestream(getSOCKSDestinationAddress(id, from, to), byteStream);
}
-void SOCKS5BytestreamServer::removeBytestream(const String& id, const JID& from, const JID& to) {
+void SOCKS5BytestreamServer::removeBytestream(const std::string& id, const JID& from, const JID& to) {
bytestreams.removeBytestream(getSOCKSDestinationAddress(id, from, to));
}
-String SOCKS5BytestreamServer::getSOCKSDestinationAddress(const String& id, const JID& from, const JID& to) {
+std::string SOCKS5BytestreamServer::getSOCKSDestinationAddress(const std::string& id, const JID& from, const JID& to) {
return Hexify::hexify(SHA1::getHash(ByteArray(id + from.toString() + to.toString())));
}
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServer.h b/Swiften/FileTransfer/SOCKS5BytestreamServer.h
index 35a8d4f..d5a62bb 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServer.h
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServer.h
@@ -10,7 +10,7 @@
#include <map>
#include "Swiften/Network/ConnectionServer.h"
-#include "Swiften/Base/String.h"
+#include <string>
#include "Swiften/JID/JID.h"
#include "Swiften/FileTransfer/ReadBytestream.h"
#include "Swiften/FileTransfer/SOCKS5BytestreamRegistry.h"
@@ -27,16 +27,16 @@ namespace Swift {
void start();
void stop();
- void addBytestream(const String& id, const JID& from, const JID& to, boost::shared_ptr<ReadBytestream> byteStream);
- void removeBytestream(const String& id, const JID& from, const JID& to);
+ void addBytestream(const std::string& id, const JID& from, const JID& to, boost::shared_ptr<ReadBytestream> byteStream);
+ void removeBytestream(const std::string& id, const JID& from, const JID& to);
/*protected:
- boost::shared_ptr<ReadBytestream> getBytestream(const String& dest);*/
+ boost::shared_ptr<ReadBytestream> getBytestream(const std::string& dest);*/
private:
void handleNewConnection(boost::shared_ptr<Connection> connection);
- static String getSOCKSDestinationAddress(const String& id, const JID& from, const JID& to);
+ static std::string getSOCKSDestinationAddress(const std::string& id, const JID& from, const JID& to);
private:
friend class SOCKS5BytestreamServerSession;
diff --git a/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp b/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp
index afd71c0..0cd273a 100644
--- a/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp
+++ b/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp
@@ -52,7 +52,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture {
IBB::ref ibb = stanzaChannel->sentStanzas[0]->getPayload<IBB>();
CPPUNIT_ASSERT_EQUAL(IBB::Open, ibb->getAction());
CPPUNIT_ASSERT_EQUAL(1234, ibb->getBlockSize());
- CPPUNIT_ASSERT_EQUAL(String("myid"), ibb->getStreamID());
+ CPPUNIT_ASSERT_EQUAL(std::string("myid"), ibb->getStreamID());
}
void testStart_ResponseStartsSending() {
@@ -68,7 +68,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(IBB::Data, ibb->getAction());
CPPUNIT_ASSERT_EQUAL(ByteArray("abc"), ibb->getData());
CPPUNIT_ASSERT_EQUAL(0, ibb->getSequenceNumber());
- CPPUNIT_ASSERT_EQUAL(String("myid"), ibb->getStreamID());
+ CPPUNIT_ASSERT_EQUAL(std::string("myid"), ibb->getStreamID());
}
void testResponseContinuesSending() {
@@ -84,7 +84,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(IBB::Data, ibb->getAction());
CPPUNIT_ASSERT_EQUAL(ByteArray("def"), ibb->getData());
CPPUNIT_ASSERT_EQUAL(1, ibb->getSequenceNumber());
- CPPUNIT_ASSERT_EQUAL(String("myid"), ibb->getStreamID());
+ CPPUNIT_ASSERT_EQUAL(std::string("myid"), ibb->getStreamID());
}
void testRespondToAllFinishes() {
@@ -120,7 +120,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT(stanzaChannel->isRequestAtIndex<IBB>(1, JID("foo@bar.com/baz"), IQ::Set));
IBB::ref ibb = stanzaChannel->sentStanzas[1]->getPayload<IBB>();
CPPUNIT_ASSERT_EQUAL(IBB::Close, ibb->getAction());
- CPPUNIT_ASSERT_EQUAL(String("myid"), ibb->getStreamID());
+ CPPUNIT_ASSERT_EQUAL(std::string("myid"), ibb->getStreamID());
CPPUNIT_ASSERT(finished);
CPPUNIT_ASSERT(!error);
}
@@ -144,7 +144,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture {
}
private:
- std::auto_ptr<IBBSendSession> createSession(const String& to) {
+ std::auto_ptr<IBBSendSession> createSession(const std::string& to) {
std::auto_ptr<IBBSendSession> session(new IBBSendSession("myid", JID(to), bytestream, iqRouter));
session->onFinished.connect(boost::bind(&IBBSendSessionTest::handleFinished, this, _1));
return session;
diff --git a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp
index b3b93ac..c6d246d 100644
--- a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp
+++ b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp
@@ -123,12 +123,12 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture {
receivedDataChunks = 0;
}
- void request(const String& hostname) {
- receive(ByteArray("\x05\x01\x00\x03", 4) + hostname.getUTF8Size() + hostname + ByteArray("\x00\x00", 2));
+ void request(const std::string& hostname) {
+ receive(ByteArray("\x05\x01\x00\x03", 4) + hostname.size() + hostname + ByteArray("\x00\x00", 2));
}
- void skipHeader(const String& hostname) {
- int headerSize = 7 + hostname.getUTF8Size();
+ void skipHeader(const std::string& hostname) {
+ int headerSize = 7 + hostname.size();
receivedData = ByteArray(receivedData.getData() + headerSize, receivedData.getSize() - headerSize);
}