summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers')
-rw-r--r--Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp11
-rw-r--r--Swiften/Serializer/PayloadSerializers/DelaySerializer.h1
2 files changed, 9 insertions, 3 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp b/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp
index 041165f..a54cf9e 100644
--- a/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp
@@ -20,11 +20,16 @@ String DelaySerializer::serializePayload(boost::shared_ptr<Delay> delay) const
if (delay->getFrom()) {
delayElement.setAttribute("from", delay->getFrom()->toString());
}
- String stampString = String(boost::posix_time::to_iso_extended_string(delay->getStamp()));
- stampString.replaceAll(',', ".");
- stampString += "Z";
+ String stampString = boostPTimeToXEP0082(delay->getStamp());
delayElement.setAttribute("stamp", stampString);
return delayElement.serialize();
}
+String DelaySerializer::boostPTimeToXEP0082(const boost::posix_time::ptime& time) {
+ String stampString = String(boost::posix_time::to_iso_extended_string(time));
+ stampString.replaceAll(',', ".");
+ stampString += "Z";
+ return stampString;
+}
+
}
diff --git a/Swiften/Serializer/PayloadSerializers/DelaySerializer.h b/Swiften/Serializer/PayloadSerializers/DelaySerializer.h
index 949b084..eb33c9f 100644
--- a/Swiften/Serializer/PayloadSerializers/DelaySerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/DelaySerializer.h
@@ -15,6 +15,7 @@ namespace Swift {
DelaySerializer();
virtual String serializePayload(boost::shared_ptr<Delay>) const;
+ static String boostPTimeToXEP0082(const boost::posix_time::ptime& time);
};
}