summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp')
-rw-r--r--kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp b/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp
index 9d5ee471..fcd73029 100644
--- a/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp
+++ b/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp
@@ -223,6 +223,7 @@ void Client::start(const TQString &host, const TQString &user, const TQString &p
connect(pr, TQT_SIGNAL(roster(const Roster &)), TQT_SLOT(prRoster(const Roster &)));
new JT_ServInfo(rootTask());
+ new PongServer(rootTask());
d->active = true;
}
@@ -1520,3 +1521,35 @@ LiveRoster::ConstIterator LiveRoster::find(const Jid &j, bool compareRes) const
}
}
+
+//----------------------------------------------------------------------------
+// PongServer
+//----------------------------------------------------------------------------
+/**
+ * \class PongServer
+ * \brief Answers XMPP Pings
+ */
+
+PongServer::PongServer(Task *parent)
+:Task(parent)
+{
+}
+
+PongServer::~PongServer()
+{
+}
+
+bool PongServer::take(const TQDomElement &e)
+{
+ if (e.tagName() != "iq" || e.attribute("type") != "get")
+ return false;
+
+ bool found = false;
+ TQDomElement ping = findSubTag(e, "ping", &found);
+ if (found && ping.attribute("xmlns") == "urn:xmpp:ping") {
+ TQDomElement iq = createIQ(doc(), "result", e.attribute("from"), e.attribute("id"));
+ send(iq);
+ return true;
+ }
+ return false;
+}