[Tkabber-dev] r858 - in trunk/tkabber-plugins: . debug debug/msgs tkabber-khim tkabber-khim/khim tkabber-khim/msgs

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Wed Jan 3 18:10:34 MSK 2007


Author: sergei
Date: 2007-01-03 18:10:29 +0300 (Wed, 03 Jan 2007)
New Revision: 858

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/debug/debug.tcl
   trunk/tkabber-plugins/debug/msgs/es.msg
   trunk/tkabber-plugins/debug/msgs/pl.msg
   trunk/tkabber-plugins/debug/msgs/ru.msg
   trunk/tkabber-plugins/debug/msgs/uk.msg
   trunk/tkabber-plugins/tkabber-khim/khim/pl.msg
   trunk/tkabber-plugins/tkabber-khim/khim/ru.msg
   trunk/tkabber-plugins/tkabber-khim/msgs/pl.msg
   trunk/tkabber-plugins/tkabber-khim/msgs/ru.msg
   trunk/tkabber-plugins/tkabber-khim/tkabber-khim.tcl
Log:
	* debug/debug.tcl: Made plugin options customizeable via GUI.

	* debug/msgs/ru.msg: Updated.

	* debug/msgs/es.msg, debug/msgs/pl.msg, debug/msgs/uk.msg: Added
	  VIM modeline.

	* tkabber-khim/tkabber-khim.tcl, tkabber-khim/khim/pl.msg,
	  tkabber-khim/khim/ru.msg, tkabber-khim/msgs/pl.msg,
	  tkabber-khim/msgs/ru.msg: Added newline to a message, which
	  is printed to the terminal when KHIM cannot be loaded, to fit
	  80 symbol width.


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2007-01-02 18:31:07 UTC (rev 857)
+++ trunk/tkabber-plugins/ChangeLog	2007-01-03 15:10:29 UTC (rev 858)
@@ -1,3 +1,18 @@
+2006-01-03  Sergei Golovan <sgolovan at nes.ru>
+
+	* debug/debug.tcl: Made plugin options customizeable via GUI.
+
+	* debug/msgs/ru.msg: Updated.
+
+	* debug/msgs/es.msg, debug/msgs/pl.msg, debug/msgs/uk.msg: Added
+	  VIM modeline.
+
+	* tkabber-khim/tkabber-khim.tcl, tkabber-khim/khim/pl.msg,
+	  tkabber-khim/khim/ru.msg, tkabber-khim/msgs/pl.msg,
+	  tkabber-khim/msgs/ru.msg: Added newline to a message, which
+	  is printed to the terminal when KHIM cannot be loaded, to fit
+	  80 symbol width.
+
 2006-01-01  Sergei Golovan <sgolovan at nes.ru>
 
 	* tkabber-khim/msgs/ru.msg, whiteboard/msgs/ru.msg: Updated.

Modified: trunk/tkabber-plugins/debug/debug.tcl
===================================================================
--- trunk/tkabber-plugins/debug/debug.tcl	2007-01-02 18:31:07 UTC (rev 857)
+++ trunk/tkabber-plugins/debug/debug.tcl	2007-01-03 15:10:29 UTC (rev 858)
@@ -3,114 +3,135 @@
 
 # Some tweaks by Badlop
 
-# Example options:
-# set debug_lvls	[list jlib roster plugins]
-# set debug_winP	1
+# Options changed by Sergei Golovan
 
 package require msgcat
-::msgcat::mcload [file join [file dirname [info script]] msgs]
 
