From 09de88ddd4377a53a880b98d63bbe391eba982b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sat, 8 May 2010 19:18:21 +0200 Subject: Renamed Conference->Room. diff --git a/Swiften/Elements/Storage.h b/Swiften/Elements/Storage.h index dcc4b85..7d978d1 100644 --- a/Swiften/Elements/Storage.h +++ b/Swiften/Elements/Storage.h @@ -15,8 +15,8 @@ namespace Swift { class Storage : public Payload { public: - struct Conference { - Conference() : autoJoin(false) {} + struct Room { + Room() : autoJoin(false) {} String name; JID jid; @@ -35,11 +35,11 @@ namespace Swift { Storage() { } - const std::vector& getConferences() const { + const std::vector& getRooms() const { return conferences; } - void addConference(const Conference& conference) { + void addRoom(const Room& conference) { conferences.push_back(conference); } @@ -52,7 +52,7 @@ namespace Swift { } private: - std::vector conferences; + std::vector conferences; std::vector urls; }; } diff --git a/Swiften/MUC/MUCBookmarkManager.cpp b/Swiften/MUC/MUCBookmarkManager.cpp index aa8f026..3675635 100644 --- a/Swiften/MUC/MUCBookmarkManager.cpp +++ b/Swiften/MUC/MUCBookmarkManager.cpp @@ -28,15 +28,15 @@ void MUCBookmarkManager::handleBookmarksReceived(boost::shared_ptr payl storage = payload; std::vector receivedBookmarks; - foreach (Storage::Conference conference, payload->getConferences()) { - String name = (!conference.name.isEmpty()) ? conference.name : conference.jid.getNode(); - MUCBookmark bookmark(conference.jid, name); - bookmark.setAutojoin(conference.autoJoin); - if (!conference.nick.isEmpty()) { - bookmark.setNick(conference.nick); + foreach (Storage::Room room, payload->getRooms()) { + String name = (!room.name.isEmpty()) ? room.name : room.jid.getNode(); + MUCBookmark bookmark(room.jid, name); + bookmark.setAutojoin(room.autoJoin); + if (!room.nick.isEmpty()) { + bookmark.setNick(room.nick); } - if (!conference.password.isEmpty()) { - bookmark.setPassword(conference.password); + if (!room.password.isEmpty()) { + bookmark.setPassword(room.password); } receivedBookmarks.push_back(bookmark); } diff --git a/Swiften/Parser/PayloadParsers/StorageParser.cpp b/Swiften/Parser/PayloadParsers/StorageParser.cpp index 660bdd0..c82b82c 100644 --- a/Swiften/Parser/PayloadParsers/StorageParser.cpp +++ b/Swiften/Parser/PayloadParsers/StorageParser.cpp @@ -16,11 +16,11 @@ StorageParser::StorageParser() : level(TopLevel) { void StorageParser::handleStartElement(const String& element, const String&, const AttributeMap& attributes) { if (level == BookmarkLevel) { if (element == "conference") { - assert(!conference); - conference = Storage::Conference(); - conference->autoJoin = attributes.getBoolAttribute("autojoin", false); - conference->jid = JID(attributes.getAttribute("jid")); - conference->name = attributes.getAttribute("name"); + assert(!room); + room = Storage::Room(); + room->autoJoin = attributes.getBoolAttribute("autojoin", false); + room->jid = JID(attributes.getAttribute("jid")); + room->name = attributes.getAttribute("name"); } else if (element == "url") { assert(!url); @@ -39,9 +39,9 @@ void StorageParser::handleEndElement(const String& element, const String&) { --level; if (level == BookmarkLevel) { if (element == "conference") { - assert(conference); - getPayloadInternal()->addConference(*conference); - conference.reset(); + assert(room); + getPayloadInternal()->addRoom(*room); + room.reset(); } else if (element == "url") { assert(url); @@ -49,12 +49,12 @@ void StorageParser::handleEndElement(const String& element, const String&) { url.reset(); } } - else if (level == DetailLevel && conference) { + else if (level == DetailLevel && room) { if (element == "nick") { - conference->nick = currentText; + room->nick = currentText; } else if (element == "password") { - conference->password = currentText; + room->password = currentText; } } } diff --git a/Swiften/Parser/PayloadParsers/StorageParser.h b/Swiften/Parser/PayloadParsers/StorageParser.h index e8fcbd8..a8bd4a2 100644 --- a/Swiften/Parser/PayloadParsers/StorageParser.h +++ b/Swiften/Parser/PayloadParsers/StorageParser.h @@ -28,7 +28,7 @@ namespace Swift { }; int level; String currentText; - boost::optional conference; + boost::optional room; boost::optional url; }; } diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp index b30b204..0fe58e0 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp @@ -40,8 +40,8 @@ class PrivateStorageParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(payload); boost::shared_ptr storage = boost::dynamic_pointer_cast(payload->getPayload()); CPPUNIT_ASSERT(storage); - CPPUNIT_ASSERT_EQUAL(String("Alice"), storage->getConferences()[0].nick); - CPPUNIT_ASSERT_EQUAL(JID("swift@rooms.swift.im"), storage->getConferences()[0].jid); + CPPUNIT_ASSERT_EQUAL(String("Alice"), storage->getRooms()[0].nick); + CPPUNIT_ASSERT_EQUAL(JID("swift@rooms.swift.im"), storage->getRooms()[0].jid); } void testParse_NoPayload() { @@ -75,7 +75,7 @@ class PrivateStorageParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(payload); boost::shared_ptr storage = boost::dynamic_pointer_cast(payload->getPayload()); CPPUNIT_ASSERT(storage); - CPPUNIT_ASSERT_EQUAL(String("Rabbit"), storage->getConferences()[0].nick); + CPPUNIT_ASSERT_EQUAL(String("Rabbit"), storage->getRooms()[0].nick); } void testParse_UnsupportedPayload() { diff --git a/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp index 03dc144..cad3b5c 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp @@ -14,15 +14,15 @@ using namespace Swift; class StorageParserTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(StorageParserTest); - CPPUNIT_TEST(testParse_Conference); - CPPUNIT_TEST(testParse_MultipleConferences); + CPPUNIT_TEST(testParse_Room); + CPPUNIT_TEST(testParse_MultipleRooms); CPPUNIT_TEST(testParse_URL); CPPUNIT_TEST_SUITE_END(); public: StorageParserTest() {} - void testParse_Conference() { + void testParse_Room() { PayloadsParserTester parser; CPPUNIT_ASSERT(parser.parse( @@ -36,16 +36,16 @@ class StorageParserTest : public CppUnit::TestFixture { "")); Storage* payload = dynamic_cast(parser.getPayload().get()); - std::vector conferences = payload->getConferences(); - CPPUNIT_ASSERT_EQUAL(1, static_cast(conferences.size())); - CPPUNIT_ASSERT_EQUAL(String("Council of Oberon"), conferences[0].name); - CPPUNIT_ASSERT_EQUAL(JID("council@conference.underhill.org"), conferences[0].jid); - CPPUNIT_ASSERT(conferences[0].autoJoin); - CPPUNIT_ASSERT_EQUAL(String("Puck"), conferences[0].nick); - CPPUNIT_ASSERT_EQUAL(String("MyPass"), conferences[0].password); + std::vector rooms = payload->getRooms(); + CPPUNIT_ASSERT_EQUAL(1, static_cast(rooms.size())); + CPPUNIT_ASSERT_EQUAL(String("Council of Oberon"), rooms[0].name); + CPPUNIT_ASSERT_EQUAL(JID("council@conference.underhill.org"), rooms[0].jid); + CPPUNIT_ASSERT(rooms[0].autoJoin); + CPPUNIT_ASSERT_EQUAL(String("Puck"), rooms[0].nick); + CPPUNIT_ASSERT_EQUAL(String("MyPass"), rooms[0].password); } - void testParse_MultipleConferences() { + void testParse_MultipleRooms() { PayloadsParserTester parser; CPPUNIT_ASSERT(parser.parse( @@ -59,12 +59,12 @@ class StorageParserTest : public CppUnit::TestFixture { "")); Storage* payload = dynamic_cast(parser.getPayload().get()); - std::vector conferences = payload->getConferences(); - CPPUNIT_ASSERT_EQUAL(2, static_cast(conferences.size())); - CPPUNIT_ASSERT_EQUAL(String("Council of Oberon"), conferences[0].name); - CPPUNIT_ASSERT_EQUAL(JID("council@conference.underhill.org"), conferences[0].jid); - CPPUNIT_ASSERT_EQUAL(String("Tea party"), conferences[1].name); - CPPUNIT_ASSERT_EQUAL(JID("teaparty@wonderland.lit"), conferences[1].jid); + std::vector rooms = payload->getRooms(); + CPPUNIT_ASSERT_EQUAL(2, static_cast(rooms.size())); + CPPUNIT_ASSERT_EQUAL(String("Council of Oberon"), rooms[0].name); + CPPUNIT_ASSERT_EQUAL(JID("council@conference.underhill.org"), rooms[0].jid); + CPPUNIT_ASSERT_EQUAL(String("Tea party"), rooms[1].name); + CPPUNIT_ASSERT_EQUAL(JID("teaparty@wonderland.lit"), rooms[1].jid); } void testParse_URL() { diff --git a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp index b4a2a49..0de75e5 100644 --- a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp @@ -20,19 +20,19 @@ StorageSerializer::StorageSerializer() : GenericPayloadSerializer() { String StorageSerializer::serializePayload(boost::shared_ptr storage) const { XMLElement storageElement("storage", "storage:bookmarks"); - foreach(const Storage::Conference& conference, storage->getConferences()) { + foreach(const Storage::Room& room, storage->getRooms()) { boost::shared_ptr conferenceElement(new XMLElement("conference")); - conferenceElement->setAttribute("name", conference.name); - conferenceElement->setAttribute("jid", conference.jid); - conferenceElement->setAttribute("autojoin", conference.autoJoin ? "1" : "0"); - if (!conference.nick.isEmpty()) { + conferenceElement->setAttribute("name", room.name); + conferenceElement->setAttribute("jid", room.jid); + conferenceElement->setAttribute("autojoin", room.autoJoin ? "1" : "0"); + if (!room.nick.isEmpty()) { boost::shared_ptr nickElement(new XMLElement("nick")); - nickElement->addNode(boost::shared_ptr(new XMLTextNode(conference.nick))); + nickElement->addNode(boost::shared_ptr(new XMLTextNode(room.nick))); conferenceElement->addNode(nickElement); } - if (!conference.password.isEmpty()) { + if (!room.password.isEmpty()) { boost::shared_ptr passwordElement(new XMLElement("password")); - passwordElement->addNode(boost::shared_ptr(new XMLTextNode(conference.password))); + passwordElement->addNode(boost::shared_ptr(new XMLTextNode(room.password))); conferenceElement->addNode(passwordElement); } storageElement.addNode(conferenceElement); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp index 97a4655..59df665 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp @@ -26,11 +26,11 @@ class PrivateStorageSerializerTest : public CppUnit::TestFixture { boost::shared_ptr privateStorage(new PrivateStorage()); boost::shared_ptr storage(new Storage()); - Storage::Conference conference; - conference.name = "Swift"; - conference.jid = JID("swift@rooms.swift.im"); - conference.nick = "Alice"; - storage->addConference(conference); + Storage::Room room; + room.name = "Swift"; + room.jid = JID("swift@rooms.swift.im"); + room.nick = "Alice"; + storage->addRoom(room); privateStorage->setPayload(storage); CPPUNIT_ASSERT_EQUAL(String( diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp index 5888731..8add953 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp @@ -24,13 +24,13 @@ class StorageSerializerTest : public CppUnit::TestFixture { void testSerialize() { PayloadsSerializer serializer; boost::shared_ptr storage(new Storage()); - Storage::Conference conference; - conference.name = "Council of Oberon"; - conference.autoJoin = true; - conference.jid = JID("council@conference.underhill.org"); - conference.nick = "Puck"; - conference.password = "MyPass"; - storage->addConference(conference); + Storage::Room room; + room.name = "Council of Oberon"; + room.autoJoin = true; + room.jid = JID("council@conference.underhill.org"); + room.nick = "Puck"; + room.password = "MyPass"; + storage->addRoom(room); Storage::URL url; url.name = "Complete Works of Shakespeare"; url.url = "http://the-tech.mit.edu/Shakespeare/"; @@ -52,11 +52,11 @@ class StorageSerializerTest : public CppUnit::TestFixture { void testSerialize_NoNickOrPassword() { PayloadsSerializer serializer; boost::shared_ptr storage(new Storage()); - Storage::Conference conference; - conference.name = "Council of Oberon"; - conference.autoJoin = true; - conference.jid = JID("council@conference.underhill.org"); - storage->addConference(conference); + Storage::Room room; + room.name = "Council of Oberon"; + room.autoJoin = true; + room.jid = JID("council@conference.underhill.org"); + storage->addRoom(room); CPPUNIT_ASSERT_EQUAL(String( "" -- cgit v0.10.2-6-g49f6