[Tkabber-dev] r1827 - in trunk/tkabber: . plugins/iq

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Mon Aug 3 20:53:11 MSD 2009


Author: sergei
Date: 2009-08-03 20:53:10 +0400 (Mon, 03 Aug 2009)
New Revision: 1827

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/plugins/iq/ping.tcl
Log:
	* plugins/iq/ping.tcl: Use xmpp::ping package from TclXMPP.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2009-08-03 13:28:23 UTC (rev 1826)
+++ trunk/tkabber/ChangeLog	2009-08-03 16:53:10 UTC (rev 1827)
@@ -6,6 +6,8 @@
 	* doc/tkabber.html, doc/tkabber.xml, README: Replaced TclGPGME by
 	  TclGPG.
 
+	* plugins/iq/ping.tcl: Use xmpp::ping package from TclXMPP.
+
 2009-08-01  Sergei Golovan  <sgolovan at nes.ru>
 
 	* plugins/general/comm.tcl: Raised priority of cleanup function in

Modified: trunk/tkabber/plugins/iq/ping.tcl
===================================================================
--- trunk/tkabber/plugins/iq/ping.tcl	2009-08-03 13:28:23 UTC (rev 1826)
+++ trunk/tkabber/plugins/iq/ping.tcl	2009-08-03 16:53:10 UTC (rev 1827)
@@ -1,32 +1,34 @@
 # $Id$
-# Reply to XMPP Ping (XEP-0199) support
+# XMPP Ping (XEP-0199) support
 
 #############################################################################
 
+package require xmpp::ping
+
 namespace eval ping {
     custom::defvar options(ping) 0 \
-	[::msgcat::mc "Ping server using urn:xmpp:ping requests."] \
+	[::msgcat::mc "Ping server using XMPP ping requests."] \
 	-group IQ \
 	-type boolean \
-	-command [namespace current]::start_all
+	-command [namespace code start_all]
 
     custom::defvar options(timeout) 30 \
 	[::msgcat::mc "Reconnect to server if it does not reply (with result\
-		       or with error) to ping (urn:xmpp:ping) request in\
+		       or with error) to XMPP ping request in\
 		       specified time interval (in seconds)."] \
 	-group IQ \
 	-type integer \
-	-command [namespace current]::start_all
+	-command [namespace code start_all]
 
     custom::defvar options(pong) 0 \
-	[::msgcat::mc "Reply to ping (urn:xmpp:ping) requests."] \
+	[::msgcat::mc "Reply to XMPP ping requests."] \
 	-group IQ \
 	-type boolean
 
     variable sequence
 
-    ::xmpp::iq::register get query urn:xmpp:ping [namespace current]::reply
-    hook::add connected_hook [namespace current]::start
+    ::xmpp::ping::register -command [namespace code reply]
+    hook::add connected_hook [namespace code start]
 }
 
 #############################################################################
@@ -67,10 +69,9 @@
 	set sequence($xlib) 0
     }
 
-    ::xmpp::sendIQ $xlib get \
-	-query [::xmpp::xml::create ping -xmlns urn:xmpp:ping] \
-	-timeout [expr {$options(timeout)*1000}] \
-	-command [namespace code [list result $xlib [incr sequence($xlib)]]]
+    ::xmpp::ping::ping $xlib \
+	    -timeout [expr {$options(timeout)*1000}] \
+	    -command [namespace code [list result $xlib [incr sequence($xlib)]]]
 }
 
 proc ping::result {xlib seq status xml} {



More information about the Tkabber-dev mailing list