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/MUC
parentcad974b45c0fb9355e68d9728e42c9ae3dbcebc7 (diff)
downloadswift-cb05f5a908e20006c954ce38755c2e422ecc2388.zip
swift-cb05f5a908e20006c954ce38755c2e422ecc2388.tar.bz2
Removed Swift::String.
Diffstat (limited to 'Swiften/MUC')
-rw-r--r--Swiften/MUC/MUC.cpp22
-rw-r--r--Swiften/MUC/MUC.h22
-rw-r--r--Swiften/MUC/MUCBookmark.h20
-rw-r--r--Swiften/MUC/UnitTest/MUCTest.cpp10
4 files changed, 37 insertions, 37 deletions
diff --git a/Swiften/MUC/MUC.cpp b/Swiften/MUC/MUC.cpp
index 486ba27..b8c23cd 100644
--- a/Swiften/MUC/MUC.cpp
+++ b/Swiften/MUC/MUC.cpp
@@ -22,7 +22,7 @@
namespace Swift {
-typedef std::pair<String, MUCOccupant> StringMUCOccupantPair;
+typedef std::pair<std::string, MUCOccupant> StringMUCOccupantPair;
MUC::MUC(StanzaChannel* stanzaChannel, IQRouter* iqRouter, DirectedPresenceSender* presenceSender, const JID &muc, MUCRegistry* mucRegistry) : ownMUCJID(muc), stanzaChannel(stanzaChannel), iqRouter_(iqRouter), presenceSender(presenceSender), mucRegistry(mucRegistry) {
scopedConnection_ = stanzaChannel->onPresenceReceived.connect(boost::bind(&MUC::handleIncomingPresence, this, _1));
@@ -33,7 +33,7 @@ MUC::MUC(StanzaChannel* stanzaChannel, IQRouter* iqRouter, DirectedPresenceSende
/**
* Join the MUC with default context.
*/
-void MUC::joinAs(const String &nick) {
+void MUC::joinAs(const std::string &nick) {
joinSince_ = boost::posix_time::not_a_date_time;
internalJoin(nick);
}
@@ -41,12 +41,12 @@ void MUC::joinAs(const String &nick) {
/**
* Join the MUC with context since date.
*/
-void MUC::joinWithContextSince(const String &nick, const boost::posix_time::ptime& since) {
+void MUC::joinWithContextSince(const std::string &nick, const boost::posix_time::ptime& since) {
joinSince_ = since;
internalJoin(nick);
}
-void MUC::internalJoin(const String &nick) {
+void MUC::internalJoin(const std::string &nick) {
//TODO: password
//TODO: history request
joinComplete_ = false;
@@ -74,7 +74,7 @@ void MUC::part() {
}
void MUC::handleUserLeft(LeavingType type) {
- std::map<String,MUCOccupant>::iterator i = occupants.find(ownMUCJID.getResource());
+ std::map<std::string,MUCOccupant>::iterator i = occupants.find(ownMUCJID.getResource());
if (i != occupants.end()) {
MUCOccupant me = i->second;
occupants.erase(i);
@@ -102,7 +102,7 @@ void MUC::handleIncomingPresence(Presence::ref presence) {
// (i.e. we start getting non-error presence from the MUC) or not
if (!joinSucceeded_) {
if (presence->getType() == Presence::Error) {
- String reason;
+ std::string reason;
onJoinFailed(presence->getPayload<ErrorPayload>());
return;
}
@@ -112,8 +112,8 @@ void MUC::handleIncomingPresence(Presence::ref presence) {
}
}
- String nick = presence->getFrom().getResource();
- if (nick.isEmpty()) {
+ std::string nick = presence->getFrom().getResource();
+ if (nick.empty()) {
return;
}
MUCOccupant::Role role(MUCOccupant::NoRole);
@@ -135,7 +135,7 @@ void MUC::handleIncomingPresence(Presence::ref presence) {
return;
}
else {
- std::map<String,MUCOccupant>::iterator i = occupants.find(nick);
+ std::map<std::string,MUCOccupant>::iterator i = occupants.find(nick);
if (i != occupants.end()) {
//TODO: part type
onOccupantLeft(i->second, Part, "");
@@ -144,7 +144,7 @@ void MUC::handleIncomingPresence(Presence::ref presence) {
}
}
else if (presence->getType() == Presence::Available) {
- std::map<String, MUCOccupant>::iterator it = occupants.find(nick);
+ std::map<std::string, MUCOccupant>::iterator it = occupants.find(nick);
MUCOccupant occupant(nick, role, affiliation);
bool isJoin = true;
if (realJID) {
@@ -161,7 +161,7 @@ void MUC::handleIncomingPresence(Presence::ref presence) {
}
occupants.erase(it);
}
- std::pair<std::map<String, MUCOccupant>::iterator, bool> result = occupants.insert(std::make_pair(nick, occupant));
+ std::pair<std::map<std::string, MUCOccupant>::iterator, bool> result = occupants.insert(std::make_pair(nick, occupant));
if (isJoin) {
onOccupantJoined(result.first->second);
}
diff --git a/Swiften/MUC/MUC.h b/Swiften/MUC/MUC.h
index cdef292..ef76a6a 100644
--- a/Swiften/MUC/MUC.h
+++ b/Swiften/MUC/MUC.h
@@ -7,7 +7,7 @@
#pragma once
#include "Swiften/JID/JID.h"
-#include "Swiften/Base/String.h"
+#include <string>
#include "Swiften/Elements/Message.h"
#include "Swiften/Elements/Presence.h"
#include "Swiften/Elements/MUCOccupant.h"
@@ -42,24 +42,24 @@ namespace Swift {
return ownMUCJID.toBare();
}
- void joinAs(const String &nick);
- void joinWithContextSince(const String &nick, const boost::posix_time::ptime& since);
+ void joinAs(const std::string &nick);
+ void joinWithContextSince(const std::string &nick, const boost::posix_time::ptime& since);
/*void queryRoomInfo(); */
/*void queryRoomItems(); */
- String getCurrentNick();
+ std::string getCurrentNick();
void part();
void handleIncomingMessage(Message::ref message);
/** Expose public so it can be called when e.g. user goes offline */
void handleUserLeft(LeavingType);
public:
- boost::signal<void (const String& /*nick*/)> onJoinComplete;
+ boost::signal<void (const std::string& /*nick*/)> onJoinComplete;
boost::signal<void (ErrorPayload::ref)> onJoinFailed;
boost::signal<void (Presence::ref)> onOccupantPresenceChange;
- boost::signal<void (const String&, const MUCOccupant& /*now*/, const MUCOccupant::Role& /*old*/)> onOccupantRoleChanged;
- boost::signal<void (const String&, const MUCOccupant::Affiliation& /*new*/, const MUCOccupant::Affiliation& /*old*/)> onOccupantAffiliationChanged;
+ boost::signal<void (const std::string&, const MUCOccupant& /*now*/, const MUCOccupant::Role& /*old*/)> onOccupantRoleChanged;
+ boost::signal<void (const std::string&, const MUCOccupant::Affiliation& /*new*/, const MUCOccupant::Affiliation& /*old*/)> onOccupantAffiliationChanged;
boost::signal<void (const MUCOccupant&)> onOccupantJoined;
- boost::signal<void (const MUCOccupant&, LeavingType, const String& /*reason*/)> onOccupantLeft;
+ boost::signal<void (const MUCOccupant&, LeavingType, const std::string& /*reason*/)> onOccupantLeft;
/* boost::signal<void (const MUCInfo&)> onInfoResult; */
/* boost::signal<void (const blah&)> onItemsResult; */
@@ -69,13 +69,13 @@ namespace Swift {
return ownMUCJID.equals(j, JID::WithoutResource);
}
- const String& getOwnNick() const {
+ const std::string& getOwnNick() const {
return ownMUCJID.getResource();
}
private:
void handleIncomingPresence(Presence::ref presence);
- void internalJoin(const String& nick);
+ void internalJoin(const std::string& nick);
void handleCreationConfigResponse(MUCOwnerPayload::ref, ErrorPayload::ref);
private:
@@ -84,7 +84,7 @@ namespace Swift {
IQRouter* iqRouter_;
DirectedPresenceSender* presenceSender;
MUCRegistry* mucRegistry;
- std::map<String, MUCOccupant> occupants;
+ std::map<std::string, MUCOccupant> occupants;
bool joinSucceeded_;
bool joinComplete_;
boost::bsignals::scoped_connection scopedConnection_;
diff --git a/Swiften/MUC/MUCBookmark.h b/Swiften/MUC/MUCBookmark.h
index 65797e5..10e1b78 100644
--- a/Swiften/MUC/MUCBookmark.h
+++ b/Swiften/MUC/MUCBookmark.h
@@ -8,7 +8,7 @@
#include <boost/optional.hpp>
-#include "Swiften/Base/String.h"
+#include <string>
#include "Swiften/JID/JID.h"
#include "Swiften/Elements/Storage.h"
@@ -23,7 +23,7 @@ namespace Swift {
autojoin_ = room.autoJoin;
}
- MUCBookmark(const JID& room, const String& bookmarkName) : room_(room), name_(bookmarkName), autojoin_(false) {
+ MUCBookmark(const JID& room, const std::string& bookmarkName) : room_(room), name_(bookmarkName), autojoin_(false) {
}
void setAutojoin(bool enabled) {
@@ -34,23 +34,23 @@ namespace Swift {
return autojoin_;
}
- void setNick(const boost::optional<String>& nick) {
+ void setNick(const boost::optional<std::string>& nick) {
nick_ = nick;
}
- void setPassword(const boost::optional<String>& password) {
+ void setPassword(const boost::optional<std::string>& password) {
password_ = password;
}
- const boost::optional<String>& getNick() const {
+ const boost::optional<std::string>& getNick() const {
return nick_;
}
- const boost::optional<String>& getPassword() const {
+ const boost::optional<std::string>& getPassword() const {
return password_;
}
- const String& getName() const {
+ const std::string& getName() const {
return name_;
}
@@ -78,9 +78,9 @@ namespace Swift {
private:
JID room_;
- String name_;
- boost::optional<String> nick_;
- boost::optional<String> password_;
+ std::string name_;
+ boost::optional<std::string> nick_;
+ boost::optional<std::string> password_;
bool autojoin_;
};
}
diff --git a/Swiften/MUC/UnitTest/MUCTest.cpp b/Swiften/MUC/UnitTest/MUCTest.cpp
index fd07711..117760c 100644
--- a/Swiften/MUC/UnitTest/MUCTest.cpp
+++ b/Swiften/MUC/UnitTest/MUCTest.cpp
@@ -73,7 +73,7 @@ class MUCTest : public CppUnit::TestFixture {
Presence::ref p = channel->getStanzaAtIndex<Presence>(2);
CPPUNIT_ASSERT(p);
CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/Alice"), p->getTo());
- CPPUNIT_ASSERT_EQUAL(String("Test"), p->getStatus());
+ CPPUNIT_ASSERT_EQUAL(std::string("Test"), p->getStatus());
}
/*void testJoin_Success() {
@@ -83,7 +83,7 @@ class MUCTest : public CppUnit::TestFixture {
receivePresence(JID("foo@bar.com/Rabbit"), "Here");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(joinResults.size()));
- CPPUNIT_ASSERT_EQUAL(String("Alice"), joinResults[0].nick);
+ CPPUNIT_ASSERT_EQUAL(std::string("Alice"), joinResults[0].nick);
CPPUNIT_ASSERT(joinResults[0].error);
}
@@ -96,14 +96,14 @@ class MUCTest : public CppUnit::TestFixture {
return boost::make_shared<MUC>(channel, router, presenceSender, jid, mucRegistry);
}
- void handleJoinFinished(const String& nick, ErrorPayload::ref error) {
+ void handleJoinFinished(const std::string& nick, ErrorPayload::ref error) {
JoinResult r;
r.nick = nick;
r.error = error;
joinResults.push_back(r);
}
- void receivePresence(const JID& jid, const String& status) {
+ void receivePresence(const JID& jid, const std::string& status) {
Presence::ref p = Presence::create(status);
p->setFrom(jid);
//MUCUserPayload::ref mucUserPayload = boost::make_shared<MUCUserPayload>();
@@ -119,7 +119,7 @@ class MUCTest : public CppUnit::TestFixture {
StanzaChannelPresenceSender* stanzaChannelPresenceSender;
DirectedPresenceSender* presenceSender;
struct JoinResult {
- String nick;
+ std::string nick;
ErrorPayload::ref error;
};
std::vector<JoinResult> joinResults;