[Tkabber-dev] r1789 - trunk/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Thu Apr 23 10:30:09 MSD 2009


Author: sergei
Date: 2009-04-23 10:30:09 +0400 (Thu, 23 Apr 2009)
New Revision: 1789

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/chats.tcl
Log:
	* chats.tcl: Added JID argument to chat::opened procedure to make it
	  possible to return all opened chat windows for a given JID.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2009-04-21 18:05:08 UTC (rev 1788)
+++ trunk/tkabber/ChangeLog	2009-04-23 06:30:09 UTC (rev 1789)
@@ -1,3 +1,8 @@
+2009-04-23  Sergei Golovan  <sgolovan at nes.ru>
+
+	* chats.tcl: Added JID argument to chat::opened procedure to make it
+	  possible to return all opened chat windows for a given JID.
+
 2009-04-21  Sergei Golovan  <sgolovan at nes.ru>
 
 	* pubsub.tcl: Fixed typo. Also, fixed requesting pubsub subscriptions.

Modified: trunk/tkabber/chats.tcl
===================================================================
--- trunk/tkabber/chats.tcl	2009-04-21 18:05:08 UTC (rev 1788)
+++ trunk/tkabber/chats.tcl	2009-04-23 06:30:09 UTC (rev 1789)
@@ -721,13 +721,27 @@
     }
 }
 
+proc chat::check_jid {xlib jid chatid} {
+    if {[get_xlib $chatid] != $xlib} {
+	return 0
+    } elseif {[get_jid $chatid] != $jid && \
+	    [::xmpp::jid::stripResource [get_jid $chatid]] != $jid} {
+	return 0
+    } else {
+	return 1
+    }
+}
+
 ##############################################################################
 
-proc chat::opened {{xlib {}}} {
+proc chat::opened {{xlib {}} {jid {}}} {
     variable chats
 
     if {![info exists chats(opened)]} {
 	return {}
+    } elseif {$jid != {}} {
+	return [lfilter [list [namespace current]::check_jid $xlib $jid] \
+			$chats(opened)]
     } elseif {$xlib != {}} {
 	return [lfilter [list [namespace current]::check_xlib $xlib] \
 			$chats(opened)]



More information about the Tkabber-dev mailing list