[Tkabber-dev] r742 - in trunk/tkabber: . ifacetk

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Mon Oct 2 00:16:59 MSD 2006


Author: sergei
Date: 2006-10-02 00:16:32 +0400 (Mon, 02 Oct 2006)
New Revision: 742

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/browser.tcl
   trunk/tkabber/chats.tcl
   trunk/tkabber/disco.tcl
   trunk/tkabber/ifacetk/iface.tcl
   trunk/tkabber/ifacetk/iroster.tcl
   trunk/tkabber/messages.tcl
   trunk/tkabber/privacy.tcl
Log:
	* browser.tcl, disco.tcl, ifacetk/iroster.tcl, ifacetk/iface.tcl,
	  messages.tcl, privacy.tcl: Added connection ID to drag'n'drop
	  JID data.

	* ifacetk/iroster.tcl: Added configurable drag'n'drop commands to
	  roster::create.

	* chats.tcl: Added invitation to the conference when the user is
	  dragged'n'dropped from the main roster to the room roster.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2006-10-01 18:08:20 UTC (rev 741)
+++ trunk/tkabber/ChangeLog	2006-10-01 20:16:32 UTC (rev 742)
@@ -9,6 +9,16 @@
 
 	* tkabber.tcl: Source pubsub.tcl.
 
+	* browser.tcl, disco.tcl, ifacetk/iroster.tcl, ifacetk/iface.tcl,
+	  messages.tcl, privacy.tcl: Added connection ID to drag'n'drop
+	  JID data.
+
+	* ifacetk/iroster.tcl: Added configurable drag'n'drop commands to
+	  roster::create.
+
+	* chats.tcl: Added invitation to the conference when the user is
+	  dragged'n'dropped from the main roster to the room roster.
+
 2006-09-30  Sergei Golovan  <sgolovan at nes.ru>
 
 	* balloon.tcl: Added function balloon::setup, which is useful

Modified: trunk/tkabber/browser.tcl
===================================================================
--- trunk/tkabber/browser.tcl	2006-10-01 18:08:20 UTC (rev 741)
+++ trunk/tkabber/browser.tcl	2006-10-01 20:16:32 UTC (rev 742)
@@ -67,7 +67,7 @@
     set sw [ScrolledWindow $bw.sw]
 
     set tw [Tree $bw.tree -deltax 16 -deltay 18 -dragenabled 1 \
-		-draginitcmd browser::draginitcmd]
+		-draginitcmd [list browser::draginitcmd $bw]]
     $sw setwidget $tw
 
     pack $sw -side top -expand yes -fill both
@@ -628,9 +628,10 @@
     }
 }
 
