[Tkabber-dev] r413 - in trunk/plugins/clienticons: . afficons msgs

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Oct 1 06:17:54 MSD 2010


Author: ancestor
Date: 2010-10-01 06:17:54 +0400 (Fri, 01 Oct 2010)
New Revision: 413

Added:
   trunk/plugins/clienticons/afficons/admin.png
Removed:
   trunk/plugins/clienticons/afficons/moderator.png
Modified:
   trunk/plugins/clienticons/clienticons.tcl
   trunk/plugins/clienticons/msgs/ru.msg
Log:
1) Added options which allow to hide/show client and aff icons in clienticons.tcl.
2) Fixed aff icon name for admin affiliation.


Copied: trunk/plugins/clienticons/afficons/admin.png (from rev 411, trunk/plugins/clienticons/afficons/moderator.png)
===================================================================
(Binary files differ)

Deleted: trunk/plugins/clienticons/afficons/moderator.png
===================================================================
(Binary files differ)

Modified: trunk/plugins/clienticons/clienticons.tcl
===================================================================
--- trunk/plugins/clienticons/clienticons.tcl	2010-10-01 00:15:03 UTC (rev 412)
+++ trunk/plugins/clienticons/clienticons.tcl	2010-10-01 02:17:54 UTC (rev 413)
@@ -9,16 +9,29 @@
 	variable jidnodes
 	variable icondir
     variable aicsdir
-	::msgcat::mcload [file join [file dirname [info script]] msgs]
+
+    ::msgcat::mcload [file join [file dirname [info script]] msgs]
+
     if {![::plugins::is_registered clienticons]} {
-	::plugins::register clienticons \
-			    -namespace [namespace current] \
-			    -source [info script] \
-			    -description [::msgcat::mc clienticons] \
-			    -loadcommand [namespace code load] \
-			    -unloadcommand [namespace code unload]
-	return
+        ::plugins::register clienticons \
+            -namespace [namespace current] \
+            -source [info script] \
+            -description [::msgcat::mc "Сlient icons."] \
+            -loadcommand [namespace code load] \
+            -unloadcommand [namespace code unload]
+        return
     }
+
+    custom::defgroup Plugins [::msgcat::mc "Plugins options."] -group Tkabber
+
+    custom::defvar options(show_clienticons) 1 \
+        [::msgcat::mc "Show client icons."] \
+        -type boolean -group {Client Icons}
+
+    custom::defvar options(show_afficons) 1 \
+        [::msgcat::mc "Show affiliation icons (only groupchats)."] \
+        -type boolean -group {Client Icons}
+
 	set icondir "[file dirname [info script]]/pixmap"
     set aicsdir "[file dirname [info script]]/afficons"
 }
@@ -231,39 +244,45 @@
 				catch {set cjids $tmpjlist}
 				catch {unset tmpjlist}
 			}
-			
+            
 			foreach j $cjids {
 				if {[::get_jid_status $xlib $j] != "unavailable"} {
 					set icon [::get_client_icon $j]
                     
                     if {$category == "conference"} {
-                        set role [::muc::get_role $xlib $j]
-                        set aff [::muc::get_affiliation $xlib $j]
-                        
-                        if {$role == "visitor"} {
-                            set affi visitor
-                        } elseif {$aff == "owner"} {
-                            set affi owner
-                        } else {
-                            if {$role == "moderator" && $aff != "member" && $aff != "none"} {
-                                set affi moderator
+                        if {$::plugins::clienticons::options(show_afficons)} {
+                            set offset 0
+                            
+                            if {$::plugins::clienticons::options(show_clienticons)} {
+                                set offset 17
+                            }
+                            
+                            set role [::muc::get_role $xlib $j]
+                            set aff [::muc::get_affiliation $xlib $j]
+                            
+                            if {$role == "visitor"} {
+                                set affi visitor
+                            } elseif {$aff == "owner"} {
+                                set affi owner
                             } else {
                                 set affi $aff
                             }
+                            
+                            $c create image [expr $x - $offset] $y -image afficons/$affi \
+                                -anchor e \
+                                -tag [list jid$tag group$grouptag meta$metatag $type icon afficon]
                         }
-                        
-                        $c create image [expr $x - 17] $y -image afficons/$affi \
-                            -anchor e \
-                            -tag [list jid$tag group$grouptag meta$metatag $type icon afficon]
                     }
                         
                     if {[lsearch [image names] $icon] == -1} {
                         set icon clients/unknown
                     }
                        
-					$c create image $x $y -image $icon \
-						-anchor e \
-						-tags [list jid$tag group$grouptag meta$metatag $type icon clienticon]
+                    if {$::plugins::clienticons::options(show_clienticons)} {
+                        $c create image $x $y -image $icon \
+                            -anchor e \
+                            -tags [list jid$tag group$grouptag meta$metatag $type icon clienticon]
+                    }
                     
 					incr x [expr ([image height $icon] + 1) * -1]
 				}
@@ -300,7 +319,7 @@
         image create photo $iconame -file $filename
     }
 
-    foreach ai {visitor none member moderator owner} {
+    foreach ai {visitor none member admin owner} {
         set affi "$aicsdir/${ai}.png"
         image create photo afficons/$ai -file $affi
     }
@@ -329,6 +348,8 @@
 ######################################################################################
 
 proc clienticons::load {} {
+    custom::defgroup {Client Icons} [::msgcat::mc "Client icons options."] -group Plugins -type visible
+
 	[namespace current]::load_client_icons
 	hook::add client_presence_hook [namespace current]::caps_collector
 	hook::add roster_user_popup_info_hook [namespace current]::popupinfo 99
@@ -342,4 +363,6 @@
 	rename ::ifacetk::roster::addline_old ::ifacetk::roster::addline
 	bind .roster.canvas <Expose>
 	::ifacetk::roster::redraw
+
+    custom::defgroup {Client Icons} [::msgcat::mc "Client icons options."] -group Plugins -type hidden
 }
\ No newline at end of file

Modified: trunk/plugins/clienticons/msgs/ru.msg
===================================================================
--- trunk/plugins/clienticons/msgs/ru.msg	2010-10-01 00:15:03 UTC (rev 412)
+++ trunk/plugins/clienticons/msgs/ru.msg	2010-10-01 02:17:54 UTC (rev 413)
@@ -1 +1,4 @@
-::msgcat::mcset ru "clienticons" "Расширение Client icons"
+::msgcat::mcset ru "Сlient icons." "Показ иконок клиентов."
+::msgcat::mcset ru "Client icons options." "Настройки иконок клиентов."
+::msgcat::mcset ru "Show affiliation icons (only groupchats)." "Показывать иконки рангов и ролей в конференциях."
+::msgcat::mcset ru "Show client icons." "Показывать иконки клиентов."
\ No newline at end of file



More information about the Tkabber-dev mailing list