[Tkabber-dev] r118 - in trunk/plugins: . muchidetopic

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Aug 17 16:50:03 MSD 2008


Author: kostix
Date: 2008-08-17 16:50:02 +0400 (Sun, 17 Aug 2008)
New Revision: 118

Added:
   trunk/plugins/muchidetopic/
   trunk/plugins/muchidetopic/INSTALL
   trunk/plugins/muchidetopic/license.terms
   trunk/plugins/muchidetopic/muchidetopic.tcl
Log:
New Tkabber plugin "muchidetopic" -- provides for hiding or
showing of topic window in MUC rooms.


Added: trunk/plugins/muchidetopic/INSTALL
===================================================================
--- trunk/plugins/muchidetopic/INSTALL	                        (rev 0)
+++ trunk/plugins/muchidetopic/INSTALL	2008-08-17 12:50:02 UTC (rev 118)
@@ -0,0 +1,18 @@
+As usually, copy this directory under the ~/.tkabber/plugins directory
+so that you get a hierarchy like this:
+  ~/.tkabber/plugins
+  ~/.tkabber/plugins/muchidetopic/
+  ~/.tkabber/plugins/muchidetopic/muchidetopic.tcl
+
+Restart Tkabber, to get the plugin loaded.
+
+Navigate "Tkabber->Customize->MUC Hide Topic" group of settings
+where you can specify where or not to hide the topic window
+automatically in MUC rooms when they're opened.
+
+You can toggle visibility of the MUC topic window by pressing
+<Alt-s> (or <Meta-s> on some systems) while the chat input
+window has the keyboard focus.
+
+Consult the README file for the details about using this plugin.
+


Property changes on: trunk/plugins/muchidetopic/INSTALL
___________________________________________________________________
Added: svn:eol-style
   + native

Added: trunk/plugins/muchidetopic/license.terms
===================================================================
--- trunk/plugins/muchidetopic/license.terms	                        (rev 0)
+++ trunk/plugins/muchidetopic/license.terms	2008-08-17 12:50:02 UTC (rev 118)
@@ -0,0 +1,19 @@
+Copyright (c) 2008 Konstantin Khomoutov <flatworm at users.sourceforge.net>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.


Property changes on: trunk/plugins/muchidetopic/license.terms
___________________________________________________________________
Added: svn:eol-style
   + native

Added: trunk/plugins/muchidetopic/muchidetopic.tcl
===================================================================
--- trunk/plugins/muchidetopic/muchidetopic.tcl	                        (rev 0)
+++ trunk/plugins/muchidetopic/muchidetopic.tcl	2008-08-17 12:50:02 UTC (rev 118)
@@ -0,0 +1,77 @@
+# $Id$
+# Provides for hiding of the topic window in MUC rooms
+# to save a bit of screen space.
+# Written by Konstantin Khomoutov <flatworm at users.sourceforge.net>
+# See license.terms for the terms of distribution.
+# See README for the usage details.
+
+event add <<ToggleTopicWindow>> <Alt-Key-s>
+event add <<ToggleTopicWindow>> <Meta-Key-s>
+
+namespace eval muchidetopic {
+	variable options
+	variable packinfo
+
+	custom::defgroup Plugins [::msgcat::mc "Plugins options."] \
+		-group Tkabber
+	custom::defgroup {MUC Hide Topic} \
+		[::msgcat::mc "Support for toggling visibility of\
+			room topic window in MUC."] \
+		-group Plugins
+	custom::defvar options(hidden_by_default) 1 \
+		[::msgcat::mc "Hide room topic window in newly\
+			opened MUC windows."] \
+		-type boolean -group {MUC Hide Topic}
+
+	hook::add open_chat_post_hook \
+		[namespace current]::setup
+}
+
+proc muchidetopic::topicwin {chatid} {
+	return [chat::winid $chatid].status
+}
+
+proc muchidetopic::setup {chatid type} {
+	if {![string equal $type groupchat]} return
+
+	variable options
+	variable packinfo
+	upvar 0 packinfo($chatid) pinfo
+
+	set mw [chat::winid $chatid]
+	set tw $mw.status
+	set slaves [pack slaves $mw]
+
+	set pinfo [pack info $tw]
+	set ix [lsearch -exact $slaves $tw]
+	lappend pinfo -before [lindex $slaves [expr {$ix + 1}]]
+
+	bind [chat::input_win $chatid] <<ToggleTopicWindow>> \
+		[list [namespace current]::toggle $chatid]
+
+	if {$options(hidden_by_default) && ![winfo ismapped $tw]} {
+		bind $tw <Map> {
+			pack forget %W
+			bind %W <Map> {}
+		}
+	}
+}
+
+proc muchidetopic::hide {chatid} {
+	pack forget [topicwin $chatid]
+}
+
+proc muchidetopic::show {chatid} {
+	variable packinfo
+	eval [list pack [topicwin $chatid]] $packinfo($chatid)
+}
+
+proc muchidetopic::toggle {chatid} {
+	set w [topicwin $chatid]
+	if {[winfo ismapped $w]} {
+		hide $chatid
+	} else {
+		show $chatid
+	}
+}
+


Property changes on: trunk/plugins/muchidetopic/muchidetopic.tcl
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native



More information about the Tkabber-dev mailing list