-proc browser::draginitcmd {t node top} {
+proc browser::draginitcmd {bw t node top} {
+    set connid browser(connid,$bw)
     set data [$t itemcget $node -data]
-    set data2 [lassign $data type]
+    set data2 [linsert [lassign $data type] 0 $connid]
 
     if {$type == "jid"} {
 	if {[set img [$t itemcget $node -image]] != ""} {
@@ -644,7 +645,7 @@
 }
 
 proc browser::entrydropcmd {bw target source pos op type data} {
-    set jid [lindex $data 0]
+    set jid [lindex $data 1]
     goto $bw $jid
 }
 

Modified: trunk/tkabber/chats.tcl
===================================================================
--- trunk/tkabber/chats.tcl	2006-10-01 18:08:20 UTC (rev 741)
+++ trunk/tkabber/chats.tcl	2006-10-01 20:16:32 UTC (rev 742)
@@ -538,7 +538,10 @@
 	ifacetk::roster::create $uw.users -width $rosterwidth \
 	    -popup ifacetk::roster::groupchat_popup_menu \
 	    -singleclick [list [namespace current]::user_singleclick $chatid] \
-	    -doubleclick ::ifacetk::roster::jid_doubleclick
+	    -doubleclick ::ifacetk::roster::jid_doubleclick \
+	    -draginitcmd [namespace current]::draginitcmd \
+	    -dropovercmd [list [namespace current]::dropovercmd $chatid] \
+	    -dropcmd [list [namespace current]::dropcmd $chatid]
 	pack $uw.users -fill both -side right -expand yes
 	[winfo parent $uw] configure -width $rosterwidth
 
@@ -611,6 +614,46 @@
 
 ###############################################################################
 
+proc chat::draginitcmd {target x y top} {
+    return {}
+}
+
+###############################################################################
+
+proc chat::dropovercmd {chatid target source event x y op type data} {
+    variable chats
+    set chat_connid [get_connid $chatid]
+    lassign $data jid_connid jid
+
+    if {$source != ".roster.canvas" || \
+	    ![info exists chats(status,$chatid)] || \
+	    $chats(status,$chatid) == "disconnected" || \
+	    $chat_connid != $jid_connid || \
+	    ![::roster::itemconfig $jid_connid $jid -isuser]} {
+	DropSite::setcursor dot
+	return 0
+    } else {
+	DropSite::setcursor based_arrow_down
+	return 1
+    }
+}
+
+###############################################################################
+
+proc chat::dropcmd {chatid target source x y op type data} {
+    set group [get_jid $chatid]
+    lassign $data connid jid
+    set reason [::msgcat::mc "Please join %s" $group]
+
+    if {[muc::is_compatible $group]} {
+	muc::invite_muc $connid $group $jid $reason
+    } else {
+	muc::invite_xconference $connid $group $jid $reason
+    }
+}
+
+###############################################################################
+
 proc chat::user_singleclick {chatid cjid} {
     lassign $cjid connid jid
     set nick [get_nick $connid $jid groupchat]
@@ -1459,7 +1502,7 @@
 		set group $gc
 	    }
 	    if {[cequal $reason ""]} {
-		set reas [format [::msgcat::mc "Please join %s"] $group]
+		set reas [::msgcat::mc "Please join %s" $group]
 	    } else {
 		set reas $reason
 	    }

Modified: trunk/tkabber/disco.tcl
===================================================================
--- trunk/tkabber/disco.tcl	2006-10-01 18:08:20 UTC (rev 741)
+++ trunk/tkabber/disco.tcl	2006-10-01 20:16:32 UTC (rev 742)
@@ -524,7 +524,7 @@
     set sw [ScrolledWindow $w.sw]
 
     set tw [Tree $w.tree -deltax 16 -deltay 18 -dragenabled 1 \
-		-draginitcmd [namespace current]::draginitcmd]
+		-draginitcmd [list [namespace current]::draginitcmd $w]]
     $sw setwidget $tw
 
     pack $sw -side top -expand yes -fill both
@@ -1224,7 +1224,8 @@
     return {}
 }
 
-proc disco::browser::draginitcmd {t tnode top} {
+proc disco::browser::draginitcmd {bw t tnode top} {
+    set connid browser(connid,$bw)
     set data [$t itemcget $tnode -data]
     set data2 [lassign $data type jid node]
 
@@ -1246,14 +1247,14 @@
 	    }
 	}
 
-	return [list JID {copy} [list $jid $category $type "" ""]]
+	return [list JID {copy} [list $connid $jid $category $type "" ""]]
     } else {
 	return {}
     }
 }
 
 proc disco::browser::entrydropcmd {bw target source pos op type data} {
-    set jid [lindex $data 0]
+    set jid [lindex $data 1]
     goto $bw $jid ""
 }
 

Modified: trunk/tkabber/ifacetk/iface.tcl
===================================================================
--- trunk/tkabber/ifacetk/iface.tcl	2006-10-01 18:08:20 UTC (rev 741)
+++ trunk/tkabber/ifacetk/iface.tcl	2006-10-01 20:16:32 UTC (rev 742)
@@ -708,7 +708,9 @@
 	    -popup [namespace current]::roster::popup_menu \
 	    -grouppopup [namespace current]::roster::group_popup_menu \
 	    -singleclick [namespace current]::roster::user_singleclick \
