[Tkabber-dev] r1575 - branches/dynamic-chats/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Thu Oct 23 05:10:15 MSD 2008


Author: kostix
Date: 2008-10-23 05:10:14 +0400 (Thu, 23 Oct 2008)
New Revision: 1575

Modified:
   branches/dynamic-chats/tkabber/chats.tcl
Log:
tkabber/chats.tcl: Minor tweaks of chatid code.


Modified: branches/dynamic-chats/tkabber/chats.tcl
===================================================================
--- branches/dynamic-chats/tkabber/chats.tcl	2008-10-22 18:30:19 UTC (rev 1574)
+++ branches/dynamic-chats/tkabber/chats.tcl	2008-10-23 01:10:14 UTC (rev 1575)
@@ -163,17 +163,20 @@
     expr {[info exists chat_id($winid)] ? $chat_id($winid) : ""}
 }
 
-proc chat::mkchatid {xlib jid} {
+proc chat::create_chatid {xlib jid} {
     variable nchats
     variable chats
 
-    set chatid chatid$nchats
-    incr nchats
+    upvar 0 chats(chatid,$xlib,$jid) chatid
 
-    set chats(jid,$chatid)  $jid
-    set chats(xlib,$chatid) $xlib
-    set chats(chatid,[list $xlib $jid]) $chatid
+    if {![info exists chatid]} {
+	set chatid chatid$nchats
+	incr nchats
 
+	set chats(jid,$chatid)  $jid
+	set chats(xlib,$chatid) $xlib
+    }
+
     return $chatid
 }
 
@@ -183,12 +186,12 @@
     upvar 0 chats(jid,$chatid) jid
     upvar 0 chats(xlib,$chatid) xlib
 
-    unset chats(chatid,[list $xlib $jid]) jid xlib
+    unset chats(chatid,$xlib,$jid) jid xlib
 }
 
 proc chat::chatid {xlib jid} {
     variable chats
-    upvar 0 chats(chatid,[list $xlib $jid]) chatid
+    upvar 0 chats(chatid,$xlib,$jid) chatid
     expr {[info exists chatid] ? $chatid : ""}
 }
 



More information about the Tkabber-dev mailing list