[Tkabber-dev] r2105 - in trunk/tkabber-plugins: . otr

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Mon Jan 27 09:15:50 MSK 2014


Author: sergei
Date: 2014-01-27 09:15:50 +0400 (Mon, 27 Jan 2014)
New Revision: 2105

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/otr/otr.tcl
Log:
	* otr/otr.tcl: Added heartbeat-interval option.


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2014-01-27 04:53:49 UTC (rev 2104)
+++ trunk/tkabber-plugins/ChangeLog	2014-01-27 05:15:50 UTC (rev 2105)
@@ -3,6 +3,8 @@
 	* otr/otr.tcl: Fail to load OTR plugin if Tkabber doesn't support the
 	  necessary features.
 
+	* otr/otr.tcl: Added heartbeat-interval option.
+
 2014-01-26  Sergei Golovan <sgolovan at nes.ru>
 
 	* otr/tclotr/otr.tcl: Fixed refreshing private connection if the

Modified: trunk/tkabber-plugins/otr/otr.tcl
===================================================================
--- trunk/tkabber-plugins/otr/otr.tcl	2014-01-27 04:53:49 UTC (rev 2104)
+++ trunk/tkabber-plugins/otr/otr.tcl	2014-01-27 05:15:50 UTC (rev 2105)
@@ -94,6 +94,13 @@
 		       receive a whitespace tag or an OTR error message."] \
 	-group OTR -type boolean -command [namespace current]::update_default_policy
 
+    custom::defvar options(heartbeat-interval) 60 \
+	[::msgcat::mc "If the interval between two consecutive incoming OTR messages\
+		       exceeds the specified interval (in minutes, zero means no\
+		       heartbeat at all) the heartbeat message will be sent to\
+		       change the session keys."] \
+	-group OTR -type integer -command [namespace current]::update_heartbeat
+
     custom::defvar options(dont-log-otr-messages) 0 \
 	[::msgcat::mc "Do not log OTR messages."] \
 	-group OTR -type boolean
@@ -198,6 +205,7 @@
     set ctx($xlib,$jid) \
 	[::otr::new $privkey \
 		-policy [get_policy $xlib $jid] \
+		-heartbeat $options(heartbeat-interval) \
 		-authstatecommand [namespace code [list on_authstate_change $xlib $jid]] \
 		-msgstatecommand [namespace code [list on_msgstate_change $xlib $jid]] \
 		-smpstatecommand [namespace code [list on_smpstate_change $xlib $jid]] \
@@ -299,6 +307,15 @@
 
 #############################################################################
 
+proc otr::update_heartbeat {args} {
+    variable options
+    variable ctx
+
+    foreach idx [array names ctx ::*] {
+	::otr::configure $ctx($idx) -heartbeat $options(heartbeat-interval)
+    }
+}
+
 proc otr::get_policy {xlib jid} {
     variable options
     variable PolicyFlags



More information about the Tkabber-dev mailing list