summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser/PayloadParsers/RosterItemExchangeParser.cpp')
-rw-r--r--Swiften/Parser/PayloadParsers/RosterItemExchangeParser.cpp82
1 files changed, 41 insertions, 41 deletions
diff --git a/Swiften/Parser/PayloadParsers/RosterItemExchangeParser.cpp b/Swiften/Parser/PayloadParsers/RosterItemExchangeParser.cpp
index de6caa1..f99f592 100644
--- a/Swiften/Parser/PayloadParsers/RosterItemExchangeParser.cpp
+++ b/Swiften/Parser/PayloadParsers/RosterItemExchangeParser.cpp
@@ -20,56 +20,56 @@ RosterItemExchangeParser::RosterItemExchangeParser() : level_(TopLevel), inItem_
}
void RosterItemExchangeParser::handleStartElement(const std::string& element, const std::string& /*ns*/, const AttributeMap& attributes) {
- if (level_ == PayloadLevel) {
- if (element == "item") {
- inItem_ = true;
+ if (level_ == PayloadLevel) {
+ if (element == "item") {
+ inItem_ = true;
- currentItem_ = RosterItemExchangePayload::Item();
+ currentItem_ = RosterItemExchangePayload::Item();
- currentItem_.setJID(JID(attributes.getAttribute("jid")));
- currentItem_.setName(attributes.getAttribute("name"));
+ currentItem_.setJID(JID(attributes.getAttribute("jid")));
+ currentItem_.setName(attributes.getAttribute("name"));
- std::string action = attributes.getAttribute("action");
- if (action == "add") {
- currentItem_.setAction(RosterItemExchangePayload::Item::Add);
- }
- else if (action == "modify") {
- currentItem_.setAction(RosterItemExchangePayload::Item::Modify);
- }
- else if (action == "delete") {
- currentItem_.setAction(RosterItemExchangePayload::Item::Delete);
- }
- else {
- // Add is default action according to XEP
- currentItem_.setAction(RosterItemExchangePayload::Item::Add);
- }
- }
- }
- else if (level_ == ItemLevel) {
- if (element == "group") {
- currentText_ = "";
- }
- }
- ++level_;
+ std::string action = attributes.getAttribute("action");
+ if (action == "add") {
+ currentItem_.setAction(RosterItemExchangePayload::Item::Add);
+ }
+ else if (action == "modify") {
+ currentItem_.setAction(RosterItemExchangePayload::Item::Modify);
+ }
+ else if (action == "delete") {
+ currentItem_.setAction(RosterItemExchangePayload::Item::Delete);
+ }
+ else {
+ // Add is default action according to XEP
+ currentItem_.setAction(RosterItemExchangePayload::Item::Add);
+ }
+ }
+ }
+ else if (level_ == ItemLevel) {
+ if (element == "group") {
+ currentText_ = "";
+ }
+ }
+ ++level_;
}
void RosterItemExchangeParser::handleEndElement(const std::string& element, const std::string& /*ns*/) {
- --level_;
- if (level_ == PayloadLevel) {
- if (inItem_) {
- getPayloadInternal()->addItem(currentItem_);
- inItem_ = false;
- }
- }
- else if (level_ == ItemLevel) {
- if (element == "group") {
- currentItem_.addGroup(currentText_);
- }
- }
+ --level_;
+ if (level_ == PayloadLevel) {
+ if (inItem_) {
+ getPayloadInternal()->addItem(currentItem_);
+ inItem_ = false;
+ }
+ }
+ else if (level_ == ItemLevel) {
+ if (element == "group") {
+ currentItem_.addGroup(currentText_);
+ }
+ }
}
void RosterItemExchangeParser::handleCharacterData(const std::string& data) {
- currentText_ += data;
+ currentText_ += data;
}
}