diff options
| author | Kevin Smith <git@kismith.co.uk> | 2011-11-12 16:56:21 (GMT) |
|---|---|---|
| committer | Kevin Smith <git@kismith.co.uk> | 2011-12-13 08:17:58 (GMT) |
| commit | 81c09a0f6a3e87b078340d7f35d0dea4c03f3a6d (patch) | |
| tree | 4371c5808ee26b2b5ed79ace9ccb439ff2988945 /Swiften/Parser/BOSHBodyExtractor.cpp | |
| parent | fd17fe0d239f97cedebe4ceffa234155bd299b68 (diff) | |
| download | swift-contrib-81c09a0f6a3e87b078340d7f35d0dea4c03f3a6d.zip swift-contrib-81c09a0f6a3e87b078340d7f35d0dea4c03f3a6d.tar.bz2 | |
BOSH Support for Swiften
This adds support for BOSH to Swiften. It does not expose it to Swift.
Release-Notes: Swiften now allows connects over BOSH, if used appropriately.
Diffstat (limited to 'Swiften/Parser/BOSHBodyExtractor.cpp')
| -rw-r--r-- | Swiften/Parser/BOSHBodyExtractor.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Swiften/Parser/BOSHBodyExtractor.cpp b/Swiften/Parser/BOSHBodyExtractor.cpp index d8759a3..eeebe8a 100644 --- a/Swiften/Parser/BOSHBodyExtractor.cpp +++ b/Swiften/Parser/BOSHBodyExtractor.cpp @@ -92,41 +92,43 @@ BOSHBodyExtractor::BOSHBodyExtractor(XMLParserFactory* parserFactory, const Byte if (!endStartTagSeen) { return; } // Look for the end of the element ByteArray::const_reverse_iterator j = data.rbegin(); if (!endElementSeen) { while (isWhitespace(*j) && j < data.rend()) { ++j; } if (j == data.rend() || *j != '>') { return; } ++j; while (j < data.rend() && isWhitespace(*j)) { ++j; } if (std::distance(j, data.rend()) < 6 || *(j+5) != '<' || *(j+4) != '/' || *(j+3) != 'b' || *(j+2) != 'o' || *(j+1) != 'd' || *j != 'y') { return; } j += 6; } body = BOSHBody(); if (!endElementSeen) { body->content = std::string(reinterpret_cast<const char*>(vecptr(data) + std::distance(data.begin(), i)), std::distance(i, j.base())); } // Parse the body element BOSHBodyParserClient parserClient(this); boost::shared_ptr<XMLParser> parser(parserFactory->createXMLParser(&parserClient)); if (!parser->parse(std::string(reinterpret_cast<const char*>(vecptr(data)), std::distance(data.begin(), i)))) { + /* TODO: This needs to be only validating the BOSH <body> element, so that XMPP parsing errors are caught at + the correct higher layer */ body = boost::optional<BOSHBody>(); return; } } } |
Swift