summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp')
-rw-r--r--Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp192
1 files changed, 96 insertions, 96 deletions
diff --git a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp
index d29fa73..b019626 100644
--- a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp
@@ -14,118 +14,118 @@
namespace Swift {
InBandRegistrationPayloadParser::InBandRegistrationPayloadParser() : level(TopLevel), formParser(NULL) {
- formParserFactory = new FormParserFactory();
+ formParserFactory = new FormParserFactory();
}
InBandRegistrationPayloadParser::~InBandRegistrationPayloadParser() {
- delete formParserFactory;
+ delete formParserFactory;
}
void InBandRegistrationPayloadParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == TopLevel) {
- }
- else if (level == PayloadLevel) {
- if (element == "x" && ns == "jabber:x:data") {
- assert(!formParser);
- formParser = boost::polymorphic_downcast<FormParser*>(formParserFactory->createPayloadParser());
- }
- else {
- currentText.clear();
- }
- }
+ if (level == TopLevel) {
+ }
+ else if (level == PayloadLevel) {
+ if (element == "x" && ns == "jabber:x:data") {
+ assert(!formParser);
+ formParser = boost::polymorphic_downcast<FormParser*>(formParserFactory->createPayloadParser());
+ }
+ else {
+ currentText.clear();
+ }
+ }
- if (formParser) {
- formParser->handleStartElement(element, ns, attributes);
- }
+ if (formParser) {
+ formParser->handleStartElement(element, ns, attributes);
+ }
- ++level;
+ ++level;
}
void InBandRegistrationPayloadParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
+ --level;
- if (formParser) {
- formParser->handleEndElement(element, ns);
- }
+ if (formParser) {
+ formParser->handleEndElement(element, ns);
+ }
- if (level == TopLevel) {
- }
- else if (level == PayloadLevel) {
- if (formParser) {
- getPayloadInternal()->setForm(formParser->getPayloadInternal());
- delete formParser;
- formParser = NULL;
- }
- else if (element == "registered") {
- getPayloadInternal()->setRegistered(true);
- }
- else if (element == "remove") {
- getPayloadInternal()->setRemove(true);
- }
- else if (element == "instructions") {
- getPayloadInternal()->setInstructions(currentText);
- }
- else if (element == "username") {
- getPayloadInternal()->setUsername(currentText);
- }
- else if (element == "nick") {
- getPayloadInternal()->setNick(currentText);
- }
- else if (element == "password") {
- getPayloadInternal()->setPassword(currentText);
- }
- else if (element == "name") {
- getPayloadInternal()->setName(currentText);
- }
- else if (element == "first") {
- getPayloadInternal()->setFirst(currentText);
- }
- else if (element == "last") {
- getPayloadInternal()->setLast(currentText);
- }
- else if (element == "email") {
- getPayloadInternal()->setEMail(currentText);
- }
- else if (element == "address") {
- getPayloadInternal()->setAddress(currentText);
- }
- else if (element == "city") {
- getPayloadInternal()->setCity(currentText);
- }
- else if (element == "state") {
- getPayloadInternal()->setState(currentText);
- }
- else if (element == "zip") {
- getPayloadInternal()->setZip(currentText);
- }
- else if (element == "phone") {
- getPayloadInternal()->setPhone(currentText);
- }
- else if (element == "url") {
- getPayloadInternal()->setURL(currentText);
- }
- else if (element == "date") {
- getPayloadInternal()->setDate(currentText);
- }
- else if (element == "misc") {
- getPayloadInternal()->setMisc(currentText);
- }
- else if (element == "text") {
- getPayloadInternal()->setText(currentText);
- }
- else if (element == "key") {
- getPayloadInternal()->setKey(currentText);
- }
- }
+ if (level == TopLevel) {
+ }
+ else if (level == PayloadLevel) {
+ if (formParser) {
+ getPayloadInternal()->setForm(formParser->getPayloadInternal());
+ delete formParser;
+ formParser = NULL;
+ }
+ else if (element == "registered") {
+ getPayloadInternal()->setRegistered(true);
+ }
+ else if (element == "remove") {
+ getPayloadInternal()->setRemove(true);
+ }
+ else if (element == "instructions") {
+ getPayloadInternal()->setInstructions(currentText);
+ }
+ else if (element == "username") {
+ getPayloadInternal()->setUsername(currentText);
+ }
+ else if (element == "nick") {
+ getPayloadInternal()->setNick(currentText);
+ }
+ else if (element == "password") {
+ getPayloadInternal()->setPassword(currentText);
+ }
+ else if (element == "name") {
+ getPayloadInternal()->setName(currentText);
+ }
+ else if (element == "first") {
+ getPayloadInternal()->setFirst(currentText);
+ }
+ else if (element == "last") {
+ getPayloadInternal()->setLast(currentText);
+ }
+ else if (element == "email") {
+ getPayloadInternal()->setEMail(currentText);
+ }
+ else if (element == "address") {
+ getPayloadInternal()->setAddress(currentText);
+ }
+ else if (element == "city") {
+ getPayloadInternal()->setCity(currentText);
+ }
+ else if (element == "state") {
+ getPayloadInternal()->setState(currentText);
+ }
+ else if (element == "zip") {
+ getPayloadInternal()->setZip(currentText);
+ }
+ else if (element == "phone") {
+ getPayloadInternal()->setPhone(currentText);
+ }
+ else if (element == "url") {
+ getPayloadInternal()->setURL(currentText);
+ }
+ else if (element == "date") {
+ getPayloadInternal()->setDate(currentText);
+ }
+ else if (element == "misc") {
+ getPayloadInternal()->setMisc(currentText);
+ }
+ else if (element == "text") {
+ getPayloadInternal()->setText(currentText);
+ }
+ else if (element == "key") {
+ getPayloadInternal()->setKey(currentText);
+ }
+ }
}
void InBandRegistrationPayloadParser::handleCharacterData(const std::string& data) {
- if (formParser) {
- formParser->handleCharacterData(data);
- }
- else {
- currentText += data;
- }
+ if (formParser) {
+ formParser->handleCharacterData(data);
+ }
+ else {
+ currentText += data;
+ }
}
}