summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser/PayloadParsers')
-rw-r--r--Swiften/Parser/PayloadParsers/StorageParser.cpp22
-rw-r--r--Swiften/Parser/PayloadParsers/StorageParser.h2
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp6
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp34
4 files changed, 32 insertions, 32 deletions
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() {