[Tkabber-dev] r454 - in trunk/plugins/chattoolbar: . msgs

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Jan 4 17:23:48 MSK 2011


Author: Rejjin
Date: 2011-01-04 17:23:48 +0300 (Tue, 04 Jan 2011)
New Revision: 454

Modified:
   trunk/plugins/chattoolbar/icon-table.tcl
   trunk/plugins/chattoolbar/msgs/ru.msg
Log:
- Fixed bugs in "Disco" button.
- Integrated toped plugin (dialog for change topic) in "Topic" button.
- Dialog for "Change nick" button.

Modified: trunk/plugins/chattoolbar/icon-table.tcl
===================================================================
--- trunk/plugins/chattoolbar/icon-table.tcl	2011-01-04 06:44:32 UTC (rev 453)
+++ trunk/plugins/chattoolbar/icon-table.tcl	2011-01-04 14:23:48 UTC (rev 454)
@@ -81,15 +81,44 @@
 set iconTable(text,topic) [::msgcat::mc "Change subject"]
 
 proc button_topic {chatid} {
-	set in_win [chat::input_win $chatid]
-	set new_subject [$in_win get 1.0 "end-1 chars"]
-	if {[string length $new_subject] == 0} {
-		return
+	if {![chat::is_groupchat $chatid]} {
+	return
 	}
-	set xlib [chat::get_xlib $chatid]
+	
+	set node [::xmpp::jid::node [chat::get_jid $chatid]]
+	
+	if {[winfo exist [set w ._subject_[ifacetk::nbpage $node]]]} {
+	return
+	}
+
+	add_win $w -title [::msgcat::mc "Change subject"] \
+	    -tabtitle [::msgcat::mc "%s subject" $node] \
+	    -raisecmd [list focus $w]
+		
+	set scw [ScrolledWindow $w.sw]
+	set text [text $w.subject -wrap word]
+		
+	$scw setwidget $text
+		
+	set btn [button $w.apply \
+		-text [::msgcat::mc "Save subject"] \
+		-command [list [namespace current]::button_topic:send_new_subject $chatid $text $w]]
+		
+	set sw [chat::winid $chatid].status.subject
+	$text insert end [$sw get]
+	
+	pack $scw -expand 1 -fill both
+	pack $btn -anchor se -pady 4 -padx 4
+}
+
+proc button_topic:send_new_subject {chatid text w} {
+    set chatwin [chat::winid $chatid]
+    set xlib [chat::get_xlib $chatid]
     set jid [chat::get_jid $chatid]
-	message::send_msg $xlib $jid -type groupchat \
-		-subject $new_subject
+	set subject [$text get 1.0 "end - 1 chars"]
+
+    message::send_msg $xlib $jid -type groupchat -subject $subject
+	destroy_win $w
 }
 
 # ___________________________
@@ -203,11 +232,27 @@
 		return
 	}
 	
-	set iw [chat::input_win $chatid]
-	set nick [$iw get 1.0 "end-1 chars"]
-	muc::change_nick $chatid $nick
+	if {[winfo exist .change_nick]} {
+	focus .change_nick
+	return
+	}
+	
+	toplevel .change_nick
+	wm title .change_nick [::msgcat::mc "Change nick"]
+	pack [label .change_nick.lab -text [::msgcat::mc "Change nick"]]
+	pack [entry .change_nick.nick]
+	pack [button .change_nick.ok -text OK -command \
+		[list [namespace current]::button_change_nick:new_nick $chatid]] \
+	[button .change_nick.cancel -text Cancel -command \
+	[list destroy .change_nick]] \
+		-side left -fill x -padx 3 -pady 3 -expand 1
+	focus .change_nick.nick
 }
 
+proc button_change_nick:new_nick {chatid} {
+	muc::change_nick $chatid [.change_nick.nick get]
+	destroy .change_nick
+}
 # ___________________________
 set iconTable(icon,disco) {
 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACjUlEQVR4nMWTS2sTYRSGn5nMZCadNJeJ1tqLLWmsloJKa6GCRcGFLqyle7Eg4sJf4NadP0MXLgQX4l4Qu9GNije0WtokdYxJ08nkMvPNTC5urFjr3gNnc3jfh8O5wP8O6e/C2StXY+bY8duhlro2PJge9z2X128+Ui+XKofM+CNdCu6uPr5f2NVH/jQPTUxlJhcuPzk6O7+Sm5tPLcyfpJcexY8YlL6Xjc/v3s1Jemwpk0o+t0vF0j7A3OLKg8GZ85cWzp9hYsTENDRqkTghGvWGoCU8Ko1aWo9q56Jd8cBr1oW8ax6bPn1haHpmeTibZTwd5ZAEXR/MPhlJVUlnTNIDh5GjBhU3nEqMTt4C+A04kDtxPZZIMprWaXfBlaABOKKHaHm0HIe+wQHU7DECWcUnugig7AI6famTOw0X23Z4GUp09DiyLFH6UcMqFPGEwHMcgq0CiBaSkcruAbSaDfVLvogiazhdnYSZQY5INOwa1sYG3dCj30yTKetUu21kRVX2AILv+fVyvT1pWzaxeIpYIomiqgRCIJp1cpNHiGgR1GCMcOcbPa9u7ZmBb1sP5VqZsFkl2a9BKKiVK/gtl6iikEka9PfaSE6VmARK21vds8bAddYGRiaWXdc/eGr2BFNTOQzDQIqoKKpGrbJN/tN7Wj8KGJrqlNde3fDdZvU3oNPptKW2+8IcGl9qOk68X1c4fDCB6/k49ja2tYFtbZKM68IpfLhZKa4/23dIolUv9bzaWlSPzXbanUx+I49V2EQ4FeTQRZeCkr359o719cM9oPevX0gCR2RZnjkwkr2oJQdyUkQxZHq+37CL1a2vTwNfvAQ2gTLQ2/dMv7rSf2UfoAIdwAU8wAfCXfFPffsXfMRKZIsAAAAASUVORK5CYII=
@@ -216,7 +261,7 @@
 set iconTable(text,disco) [::msgcat::mc "Disco"]
 
 proc button_disco {chatid} {
-	eval [list join_group_dialog {}]
+	eval [list disco::browser::open_win "" ""]
 }
 # ___________________________
 set iconTable(icon,join_conference) {

Modified: trunk/plugins/chattoolbar/msgs/ru.msg
===================================================================
--- trunk/plugins/chattoolbar/msgs/ru.msg	2011-01-04 06:44:32 UTC (rev 453)
+++ trunk/plugins/chattoolbar/msgs/ru.msg	2011-01-04 14:23:48 UTC (rev 454)
@@ -27,3 +27,5 @@
 ::msgcat::mcset ru "Change nick" "Сменить псевдоним"
 ::msgcat::mcset ru "Disco" "Обзор служб"
 ::msgcat::mcset ru "Join conference" "Войти в комнату"
+::msgcat::mcset ru "%s subject" "%s тема"
+::msgcat::mcset ru "Save subject" "Сохранить тему"
\ No newline at end of file



More information about the Tkabber-dev mailing list