diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-05-08 17:18:21 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-05-08 17:22:18 (GMT) |
commit | 09de88ddd4377a53a880b98d63bbe391eba982b9 (patch) | |
tree | baa45c64b17eff11c22be25ba52271ee822268fd | |
parent | fc7c2dd9140b38df288450a4732297b53188e87a (diff) | |
download | swift-09de88ddd4377a53a880b98d63bbe391eba982b9.zip swift-09de88ddd4377a53a880b98d63bbe391eba982b9.tar.bz2 |
Renamed Conference->Room.
9 files changed, 70 insertions, 70 deletions
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<Conference>& getConferences() const { + const std::vector<Room>& 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<Conference> conferences; + std::vector<Room> conferences; std::vector<URL> 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<Storage> payl storage = payload; std::vector<MUCBookmark> 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<Storage::Conference> conference; + boost::optional<Storage::Room> room; boost::optional<Storage::URL> 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> storage = boost::dynamic_pointer_cast<Storage>(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> storage = boost::dynamic_pointer_cast<Storage>(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>")); Storage* payload = dynamic_cast<Storage*>(parser.getPayload().get()); - std::vector<Storage::Conference> conferences = payload->getConferences(); - CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(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<Storage::Room> rooms = payload->getRooms(); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(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>")); Storage* payload = dynamic_cast<Storage*>(parser.getPayload().get()); - std::vector<Storage::Conference> conferences = payload->getConferences(); - CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(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<Storage::Room> rooms = payload->getRooms(); + CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(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<Storage>() { String StorageSerializer::serializePayload(boost::shared_ptr<Storage> storage) const { XMLElement storageElement("storage", "storage:bookmarks"); - foreach(const Storage::Conference& conference, storage->getConferences()) { + foreach(const Storage::Room& room, storage->getRooms()) { boost::shared_ptr<XMLElement> 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<XMLElement> nickElement(new XMLElement("nick")); - nickElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(conference.nick))); + nickElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(room.nick))); conferenceElement->addNode(nickElement); } - if (!conference.password.isEmpty()) { + if (!room.password.isEmpty()) { boost::shared_ptr<XMLElement> passwordElement(new XMLElement("password")); - passwordElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(conference.password))); + passwordElement->addNode(boost::shared_ptr<XMLTextNode>(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> privateStorage(new PrivateStorage()); boost::shared_ptr<Storage> 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> 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> 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( "<storage xmlns=\"storage:bookmarks\">" |