diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-06-09 18:13:00 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-06-09 18:13:00 (GMT) |
commit | 8858521436a302d366b437828128717aaa2cde57 (patch) | |
tree | 86a4658217f11ba8b42097553f62f7b64b3d27cb /Swiften/Serializer/PayloadSerializers | |
parent | 1cea8b4c47e8b03aea7e452fb49b8dea3233eb36 (diff) | |
download | swift-8858521436a302d366b437828128717aaa2cde57.zip swift-8858521436a302d366b437828128717aaa2cde57.tar.bz2 |
DateTime refactoring.
Moved DateTime serializing into Base.
Fixed a bug when XEP82 dates are non-UTC.
Added unit tests.
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers')
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp | 11 | ||||
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/DelaySerializer.h | 1 |
2 files changed, 2 insertions, 10 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp b/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp index 4f86faa..6148632 100644 --- a/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp @@ -11,6 +11,7 @@ #include <Swiften/Base/String.h> #include <Swiften/Serializer/XML/XMLElement.h> +#include <Swiften/Base/DateTime.h> namespace Swift { @@ -22,16 +23,8 @@ std::string DelaySerializer::serializePayload(boost::shared_ptr<Delay> delay) c if (delay->getFrom()) { delayElement.setAttribute("from", delay->getFrom()->toString()); } - std::string stampString = boostPTimeToXEP0082(delay->getStamp()); - delayElement.setAttribute("stamp", stampString); + delayElement.setAttribute("stamp", dateTimeToString(delay->getStamp())); return delayElement.serialize(); } -std::string DelaySerializer::boostPTimeToXEP0082(const boost::posix_time::ptime& time) { - std::string stampString = std::string(boost::posix_time::to_iso_extended_string(time)); - String::replaceAll(stampString, ',', "."); - stampString += "Z"; - return stampString; -} - } diff --git a/Swiften/Serializer/PayloadSerializers/DelaySerializer.h b/Swiften/Serializer/PayloadSerializers/DelaySerializer.h index 4705e71..06c7665 100644 --- a/Swiften/Serializer/PayloadSerializers/DelaySerializer.h +++ b/Swiften/Serializer/PayloadSerializers/DelaySerializer.h @@ -15,7 +15,6 @@ namespace Swift { DelaySerializer(); virtual std::string serializePayload(boost::shared_ptr<Delay>) const; - static std::string boostPTimeToXEP0082(const boost::posix_time::ptime& time); }; } |