aboutsummaryrefslogtreecommitdiff
path: root/src/QXmppEntityTimeIq.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-11-08 09:26:45 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-11-08 09:26:45 +0000
commit63de60dac600542823843223ee091ace86725361 (patch)
tree089ca055f352e739db9c1242ae92b93aef43ea2b /src/QXmppEntityTimeIq.cpp
parentcb8b6cb286e923dfc8b7fe0fa9d30a4da3b84e95 (diff)
downloadqxmpp-63de60dac600542823843223ee091ace86725361.tar.gz
QXmppEntityTimeIq should store timezone offsets in seconds
and handle parsing / serialisation internally.
Diffstat (limited to 'src/QXmppEntityTimeIq.cpp')
-rw-r--r--src/QXmppEntityTimeIq.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/QXmppEntityTimeIq.cpp b/src/QXmppEntityTimeIq.cpp
index d86579aa..7a90f64c 100644
--- a/src/QXmppEntityTimeIq.cpp
+++ b/src/QXmppEntityTimeIq.cpp
@@ -29,21 +29,35 @@
#include "QXmppConstants.h"
#include "QXmppUtils.h"
-QString QXmppEntityTimeIq::tzo() const
+/// Returns the timezone offset in seconds.
+///
+
+int QXmppEntityTimeIq::tzo() const
{
return m_tzo;
}
-void QXmppEntityTimeIq::setTzo(const QString &tzo)
+/// Sets the timezone offset in seconds.
+///
+/// \param tzo
+
+void QXmppEntityTimeIq::setTzo(int tzo)
{
m_tzo = tzo;
}
+/// Returns the date/time in Coordinated Universal Time (UTC).
+///
+
QDateTime QXmppEntityTimeIq::utc() const
{
return m_utc;
}
+/// Sets the date/time in Coordinated Universal Time (UTC).
+///
+/// \param utc
+
void QXmppEntityTimeIq::setUtc(const QDateTime &utc)
{
m_utc = utc;
@@ -58,7 +72,7 @@ bool QXmppEntityTimeIq::isEntityTimeIq(const QDomElement &element)
void QXmppEntityTimeIq::parseElementFromChild(const QDomElement &element)
{
QDomElement timeElement = element.firstChildElement("time");
- m_tzo = timeElement.firstChildElement("tzo").text();
+ m_tzo = timezoneOffsetFromString(timeElement.firstChildElement("tzo").text());
m_utc = datetimeFromString(timeElement.firstChildElement("utc").text());
}
@@ -67,8 +81,7 @@ void QXmppEntityTimeIq::toXmlElementFromChild(QXmlStreamWriter *writer) const
writer->writeStartElement("time");
helperToXmlAddAttribute(writer, "xmlns", ns_entity_time);
- if(!m_tzo.isEmpty())
- helperToXmlAddTextElement(writer, "tzo", m_tzo);
+ helperToXmlAddTextElement(writer, "tzo", timezoneOffsetToString(m_tzo));
if(m_utc.isValid())
helperToXmlAddTextElement(writer, "utc", datetimeToString(m_utc));