[Tkabber-dev] r765 - in trunk/tkabber: . pixmaps/default pixmaps/default/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sat Oct 21 10:23:14 MSD 2006


Author: sergei
Date: 2006-10-21 10:23:09 +0400 (Sat, 21 Oct 2006)
New Revision: 765

Added:
   trunk/tkabber/pixmaps/default/tkabber/gpg-vsigned.gif
Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/gpgme.tcl
   trunk/tkabber/pixmaps/default/icondef.xml
Log:
	* pixmaps/default/icondef.xml,
	  pixmaps/default/tkabber/gpg-vsigned.gif: Added image for
	  signature which is not at least marginally trusted or which
	  signer's JID does not belong to key UIDs.

	* gpgme.tcl: Added extra signature validity check and made
	  drawing special icon when the signature seems to be
	  suspicious.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2006-10-20 19:05:28 UTC (rev 764)
+++ trunk/tkabber/ChangeLog	2006-10-21 06:23:09 UTC (rev 765)
@@ -1,3 +1,14 @@
+2006-10-21  Sergei Golovan  <sgolovan at nes.ru>
+
+	* pixmaps/default/icondef.xml,
+	  pixmaps/default/tkabber/gpg-vsigned.gif: Added image for
+	  signature which is not at least marginally trusted or which
+	  signer's JID does not belong to key UIDs.
+
+	* gpgme.tcl: Added extra signature validity check and made
+	  drawing special icon when the signature seems to be
+	  suspicious.
+
 2006-10-20  Sergei Golovan  <sgolovan at nes.ru>
 
 	* chats.tcl: Added new hook rewrite_message_hook. It is run before

Modified: trunk/tkabber/gpgme.tcl
===================================================================
--- trunk/tkabber/gpgme.tcl	2006-10-20 19:05:28 UTC (rev 764)
+++ trunk/tkabber/gpgme.tcl	2006-10-21 06:23:09 UTC (rev 765)
@@ -565,12 +565,65 @@
     return [string trimleft $text]
 }
 
-proc ::ssj::signed:Label {lb jid pinfo} {
+proc ::ssj::signed:Label {lb connid jid pinfo} {
+    if {[set rjid [muc::get_real_jid $connid $jid]] == ""} {
+	set rjid [node_and_server_from_jid $jid]
+    } else {
+	set rjid [node_and_server_from_jid $rjid]
+    }
+
     array set params $pinfo
+
+    set checks {}
+    set trust 0
+    foreach signature $params(signatures) {
+	set emails {}
+	set valid 0
+	foreach {k v} $signature {
+	    switch -- $k {
+		key {
+		    foreach {k v} $v {
+			if {![cequal $k subkeys]} {
+			    continue
+			}
+			foreach subkey $v {
+			    catch {unset sparams}
+			    array set sparams $subkey
+			    if {[info exists sparams(email)]} {
+				lappend emails $sparams(email)
+			    }
+			}
+		    }
+		}
+		validity {
+		    switch -- $v {
+			ultimate -
+			full -
+			marginal {
+			    set valid 1
+			}
+			never -
+			undefined -
+			unknown -
+			default {
+			    set valid 0
+			}
+		    }
+		}
+	    }
+	}
+	if {$valid && ([lsearch -exact $emails $rjid] >= 0)} {
+	    set trust 1
+	    break
+	}
+    }
+
     if {[info exists params(reason)]} {
 	set args [list -image gpg/badsigned]
+    } elseif {$trust} {
+	set args [list -image gpg/signed]
     } else {
-	set args [list -image gpg/signed]
+	set args [list -image gpg/vsigned]
     }
 
     if {![cequal [set info [signed:info $pinfo]] ""]} {
@@ -1288,7 +1341,7 @@
 	    destroy $lb
 	}
 
-	signed:Label $lb $from
+	signed:Label $lb $connid $from
 		     [signed:input $connid $from $chdata $body \
 				   [::msgcat::mc "Message body"]]
 	grid $lb -row 1 -column 2 -sticky e
@@ -1331,7 +1384,7 @@
 	set connid [chat::get_connid $chatid]
         catch {
             $chatw window create end \
-                  -window [signed:Label $chatw.signed$signedid $from \
+                  -window [signed:Label $chatw.signed$signedid $connid $from \
                               [signed:input $connid $from $chdata $body \
                                   [::msgcat::mc "Message body"]]]
         }

Modified: trunk/tkabber/pixmaps/default/icondef.xml
===================================================================
--- trunk/tkabber/pixmaps/default/icondef.xml	2006-10-20 19:05:28 UTC (rev 764)
+++ trunk/tkabber/pixmaps/default/icondef.xml	2006-10-21 06:23:09 UTC (rev 765)
@@ -52,6 +52,10 @@
   </icon>
   <!-- GPG icons -->
   <icon>
+    <image xmlns='tkimage'>gpg/vsigned</image>
+    <object mime="image/gif">tkabber/gpg-vsigned.gif</object>
+  </icon>
+  <icon>
     <image xmlns='tkimage'>gpg/signed</image>
     <object mime="image/gif">tkabber/gpg-signed.gif</object>
   </icon>

Added: trunk/tkabber/pixmaps/default/tkabber/gpg-vsigned.gif
===================================================================
(Binary files differ)


Property changes on: trunk/tkabber/pixmaps/default/tkabber/gpg-vsigned.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream



More information about the Tkabber-dev mailing list