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

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Dec 31 14:34:32 MSK 2013


Author: sergei
Date: 2013-12-31 14:34:32 +0400 (Tue, 31 Dec 2013)
New Revision: 2044

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/login.tcl
   trunk/tkabber/msgs/ru.msg
   trunk/tkabber/plugins/iq/ping.tcl
Log:
	* login.tcl, plugins/iq/ping.tcl: Added option to use ping only for
	  TCP based connections. Switch default behavior to ping TCP based
	  connections only.

	* msgs/ru.msg: Updated Russian translation.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2013-12-31 08:02:23 UTC (rev 2043)
+++ trunk/tkabber/ChangeLog	2013-12-31 10:34:32 UTC (rev 2044)
@@ -2,6 +2,10 @@
 
 	* login.tcl: Define the autologin variable in Customize interface.
 
+	* login.tcl, plugins/iq/ping.tcl: Added option to use ping only for
+	  TCP based connections. Switch default behavior to ping TCP based
+	  connections only.
+
 	* msgs/ru.msg: Updated Russian translation.
 
 2013-12-30  Sergei Golovan  <sgolovan at nes.ru>

Modified: trunk/tkabber/login.tcl
===================================================================
--- trunk/tkabber/login.tcl	2013-12-31 08:02:23 UTC (rev 2043)
+++ trunk/tkabber/login.tcl	2013-12-31 10:34:32 UTC (rev 2044)
@@ -547,6 +547,7 @@
 	    }
 	}
 
+	set transport bosh
 	lappend args -transport bosh \
 		     -timeout   $lc(boshtimeout) \
 		     -wait      $lc(boshwait) \
@@ -573,6 +574,7 @@
 	    }
 	}
 
+	set transport poll
 	lappend args -transport poll \
 		     -timeout   $lc(polltimeout) \
 		     -int       $lc(pollmin) \
@@ -627,6 +629,9 @@
 	set hosts [lassign $hosts hp]
 	lassign $hp host port
 
+	global xmppTransport
+	set xmppTransport($xlib) $transport
+
 	eval [list ::xmpp::connect $xlib $host $port \
 				   -command [list login_connect_result $xlib $hosts $logindata $args]] \
 				   $args

Modified: trunk/tkabber/msgs/ru.msg
===================================================================
--- trunk/tkabber/msgs/ru.msg	2013-12-31 08:02:23 UTC (rev 2043)
+++ trunk/tkabber/msgs/ru.msg	2013-12-31 10:34:32 UTC (rev 2044)
@@ -285,6 +285,8 @@
 	сообщений (правил обеспечения приватности)."
 ::msgcat::mcset ru "bored" "скукотища!"
 ::msgcat::mcset ru "BOSH" "BOSH"
+::msgcat::mcset ru "Both TCP based and HTTP based connections" "Для\
+	подключений как по TCP, так и по HTTP"
 ::msgcat::mcset ru "Bottom" "Снизу"
 ::msgcat::mcset ru "brave" "всё нипочём"
 ::msgcat::mcset ru "Browse" "Просмотреть"
@@ -1283,6 +1285,7 @@
 ::msgcat::mcset ru "Nickname is changing already" "Псевдоним уже в процессе\
 	изменения"
 ::msgcat::mcset ru "Nickname:" "Псевдоним:"
+::msgcat::mcset ru "No" "Нет"
 ::msgcat::mcset ru "No active list" "Нет активного списка"
 ::msgcat::mcset ru "No avatar to store" "Нет аватары для загрузки"
 ::msgcat::mcset ru "No conferences for %s in progress..." "Нет активной\
@@ -1356,6 +1359,7 @@
 	JID"
 ::msgcat::mcset ru "Only one option \"-username\" or \"-domain\" is allowed"\
 	"Только одна опция из \"-username\" и \"-domain\" допустима"
+::msgcat::mcset ru "Only TCP based connections" "Только для подключений по TCP"
 ::msgcat::mcset ru "Open" "Открыть"
 ::msgcat::mcset ru "Open chat" "Открытие окна разговора"
 ::msgcat::mcset ru "Open chat..." "Открытие окна разговора..."

Modified: trunk/tkabber/plugins/iq/ping.tcl
===================================================================
--- trunk/tkabber/plugins/iq/ping.tcl	2013-12-31 08:02:23 UTC (rev 2043)
+++ trunk/tkabber/plugins/iq/ping.tcl	2013-12-31 10:34:32 UTC (rev 2044)
@@ -6,10 +6,13 @@
 package require xmpp::ping
 
 namespace eval ping {
-    custom::defvar options(ping) 0 \
+    custom::defvar options(ping) 1 \
 	[::msgcat::mc "Ping server using XMPP ping requests."] \
 	-group IQ \
-	-type boolean \
+	-type options \
+	-values [list 0 [::msgcat::mc "No"] \
+		      1 [::msgcat::mc "Only TCP based connections"] \
+		      2 [::msgcat::mc "Both TCP based and HTTP based connections"]] \
 	-command [namespace code start_all]
 
     custom::defvar options(timeout) 30 \
@@ -46,10 +49,6 @@
 #############################################################################
 
 proc ping::start_all {args} {
-    variable options
-
-    if {!$options(ping) || ($options(timeout) <= 0)} return
-
     foreach xlib [connections] {
 	start $xlib
     }
@@ -60,11 +59,15 @@
 proc ping::start {xlib} {
     variable options
     variable sequence
+    global xmppTransport
 
     after cancel [namespace code [list start $xlib]]
 
-    if {!$options(ping) || ($options(timeout) <= 0)} return
+    if {$options(ping) == 0 || ($options(timeout) <= 0)} return
 
+    if {$options(ping) < 2 && [info exists xmppTransport($xlib)] && \
+	    ($xmppTransport($xlib) == "bosh" || $xmppTransport($xlib) == "poll")} return
+
     if {![info exists sequence($xlib)]} {
 	set sequence($xlib) 0
     }
@@ -78,8 +81,11 @@
     variable options
     variable sequence
 
-    if {!$options(ping) || ($options(timeout) <= 0)} return
+    if {$options(ping) == 0 || ($options(timeout) <= 0)} return
 
+    if {$options(ping) < 2 && [info exists xmppTransport($xlib)] && \
+	    ($xmppTransport($xlib) == "bosh" || $xmppTransport($xlib) == "poll")} return
+
     if {[lsearch -exact [connections] $xlib] < 0} return
 
     if {[string equal $status abort]} return



More information about the Tkabber-dev mailing list