[Tkabber-dev] r1024 - in trunk/tkabber: . ifacetk plugins/chat plugins/general plugins/roster

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Wed Mar 7 18:58:28 MSK 2007


Author: sergei
Date: 2007-03-07 18:58:27 +0300 (Wed, 07 Mar 2007)
New Revision: 1024

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/chats.tcl
   trunk/tkabber/gpgme.tcl
   trunk/tkabber/ifacetk/iroster.tcl
   trunk/tkabber/itemedit.tcl
   trunk/tkabber/messages.tcl
   trunk/tkabber/muc.tcl
   trunk/tkabber/plugins/chat/logger.tcl
   trunk/tkabber/plugins/general/jitworkaround.tcl
   trunk/tkabber/plugins/roster/annotations.tcl
   trunk/tkabber/plugins/roster/fetch_nicknames.tcl
   trunk/tkabber/roster.tcl
Log:
	* muc.tcl, chats.tcl: Added new option
	  ::muc::options(gen_muc_status_change_msgs) which allows to enable
	  groupchat status messages separately from chat status messages.

	* roster.tcl, ifacetk/iroster.tcl: Added "My Resources" roster group,
	  which contains own JID.

	* gpgme.tcl, plugins/chat/logger.tcl,
	  plugins/roster/fetch_nicknames.tcl, plugins/roster/annotations.tcl,
	  itemedit.tcl, messages.tcl: Fixed roster menu items if the JID,
	  where the menu is popped up, doesn't belong to the roster. The bug
	  appeared in "My Resources" and "Active chats" roster groups, and in
	  chat windows menus.

	* plugins/general/jitworkaround.tcl: Fixed bug which appeared if
	  subscribed presence from JIT comes before the roster item.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-03-06 21:04:34 UTC (rev 1023)
+++ trunk/tkabber/ChangeLog	2007-03-07 15:58:27 UTC (rev 1024)
@@ -1,3 +1,22 @@
+2007-03-07  Sergei Golovan  <sgolovan at nes.ru>
+
+	* muc.tcl, chats.tcl: Added new option
+	  ::muc::options(gen_muc_status_change_msgs) which allows to enable
+	  groupchat status messages separately from chat status messages.
+
+	* roster.tcl, ifacetk/iroster.tcl: Added "My Resources" roster group,
+	  which contains own JID.
+
+	* gpgme.tcl, plugins/chat/logger.tcl,
+	  plugins/roster/fetch_nicknames.tcl, plugins/roster/annotations.tcl,
+	  itemedit.tcl, messages.tcl: Fixed roster menu items if the JID,
+	  where the menu is popped up, doesn't belong to the roster. The bug
+	  appeared in "My Resources" and "Active chats" roster groups, and in
+	  chat windows menus.
+
+	* plugins/general/jitworkaround.tcl: Fixed bug which appeared if
+	  subscribed presence from JIT comes before the roster item.
+
 2007-03-06  Sergei Golovan  <sgolovan at nes.ru>
 
 	* chats.tcl: Fixed moving interface tabs by keyboard shortcuts

Modified: trunk/tkabber/chats.tcl
===================================================================
--- trunk/tkabber/chats.tcl	2007-03-06 21:04:34 UTC (rev 1023)
+++ trunk/tkabber/chats.tcl	2007-03-07 15:58:27 UTC (rev 1024)
@@ -30,7 +30,7 @@
 	-values [list normal [::msgcat::mc "Normal"] \
 		      chat [string trim [::msgcat::mc "Chat "]]]
     custom::defvar options(gen_status_change_msgs) 0 \
-	[::msgcat::mc "Generate chat messages when room occupant or chat peer\
+	[::msgcat::mc "Generate chat messages when chat peer\
 	    changes his/her status and/or status message"] \
 	-type boolean -group Chat
 

Modified: trunk/tkabber/gpgme.tcl
===================================================================
--- trunk/tkabber/gpgme.tcl	2007-03-06 21:04:34 UTC (rev 1023)
+++ trunk/tkabber/gpgme.tcl	2007-03-07 15:58:27 UTC (rev 1024)
@@ -937,9 +937,8 @@
 }
 
 proc ::ssj::prefs_user_menu {m connid jid} {
-    set rjid [roster::find_jid $connid $jid]
     $m add command -label [::msgcat::mc "Edit security..."] \
-	-command [list ::ssj::prefs $connid $rjid]
+	-command [list ::ssj::prefs $connid $jid]
 }
 
 hook::add chat_create_user_menu_hook ::ssj::prefs_user_menu 78