-	    -doubleclick [namespace current]::roster::jid_doubleclick
+	    -doubleclick [namespace current]::roster::jid_doubleclick \
+	    -draginitcmd [namespace current]::roster::draginitcmd \
+	    -dropcmd [namespace current]::roster::dropcmd
 	pack .roster -expand yes -fill both -side left -in $rw
 
 	if {$options(tabs_at_bottom)} {
@@ -789,7 +791,9 @@
 	    -popup [namespace current]::roster::popup_menu \
 	    -grouppopup [namespace current]::roster::group_popup_menu \
 	    -singleclick [namespace current]::roster::user_singleclick \
-	    -doubleclick [namespace current]::roster::jid_doubleclick
+	    -doubleclick [namespace current]::roster::jid_doubleclick \
+	    -draginitcmd [namespace current]::roster::draginitcmd \
+	    -dropcmd [namespace current]::roster::dropcmd
 	pack .roster -expand yes -fill both -side left -in [$mf getframe]
 	set geometry [option get . geometry [winfo class .]]
 	if {$geometry == ""} {

Modified: trunk/tkabber/ifacetk/iroster.tcl
===================================================================
--- trunk/tkabber/ifacetk/iroster.tcl	2006-10-01 18:08:20 UTC (rev 741)
+++ trunk/tkabber/ifacetk/iroster.tcl	2006-10-01 20:16:32 UTC (rev 742)
@@ -786,6 +786,9 @@
 	    -grouppopup {set grouppopupproc $val}
 	    -singleclick {set singleclickproc $val}
 	    -doubleclick {set doubleclickproc $val}
+	    -draginitcmd {set draginitcmd $val}
+	    -dropovercmd {set dropovercmd $val}
+	    -dropcmd {set dropcmd $val}
 	}
     }
 
@@ -845,11 +848,20 @@
 
     bindscroll $w.canvas
 
-    if {$w == ".roster"} {
-	DropSite::register .roster.canvas -dropcmd [namespace current]::dropcmd \
-	    -droptypes {JID}
-	DragSite::register .roster.canvas -draginitcmd [namespace current]::draginitcmd
+    if {[info exists draginitcmd]} {
+	DragSite::register $w.canvas -draginitcmd $draginitcmd
     }
+
+    set args {}
+    if {[info exists dropovercmd]} {
+	lappend args -dropovercmd $dropovercmd
+    }
+    if {[info exists dropcmd]} {
+	lappend args -dropcmd $dropcmd
+    }
+    if {![lempty $args]} {
+	eval [list DropSite::register $w.canvas -droptypes {JID}] $args
+    }
 }
 
 proc roster::addline {w type text jid group indent {jids {}} {icon ""} {foreground ""}} {
@@ -1295,7 +1307,7 @@
 
     debugmsg roster "GG: $gr; $tags"
 
-    lassign $data jid category type name version fromgid
+    lassign $data _connid jid category type name version fromgid
     set subsc ""
 
     if {[info exists fromgid]} {
@@ -1361,7 +1373,7 @@
 	set cjid [tag_to_jid $tag]
 	lassign $cjid connid jid
 
-	set data [list $jid \
+	set data [list $connid $jid \
 		      [::roster::itemconfig $connid $jid -category] \
 		      [::roster::itemconfig $connid $jid -subtype] \
 		      [::roster::itemconfig $connid $jid -name] {} \

Modified: trunk/tkabber/messages.tcl
===================================================================
--- trunk/tkabber/messages.tcl	2006-10-01 18:08:20 UTC (rev 741)
+++ trunk/tkabber/messages.tcl	2006-10-01 20:16:32 UTC (rev 742)
@@ -569,7 +569,7 @@
 }
 
 proc message::jiddropcmd {target source pos op type data} {
-    set jid [lindex $data 0]
+    set jid [lindex $data 1]
     $target delete 0 end
     $target insert 0 $jid
 }

Modified: trunk/tkabber/privacy.tcl
===================================================================
--- trunk/tkabber/privacy.tcl	2006-10-01 18:08:20 UTC (rev 741)
+++ trunk/tkabber/privacy.tcl	2006-10-01 20:16:32 UTC (rev 742)
@@ -990,7 +990,7 @@
 
 
 proc privacy::dropcmd {target source X Y op type data} {
-    add_special_jid $target [lindex $data 0]
+    add_special_jid $target [lindex $data 1]
 }
 
 



More information about the Tkabber-dev mailing list