[Tkabber-dev] r1288 - trunk/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Oct 28 21:21:36 MSK 2007


Author: sergei
Date: 2007-10-28 21:21:36 +0300 (Sun, 28 Oct 2007)
New Revision: 1288

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/messages.tcl
Log:
	* messages.tcl: Made 'Add user' menu item inactive if the contact's
	  real JID isn't available.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-10-28 05:56:23 UTC (rev 1287)
+++ trunk/tkabber/ChangeLog	2007-10-28 18:21:36 UTC (rev 1288)
@@ -2,6 +2,9 @@
 
 	* ifacetk/unix.xrdb: Fixed balloons resources.
 
+	* messages.tcl: Made 'Add user' menu item inactive if the contact's
+	  real JID isn't available.
+
 2007-10-27  Sergei Golovan  <sgolovan at nes.ru>
 
 	* tkabber.tcl: Increased priority for options read from default XRDB

Modified: trunk/tkabber/messages.tcl
===================================================================
--- trunk/tkabber/messages.tcl	2007-10-28 05:56:23 UTC (rev 1287)
+++ trunk/tkabber/messages.tcl	2007-10-28 18:21:36 UTC (rev 1288)
@@ -777,10 +777,26 @@
 ###############################################################################
 
 proc message::add_subscribe_menu_item {m connid jid} {
+    set chatid [chat::chatid $connid [node_and_server_from_jid $jid]]
+    if {[chat::is_groupchat $chatid]} {
+	set real_jid [muc::get_real_jid $connid $jid]
+	if {$real_jid != ""} {
+	    set jid $real_jid
+	    set state normal
+	} else {
+	    set state disabled
+	}
+    } else {
+	set state normal
+    }
     set user [node_and_server_from_jid $jid]
+    if {[roster::itemconfig $connid $user -subsc] != ""} {
+	set state disabled
+    }
     $m add command -label [::msgcat::mc "Add user to roster..."] \
-	   -command [list message::send_subscribe_dialog \
-		          $user -connection $connid]
+		   -state $state \
+		   -command [list message::send_subscribe_dialog $user \
+				  -connection $connid]
 }
 
 hook::add chat_create_user_menu_hook \
@@ -963,3 +979,4 @@
 
 ###############################################################################
 
+# vim:ts=8:sw=4:sts=4:noet



More information about the Tkabber-dev mailing list