[Tkabber-dev] r2093 - in trunk/tkabber-plugins: . otr otr/msgs otr/tclotr

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sat Jan 25 23:29:10 MSK 2014


Author: sergei
Date: 2014-01-25 23:29:10 +0400 (Sat, 25 Jan 2014)
New Revision: 2093

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/otr/msgs/ru.msg
   trunk/tkabber-plugins/otr/otr.tcl
   trunk/tkabber-plugins/otr/tclotr/otr.tcl
Log:
	* otr/otr.tcl, otr/tclotr/otr.tcl: Show SSID and fingerprint in the
	  userinfo dialog.

	* otr/msgs/ru.msg: Updated Russian translations.


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2014-01-25 18:06:25 UTC (rev 2092)
+++ trunk/tkabber-plugins/ChangeLog	2014-01-25 19:29:10 UTC (rev 2093)
@@ -22,6 +22,11 @@
 
 	* otr/msgs/ru.msg, otr/trans/ru.msg: Update Russian translatinos.
 
+	* otr/otr.tcl, otr/tclotr/otr.tcl: Show SSID and fingerprint in the
+	  userinfo dialog.
+
+	* otr/msgs/ru.msg: Updated Russian translations.
+
 2014-01-24  Sergei Golovan <sgolovan at nes.ru>
 
 	* otr/key.tcl, otr/otr.tcl: Finish all existing OTR sessions for a

Modified: trunk/tkabber-plugins/otr/msgs/ru.msg
===================================================================
--- trunk/tkabber-plugins/otr/msgs/ru.msg	2014-01-25 18:06:25 UTC (rev 2092)
+++ trunk/tkabber-plugins/otr/msgs/ru.msg	2014-01-25 19:29:10 UTC (rev 2093)
@@ -40,7 +40,6 @@
 ::msgcat::mcset ru "Authentication failed" "Аутентификация не удалась"
 ::msgcat::mcset ru "Authentication from %s" "Аутентификация от %s"
 ::msgcat::mcset ru "Authentication succeeded" "Аутентификация успешная"
-::msgcat::mcset ru "Authstate:" "Состояние аутентификации:"
 ::msgcat::mcset ru "Do not log OTR messages." "Не журналировать сообщения OTR."
 ::msgcat::mcset ru "Don't log OTR messages" "Не журналировать сообщения OTR"
 ::msgcat::mcset ru "Edit authentication" "Изменение аутентификации"
@@ -51,12 +50,12 @@
 ::msgcat::mcset ru "Enter secret here (case sensitive):" \
 	"Введите секрет здесь (чувствителен к регистру):"
 ::msgcat::mcset ru "Fingerprint for you, %s:\n%s" "Отпечаток вашего (%s) ключа:\n%s"
+::msgcat::mcset ru "Fingerprint:" "Отпечаток:"
 ::msgcat::mcset ru "Finished" "Завершен"
 ::msgcat::mcset ru "I have not verified" "Я не удостоверился"
 ::msgcat::mcset ru "I have verified" "Я удостоверился"
 ::msgcat::mcset ru "Manage private keys" "Управление закрытыми ключами"
 ::msgcat::mcset ru "Manual fingerprint verification" "Ручная проверка отпечатка"
-::msgcat::mcset ru "Msgstate:" "Состояние сообщений:"
 ::msgcat::mcset ru "Not private" "Не шифрованное"
 ::msgcat::mcset ru "OK" "Продолжить"
 ::msgcat::mcset ru "OTR" "OTR"
@@ -97,6 +96,7 @@
 	аутентифицированный обмен ключами OTR при получении сообщения со\
 	специальной меткой из пробельных символов или при получении\
 	сообщения об ошибке OTR."
+::msgcat::mcset ru "State:" "Состояние:"
 ::msgcat::mcset ru "This is the question asked by your peer:" \
 	"Вопрос, который задал ваш собеседник:"
 ::msgcat::mcset ru "To authenticate using a question, pick a question\

Modified: trunk/tkabber-plugins/otr/otr.tcl
===================================================================
--- trunk/tkabber-plugins/otr/otr.tcl	2014-01-25 18:06:25 UTC (rev 2092)
+++ trunk/tkabber-plugins/otr/otr.tcl	2014-01-25 19:29:10 UTC (rev 2093)
@@ -1106,7 +1106,7 @@
     }
 }
 
-hook::add roster_user_popup_info_hook [namespace current]::otr::user_popup_info 99
+#hook::add roster_user_popup_info_hook [namespace current]::otr::user_popup_info 99
 
 #############################################################################
 
@@ -1115,8 +1115,8 @@
 
     if {$editable} return
 
