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

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Jan 26 13:31:54 MSK 2014


Author: sergei
Date: 2014-01-26 13:31:54 +0400 (Sun, 26 Jan 2014)
New Revision: 2098

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/otr/otr.tcl
Log:
	* otr/otr.tcl: Add the corresponding OTR icon to outgoing chat
	  messages.


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2014-01-26 07:55:41 UTC (rev 2097)
+++ trunk/tkabber-plugins/ChangeLog	2014-01-26 09:31:54 UTC (rev 2098)
@@ -11,6 +11,9 @@
 	* otr/auth.tcl: Replaced combobox by option menu to match edit keys
 	  dialog.
 
+	* otr/otr.tcl: Add the corresponding OTR icon to outgoing chat
+	  messages.
+
 2014-01-25  Sergei Golovan <sgolovan at nes.ru>
 
 	* otr/key.tcl, otr/tclotr/crypto.tcl: Code cleanup, made DSA key

Modified: trunk/tkabber-plugins/otr/otr.tcl
===================================================================
--- trunk/tkabber-plugins/otr/otr.tcl	2014-01-26 07:55:41 UTC (rev 2097)
+++ trunk/tkabber-plugins/otr/otr.tcl	2014-01-26 09:31:54 UTC (rev 2098)
@@ -11,7 +11,7 @@
 	package forget otr
     }
 
-    # Load message catalog:
+    # Load message catalogs:
 
     package require msgcat
     ::msgcat::mcload [file join $scriptdir msgs]
@@ -29,15 +29,17 @@
 	return
     }
 
+    # Load DSA keys and authenticaton infrastructure
+
     source [file join $scriptdir auth.tcl]
     source [file join $scriptdir key.tcl]
 
     # Auxiliary namespace. Rewrite_message_hook will use it to add some
     # supplemetary info.
+
     set ns tkabber:otr
 
-    # OTR error message
-    ::xmpp::stanzaerror::registerType otr [::msgcat::mc "OTR error"]
+    # PLugin's options
 
     variable options
 
@@ -87,11 +89,15 @@
 	[::msgcat::mc "Do not log OTR messages."] \
 	-group OTR -type boolean
 
-#   {myjid1 {jid1 {allow-encryption 0 ...} jid2 {...}} myjid2 {jid1 {...} jid2 {...}}}
+    # Hidden option for storing contacts' personal preferences
+    # {myjid1 {jid1 {allow-encryption 0 ...} jid2 {...}} myjid2 {jid1 {...} jid2 {...}}}
+
     custom::defvar options(personal-preferences) {} \
 	[::msgcat::mc "Presonal OTR preferences."] \
 	-type string -group Hidden
 
+    # Correspondence between GUI options and OTR policy flags
+
     array set PolicyFlags {allow-encryption {ALLOW_V2 ALLOW_V3}
 			   require-encryption {REQUIRE_ENCRYPTION}
 			   send-whitespace-tag {SEND_WHITESPACE_TAG}
@@ -955,11 +961,20 @@
 
     if {[info exists res(message)]} {
 	set body $res(message)
+	if {$type eq "chat" && [msgstate:index $xlib $to] > 0} {
+	    set chatid [chat::chatid $xlib $to]
+	    set chatw [chat::chat_win $chatid]
+	    if {[winfo exists $chatw]} {
+		$chatw image create end -image [msgstate:icon $xlib $to]
+	    }
+	}
     } else {
 	# Disable sending
 	hook::unset_flag rewrite_outgoing_message_hook send
 
 	# Don't show this message in the chat log window
+	# This flag makes sense only for chat messages, but causes no harm for
+	# normal ones
 	hook::unset_flag chat_send_message_hook draw
     }
     return



More information about the Tkabber-dev mailing list