@@ -1411,20 +1410,16 @@
     set jid [chat::get_jid $chatid]
     set cw [chat::winid $chatid]
 
-    if {[cequal [set sjid [roster::find_jid $connid $jid]] ""]} {
-        set sjid $jid
-    }
-
     Button $cw.status.encrypted \
 	   -relief flat \
-           -image [encrypted:icon $connid $sjid] \
+           -image [encrypted:icon $connid $jid] \
            -helptype balloon \
            -helptext [::msgcat::mc "Toggle encryption"] \
-           -command [list ::ssj::encrypt:toggleP $connid $sjid]
+           -command [list ::ssj::encrypt:toggleP $connid $jid]
 
     encrypted:trace "$cw.status.encrypted configure \
-		-image \[::ssj::encrypted:icon $connid $sjid\]" \
-        $connid $sjid
+		-image \[::ssj::encrypted:icon $connid $jid\]" \
+        $connid $jid
     pack $cw.status.encrypted -side left -before $cw.status.mb
 }
 

Modified: trunk/tkabber/ifacetk/iroster.tcl
===================================================================
--- trunk/tkabber/ifacetk/iroster.tcl	2007-03-06 21:04:34 UTC (rev 1023)
+++ trunk/tkabber/ifacetk/iroster.tcl	2007-03-07 15:58:27 UTC (rev 1024)
@@ -78,6 +78,10 @@
 	[::msgcat::mc "Default nested roster group delimiter."] \
 	-type string -group Roster \
 	-command [namespace current]::redraw_after_idle
+    custom::defvar options(show_self_contacts) 0 \
+	[::msgcat::mc "Show self-contacts in roster."] \
+	-type boolean -group Roster \
+	-command [namespace current]::redraw_after_idle
     custom::defvar options(chats_group) 0 \
 	[::msgcat::mc "Add chats group in roster."] \
 	-type boolean -group Roster \
@@ -106,6 +110,7 @@
 
     variable undef_group_name $::roster::undef_group_name
     variable chats_group_name $::roster::chats_group_name
