LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File kopete_jabber_pongserver.diff of Package kdenetwork3 (Project openSUSE:Factory)

diff -ruN kdenetwork-3.5.10.orig/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp kdenetwork-3.5.10/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp
--- kdenetwork-3.5.10.orig/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp	2006-10-01 19:26:43.000000000 +0200
+++ kdenetwork-3.5.10/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp	2009-09-12 17:03:20.989765315 +0200
@@ -223,6 +223,7 @@
 	connect(pr, SIGNAL(roster(const Roster &)), SLOT(prRoster(const Roster &)));
 
 	new JT_ServInfo(rootTask());
+	new PongServer(rootTask());
 
 	d->active = true;
 }
diff -ruN kdenetwork-3.5.10.orig/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp kdenetwork-3.5.10/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp
--- kdenetwork-3.5.10.orig/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp	2006-10-01 19:26:43.000000000 +0200
+++ kdenetwork-3.5.10/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp	2009-09-12 18:25:35.355388942 +0200
@@ -2118,3 +2118,34 @@
 	return d->elem;
 }
 
+//----------------------------------------------------------------------------
+// PongServer
+//----------------------------------------------------------------------------
+/**
+ * \class PongServer
+ * \brief Answers XMPP Pings
+ */
+
+PongServer::PongServer(Task *parent)
+:Task(parent)
+{
+}
+
+PongServer::~PongServer()
+{
+}
+
+bool PongServer::take(const QDomElement &e)
+{
+	if (e.tagName() != "iq" || e.attribute("type") != "get")
+		return false;
+
+	bool found = false;
+	QDomElement ping = findSubTag(e, "ping", &found);
+	if (found && ping.attribute("xmlns") == "urn:xmpp:ping") {
+		QDomElement iq = createIQ(doc(), "result", e.attribute("from"), e.attribute("id"));
+		send(iq);
+		return true;
+	}
+	return false;
+}
diff -ruN kdenetwork-3.5.10.orig/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.h kdenetwork-3.5.10/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.h
--- kdenetwork-3.5.10.orig/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.h	2006-10-01 19:26:43.000000000 +0200
+++ kdenetwork-3.5.10/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.h	2009-09-12 18:24:57.729539379 +0200
@@ -456,6 +456,15 @@
 		Private *d;
 	};
 	
+	class PongServer : public Task
+	{
+		Q_OBJECT
+	public:
+		PongServer(Task *);
+		~PongServer();
+
+		bool take(const QDomElement &);
+	};
 }
 
 #endif