[Tkabber-dev] r387 - in trunk/plugins: . toped toped/msgs winup

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Wed Sep 15 18:42:39 MSD 2010


Author: Rejjin
Date: 2010-09-15 18:42:38 +0400 (Wed, 15 Sep 2010)
New Revision: 387

Added:
   trunk/plugins/toped/
   trunk/plugins/toped/msgs/
   trunk/plugins/toped/msgs/ru.msg
   trunk/plugins/toped/toped.tcl
Modified:
   trunk/plugins/winup/winup.tcl
Log:
The plugin creates a window where you can easily change the theme of the conference.

Added: trunk/plugins/toped/msgs/ru.msg
===================================================================
--- trunk/plugins/toped/msgs/ru.msg	                        (rev 0)
+++ trunk/plugins/toped/msgs/ru.msg	2010-09-15 14:42:38 UTC (rev 387)
@@ -0,0 +1,3 @@
+::msgcat::mcset ru "Change subject" "Сменить тему"
+::msgcat::mcset ru "%s subject" "%s тема"
+::msgcat::mcset ru "Save subject" "Сохранить тему"
\ No newline at end of file

Added: trunk/plugins/toped/toped.tcl
===================================================================
--- trunk/plugins/toped/toped.tcl	                        (rev 0)
+++ trunk/plugins/toped/toped.tcl	2010-09-15 14:42:38 UTC (rev 387)
@@ -0,0 +1,62 @@
+# The plugin creates a window 
+# where you can easily change 
+# the theme of the conference.
+#
+# Renji 
+# xmpp: rejjin at jabber.dk
+# e-mail: webrenji at gmail.com
+#
+
+namespace eval toped { 
+
+	::msgcat::mcload [file join [file dirname [info script]] msgs]
+	
+	hook::add chat_create_conference_menu_hook \
+		[namespace current]::add_menu_item 1
+}
+
+proc toped::add_menu_item { m xlib jid } {
+	
+    set chatid [chat::chatid $xlib [::xmpp::jid::stripResource $jid]]
+	
+	$m add command -label [::msgcat::mc "Change subject"] \
+		-command [list [namespace current]::change_subject $chatid]
+	$m add separator
+}
+
+proc toped::change_subject { 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]::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 toped::send_new_subject { chatid text w } {
+    set chatwin [chat::winid $chatid]
+    set xlib [chat::get_xlib $chatid]
+    set jid [chat::get_jid $chatid]
+	set subject [$text get 0.0 end]
+
+    message::send_msg $xlib $jid -type groupchat -subject $subject
+	destroy_win $w
+}
\ No newline at end of file

Modified: trunk/plugins/winup/winup.tcl
===================================================================
--- trunk/plugins/winup/winup.tcl	2010-09-13 12:30:28 UTC (rev 386)
+++ trunk/plugins/winup/winup.tcl	2010-09-15 14:42:38 UTC (rev 387)
@@ -705,6 +705,7 @@
 
 proc winup::create_custom_options { } {
 	variable options
+	variable theme
 	
 	foreach name $::hook::winup_window_types {
 		set hook_part [lindex $name 0]



More information about the Tkabber-dev mailing list