+    variable self_contacts_group_name $roster::self_contacts_group_name
 }
 
 proc roster::get_group_lists {} {
@@ -225,6 +230,7 @@
     variable show_transport_user_icons
     variable undef_group_name
     variable chats_group_name
+    variable self_contacts_group_name
     variable collapsed
     variable show_offline
 
@@ -360,7 +366,6 @@
 		set jid [chat::get_jid $chatid]
 		lappend jidsingroup($cgroup) $jid
 		if {[cequal [roster::itemconfig $connid $jid -isuser] ""]} {
-		    roster::itemconfig $connid $jid -isuser 1
 		    roster::itemconfig $connid $jid \
 			-name [chat::get_nick $connid $jid chat]
 		    roster::itemconfig $connid $jid -subsc none
@@ -372,6 +377,15 @@
 	    set groupsundergroup($cgroup) {}
 	    set jidsundergroup($cgroup) {}
 	}
+	if {$options(show_self_contacts)} {
+	    set cgroup [list $self_contacts_group_name]
+	    set jid [::jlib::connection_bare_jid $connid]
+	    set jidsingroup($cgroup) [list $jid]
+	    set groups [linsert $groups 0 [list [join $cgroup "\u0000"] $cgroup]]
+	    roster::itemconfig $connid $jid -subsc both
+	    set groupsundergroup($cgroup) {}
+	    set jidsundergroup($cgroup) {}
+	}
 	foreach group $groups {
 	    set group [lindex $group 1]
 	    set gid [list $connid $group]
@@ -1227,10 +1241,13 @@
 proc roster::add_remove_item_menu_item {m connid jid} {
     set rjid [roster::find_jid $connid $jid]
     if {$rjid == ""} {
-	set rjid [node_and_server_from_jid $jid]
+	set state disabled
+    } else {
+	set state normal
     }
     $m add command -label [::msgcat::mc "Remove from roster..."] \
-	-command [list ifacetk::roster::remove_item_dialog $connid $rjid]
+	-command [list ifacetk::roster::remove_item_dialog $connid $rjid] \
+	-state $state
 }
 
 hook::add chat_create_user_menu_hook \

Modified: trunk/tkabber/itemedit.tcl
===================================================================
--- trunk/tkabber/itemedit.tcl	2007-03-06 21:04:34 UTC (rev 1023)
+++ trunk/tkabber/itemedit.tcl	2007-03-07 15:58:27 UTC (rev 1024)
@@ -123,8 +123,14 @@
 
 proc itemedit::prefs_user_menu {m connid jid} {
     set rjid [roster::find_jid $connid $jid]
+    if {$rjid == ""} {
+	set state disabled
+    } else {
+	set state normal
+    }
     $m add command -label [::msgcat::mc "Edit item..."] \
-	-command [list [namespace current]::show_dialog $connid $rjid]
+	-command [list [namespace current]::show_dialog $connid $rjid] \
+	-state $state
 }
 
 hook::add chat_create_user_menu_hook \

Modified: trunk/tkabber/messages.tcl
===================================================================
--- trunk/tkabber/messages.tcl	2007-03-06 21:04:34 UTC (rev 1023)
+++ trunk/tkabber/messages.tcl	2007-03-07 15:58:27 UTC (rev 1024)
@@ -915,11 +915,17 @@
 
 proc message::resubscribe_menu_item {m connid jid} {
     set rjid [roster::find_jid $connid $jid]
+    if {$rjid == ""} {
+	set state disabled
+    } else {
+	set state normal
+    }
     $m add command -label [::msgcat::mc "Resubscribe"] \
 	-command [list jlib::send_presence \
 		      -to $rjid \
 		      -type subscribe \
-		      -connection $connid]
+		      -connection $connid] \
+	-state $state
 }
 
 hook::add roster_jid_popup_menu_hook message::resubscribe_menu_item 30

Modified: trunk/tkabber/muc.tcl
===================================================================
--- trunk/tkabber/muc.tcl	2007-03-06 21:04:34 UTC (rev 1023)
+++ trunk/tkabber/muc.tcl	2007-03-07 15:58:27 UTC (rev 1024)
@@ -10,6 +10,10 @@
 	[::msgcat::mc "Generate status messages when occupants\
 	    enter/exit MUC compatible conference rooms."] \
 	-type boolean -group Chat
+    custom::defvar options(gen_muc_status_change_msgs) 0 \
+	[::msgcat::mc "Generate groupchat messages when occupant\
+	    changes his/her status and/or status message"] \
+	-type boolean -group Chat
     custom::defvar options(propose_configure) 0 \
 	[::msgcat::mc "Propose to configure newly created MUC room.\
 		       If set to false then the default room configuration\
@@ -1115,6 +1119,7 @@
 }
 
 proc muc::report_available {chatid nick entered} {
+    variable options
     variable ignore_available
 
     set connid [::chat::get_connid $chatid]
@@ -1126,7 +1131,7 @@
 
     set msg ""
 
-    set report_entered [expr {$entered && $::muc::options(gen_enter_exit_msgs) \
+    set report_entered [expr {$entered && $options(gen_enter_exit_msgs) \
 	&& (![info exists ignore_available] || $ignore_available != $nick)}]
 
     if {$report_entered} {
@@ -1140,7 +1145,7 @@
     }
     catch { unset ignore_available }
 
-    if {$::chat::options(gen_status_change_msgs)} {
+    if {$options(gen_muc_status_change_msgs)} {
 	set status [::get_user_status $connid $jid]
 	if {$report_entered} {
 	    append msg " " [::msgcat::mc "and"] " "

Modified: trunk/tkabber/plugins/chat/logger.tcl
===================================================================
--- trunk/tkabber/plugins/chat/logger.tcl	2007-03-06 21:04:34 UTC (rev 1023)
+++ trunk/tkabber/plugins/chat/logger.tcl	2007-03-07 15:58:27 UTC (rev 1024)
@@ -60,7 +60,10 @@
 proc ::logger::add_menu_item {state category m connid jid} {
     switch -- $category {
 	roster {
-	    set jid [roster::find_jid $connid $jid]
+	    set rjid [roster::find_jid $connid $jid]
+	    if {$rjid != ""} {
+		set jid $rjid
+	    }
 	}
 	chat {
 	    set nas [node_and_server_from_jid $jid]

Modified: trunk/tkabber/plugins/general/jitworkaround.tcl
===================================================================
--- trunk/tkabber/plugins/general/jitworkaround.tcl	2007-03-06 21:04:34 UTC (rev 1023)
+++ trunk/tkabber/plugins/general/jitworkaround.tcl	2007-03-07 15:58:27 UTC (rev 1024)
@@ -24,7 +24,7 @@
     set jid [roster::find_jid $connid $from]
 
     if {$jid == ""} {
-	set names($connid,$jid) $newname
+	set names($connid,$from) $newname
     } elseif {[roster::itemconfig $connid $jid -name] == ""} {
 	roster::itemconfig $connid $jid -name $newname
 	roster::send_item $connid $jid

Modified: trunk/tkabber/plugins/roster/annotations.tcl
===================================================================
--- trunk/tkabber/plugins/roster/annotations.tcl	2007-03-06 21:04:34 UTC (rev 1023)
+++ trunk/tkabber/plugins/roster/annotations.tcl	2007-03-07 15:58:27 UTC (rev 1024)
@@ -255,8 +255,14 @@
 
 proc annotations::prefs_user_menu {m connid jid} {
     set rjid [roster::find_jid $connid $jid]
+    if {$rjid == ""} {
+	set state disabled
+    } else {
+	set state normal
+    }
     $m add command -label [::msgcat::mc "Edit item notes..."] \
-	-command [list [namespace current]::show_dialog $connid $rjid]
+	-command [list [namespace current]::show_dialog $connid $rjid] \
+	-state $state
 }
 
 hook::add chat_create_user_menu_hook \

Modified: trunk/tkabber/plugins/roster/fetch_nicknames.tcl
===================================================================
--- trunk/tkabber/plugins/roster/fetch_nicknames.tcl	2007-03-06 21:04:34 UTC (rev 1023)
+++ trunk/tkabber/plugins/roster/fetch_nicknames.tcl	2007-03-07 15:58:27 UTC (rev 1024)
@@ -39,10 +39,14 @@
 
 proc fetch_nickname::add_user_menu {m connid jid} {
     set rjid [roster::find_jid $connid $jid]
-    if {$rjid != ""} {
-	$m add command -label [::msgcat::mc "Fetch nickname"] \
-	    -command [list [namespace current]::user_request $connid $rjid]
+    if {$rjid == ""} {
+	set state disabled
+    } else {
+	set state normal
     }
+    $m add command -label [::msgcat::mc "Fetch nickname"] \
+	-command [list [namespace current]::user_request $connid $rjid] \
+	-state $state
 }
 
 hook::add chat_create_user_menu_hook \
@@ -52,8 +56,14 @@
 
 proc fetch_nickname::add_service_menu {m connid jid} {
     set rjid [roster::find_jid $connid $jid]
+    if {$rjid == ""} {
+	set state disabled
+    } else {
+	set state normal
+    }
     $m add command -label [::msgcat::mc "Fetch user nicknames"] \
-	-command [list [namespace current]::service_request $connid $rjid]
+	-command [list [namespace current]::service_request $connid $rjid] \
+	-state $state
 }
 
 hook::add roster_service_popup_menu_hook \

Modified: trunk/tkabber/roster.tcl
===================================================================
--- trunk/tkabber/roster.tcl	2007-03-06 21:04:34 UTC (rev 1023)
+++ trunk/tkabber/roster.tcl	2007-03-07 15:58:27 UTC (rev 1024)
@@ -3,12 +3,14 @@
 namespace eval roster {
     variable undef_group_name [::msgcat::mc "Undefined"]
     variable chats_group_name [::msgcat::mc "Active Chats"]
+    variable self_contacts_group_name [::msgcat::mc "My Resources"]
 }
 
 proc roster::process_item {connid jid name groups subsc ask} {
     variable roster
     variable undef_group_name
     variable chats_group_name
+    variable self_contacts_group_name
 
     debugmsg roster "ROSTER_ITEM: $connid; $jid; $name; $groups; $subsc; $ask"
 
@@ -19,7 +21,7 @@
 	    lappend roster(jids,$connid) $jid
 	}
 	set groups [lrmdups $groups]
-	foreach group [list "" $undef_group_name $chats_group_name] {
+	foreach group [list "" $undef_group_name $chats_group_name $self_contacts_group_name] {
 	    set ind [lsearch -exact $groups $group]
 	    if {$ind >= 0} {
 		set groups [lreplace $groups $ind $ind]
@@ -428,12 +430,14 @@
     variable roster
     variable undef_group_name
     variable chats_group_name
+    variable self_contacts_group_name
 
     set grtags {}
     foreach group $roster(group,$connid,$jid) {
 	if {![cequal $group ""] && \
 		![cequal $group $undef_group_name] && \
-		![cequal $group $chats_group_name]} {
+		![cequal $group $chats_group_name] && \
+		![cequal $group $self_contacts_group_name]} {
 	    lappend grtags [jlib::wrapper:createtag group -chdata $group]
 	}
     }



More information about the Tkabber-dev mailing list