[Tkabber-dev] r818 - in trunk/tkabber: . plugins/si

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Dec 3 22:43:07 MSK 2006


Author: sergei
Date: 2006-12-03 22:43:03 +0300 (Sun, 03 Dec 2006)
New Revision: 818

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/disco.tcl
   trunk/tkabber/plugins/si/socks5.tcl
   trunk/tkabber/utils.tcl
Log:
	* disco.tcl, utils.tcl, plugins/si/socks5.tcl: Introduced new
	  function my_jid, which is suitable to get JID for including to
	  requests and responses (for conference recipients it returns
	  conference JID, for other recipients it returns real JID).
	  Use this new function when replying disco queries and when
	  sending files.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2006-12-03 09:24:13 UTC (rev 817)
+++ trunk/tkabber/ChangeLog	2006-12-03 19:43:03 UTC (rev 818)
@@ -3,6 +3,13 @@
 	* plugins/si/socks5.tcl: Fixed SHA1 hash computing for SOCKS5
 	  bytestreams support.
 
+	* disco.tcl, utils.tcl, plugins/si/socks5.tcl: Introduced new
+	  function my_jid, which is suitable to get JID for including to
+	  requests and responses (for conference recipients it returns
+	  conference JID, for other recipients it returns real JID).
+	  Use this new function when replying disco queries and when
+	  sending files.
+
 2006-12-02  Sergei Golovan  <sgolovan at nes.ru>
 
 	* plugins/richtext/highlight.tcl: Enable highlighting by default.

Modified: trunk/tkabber/disco.tcl
===================================================================
--- trunk/tkabber/disco.tcl	2006-12-03 09:24:13 UTC (rev 817)
+++ trunk/tkabber/disco.tcl	2006-12-03 19:43:03 UTC (rev 818)
@@ -349,13 +349,7 @@
     } else {
 	set restags {}
 
-	set bare_from [node_and_server_from_jid $from]
-	set chatid [chat::chatid $connid $bare_from]
-	if {[chat::is_groupchat $chatid]} {
-	    set myjid [chat::our_jid $chatid]
-	} else {
-	    set myjid [jlib::connection_jid $connid]
-	}
+	set myjid [my_jid $connid $from]
 
 	foreach node $root_nodes {
 	    set vars [list jid $myjid]

Modified: trunk/tkabber/plugins/si/socks5.tcl
===================================================================
--- trunk/tkabber/plugins/si/socks5.tcl	2006-12-03 09:24:13 UTC (rev 817)
+++ trunk/tkabber/plugins/si/socks5.tcl	2006-12-03 19:43:03 UTC (rev 818)
@@ -87,12 +87,10 @@
     }
 
     set myjid [encoding convertto utf-8 \
-		   [string tolower [jlib::connection_jid $state(connid)]]]
+		   [string tolower [my_jid $state(connid) $state(jid)]]]
     set hisjid [encoding convertto utf-8 [string tolower $state(jid)]]
     set hash [::sha1::sha1 $state(id)$hisjid$myjid]
 
-    debugmsg filetransfer "SOCKS5 HASH $hash"
-
     set len [binary format c [string length $hash]]
 
     puts -nonewline $sock "\x05\x01\x00\x03$len$hash\x00\x00"
@@ -163,13 +161,13 @@
     lassign [fconfigure $servsock -sockname] addr hostname port
     set ip [jlib::socket_ip $state(connid)]
     set myjid [encoding convertto utf-8 \
-		   [string tolower [jlib::connection_jid $state(connid)]]]
+		   [string tolower [my_jid $state(connid) $state(jid)]]]
     set hisjid [encoding convertto utf-8 [string tolower $state(jid)]]
     set hash [::sha1::sha1 $state(id)$myjid$hisjid]
     set hash_sid($hash) $state(id)
 
     set streamhosts [list [jlib::wrapper:createtag streamhost \
-			       -vars [list jid [jlib::connection_jid $state(connid)] \
+			       -vars [list jid [my_jid $state(connid) $state(jid)] \
 					   host $ip \
 					   port $port]]]
 
@@ -370,7 +368,7 @@
     }
 
     set myjid [encoding convertto utf-8 \
-		   [string tolower [jlib::connection_jid $state(connid)]]]
+		   [string tolower [my_jid $state(connid) $state(jid)]]]
     set hisjid [encoding convertto utf-8 [string tolower $state(jid)]]
     set hash [::sha1::sha1 $state(id)$myjid$hisjid]
 

Modified: trunk/tkabber/utils.tcl
===================================================================
--- trunk/tkabber/utils.tcl	2006-12-03 09:24:13 UTC (rev 817)
+++ trunk/tkabber/utils.tcl	2006-12-03 19:43:03 UTC (rev 818)
@@ -51,7 +51,18 @@
     
 }
 
+# my_jid - returns JID for inclusion in queries. If the recipient
+# is from some conference room then JID is a room JID.
 
+proc my_jid {connid recipient} {
+    set bare_recipient [node_and_server_from_jid $recipient]
+    set chatid [chat::chatid $connid $bare_recipient]
+    if {[chat::is_groupchat $chatid]} {
+	set myjid [chat::our_jid $chatid]
+    } else {
+	set myjid [jlib::connection_jid $connid]
+    }
+}
 
 proc win_id {prefix key} {
     global wins



More information about the Tkabber-dev mailing list