-proc debug_setup_menu {} {
-    global debug_modules debug_lvls
+namespace eval debug {
+    ::msgcat::mcload [file join [file dirname [info script]] msgs]
+
+    custom::defgroup Plugins [::msgcat::mc "Plugins options."] -group Tkabber
+
+    custom::defgroup Debug [::msgcat::mc "Debug live plugin options."] -group Plugins
+
+    custom::defvar options(log_to_file) 0 \
+	[::msgcat::mc "Log debug messages to file ~/.tkabber/tkabber.log."] \
+	-group Debug -type boolean
+
+    custom::defvar options(log_to_window) 0 \
+	[::msgcat::mc "Log debug messages to a separate tab/window."] \
+	-group Debug -type boolean
+
+    variable modules [list avatar       \
+			   browser      \
+			   browseurl    \
+			   chat         \
+			   conference   \
+			   custom       \
+			   disco        \
+			   emoticons    \
+			   filetransfer \
+			   filters      \
+			   georoster    \
+			   headlines    \
+			   hook         \
+			   http         \
+			   iface        \
+			   iq           \
+			   jidlink      \
+			   jlib         \
+			   jlib::route  \
+			   logger       \
+			   login        \
+			   message      \
+			   negotiate    \
+			   nick         \
+			   pep          \
+			   plugins      \
+			   popupmenu    \
+			   presence     \
+			   privacy      \
+			   pubsub       \
+			   register     \
+			   roster       \
+			   search       \
+			   si           \
+			   ssj          \
+			   sw           \
+			   tkabber      \
+			   userinfo     \
+			   utils        \
+			   warning      \
+			   zerobot]
+
+    foreach module $modules {
+	custom::defvar debug($module) 0 \
+	    [::msgcat::mc "Log debug messages for module %s to a tab/window." \
+			  $module] \
+	    -group Debug -type boolean
+    }
+}
+
+proc debug::setup_menu {} {
+    variable options
+    variable modules
+    variable debug
+    
     set m [.mainframe getmenu plugins]
     set ind [$m index end]
 
     set buttons [menu $m.devel -tearoff $ifacetk::options(show_tearoffs)]
-    $buttons add checkbutton -label [::msgcat::mc "Debug to window"] -variable debug_winP
 
+    $buttons add checkbutton -label [::msgcat::mc "Log to file"] \
+	-variable [namespace current]::options(log_to_file)
+    $buttons add checkbutton -label [::msgcat::mc "Log to window"] \
+	-variable [namespace current]::options(log_to_window)
+
     $buttons add separator
-    foreach l [list avatar       \
-                    browser      \
-                    browseurl    \
-                    chat         \
-                    conference   \
-                    custom       \
-		    disco        \
-                    emoticons    \
-                    filetransfer \
-                    filters      \
-                    georoster    \
-		    headlines    \
-                    hook         \
-		    http         \
-                    iface        \
-                    iq           \
-                    jidlink      \
-                    jlib         \
-                    jlib::route  \
-                    logger       \
-                    login        \
-                    message      \
-                    negotiate    \
-                    nick         \
-		    pep          \
-                    plugins      \
-		    popupmenu    \
-                    presence     \
-		    privacy      \
-		    pubsub       \
-                    register     \
-                    roster       \
-                    search       \
-                    si           \
-                    ssj          \
-		    sw           \
-                    tkabber      \
-                    userinfo     \
-                    utils        \
-                    warning      \
-                    zerobot] {
-        if {[lsearch -exact $debug_lvls $l] >= 0} {
-            set debug_modules($l) 1
-        } else {
-            set debug_modules($l) 0
-        }
 
-	$buttons add checkbutton -label $l -variable debug_modules($l) \
-	    -command [namespace current]::debug_update
+    foreach module $modules {
+	$buttons add checkbutton -label $module \
+	    -variable [namespace current]::debug($module)
     }
 
-    $m add cascade -label [::msgcat::mc "Debug live"] -menu $buttons 
+    $m add cascade -label [::msgcat::mc "Debug"] -menu $buttons 
 }
-hook::add finload_hook [namespace current]::debug_setup_menu
 
-proc debug_update {} {
-    global debug_modules debug_lvls
-    
-    set debug_lvls {}
-    foreach {k v} [array get debug_modules] {
-        if {$v} {
-            lappend debug_lvls $k
-        }
-    }
-}
+hook::add finload_hook [namespace current]::debug::setup_menu
 
-proc ::debugmsg {module msg} {
-    global debug_lvls w
-    global debug_fd debug_winP
+proc ::debugmsg {module msg} \
+     [list eval [namespace current]::debug::debugmsg \$module \$msg]
 
-    if {![info exists debug_fd]} {
-        catch { file rename -force -- ~/.tkabber/tkabber.log \
-                                      ~/.tkabber/tkabber0.log }
-        set debug_fd [open ~/.tkabber/tkabber.log \
-                           { WRONLY CREAT TRUNC APPEND }]
-        fconfigure $debug_fd -buffering line
+proc debug::debugmsg {module msg} {
+    variable options
+    variable debug
+    variable debug_fd
+
+    if {$options(log_to_file)} {
+	if {![info exists debug_fd]} {
+	    catch { file rename -force -- ~/.tkabber/tkabber.log \
+					  ~/.tkabber/tkabber0.log }
+	    set debug_fd [open ~/.tkabber/tkabber.log w]
+	    fconfigure $debug_fd -buffering line
+	}
+
+	puts $debug_fd [format "%s %-12.12s %s" \
+			       [clock format [clock seconds] -format "%m/%d %T"] \
+			       $module $msg]
     }
 
-    puts $debug_fd [format "%s %-12.12s %s" \
-                           [clock format [clock seconds] -format "%m/%d %T"] \
-                           $module $msg]
-
-    if {([lsearch -exact $debug_lvls $module] < 0) || (!$debug_winP)} {
+    if {!$options(log_to_window) || !$debug($module)} {
         return
     }
 
     set dw .debug
 
     if {![winfo exists $dw]} {
-        add_win $dw -title Debug -tabtitle debug -class Chat \
-	    -raisecmd "focus [list $dw.body]
-		       tab_set_updated [list $dw]"
+        add_win $dw -title [::msgcat::mc Debug] \
+		    -tabtitle [::msgcat::mc Debug] \
+		    -class Chat \
+		    -raisecmd "focus [list $dw.body]
+			       tab_set_updated [list $dw]"
 
         [ScrolledWindow $dw.sw] setwidget \
             [text $dw.body -yscrollcommand [list $dw.scroll set] \
@@ -162,24 +183,4 @@
     $dw.body configure -state disabled
 }
 
-#namespace eval zerobot {
-#    proc examine_message {from id type subject body err thread priority x} {
-#        global userstatus
-#
-#       switch -- $userstatus {
-#           away
-#               -
-#           xa {
-#               if {([string length [set body [checkP $from $type $subject \
-#                                                    $body $x]]] > 0) \
-#                       && ([catch { notify $from $body } result])} {
-#                   debugmsg zerobot "notify: $result"
-#               }
-#           }
-#           default {
-#               reset
-#           }
-#       }
-#   }
-#   hook::add examine_message_hook   [namespace current]::examine_message   10
-#}
+# vim:ts=8:sw=4:sts=4:noet

Modified: trunk/tkabber-plugins/debug/msgs/es.msg
===================================================================
--- trunk/tkabber-plugins/debug/msgs/es.msg	2007-01-02 18:31:07 UTC (rev 857)
+++ trunk/tkabber-plugins/debug/msgs/es.msg	2007-01-03 15:10:29 UTC (rev 858)
@@ -1,2 +1,4 @@
 ::msgcat::mcset es "Debug live" "Depurar en vivo"
 ::msgcat::mcset es "Debug to window" "Depurar en ventana"
+
+# vim:ft=tcl:ts=8:sw=4:sts=4:noet

Modified: trunk/tkabber-plugins/debug/msgs/pl.msg
===================================================================
--- trunk/tkabber-plugins/debug/msgs/pl.msg	2007-01-02 18:31:07 UTC (rev 857)
+++ trunk/tkabber-plugins/debug/msgs/pl.msg	2007-01-03 15:10:29 UTC (rev 858)
@@ -5,3 +5,5 @@
 
 ::msgcat::mcset pl "Debug live" "Debugowanie"
 ::msgcat::mcset pl "Debug to window" "Pokaż w oknie"
+
+# vim:ft=tcl:ts=8:sw=4:sts=4:noet

Modified: trunk/tkabber-plugins/debug/msgs/ru.msg
===================================================================
--- trunk/tkabber-plugins/debug/msgs/ru.msg	2007-01-02 18:31:07 UTC (rev 857)
+++ trunk/tkabber-plugins/debug/msgs/ru.msg	2007-01-03 15:10:29 UTC (rev 858)
@@ -1,2 +1,13 @@
-::msgcat::mcset ru "Debug live" "Модуль отладки"
+::msgcat::mcset ru "Debug" "Отладка"
 ::msgcat::mcset ru "Debug to window" "Выводить отладочную информацию в окно"
+::msgcat::mcset ru "Debug live plugin options." "Настройки расширения отладки."
+::msgcat::mcset ru "Log debug messages for module %s to a tab/window." \
+    "Сохранять отладочные сообщения для модуля %s во вкладку или окно."
+::msgcat::mcset ru "Log debug messages to a separate tab/window." \
+    "Сохранять отладочные сообщения в отдельную вкладку или окно."
+::msgcat::mcset ru "Log debug messages to file ~/.tkabber/tkabber.log." \
+    "Сохранять отладочные сообщения в файл ~/.tkabber/tkabber.log."
+::msgcat::mcset ru "Log to file" "Сохранять в файл"
+::msgcat::mcset ru "Log to window" "Сохранять в окно"
+
+# vim:ft=tcl:ts=8:sw=4:sts=4:noet

Modified: trunk/tkabber-plugins/debug/msgs/uk.msg
===================================================================
--- trunk/tkabber-plugins/debug/msgs/uk.msg	2007-01-02 18:31:07 UTC (rev 857)
+++ trunk/tkabber-plugins/debug/msgs/uk.msg	2007-01-03 15:10:29 UTC (rev 858)
@@ -1,2 +1,4 @@
 ::msgcat::mcset uk "Debug live" "Дебаггер"
 ::msgcat::mcset uk "Debug to window" "Виводити налагоджувальну інформацію у вікно"
+
+# vim:ft=tcl:ts=8:sw=4:sts=4:noet

Modified: trunk/tkabber-plugins/tkabber-khim/khim/pl.msg
===================================================================
--- trunk/tkabber-plugins/tkabber-khim/khim/pl.msg	2007-01-02 18:31:07 UTC (rev 857)
+++ trunk/tkabber-plugins/tkabber-khim/khim/pl.msg	2007-01-03 15:10:29 UTC (rev 858)
@@ -107,6 +107,7 @@
 
 }
 
+# vim:ft=tcl:ts=8:sw=4:sts=4:noet
 # Local Variables:
 # mode: tcl
 # End:

Modified: trunk/tkabber-plugins/tkabber-khim/khim/ru.msg
===================================================================
--- trunk/tkabber-plugins/tkabber-khim/khim/ru.msg	2007-01-02 18:31:07 UTC (rev 857)
+++ trunk/tkabber-plugins/tkabber-khim/khim/ru.msg	2007-01-03 15:10:29 UTC (rev 858)
@@ -118,6 +118,7 @@
 
 }
 
+# vim:ft=tcl:ts=8:sw=4:sts=4:noet
 # Local Variables:
 # mode: tcl
 # End:

Modified: trunk/tkabber-plugins/tkabber-khim/msgs/pl.msg
===================================================================
--- trunk/tkabber-plugins/tkabber-khim/msgs/pl.msg	2007-01-02 18:31:07 UTC (rev 857)
+++ trunk/tkabber-plugins/tkabber-khim/msgs/pl.msg	2007-01-03 15:10:29 UTC (rev 858)
@@ -4,4 +4,7 @@
 # Please notify me of errors or incoherencies
 
 ::msgcat::mcset pl "KHIM options" "Ustawienia wtyczki KHIM"
-::msgcat::mcset pl "Wystąpił problem podczas ładowania wtyczki KHIM. Funkcje dostępne przez wtyczkę będą wyłączone. Sprawdź instrukcje w pliku INSTALL w katalogu wtyczki."
+::msgcat::mcset pl "Problem loading KHIM. Tkabber-khim functionality will be disabled.\nRefer to the INSTALL file of the tkabber-khim plugin." \
+    "Wystąpił problem podczas ładowania wtyczki KHIM.\nFunkcje dostępne przez wtyczkę będą wyłączone.\nSprawdź instrukcje w pliku INSTALL w katalogu wtyczki."
+
+# vim:ft=tcl:ts=8:sw=4:sts=4:noet

Modified: trunk/tkabber-plugins/tkabber-khim/msgs/ru.msg
===================================================================
--- trunk/tkabber-plugins/tkabber-khim/msgs/ru.msg	2007-01-02 18:31:07 UTC (rev 857)
+++ trunk/tkabber-plugins/tkabber-khim/msgs/ru.msg	2007-01-03 15:10:29 UTC (rev 858)
@@ -1,9 +1,10 @@
 # $Id$
 
 ::msgcat::mcset ru "KHIM options" "Настройки KHIM"
-::msgcat::mcset ru "Problem loading KHIM. Tkabber-khim functionality will be disabled.\
-		    Refer to the INSTALL file of the tkabber-khim plugin." \
-		   "Не удалось загрузить KHIM. Плагин Tkabber-khim не будет активизирован.\
-		    Обратитесь к файлу INSTALL в каталоге с плагином tkabber-khim."
+::msgcat::mcset ru "Problem loading KHIM. Tkabber-khim functionality will be\
+		    disabled.\nRefer to the INSTALL file of the tkabber-khim plugin." \
+		   "Не удалось загрузить KHIM. Расширение Tkabber-khim не будет\
+		    активизирован.\nОбратитесь к файлу INSTALL в каталоге с расширением\
+		    tkabber-khim."
 
 # vim:ft=tcl:ts=8:sw=4:sts=4:noet

Modified: trunk/tkabber-plugins/tkabber-khim/tkabber-khim.tcl
===================================================================
--- trunk/tkabber-plugins/tkabber-khim/tkabber-khim.tcl	2007-01-02 18:31:07 UTC (rev 857)
+++ trunk/tkabber-plugins/tkabber-khim/tkabber-khim.tcl	2007-01-03 15:10:29 UTC (rev 858)
@@ -35,9 +35,9 @@
 	# TODO why didn't tk_messageBox work here?
 	puts stderr $err
 	puts stderr [::msgcat::mc "Problem loading KHIM. Tkabber-khim\
-				   functionality will be disabled.\
-				   Refer to the INSTALL file of the\
-				   tkabber-khim plugin."]
+				   functionality will be\
+				   disabled.\nRefer to the INSTALL file\
+				   of the tkabber-khim plugin."]
 	# Clean up what's already here and bail out:
 	namespace delete [namespace current]
 	return



More information about the Tkabber-dev mailing list