QXmppPingIq.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (C) 2008-2012 The QXmpp developers
  3. *
  4. * Author:
  5. * Jeremy Lainé
  6. *
  7. * Source:
  8. * http://code.google.com/p/qxmpp
  9. *
  10. * This file is a part of QXmpp library.
  11. *
  12. * This library is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU Lesser General Public
  14. * License as published by the Free Software Foundation; either
  15. * version 2.1 of the License, or (at your option) any later version.
  16. *
  17. * This library is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. * Lesser General Public License for more details.
  21. *
  22. */
  23. #include "QXmppConstants.h"
  24. #include "QXmppPingIq.h"
  25. #include "QXmppUtils.h"
  26. #include <QDomElement>
  27. QXmppPingIq::QXmppPingIq() : QXmppIq(QXmppIq::Get)
  28. {
  29. }
  30. bool QXmppPingIq::isPingIq(const QDomElement &element)
  31. {
  32. QDomElement pingElement = element.firstChildElement("ping");
  33. return (element.attribute("type") == "get" &&
  34. pingElement.namespaceURI() == ns_ping);
  35. }
  36. void QXmppPingIq::toXmlElementFromChild(QXmlStreamWriter *writer) const
  37. {
  38. writer->writeStartElement("ping");
  39. writer->writeAttribute("xmlns", ns_ping);
  40. writer->writeEndElement();
  41. }