[Tkabber-dev] r761 - in trunk/tkabber: . trans

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sat Oct 14 21:34:01 MSD 2006


Author: sergei
Date: 2006-10-14 21:33:54 +0400 (Sat, 14 Oct 2006)
New Revision: 761

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/messages.tcl
   trunk/tkabber/muc.tcl
   trunk/tkabber/trans/ru.msg
Log:
	* messages.tcl: Use threads for normal messages (they aren't
	  stored in message archive yet). Also use different variables
	  for choosing connection for different message windows.

	* muc.tcl: Added Node name for 'Current rooms' node.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2006-10-13 18:57:10 UTC (rev 760)
+++ trunk/tkabber/ChangeLog	2006-10-14 17:33:54 UTC (rev 761)
@@ -1,3 +1,11 @@
+2006-10-14  Sergei Golovan  <sgolovan at nes.ru>
+
+	* messages.tcl: Use threads for normal messages (they aren't
+	  stored in message archive yet). Also use different variables
+	  for choosing connection for different message windows.
+
+	* muc.tcl: Added Node name for 'Current rooms' node.
+
 2006-10-13  Sergei Golovan  <sgolovan at nes.ru>
 
 	* ifacetk/iface.tcl: Bugfix.

Modified: trunk/tkabber/messages.tcl
===================================================================
--- trunk/tkabber/messages.tcl	2006-10-13 18:57:10 UTC (rev 760)
+++ trunk/tkabber/messages.tcl	2006-10-14 17:33:54 UTC (rev 761)
@@ -79,6 +79,8 @@
     frame $mw.frame
     pack $mw.frame -side top -fill both -expand yes -padx 2m -pady 2m
 
+    label $mw.thread -text $thread
+
     if {$replyP} {
         set title [::msgcat::mc "Message from:"]
     } else {
@@ -290,6 +292,12 @@
 hook::add roster_create_groupchat_user_menu_hook \
     {message::send_dialog_item disabled} 15
 
+package require sha1
+
+proc message::generate_thread {from to} {
+    return [sha1::sha1 $from$to[random 1000000000]]
+}
+
 proc message::send_dialog {args} {
     global font
     variable msgid
@@ -300,7 +308,6 @@
 
     set to ""
     set subject ""
-    set thread ""
     set group 0
     set cstate normal
     foreach {opt val} $args {
@@ -315,6 +322,7 @@
 	    }
 	}
     }
+
     if {![info exists connid]} {
 	if {$group} {
 	    set connid [jlib::route ""]
@@ -323,18 +331,16 @@
 	}
     }
 
-    set send_dialog_connid [jlib::connection_jid $connid]
+    set mw .msgsend$msgid
+    toplevel $mw -class Message
+    wm group $mw .
 
-    set sendargs ""
+    set send_dialog_connid($mw) [jlib::connection_jid $connid]
 
-    if {$thread != ""} {
-        lappend sendargs -thread $thread
+    if {![info exists thread]} {
+	set thread [generate_thread $send_dialog_connid($mw) $to]
     }
 
-    set mw .msgsend$msgid
-    toplevel $mw -class Message
-    wm group $mw .
-
     if {$group} {
 	if {$to != ""} {
 	    set title [format [::msgcat::mc "Send message to group %s"] $to]
@@ -374,6 +380,8 @@
     set sep [Separator::create $mw.sep -orient horizontal]
     pack $sep -pady 1m -fill x -side bottom
 
+    label $mw.thread -text $thread
+
     frame $mw.frame
     pack $mw.frame -side top -fill both -expand yes -padx 2m -pady 2m
 
@@ -387,7 +395,7 @@
 	}
 	label $mw.f.lconnection -text [::msgcat::mc "From: "]
 	ComboBox $mw.f.connection \
-	    -textvariable [namespace current]::send_dialog_connid \
+	    -textvariable [namespace current]::send_dialog_connid($mw) \
 	    -values $connections \
 	    -font $font \
 	    -state $cstate
@@ -452,10 +460,12 @@
     variable send_dialog_connid
     
     foreach c [jlib::connections] {
-	if {[jlib::connection_jid $c] == $send_dialog_connid} {
+	if {[jlib::connection_jid $c] == $send_dialog_connid($mw)} {
 	    set connid $c
 	}
     }
+    unset send_dialog_connid($mw)
+
     if {![info exists connid]} {
 	eval [list send $mw] $args
     } else {
@@ -491,13 +501,14 @@
 	}
     }
 
+    set thread [$mw.thread cget -text]
     set subj [$mw.f.subj get]
     set body [$mw.body get 1.0 {end -1 chars}]
 
     foreach jid $jids {
 	if {!$group || [::roster::itemconfig $connid $jid -isuser]} {
 	    send_msg $jid -type normal \
-		-subject $subj -body $body \
+		-subject $subj -body $body -thread $thread \
 		-connection $connid
 	}
     }

Modified: trunk/tkabber/muc.tcl
===================================================================
--- trunk/tkabber/muc.tcl	2006-10-13 18:57:10 UTC (rev 760)
+++ trunk/tkabber/muc.tcl	2006-10-14 17:33:54 UTC (rev 761)
@@ -1517,7 +1517,7 @@
 }
 
 hook::add postload_hook \
-    [list disco::register_node $::NS(muc#rooms) muc::disco_reply ""]
+    [list disco::register_node $::NS(muc#rooms) muc::disco_reply "Current rooms"]
 
 ###############################################################################
 

Modified: trunk/tkabber/trans/ru.msg
===================================================================
--- trunk/tkabber/trans/ru.msg	2006-10-13 18:57:10 UTC (rev 760)
+++ trunk/tkabber/trans/ru.msg	2006-10-14 17:33:54 UTC (rev 761)
@@ -36,4 +36,5 @@
 ::trans::trset ru "Extended away" "Отошёл давно"
 ::trans::trset ru "Do not disturb" "Не беспокоить"
 ::trans::trset ru "Unavailable" "Недоступен"
+::trans::trset ru "Current rooms" "Текущие комнаты"
 



More information about the Tkabber-dev mailing list