-    set bare_jid [::xmpp::jid::removeResource $jid]
-    set chatid [chat::chatid $xlib $bare_jid]
+    set bjid [::xmpp::jid::removeResource $jid]
+    set chatid [chat::chatid $xlib $bjid]
     if {[chat::is_groupchat $chatid]} {
 	if {[info exists ctx(authstate,$xlib,$jid)]} {
 	    set jids [list authstate,$xlib,$jid]
@@ -1124,7 +1124,8 @@
 	    set jids [list]
 	}
     } else {
-	set jids [array names ctx authstate,$xlib,$bare_jid/*]
+	set bjpat [regsub -all {(.)} $bjid {\\\1}]
+	set jids [array names ctx authstate,$xlib,$bjpat/*]
     }
     if {[llength $jids] > 0} {
 	set otrinfo [$tab insert end otrinfo \
@@ -1135,12 +1136,15 @@
 	    set x [userinfo::pack_frame $otrinfo.otr_$i $fjid]
 
 	    # TODO: nice report
-	    userinfo::pack_entry $jid $x 1 otr_authstate_$i [::msgcat::mc "Authstate:"]
-	    set userinfo::userinfo(otr_authstate_$i,$jid) $ctx(authstate,$xlib,$fjid)
+	    userinfo::pack_entry $jid $x 1 otr_state_$i [::msgcat::mc "State:"]
+	    set userinfo::userinfo(otr_state_$i,$jid) [msgstate:helptext $xlib $fjid]
 
-	    userinfo::pack_entry $jid $x 2 otr_msgstate_$i [::msgcat::mc "Msgstate:"]
-	    set userinfo::userinfo(otr_msgstate_$i,$jid) $ctx(msgstate,$xlib,$fjid)
+	    userinfo::pack_entry $jid $x 3 otr_fingerprint_$i [::msgcat::mc "Fingerprint:"]
+	    set userinfo::userinfo(otr_fingerprint_$i,$jid) [::otr::fingerprint $ctx($xlib,$fjid)]
 
+	    userinfo::pack_entry $jid $x 4 otr_ssid_$i [::msgcat::mc "SSID:"]
+	    set userinfo::userinfo(otr_ssid_$i,$jid) [::otr::ssid $ctx($xlib,$fjid)]
+
 	    incr i
 	}
     }

Modified: trunk/tkabber-plugins/otr/tclotr/otr.tcl
===================================================================
--- trunk/tkabber-plugins/otr/tclotr/otr.tcl	2014-01-25 18:06:25 UTC (rev 2092)
+++ trunk/tkabber-plugins/otr/tclotr/otr.tcl	2014-01-25 19:29:10 UTC (rev 2093)
@@ -295,9 +295,17 @@
     upvar 0 $token state
 
     if {$me} {
-        set key $state(privatekey)
+        if {[info exists state(privatekey)]} {
+            set key $state(privatekey)
+        } else {
+            return ""
+        }
     } else {
-        set key $state(publickey)
+        if {[info exists state(publickey)]} {
+            set key $state(publickey)
+        } else {
+            return ""
+        }
     }
 
     binary scan [::otr::crypto::DSAFingerprint $key] Iu* nums
@@ -308,6 +316,22 @@
     join $res
 }
 
+# ::otr::ssid --
+
+proc ::otr::ssid {token} {
+    variable $token
+    upvar 0 $token state
+
+    switch -- $state(msgstate) {
+        MSGSTATE_ENCRYPTED {
+            return $state(displayssid)
+        }
+        default {
+            return ""
+        }
+    }
+}
+
 # ::otr::requestConversation --
 #
 #       Send the OTR query message to the peer.
@@ -890,7 +914,7 @@
     if {$message ne ""} {
         # Success
         UpdatePeerDHKeysAfterAKE $token $gy $keyidy
-        StoreSSID $token
+        StoreSSID $token 0
 
         CallBack $token send $message
 
@@ -934,7 +958,7 @@
     if {$keyidy ne ""} {
         # Success
         UpdatePeerDHKeysAfterAKE $token $state(gy) $keyidy
-        StoreSSID $token
+        StoreSSID $token 1
 
         switch -- $state(msgstate) {
             MSGSTATE_PLAINTEXT {
@@ -978,7 +1002,7 @@
 
 # ::otr::StoreSSID --
 
-proc ::otr::StoreSSID {token} {
+proc ::otr::StoreSSID {token flag} {
     variable $token
     upvar 0 $token state
 
@@ -986,6 +1010,12 @@
     set x  $state(x,[expr {$state(keyid)-1}])
 
     lassign [::otr::crypto::AKEKeys $gy $x] state(ssid)
+    binary scan $state(ssid) H8H8 left right
+    if {$flag} {
+        set state(displayssid) "*$left* $right"
+    } else {
+        set state(displayssid) "$left *$right*"
+    }
 }
 
 # ::otr::ShowCantDecipherError --



More information about the Tkabber-dev mailing list