summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/MUC')
-rw-r--r--Swiften/MUC/MUC.h4
-rw-r--r--Swiften/MUC/MUCBookmarkManager.cpp6
-rw-r--r--Swiften/MUC/MUCBookmarkManager.h6
-rw-r--r--Swiften/MUC/MUCImpl.cpp50
-rw-r--r--Swiften/MUC/MUCImpl.h4
-rw-r--r--Swiften/MUC/MUCManager.cpp2
-rw-r--r--Swiften/MUC/UnitTest/MUCTest.cpp26
-rw-r--r--Swiften/MUC/UnitTest/MockMUC.h4
8 files changed, 51 insertions, 51 deletions
diff --git a/Swiften/MUC/MUC.h b/Swiften/MUC/MUC.h
index e8f953e..d0c2bab 100644
--- a/Swiften/MUC/MUC.h
+++ b/Swiften/MUC/MUC.h
@@ -7,9 +7,9 @@
#pragma once
#include <map>
+#include <memory>
#include <string>
-#include <boost/shared_ptr.hpp>
#include <boost/signals/connection.hpp>
#include <Swiften/Base/API.h>
@@ -30,7 +30,7 @@ namespace Swift {
class SWIFTEN_API MUC {
public:
- typedef boost::shared_ptr<MUC> ref;
+ typedef std::shared_ptr<MUC> ref;
enum JoinResult { JoinSucceeded, JoinFailed };
enum LeavingType { LeavePart, LeaveKick, LeaveBan, LeaveDestroy, LeaveNotMember, Disconnect };
diff --git a/Swiften/MUC/MUCBookmarkManager.cpp b/Swiften/MUC/MUCBookmarkManager.cpp
index 1d8c2aa..570c613 100644
--- a/Swiften/MUC/MUCBookmarkManager.cpp
+++ b/Swiften/MUC/MUCBookmarkManager.cpp
@@ -7,9 +7,9 @@
#include <Swiften/MUC/MUCBookmarkManager.h>
#include <iostream>
+#include <memory>
#include <boost/bind.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Base/foreach.h>
#include <Swiften/Queries/IQRouter.h>
@@ -26,7 +26,7 @@ MUCBookmarkManager::MUCBookmarkManager(IQRouter* iqRouter) {
request->send();
}
-void MUCBookmarkManager::handleBookmarksReceived(boost::shared_ptr<Storage> payload, ErrorPayload::ref error) {
+void MUCBookmarkManager::handleBookmarksReceived(std::shared_ptr<Storage> payload, ErrorPayload::ref error) {
if (error) {
return;
}
@@ -99,7 +99,7 @@ void MUCBookmarkManager::removeBookmark(const MUCBookmark& bookmark) {
void MUCBookmarkManager::flush() {
if (!storage) {
- storage = boost::make_shared<Storage>();
+ storage = std::make_shared<Storage>();
}
// Update the storage element
storage->clearRooms();
diff --git a/Swiften/MUC/MUCBookmarkManager.h b/Swiften/MUC/MUCBookmarkManager.h
index 18dd677..58aaeee 100644
--- a/Swiften/MUC/MUCBookmarkManager.h
+++ b/Swiften/MUC/MUCBookmarkManager.h
@@ -6,10 +6,10 @@
#pragma once
+#include <memory>
#include <vector>
#include <boost/optional.hpp>
-#include <boost/shared_ptr.hpp>
#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
@@ -40,13 +40,13 @@ namespace Swift {
private:
bool containsEquivalent(const std::vector<MUCBookmark>& list, const MUCBookmark& bookmark);
- void handleBookmarksReceived(boost::shared_ptr<Storage> payload, ErrorPayload::ref error);
+ void handleBookmarksReceived(std::shared_ptr<Storage> payload, ErrorPayload::ref error);
void flush();
private:
bool ready_;
std::vector<MUCBookmark> bookmarks_;
IQRouter* iqRouter_;
- boost::shared_ptr<Storage> storage;
+ std::shared_ptr<Storage> storage;
};
}
diff --git a/Swiften/MUC/MUCImpl.cpp b/Swiften/MUC/MUCImpl.cpp
index 8562ec8..4bab39d 100644
--- a/Swiften/MUC/MUCImpl.cpp
+++ b/Swiften/MUC/MUCImpl.cpp
@@ -6,9 +6,9 @@
#include <Swiften/MUC/MUCImpl.h>
+#include <memory>
+
#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Base/foreach.h>
#include <Swiften/Client/StanzaChannel.h>
@@ -92,10 +92,10 @@ void MUCImpl::internalJoin(const std::string &nick) {
ownMUCJID = JID(ownMUCJID.getNode(), ownMUCJID.getDomain(), nick);
- Presence::ref joinPresence = presenceSender->getLastSentUndirectedPresence() ? (*presenceSender->getLastSentUndirectedPresence())->clone() : boost::make_shared<Presence>();
+ Presence::ref joinPresence = presenceSender->getLastSentUndirectedPresence() ? (*presenceSender->getLastSentUndirectedPresence())->clone() : std::make_shared<Presence>();
assert(joinPresence->getType() == Presence::Available);
joinPresence->setTo(ownMUCJID);
- MUCPayload::ref mucPayload = boost::make_shared<MUCPayload>();
+ MUCPayload::ref mucPayload = std::make_shared<MUCPayload>();
if (joinSince_ != boost::posix_time::not_a_date_time) {
mucPayload->setSince(joinSince_);
}
@@ -108,7 +108,7 @@ void MUCImpl::internalJoin(const std::string &nick) {
}
void MUCImpl::changeNickname(const std::string& newNickname) {
- Presence::ref changeNicknamePresence = boost::make_shared<Presence>();
+ Presence::ref changeNicknamePresence = std::make_shared<Presence>();
changeNicknamePresence->setTo(ownMUCJID.toBare().toString() + std::string("/") + newNickname);
presenceSender->sendPresence(changeNicknamePresence);
}
@@ -157,7 +157,7 @@ void MUCImpl::handleIncomingPresence(Presence::ref presence) {
presenceSender->addDirectedPresenceReceiver(ownMUCJID, DirectedPresenceSender::DontSendPresence);
if (presenceSender->getLastSentUndirectedPresence() && !isEqualExceptID(**(presenceSender->getLastSentUndirectedPresence()), *joinRequestPresence_)) {
// our presence changed between join request and join complete, send current presence to MUC
- Presence::ref latestPresence = boost::make_shared<Presence>(**presenceSender->getLastSentUndirectedPresence());
+ Presence::ref latestPresence = std::make_shared<Presence>(**presenceSender->getLastSentUndirectedPresence());
latestPresence->setTo(ownMUCJID);
presenceSender->sendPresence(latestPresence);
}
@@ -185,7 +185,7 @@ void MUCImpl::handleIncomingPresence(Presence::ref presence) {
LeavingType type = LeavePart;
boost::optional<std::string> newNickname;
if (mucPayload) {
- if (boost::dynamic_pointer_cast<MUCDestroyPayload>(mucPayload->getPayload())) {
+ if (std::dynamic_pointer_cast<MUCDestroyPayload>(mucPayload->getPayload())) {
type = LeaveDestroy;
}
else foreach (MUCUserPayload::StatusCode status, mucPayload->getStatusCodes()) {
@@ -285,8 +285,8 @@ void MUCImpl::handleIncomingPresence(Presence::ref presence) {
// Accept default room configuration and create an instant room http://xmpp.org/extensions/xep-0045.html#createroom-instant
MUCOwnerPayload::ref mucPayload(new MUCOwnerPayload());
presenceSender->addDirectedPresenceReceiver(ownMUCJID, DirectedPresenceSender::DontSendPresence);
- mucPayload->setPayload(boost::make_shared<Form>(Form::SubmitType));
- boost::shared_ptr< GenericRequest<MUCOwnerPayload> > request = boost::make_shared< GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_);
+ mucPayload->setPayload(std::make_shared<Form>(Form::SubmitType));
+ std::shared_ptr< GenericRequest<MUCOwnerPayload> > request = std::make_shared< GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_);
request->onResponse.connect(boost::bind(&MUCImpl::handleCreationConfigResponse, this, _1, _2));
request->send();
}
@@ -330,12 +330,12 @@ void MUCImpl::kickOccupant(const JID& jid) {
* Call with the room JID, not the real JID.
*/
void MUCImpl::changeOccupantRole(const JID& jid, MUCOccupant::Role role) {
- MUCAdminPayload::ref mucPayload = boost::make_shared<MUCAdminPayload>();
+ MUCAdminPayload::ref mucPayload = std::make_shared<MUCAdminPayload>();
MUCItem item;
item.role = role;
item.nick = jid.getResource();
mucPayload->addItem(item);
- boost::shared_ptr<GenericRequest<MUCAdminPayload> > request = boost::make_shared<GenericRequest<MUCAdminPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_);
+ std::shared_ptr<GenericRequest<MUCAdminPayload> > request = std::make_shared<GenericRequest<MUCAdminPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_);
request->onResponse.connect(boost::bind(&MUCImpl::handleOccupantRoleChangeResponse, this, _1, _2, jid, role));
request->send();
@@ -348,11 +348,11 @@ void MUCImpl::handleOccupantRoleChangeResponse(MUCAdminPayload::ref /*unused*/,
}
void MUCImpl::requestAffiliationList(MUCOccupant::Affiliation affiliation) {
- MUCAdminPayload::ref mucPayload = boost::make_shared<MUCAdminPayload>();
+ MUCAdminPayload::ref mucPayload = std::make_shared<MUCAdminPayload>();
MUCItem item;
item.affiliation = affiliation;
mucPayload->addItem(item);
- boost::shared_ptr<GenericRequest<MUCAdminPayload> > request = boost::make_shared< GenericRequest<MUCAdminPayload> >(IQ::Get, getJID(), mucPayload, iqRouter_);
+ std::shared_ptr<GenericRequest<MUCAdminPayload> > request = std::make_shared< GenericRequest<MUCAdminPayload> >(IQ::Get, getJID(), mucPayload, iqRouter_);
request->onResponse.connect(boost::bind(&MUCImpl::handleAffiliationListResponse, this, _1, _2, affiliation));
request->send();
}
@@ -361,12 +361,12 @@ void MUCImpl::requestAffiliationList(MUCOccupant::Affiliation affiliation) {
* Must be called with the real JID, not the room JID.
*/
void MUCImpl::changeAffiliation(const JID& jid, MUCOccupant::Affiliation affiliation) {
- MUCAdminPayload::ref mucPayload = boost::make_shared<MUCAdminPayload>();
+ MUCAdminPayload::ref mucPayload = std::make_shared<MUCAdminPayload>();
MUCItem item;
item.affiliation = affiliation;
item.realJID = jid.toBare();
mucPayload->addItem(item);
- boost::shared_ptr<GenericRequest<MUCAdminPayload> > request = boost::make_shared<GenericRequest<MUCAdminPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_);
+ std::shared_ptr<GenericRequest<MUCAdminPayload> > request = std::make_shared<GenericRequest<MUCAdminPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_);
request->onResponse.connect(boost::bind(&MUCImpl::handleAffiliationChangeResponse, this, _1, _2, jid, affiliation));
request->send();
}
@@ -393,7 +393,7 @@ void MUCImpl::handleAffiliationChangeResponse(MUCAdminPayload::ref /*unused*/, E
}
void MUCImpl::changeSubject(const std::string& subject) {
- Message::ref message = boost::make_shared<Message>();
+ Message::ref message = std::make_shared<Message>();
message->setSubject(subject);
message->setType(Message::Groupchat);
message->setTo(ownMUCJID.toBare());
@@ -402,15 +402,15 @@ void MUCImpl::changeSubject(const std::string& subject) {
void MUCImpl::requestConfigurationForm() {
MUCOwnerPayload::ref mucPayload(new MUCOwnerPayload());
- boost::shared_ptr<GenericRequest<MUCOwnerPayload> > request = boost::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Get, getJID(), mucPayload, iqRouter_);
+ std::shared_ptr<GenericRequest<MUCOwnerPayload> > request = std::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Get, getJID(), mucPayload, iqRouter_);
request->onResponse.connect(boost::bind(&MUCImpl::handleConfigurationFormReceived, this, _1, _2));
request->send();
}
void MUCImpl::cancelConfigureRoom() {
MUCOwnerPayload::ref mucPayload(new MUCOwnerPayload());
- mucPayload->setPayload(boost::make_shared<Form>(Form::CancelType));
- boost::shared_ptr<GenericRequest<MUCOwnerPayload> > request = boost::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_);
+ mucPayload->setPayload(std::make_shared<Form>(Form::CancelType));
+ std::shared_ptr<GenericRequest<MUCOwnerPayload> > request = std::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_);
request->send();
}
@@ -435,7 +435,7 @@ void MUCImpl::handleConfigurationResultReceived(MUCOwnerPayload::ref /*payload*/
void MUCImpl::configureRoom(Form::ref form) {
MUCOwnerPayload::ref mucPayload(new MUCOwnerPayload());
mucPayload->setPayload(form);
- boost::shared_ptr<GenericRequest<MUCOwnerPayload> > request = boost::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_);
+ std::shared_ptr<GenericRequest<MUCOwnerPayload> > request = std::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_);
if (unlocking) {
request->onResponse.connect(boost::bind(&MUCImpl::handleCreationConfigResponse, this, _1, _2));
}
@@ -446,19 +446,19 @@ void MUCImpl::configureRoom(Form::ref form) {
}
void MUCImpl::destroyRoom() {
- MUCOwnerPayload::ref mucPayload = boost::make_shared<MUCOwnerPayload>();
- MUCDestroyPayload::ref mucDestroyPayload = boost::make_shared<MUCDestroyPayload>();
+ MUCOwnerPayload::ref mucPayload = std::make_shared<MUCOwnerPayload>();
+ MUCDestroyPayload::ref mucDestroyPayload = std::make_shared<MUCDestroyPayload>();
mucPayload->setPayload(mucDestroyPayload);
- boost::shared_ptr< GenericRequest<MUCOwnerPayload> > request = boost::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_);
+ std::shared_ptr< GenericRequest<MUCOwnerPayload> > request = std::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_);
request->onResponse.connect(boost::bind(&MUCImpl::handleConfigurationResultReceived, this, _1, _2));
request->send();
}
void MUCImpl::invitePerson(const JID& person, const std::string& reason, bool isImpromptu, bool isReuseChat) {
- Message::ref message = boost::make_shared<Message>();
+ Message::ref message = std::make_shared<Message>();
message->setTo(person);
message->setType(Message::Normal);
- MUCInvitationPayload::ref invite = boost::make_shared<MUCInvitationPayload>();
+ MUCInvitationPayload::ref invite = std::make_shared<MUCInvitationPayload>();
invite->setReason(reason);
invite->setJID(ownMUCJID.toBare());
invite->setIsImpromptu(isImpromptu);
diff --git a/Swiften/MUC/MUCImpl.h b/Swiften/MUC/MUCImpl.h
index 9b4377a..f9802af 100644
--- a/Swiften/MUC/MUCImpl.h
+++ b/Swiften/MUC/MUCImpl.h
@@ -7,9 +7,9 @@
#pragma once
#include <map>
+#include <memory>
#include <string>
-#include <boost/shared_ptr.hpp>
#include <boost/signals/connection.hpp>
#include <Swiften/Base/API.h>
@@ -31,7 +31,7 @@ namespace Swift {
class SWIFTEN_API MUCImpl : public MUC {
public:
- typedef boost::shared_ptr<MUCImpl> ref;
+ typedef std::shared_ptr<MUCImpl> ref;
public:
MUCImpl(StanzaChannel* stanzaChannel, IQRouter* iqRouter, DirectedPresenceSender* presenceSender, const JID &muc, MUCRegistry* mucRegistry);
diff --git a/Swiften/MUC/MUCManager.cpp b/Swiften/MUC/MUCManager.cpp
index b4e3b00..81e5cd5 100644
--- a/Swiften/MUC/MUCManager.cpp
+++ b/Swiften/MUC/MUCManager.cpp
@@ -14,7 +14,7 @@ MUCManager::MUCManager(StanzaChannel* stanzaChannel, IQRouter* iqRouter, Directe
}
MUC::ref MUCManager::createMUC(const JID& jid) {
- return boost::make_shared<MUCImpl>(stanzaChannel, iqRouter, presenceSender, jid, mucRegistry);
+ return std::make_shared<MUCImpl>(stanzaChannel, iqRouter, presenceSender, jid, mucRegistry);
}
}
diff --git a/Swiften/MUC/UnitTest/MUCTest.cpp b/Swiften/MUC/UnitTest/MUCTest.cpp
index 548617c..115787e 100644
--- a/Swiften/MUC/UnitTest/MUCTest.cpp
+++ b/Swiften/MUC/UnitTest/MUCTest.cpp
@@ -4,9 +4,9 @@
* See the COPYING file for more information.
*/
+#include <memory>
+
#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -102,7 +102,7 @@ class MUCTest : public CppUnit::TestFixture {
void testCreateInstant() {
MUC::ref testling = createMUC(JID("rabbithole@wonderland.lit"));
testling->joinAs("Alice");
- Presence::ref serverRespondsLocked = boost::make_shared<Presence>();
+ Presence::ref serverRespondsLocked = std::make_shared<Presence>();
serverRespondsLocked->setFrom(JID("rabbithole@wonderland.lit/Alice"));
MUCUserPayload::ref mucPayload(new MUCUserPayload());
MUCItem myItem;
@@ -122,12 +122,12 @@ class MUCTest : public CppUnit::TestFixture {
}
void testReplicateBug() {
- Presence::ref initialPresence = boost::make_shared<Presence>();
+ Presence::ref initialPresence = std::make_shared<Presence>();
initialPresence->setStatus("");
- VCard::ref vcard = boost::make_shared<VCard>();
+ VCard::ref vcard = std::make_shared<VCard>();
vcard->setPhoto(createByteArray("15c30080ae98ec48be94bf0e191d43edd06e500a"));
initialPresence->addPayload(vcard);
- CapsInfo::ref caps = boost::make_shared<CapsInfo>();
+ CapsInfo::ref caps = std::make_shared<CapsInfo>();
caps->setNode("http://swift.im");
caps->setVersion("p2UP0DrcVgKM6jJqYN/B92DKK0o=");
initialPresence->addPayload(caps);
@@ -135,7 +135,7 @@ class MUCTest : public CppUnit::TestFixture {
MUC::ref testling = createMUC(JID("test@rooms.swift.im"));
testling->joinAs("Test");
- Presence::ref serverRespondsLocked = boost::make_shared<Presence>();
+ Presence::ref serverRespondsLocked = std::make_shared<Presence>();
serverRespondsLocked->setFrom(JID("test@rooms.swift.im/Test"));
serverRespondsLocked->setTo(JID("test@swift.im/6913d576d55f0b67"));
serverRespondsLocked->addPayload(vcard);
@@ -163,14 +163,14 @@ class MUCTest : public CppUnit::TestFixture {
testling->joinAs("Rabbit");
// Rabbit joins
- Presence::ref rabbitJoins = boost::make_shared<Presence>();
+ Presence::ref rabbitJoins = std::make_shared<Presence>();
rabbitJoins->setTo("test@swift.im/6913d576d55f0b67");
rabbitJoins->setFrom(testling->getJID().toString() + "/Rabbit");
channel->onPresenceReceived(rabbitJoins);
CPPUNIT_ASSERT_EQUAL(true, testling->hasOccupant("Rabbit"));
// Alice joins
- Presence::ref aliceJoins = boost::make_shared<Presence>();
+ Presence::ref aliceJoins = std::make_shared<Presence>();
aliceJoins->setTo("test@swift.im/6913d576d55f0b67");
aliceJoins->setFrom(testling->getJID().toString() + "/Alice");
channel->onPresenceReceived(aliceJoins);
@@ -183,7 +183,7 @@ class MUCTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(std::string("Dodo"), stanza->getTo().getResource());
// Alice changes nick to Alice2
- stanza = boost::make_shared<Presence>();
+ stanza = std::make_shared<Presence>();
stanza->setFrom(JID("foo@bar.com/Alice"));
stanza->setTo(JID(router->getJID()));
stanza->setType(Presence::Unavailable);
@@ -201,7 +201,7 @@ class MUCTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(true, testling->hasOccupant("Alice2"));
// We (Rabbit) change nick to Robot
- stanza = boost::make_shared<Presence>();
+ stanza = std::make_shared<Presence>();
stanza->setFrom(JID("foo@bar.com/Rabbit"));
stanza->setTo(JID(router->getJID()));
stanza->setType(Presence::Unavailable);
@@ -235,7 +235,7 @@ class MUCTest : public CppUnit::TestFixture {
private:
MUC::ref createMUC(const JID& jid) {
- MUC::ref muc = boost::make_shared<MUCImpl>(channel, router, presenceSender, jid, mucRegistry);
+ MUC::ref muc = std::make_shared<MUCImpl>(channel, router, presenceSender, jid, mucRegistry);
muc->onOccupantNicknameChanged.connect(boost::bind(&MUCTest::handleOccupantNicknameChanged, this, _1, _2));
return muc;
}
@@ -250,7 +250,7 @@ class MUCTest : public CppUnit::TestFixture {
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>();
+ //MUCUserPayload::ref mucUserPayload = std::make_shared<MUCUserPayload>();
//mucUserPayload->addItem(item);
//p->addPayload(mucUserPayload);
channel->onPresenceReceived(p);
diff --git a/Swiften/MUC/UnitTest/MockMUC.h b/Swiften/MUC/UnitTest/MockMUC.h
index c61f8a9..575c8e7 100644
--- a/Swiften/MUC/UnitTest/MockMUC.h
+++ b/Swiften/MUC/UnitTest/MockMUC.h
@@ -7,9 +7,9 @@
#pragma once
#include <map>
+#include <memory>
#include <string>
-#include <boost/shared_ptr.hpp>
#include <boost/signals/connection.hpp>
#include <Swiften/Base/API.h>
@@ -31,7 +31,7 @@ namespace Swift {
class SWIFTEN_API MockMUC : public MUC{
public:
- typedef boost::shared_ptr<MockMUC> ref;
+ typedef std::shared_ptr<MockMUC> ref;
public:
MockMUC(const JID &muc);