[Tkabber-dev] r2054 - in trunk/tkabber: . ifacetk plugins/general

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Jan 7 21:19:42 MSK 2014


Author: sergei
Date: 2014-01-07 21:19:42 +0400 (Tue, 07 Jan 2014)
New Revision: 2054

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/chats.tcl
   trunk/tkabber/ifacetk/roster.tcl
   trunk/tkabber/muc.tcl
   trunk/tkabber/plugins/general/remote.tcl
   trunk/tkabber/roster.tcl
Log:
	* chats.tcl, ifacetk/roster.tcl, muc.tcl, plugins/general/remote.tcl,
	  roster.tcl: Added a few checks if roster::find_jid returns empty
	  string.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2014-01-01 09:32:50 UTC (rev 2053)
+++ trunk/tkabber/ChangeLog	2014-01-07 17:19:42 UTC (rev 2054)
@@ -1,3 +1,9 @@
+2014-01-07  Sergei Golovan  <sgolovan at nes.ru>
+
+	* chats.tcl, ifacetk/roster.tcl, muc.tcl, plugins/general/remote.tcl,
+	  roster.tcl: Added a few checks if roster::find_jid returns empty
+	  string.
+
 2014-01-01  Sergei Golovan  <sgolovan at nes.ru>
 
 	* *: 1.0 is released.

Modified: trunk/tkabber/chats.tcl
===================================================================
--- trunk/tkabber/chats.tcl	2014-01-01 09:32:50 UTC (rev 2053)
+++ trunk/tkabber/chats.tcl	2014-01-07 17:19:42 UTC (rev 2054)
@@ -127,9 +127,9 @@
 	    if {[is_groupchat $chatid1]} {
 		set nick [::xmpp::jid::resource $jid]
 	    } else {
-		set nick [roster::itemconfig $xlib \
-			      [roster::find_jid $xlib $jid] -name]
-		if {$nick == ""} {
+		set rjid [roster::find_jid $xlib $jid]
+		set nick [roster::itemconfig $xlib $rjid -name]
+		if {$rjid == "" || $nick == ""} {
 		    if {[::xmpp::jid::node $jid] != ""} {
 			set nick [::xmpp::jid::node $jid]
 		    } else {
@@ -298,9 +298,9 @@
 proc chat::window_titles {chatid} {
     set xlib [get_xlib $chatid]
     set jid [get_jid $chatid]
-    set chatname [roster::itemconfig $xlib \
-		      [roster::find_jid $xlib $jid] -name]
-    if {$chatname != ""} {
+    set rjid [roster::find_jid $xlib $jid]
+    set chatname [roster::itemconfig $xlib $rjid -name]
+    if {$rjid != "" && $chatname != ""} {
 	set tabtitlename $chatname
 	set titlename $chatname
     } else {

Modified: trunk/tkabber/ifacetk/roster.tcl
===================================================================
--- trunk/tkabber/ifacetk/roster.tcl	2014-01-01 09:32:50 UTC (rev 2053)
+++ trunk/tkabber/ifacetk/roster.tcl	2014-01-07 17:19:42 UTC (rev 2054)
@@ -860,8 +860,12 @@
 
     set subsc [::roster::itemconfig $xlib $user -subsc]
     if {[string equal $subsc ""]} {
-	set subsc [::roster::itemconfig $xlib \
-		       [::roster::find_jid $xlib $user] -subsc]
+	set ruser [::roster::find_jid $xlib $user]
+	if {$ruser != ""} {
+	    set subsc [::roster::itemconfig $xlib $ruser -subsc]
+	} else {
+	    set subsc none
+	}
     }
 
     if {([string equal $subsc from] || [string equal $subsc none]) && \
@@ -940,8 +944,12 @@
 
     set subsc [::roster::itemconfig $xlib $user -subsc]
     if {[string equal $subsc ""]} {
-	set subsc [::roster::itemconfig $xlib \
-	               [::roster::find_jid $xlib $user] -subsc]
+	set ruser [::roster::find_jid $xlib $user]
+	if {$ruser != ""} {
+	    set subsc [::roster::itemconfig $xlib $ruser -subsc]
+	} else {
+	    set subsc none
+	}
     }
 
     if {!([string equal $subsc from] || [string equal $subsc none]) || \
@@ -1522,7 +1530,7 @@
 
 proc roster::add_remove_item_menu_item {m xlib jid} {
     set rjid [roster::find_jid $xlib $jid]
-    if {$rjid == ""} {
+    if {$jid != "" && $rjid == ""} {
 	set state disabled
     } else {
 	set state normal

Modified: trunk/tkabber/muc.tcl
===================================================================
--- trunk/tkabber/muc.tcl	2014-01-01 09:32:50 UTC (rev 2053)
+++ trunk/tkabber/muc.tcl	2014-01-07 17:19:42 UTC (rev 2054)
@@ -972,11 +972,10 @@
 			    set inviter [::xmpp::xml::getAttr $sattrs from]
 			    if {![string equal $inviter ""]} {
 				foreach c [connections] {
+				    set rjid [roster::find_jid $c $inviter]
 				    set name \
-					[roster::itemconfig $c \
-					     [roster::find_jid $c $inviter] \
-						  -name]
-				    if {$name != ""} break
+					[roster::itemconfig $c $rjid -name]
+				    if {$rjid != "" && $name != ""} break
 				}
 				if {![string equal $name ""]} {
 				    set inviter "$name ($inviter)"

Modified: trunk/tkabber/plugins/general/remote.tcl
===================================================================
--- trunk/tkabber/plugins/general/remote.tcl	2014-01-01 09:32:50 UTC (rev 2053)
+++ trunk/tkabber/plugins/general/remote.tcl	2014-01-07 17:19:42 UTC (rev 2054)
@@ -654,10 +654,9 @@
 	if {![cequal [chat::get_xlib $chatid] $xlib]} continue
 
 	set jid [chat::get_jid $chatid]
-	set name [::roster::itemconfig $xlib \
-				       [::roster::find_jid $xlib $jid] \
-				       -name]
-	if {![cequal $name ""]} {
+	set rjid [::roster::find_jid $xlib $jid]
+	set name [::roster::itemconfig $xlib $rjid -name]
+	if {$rjid != "" && $name != ""} {
 	    set name [format "%s (%s)" $name $jid]
 	} else {
 	    set name $jid

Modified: trunk/tkabber/roster.tcl
===================================================================
--- trunk/tkabber/roster.tcl	2014-01-01 09:32:50 UTC (rev 2053)
+++ trunk/tkabber/roster.tcl	2014-01-07 17:19:42 UTC (rev 2054)
@@ -276,7 +276,11 @@
 # Returns true if $jid is allowed to receive our presence information,
 # false otherwise.
 proc roster::is_trusted {xlib jid} {
-    set subsc [itemconfig $xlib [find_jid $xlib $jid] -subsc]
+    set rjid [find_jid $xlib $jid]
+    if {$rjid == ""} {
+	return 0
+    }
+    set subsc [itemconfig $xlib $rjid -subsc]
 
     if {[::xmpp::jid::stripResource $jid] == [connection_bare_jid $xlib]} {
 	return 1



More information about the Tkabber-dev mailing list