summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/Roster')
-rw-r--r--Swift/Controllers/Roster/ContactRosterItem.cpp6
-rw-r--r--Swift/Controllers/Roster/ContactRosterItem.h8
-rw-r--r--Swift/Controllers/Roster/Roster.h5
-rw-r--r--Swift/Controllers/Roster/RosterController.cpp37
-rw-r--r--Swift/Controllers/Roster/RosterController.h15
-rw-r--r--Swift/Controllers/Roster/RosterItem.h3
-rw-r--r--Swift/Controllers/Roster/TableRoster.h2
-rw-r--r--Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp4
-rw-r--r--Swift/Controllers/Roster/UnitTest/RosterTest.cpp8
-rw-r--r--Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp6
10 files changed, 46 insertions, 48 deletions
diff --git a/Swift/Controllers/Roster/ContactRosterItem.cpp b/Swift/Controllers/Roster/ContactRosterItem.cpp
index 89053e6..0ad023a 100644
--- a/Swift/Controllers/Roster/ContactRosterItem.cpp
+++ b/Swift/Controllers/Roster/ContactRosterItem.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -87,14 +87,14 @@ const JID& ContactRosterItem::getDisplayJID() const {
}
-typedef std::pair<std::string, boost::shared_ptr<Presence> > StringPresencePair;
+typedef std::pair<std::string, std::shared_ptr<Presence> > StringPresencePair;
void ContactRosterItem::clearPresence() {
presence_.reset();
onDataChanged();
}
-void ContactRosterItem::applyPresence(boost::shared_ptr<Presence> presence) {
+void ContactRosterItem::applyPresence(std::shared_ptr<Presence> presence) {
presence_ = presence;
onDataChanged();
}
diff --git a/Swift/Controllers/Roster/ContactRosterItem.h b/Swift/Controllers/Roster/ContactRosterItem.h
index d77ba2d..5cc722e 100644
--- a/Swift/Controllers/Roster/ContactRosterItem.h
+++ b/Swift/Controllers/Roster/ContactRosterItem.h
@@ -1,11 +1,12 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -13,7 +14,6 @@
#include <boost/bind.hpp>
#include <boost/date_time/posix_time/ptime.hpp>
#include <boost/filesystem/path.hpp>
-#include <boost/shared_ptr.hpp>
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/Elements/MUCOccupant.h>
@@ -55,7 +55,7 @@ class ContactRosterItem : public RosterItem {
const JID& getJID() const;
void setDisplayJID(const JID& jid);
const JID& getDisplayJID() const;
- void applyPresence(boost::shared_ptr<Presence> presence);
+ void applyPresence(std::shared_ptr<Presence> presence);
const std::vector<std::string>& getGroups() const;
/** Only used so a contact can know about the groups it's in*/
void addGroup(const std::string& group);
@@ -84,7 +84,7 @@ class ContactRosterItem : public RosterItem {
JID displayJID_;
boost::posix_time::ptime lastAvailableTime_;
boost::filesystem::path avatarPath_;
- boost::shared_ptr<Presence> presence_;
+ std::shared_ptr<Presence> presence_;
std::vector<std::string> groups_;
MUCOccupant::Role mucRole_;
MUCOccupant::Affiliation mucAffiliation_;
diff --git a/Swift/Controllers/Roster/Roster.h b/Swift/Controllers/Roster/Roster.h
index 70e5bab..3bd9ec0 100644
--- a/Swift/Controllers/Roster/Roster.h
+++ b/Swift/Controllers/Roster/Roster.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -7,12 +7,11 @@
#pragma once
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
-#include <boost/shared_ptr.hpp>
-
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/JID/JID.h>
diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp
index f863ed7..47c24fc 100644
--- a/Swift/Controllers/Roster/RosterController.cpp
+++ b/Swift/Controllers/Roster/RosterController.cpp
@@ -6,8 +6,9 @@
#include <Swift/Controllers/Roster/RosterController.h>
+#include <memory>
+
#include <boost/bind.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Avatars/AvatarManager.h>
#include <Swiften/Base/Path.h>
@@ -96,7 +97,7 @@ RosterController::RosterController(const JID& jid, XMPPRoster* xmppRoster, Avata
handleShowOfflineToggled(settings_->getSetting(SettingConstants::SHOW_OFFLINE));
- ownContact_ = boost::make_shared<ContactRosterItem>(myJID_.toBare(), myJID_.toBare(), nickManager_->getOwnNick(), static_cast<GroupRosterItem*>(nullptr));
+ ownContact_ = std::make_shared<ContactRosterItem>(myJID_.toBare(), myJID_.toBare(), nickManager_->getOwnNick(), static_cast<GroupRosterItem*>(nullptr));
ownContact_->setVCard(vcardManager_->getVCard(myJID_.toBare()));
ownContact_->setAvatarPath(pathToString(avatarManager_->getAvatarPath(myJID_.toBare())));
mainWindow_->setMyContactRosterItem(ownContact_);
@@ -216,39 +217,39 @@ void RosterController::handleBlockingItemRemoved(const JID& jid) {
roster_->applyOnItems(SetBlockingState(jid, ContactRosterItem::IsUnblocked));
}
-void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
- if (boost::shared_ptr<AddContactUIEvent> addContactEvent = boost::dynamic_pointer_cast<AddContactUIEvent>(event)) {
+void RosterController::handleUIEvent(std::shared_ptr<UIEvent> event) {
+ if (std::shared_ptr<AddContactUIEvent> addContactEvent = std::dynamic_pointer_cast<AddContactUIEvent>(event)) {
RosterItemPayload item;
item.setName(addContactEvent->getName());
item.setJID(addContactEvent->getJID());
item.setGroups(std::vector<std::string>(addContactEvent->getGroups().begin(), addContactEvent->getGroups().end()));
- boost::shared_ptr<RosterPayload> roster(new RosterPayload());
+ std::shared_ptr<RosterPayload> roster(new RosterPayload());
roster->addItem(item);
SetRosterRequest::ref request = SetRosterRequest::create(roster, iqRouter_);
request->onResponse.connect(boost::bind(&RosterController::handleRosterSetError, this, _1, roster));
request->send();
subscriptionManager_->requestSubscription(addContactEvent->getJID());
}
- else if (boost::shared_ptr<RemoveRosterItemUIEvent> removeEvent = boost::dynamic_pointer_cast<RemoveRosterItemUIEvent>(event)) {
+ else if (std::shared_ptr<RemoveRosterItemUIEvent> removeEvent = std::dynamic_pointer_cast<RemoveRosterItemUIEvent>(event)) {
RosterItemPayload item(removeEvent->getJID(), "", RosterItemPayload::Remove);
- boost::shared_ptr<RosterPayload> roster(new RosterPayload());
+ std::shared_ptr<RosterPayload> roster(new RosterPayload());
roster->addItem(item);
SetRosterRequest::ref request = SetRosterRequest::create(roster, iqRouter_);
request->onResponse.connect(boost::bind(&RosterController::handleRosterSetError, this, _1, roster));
request->send();
}
- else if (boost::shared_ptr<RenameRosterItemUIEvent> renameEvent = boost::dynamic_pointer_cast<RenameRosterItemUIEvent>(event)) {
+ else if (std::shared_ptr<RenameRosterItemUIEvent> renameEvent = std::dynamic_pointer_cast<RenameRosterItemUIEvent>(event)) {
JID contact(renameEvent->getJID());
RosterItemPayload item(contact, renameEvent->getNewName(), xmppRoster_->getSubscriptionStateForJID(contact));
item.setGroups(xmppRoster_->getGroupsForJID(contact));
- boost::shared_ptr<RosterPayload> roster(new RosterPayload());
+ std::shared_ptr<RosterPayload> roster(new RosterPayload());
roster->addItem(item);
SetRosterRequest::ref request = SetRosterRequest::create(roster, iqRouter_);
request->onResponse.connect(boost::bind(&RosterController::handleRosterSetError, this, _1, roster));
request->send();
}
- else if (boost::shared_ptr<RenameGroupUIEvent> renameGroupEvent = boost::dynamic_pointer_cast<RenameGroupUIEvent>(event)) {
+ else if (std::shared_ptr<RenameGroupUIEvent> renameGroupEvent = std::dynamic_pointer_cast<RenameGroupUIEvent>(event)) {
std::vector<XMPPRosterItem> items = xmppRoster_->getItems();
std::string group = renameGroupEvent->getGroup();
// FIXME: We should handle contacts groups specially to avoid clashes
@@ -267,7 +268,7 @@ void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
}
}
}
- else if (boost::shared_ptr<SendFileUIEvent> sendFileEvent = boost::dynamic_pointer_cast<SendFileUIEvent>(event)) {
+ else if (std::shared_ptr<SendFileUIEvent> sendFileEvent = std::dynamic_pointer_cast<SendFileUIEvent>(event)) {
//TODO add send file dialog to ChatView of receipient jid
ftOverview_->sendFile(sendFileEvent->getJID(), sendFileEvent->getFilename());
}
@@ -281,7 +282,7 @@ void RosterController::updateItem(const XMPPRosterItem& item) {
RosterItemPayload itemPayload(item.getJID(), item.getName(), item.getSubscription());
itemPayload.setGroups(item.getGroups());
- RosterPayload::ref roster = boost::make_shared<RosterPayload>();
+ RosterPayload::ref roster = std::make_shared<RosterPayload>();
roster->addItem(itemPayload);
SetRosterRequest::ref request = SetRosterRequest::create(roster, iqRouter_);
@@ -290,7 +291,7 @@ void RosterController::updateItem(const XMPPRosterItem& item) {
}
void RosterController::initBlockingCommand() {
- boost::shared_ptr<BlockList> blockList = clientBlockListManager_->requestBlockList();
+ std::shared_ptr<BlockList> blockList = clientBlockListManager_->requestBlockList();
blockingOnStateChangedConnection_ = blockList->onStateChanged.connect(boost::bind(&RosterController::handleBlockingStateChanged, this));
blockingOnItemAddedConnection_ = blockList->onItemAdded.connect(boost::bind(&RosterController::handleBlockingItemAdded, this, _1));
@@ -303,11 +304,11 @@ void RosterController::initBlockingCommand() {
}
}
-void RosterController::handleRosterItemUpdated(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> rosterPayload) {
+void RosterController::handleRosterItemUpdated(ErrorPayload::ref error, std::shared_ptr<RosterPayload> rosterPayload) {
if (!!error) {
handleRosterSetError(error, rosterPayload);
}
- boost::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList();
+ std::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList();
std::vector<RosterItemPayload> items = rosterPayload->getItems();
if (blockList->getState() == BlockList::Available && items.size() > 0) {
std::vector<JID> jids = blockList->getItems();
@@ -317,7 +318,7 @@ void RosterController::handleRosterItemUpdated(ErrorPayload::ref error, boost::s
}
}
-void RosterController::handleRosterSetError(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> rosterPayload) {
+void RosterController::handleRosterSetError(ErrorPayload::ref error, std::shared_ptr<RosterPayload> rosterPayload) {
if (!error) {
return;
}
@@ -325,7 +326,7 @@ void RosterController::handleRosterSetError(ErrorPayload::ref error, boost::shar
if (!error->getText().empty()) {
text += ": " + error->getText();
}
- boost::shared_ptr<ErrorEvent> errorEvent(new ErrorEvent(JID(myJID_.getDomain()), text));
+ std::shared_ptr<ErrorEvent> errorEvent(new ErrorEvent(JID(myJID_.getDomain()), text));
eventController_->handleIncomingEvent(errorEvent);
}
@@ -350,7 +351,7 @@ void RosterController::handleSubscriptionRequest(const JID& jid, const std::stri
SubscriptionRequestEvent* eventPointer = new SubscriptionRequestEvent(jid, message);
eventPointer->onAccept.connect(boost::bind(&RosterController::handleSubscriptionRequestAccepted, this, eventPointer));
eventPointer->onDecline.connect(boost::bind(&RosterController::handleSubscriptionRequestDeclined, this, eventPointer));
- boost::shared_ptr<StanzaEvent> event(eventPointer);
+ std::shared_ptr<StanzaEvent> event(eventPointer);
eventController_->handleIncomingEvent(event);
}
diff --git a/Swift/Controllers/Roster/RosterController.h b/Swift/Controllers/Roster/RosterController.h
index f1660a8..333a0a5 100644
--- a/Swift/Controllers/Roster/RosterController.h
+++ b/Swift/Controllers/Roster/RosterController.h
@@ -1,16 +1,15 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
+#include <memory>
#include <set>
#include <string>
-#include <boost/shared_ptr.hpp>
-
#include <Swiften/Avatars/AvatarManager.h>
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/Elements/ErrorPayload.h>
@@ -77,13 +76,13 @@ namespace Swift {
void handleStartChatRequest(const JID& contact);
void handleChangeStatusRequest(StatusShow::Type show, const std::string &statusText);
void handleShowOfflineToggled(bool state);
- void handleIncomingPresence(boost::shared_ptr<Presence> newPresence);
+ void handleIncomingPresence(std::shared_ptr<Presence> newPresence);
void handleSubscriptionRequest(const JID& jid, const std::string& message);
void handleSubscriptionRequestAccepted(SubscriptionRequestEvent* event);
void handleSubscriptionRequestDeclined(SubscriptionRequestEvent* event);
- void handleUIEvent(boost::shared_ptr<UIEvent> event);
- void handleRosterItemUpdated(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> rosterPayload);
- void handleRosterSetError(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> rosterPayload);
+ void handleUIEvent(std::shared_ptr<UIEvent> event);
+ void handleRosterItemUpdated(ErrorPayload::ref error, std::shared_ptr<RosterPayload> rosterPayload);
+ void handleRosterSetError(ErrorPayload::ref error, std::shared_ptr<RosterPayload> rosterPayload);
void applyAllPresenceTo(const JID& jid);
void handleEditProfileRequest();
void handleOnCapsChanged(const JID& jid);
@@ -114,7 +113,7 @@ namespace Swift {
FileTransferOverview* ftOverview_;
ClientBlockListManager* clientBlockListManager_;
RosterVCardProvider* rosterVCardProvider_;
- boost::shared_ptr<ContactRosterItem> ownContact_;
+ std::shared_ptr<ContactRosterItem> ownContact_;
boost::bsignals::scoped_connection blockingOnStateChangedConnection_;
boost::bsignals::scoped_connection blockingOnItemAddedConnection_;
diff --git a/Swift/Controllers/Roster/RosterItem.h b/Swift/Controllers/Roster/RosterItem.h
index e7a3e20..2c51ae9 100644
--- a/Swift/Controllers/Roster/RosterItem.h
+++ b/Swift/Controllers/Roster/RosterItem.h
@@ -6,10 +6,9 @@
#pragma once
+#include <memory>
#include <string>
-#include <boost/shared_ptr.hpp>
-
#include <Swiften/Base/boost_bsignals.h>
namespace Swift {
diff --git a/Swift/Controllers/Roster/TableRoster.h b/Swift/Controllers/Roster/TableRoster.h
index 3d336ef..19a4ec6 100644
--- a/Swift/Controllers/Roster/TableRoster.h
+++ b/Swift/Controllers/Roster/TableRoster.h
@@ -80,6 +80,6 @@ namespace Swift {
Roster* model;
std::vector<Section> sections;
bool updatePending;
- boost::shared_ptr<Timer> updateTimer;
+ std::shared_ptr<Timer> updateTimer;
};
}
diff --git a/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp b/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp
index 91cc764..e01f78a 100644
--- a/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp
+++ b/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp
@@ -318,10 +318,10 @@ class RosterControllerTest : public CppUnit::TestFixture {
groups.push_back("Enemies");
xmppRoster_->addContact(jid, "Bob", groups, RosterItemPayload::From);
CPPUNIT_ASSERT_EQUAL(groups.size(), xmppRoster_->getGroupsForJID(jid).size());
- uiEventStream_->send(boost::shared_ptr<UIEvent>(new RenameRosterItemUIEvent(jid, "Robert")));
+ uiEventStream_->send(std::make_shared<RenameRosterItemUIEvent>(jid, "Robert"));
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), channel_->iqs_.size());
CPPUNIT_ASSERT_EQUAL(IQ::Set, channel_->iqs_[0]->getType());
- boost::shared_ptr<RosterPayload> payload = channel_->iqs_[0]->getPayload<RosterPayload>();
+ std::shared_ptr<RosterPayload> payload = channel_->iqs_[0]->getPayload<RosterPayload>();
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), payload->getItems().size());
RosterItemPayload item = payload->getItems()[0];
CPPUNIT_ASSERT_EQUAL(jid, item.getJID());
diff --git a/Swift/Controllers/Roster/UnitTest/RosterTest.cpp b/Swift/Controllers/Roster/UnitTest/RosterTest.cpp
index dd22cb7..4687176 100644
--- a/Swift/Controllers/Roster/UnitTest/RosterTest.cpp
+++ b/Swift/Controllers/Roster/UnitTest/RosterTest.cpp
@@ -4,7 +4,7 @@
* See the COPYING file for more information.
*/
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -90,7 +90,7 @@ class RosterTest : public CppUnit::TestFixture {
roster_->removeContact(jid4b);
roster_->addContact(jid4c, JID(), "Bert", "group1", "");
roster_->addContact(jid4b, JID(), "Ernie", "group1", "");
- boost::shared_ptr<Presence> presence(new Presence());
+ std::shared_ptr<Presence> presence(new Presence());
presence->setShow(StatusShow::DND);
presence->setFrom(jid4a);
roster_->applyOnItems(SetPresence(presence, JID::WithResource));
@@ -99,7 +99,7 @@ class RosterTest : public CppUnit::TestFixture {
presence->setFrom(jid4c);
roster_->applyOnItems(SetPresence(presence, JID::WithResource));
- presence = boost::make_shared<Presence>();
+ presence = std::make_shared<Presence>();
presence->setFrom(jid4b);
presence->setShow(StatusShow::Online);
roster_->applyOnItems(SetPresence(presence, JID::WithResource));
@@ -111,7 +111,7 @@ class RosterTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(std::string("Bert"), children[1]->getDisplayName());
CPPUNIT_ASSERT_EQUAL(std::string("Bird"), children[2]->getDisplayName());
- presence = boost::make_shared<Presence>();
+ presence = std::make_shared<Presence>();
presence->setFrom(jid4c);
presence->setType(Presence::Unavailable);
roster_->removeContact(jid4c);
diff --git a/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp b/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp
index 086bd6f..e4e8bdb 100644
--- a/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp
+++ b/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -16,7 +16,7 @@ std::ostream& operator<<(std::ostream& os, const Swift::TableRoster::Index& i) {
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <boost/variant.hpp>
#include <Swiften/Network/DummyTimerFactory.h>
@@ -46,7 +46,7 @@ class TableRosterTest : public CppUnit::TestFixture {
void testAddContact_EmptyRoster() {
/*
- boost::shared_ptr<TableRoster> tableRoster(createTestling());
+ std::shared_ptr<TableRoster> tableRoster(createTestling());
addContact(jid1, "1", "group1");