[Tkabber-dev] r1560 - in trunk/tkabber: . examples/configs ifacetk plugins/chat plugins/general plugins/pep plugins/roster plugins/si

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Oct 19 10:23:58 MSD 2008


Author: sergei
Date: 2008-10-19 10:23:58 +0400 (Sun, 19 Oct 2008)
New Revision: 1560

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/chats.tcl
   trunk/tkabber/examples/configs/mtr-config.tcl
   trunk/tkabber/gpgme.tcl
   trunk/tkabber/iface.tcl
   trunk/tkabber/ifacetk/iroster.tcl
   trunk/tkabber/itemedit.tcl
   trunk/tkabber/joingrdialog.tcl
   trunk/tkabber/messages.tcl
   trunk/tkabber/muc.tcl
   trunk/tkabber/plugins/chat/disco.tcl
   trunk/tkabber/plugins/chat/histool.tcl
   trunk/tkabber/plugins/chat/info_commands.tcl
   trunk/tkabber/plugins/chat/irc_commands.tcl
   trunk/tkabber/plugins/chat/log_on_open.tcl
   trunk/tkabber/plugins/chat/logger.tcl
   trunk/tkabber/plugins/chat/muc_ignore.tcl
   trunk/tkabber/plugins/chat/nick_colors.tcl
   trunk/tkabber/plugins/general/avatars.tcl
   trunk/tkabber/plugins/general/headlines.tcl
   trunk/tkabber/plugins/general/message_archive.tcl
   trunk/tkabber/plugins/general/remote.tcl
   trunk/tkabber/plugins/pep/user_activity.tcl
   trunk/tkabber/plugins/pep/user_location.tcl
   trunk/tkabber/plugins/pep/user_mood.tcl
   trunk/tkabber/plugins/pep/user_tune.tcl
   trunk/tkabber/plugins/roster/annotations.tcl
   trunk/tkabber/plugins/roster/cache_categories.tcl
   trunk/tkabber/plugins/roster/conferenceinfo.tcl
   trunk/tkabber/plugins/roster/conferences.tcl
   trunk/tkabber/plugins/roster/fetch_nicknames.tcl
   trunk/tkabber/plugins/si/socks5.tcl
   trunk/tkabber/presence.tcl
   trunk/tkabber/privacy.tcl
   trunk/tkabber/roster.tcl
   trunk/tkabber/userinfo.tcl
   trunk/tkabber/utils.tcl
Log:
	* plugins/roster/annotations.tcl: Fixed widget name with connection
	  token inside.

	* itemedit.tcl, utils.tcl, chats.tcl, privacy.tcl, gpgme.tcl: Added
	  (and use) new procedure which maps colons in connection token to
	  number signs for usage in widget names.

	*  chats.tcl, examples/configs/mtr-config.tcl, gpgme.tcl, iface.tcl,
	   ifacetk/iroster.tcl, itemedit.tcl, joingrdialog.tcl, messages.tcl,
	   muc.tcl, plugins/chat/disco.tcl, plugins/chat/histool.tcl,
	   plugins/chat/info_commands.tcl, plugins/chat/irc_commands.tcl,
	   plugins/chat/log_on_open.tcl, plugins/chat/logger.tcl,
	   plugins/chat/muc_ignore.tcl, plugins/chat/nick_colors.tcl,
	   plugins/general/avatars.tcl, plugins/general/headlines.tcl,
	   plugins/general/message_archive.tcl, plugins/general/remote.tcl,
	   plugins/pep/user_activity.tcl, plugins/pep/user_location.tcl,
	   plugins/pep/user_mood.tcl, plugins/pep/user_tune.tcl,
	   plugins/roster/annotations.tcl, plugins/roster/cache_categories.tcl,
	   plugins/roster/conferenceinfo.tcl, plugins/roster/conferences.tcl,
	   plugins/roster/fetch_nicknames.tcl, plugins/si/socks5.tcl,
	   presence.tcl, privacy.tcl, roster.tcl, userinfo.tcl, utils.tcl:
	   Replaced JID related procedures from utils.tcl (node_from_jid,
	   server_from_jid, resource_from_jid, node_and_server_from_jid,
	   tolower_node_and_domain) by procedures from xmpp::jid package
	   (::xmpp::jid::node, ::xmpp::jid::server, ::xmpp::jid::resource,
	   ::xmpp::jid::stripResource, ::xmpp::jid::normalize).


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/ChangeLog	2008-10-19 06:23:58 UTC (rev 1560)
@@ -1,3 +1,32 @@
+2008-10-19  Sergei Golovan  <sgolovan at nes.ru>
+
+	* plugins/roster/annotations.tcl: Fixed widget name with connection
+	  token inside.
+
+	* itemedit.tcl, utils.tcl, chats.tcl, privacy.tcl, gpgme.tcl: Added
+	  (and use) new procedure which maps colons in connection token to
+	  number signs for usage in widget names.
+
+	*  chats.tcl, examples/configs/mtr-config.tcl, gpgme.tcl, iface.tcl,
+	   ifacetk/iroster.tcl, itemedit.tcl, joingrdialog.tcl, messages.tcl,
+	   muc.tcl, plugins/chat/disco.tcl, plugins/chat/histool.tcl,
+	   plugins/chat/info_commands.tcl, plugins/chat/irc_commands.tcl,
+	   plugins/chat/log_on_open.tcl, plugins/chat/logger.tcl,
+	   plugins/chat/muc_ignore.tcl, plugins/chat/nick_colors.tcl,
+	   plugins/general/avatars.tcl, plugins/general/headlines.tcl,
+	   plugins/general/message_archive.tcl, plugins/general/remote.tcl,
+	   plugins/pep/user_activity.tcl, plugins/pep/user_location.tcl,
+	   plugins/pep/user_mood.tcl, plugins/pep/user_tune.tcl,
+	   plugins/roster/annotations.tcl, plugins/roster/cache_categories.tcl,
+	   plugins/roster/conferenceinfo.tcl, plugins/roster/conferences.tcl,
+	   plugins/roster/fetch_nicknames.tcl, plugins/si/socks5.tcl,
+	   presence.tcl, privacy.tcl, roster.tcl, userinfo.tcl, utils.tcl:
+	   Replaced JID related procedures from utils.tcl (node_from_jid,
+	   server_from_jid, resource_from_jid, node_and_server_from_jid,
+	   tolower_node_and_domain) by procedures from xmpp::jid package
+	   (::xmpp::jid::node, ::xmpp::jid::server, ::xmpp::jid::resource,
+	   ::xmpp::jid::stripResource, ::xmpp::jid::normalize).
+
 2008-10-18  Sergei Golovan  <sgolovan at nes.ru>
 
 	* presence.tcl: Fixed sending directed presence.

Modified: trunk/tkabber/chats.tcl
===================================================================
--- trunk/tkabber/chats.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/chats.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -127,16 +127,16 @@
     set nick $jid
     switch -- $type {
 	chat {
-	    set group [node_and_server_from_jid $jid]
+	    set group [::xmpp::jid::stripResource $jid]
 	    set chatid1 [chatid $xlib $group]
 	    if {[is_groupchat $chatid1]} {
-		set nick [resource_from_jid $jid]
+		set nick [::xmpp::jid::resource $jid]
 	    } else {
 		set nick [roster::itemconfig $xlib \
 			      [roster::find_jid $xlib $jid] -name]
 		if {$nick == ""} {
-		    if {[node_from_jid $jid] != ""} {
-			set nick [node_from_jid $jid]
+		    if {[::xmpp::jid::node $jid] != ""} {
+			set nick [::xmpp::jid::node $jid]
 		    } else {
 			set nick $jid
 		    }
@@ -144,7 +144,7 @@
 	    }
 	}
 	groupchat {
-	    set nick [resource_from_jid $jid]
+	    set nick [::xmpp::jid::resource $jid]
 	}
     }
     return $nick
@@ -154,7 +154,7 @@
     set xlib [get_xlib $chatid]
     set jid [get_jid $chatid]
     set tag [jid_to_tag $jid]
-    return .chat_[string map {: #} $xlib]_$tag
+    return .chat_[psuffix $xlib]_$tag
 }
 
 proc chat::winid_to_chatid {winid} {
@@ -228,7 +228,7 @@
 	set type $options(default_message_type)
     }
 
-    set from [tolower_node_and_domain $from]
+    set from [::xmpp::jid::normalize $from]
 }
 
 hook::add rewrite_message_hook [namespace current]::chat::rewrite_message 99
@@ -249,14 +249,14 @@
 	    set chats(id,$chatid) $id
 	}
 	groupchat {
-	    set chatid [chatid $xlib [node_and_server_from_jid $from]]
+	    set chatid [chatid $xlib [::xmpp::jid::stripResource $from]]
 
 	    if {![is_groupchat $chatid]} return
 
 	    if {$is_subject} {
 		set_subject $chatid $subject
 		if {[cequal $body ""]} {
-		    set nick [resource_from_jid $from]
+		    set nick [::xmpp::jid::resource $from]
 		    if {[cequal $nick ""]} {
 			set body [::msgcat::mc "Subject is set to: %s" $subject]
 		    } else {
@@ -310,7 +310,7 @@
     } else {
 	set titlename $jid
 	if {[is_groupchat $chatid]} {
-	    set tabtitlename [node_from_jid $jid]
+	    set tabtitlename [::xmpp::jid::node $jid]
 	} else {
 	    set tabtitlename [get_nick $xlib $jid chat]
 	}
@@ -386,7 +386,7 @@
 
     set xlib [get_xlib $chatid]
     set jid [get_jid $chatid]
-    set jid [tolower_node_and_domain $jid]
+    set jid [::xmpp::jid::normalize $jid]
     set chatid [chatid $xlib $jid]
 
     set cw [winid $chatid]
@@ -944,7 +944,7 @@
 	set jid $user
     }
 
-    set jid [tolower_node_and_domain $jid]
+    set jid [::xmpp::jid::normalize $jid]
 
     set chatid [chatid $xlib $jid]
     set cw [winid $chatid]
@@ -989,13 +989,13 @@
 	default { return }
     }
 
-    set group [node_and_server_from_jid $jid]
+    set group [::xmpp::jid::stripResource $jid]
     set chatid [chatid $xlib $group]
 
     if {[is_opened $chatid]} {
 	if {[is_groupchat $chatid]} {
 	    debugmsg chat "ST: $xlib $jid $status"
-	    if {[resource_from_jid $jid] == ""} {
+	    if {[::xmpp::jid::resource $jid] == ""} {
 		return
 	    }
 	    set nick [get_nick $xlib $jid groupchat]
@@ -1077,7 +1077,7 @@
 	    -helptext [get_user_status_desc $xlib $jid]
     }
 
-    set user [node_and_server_from_jid $jid]
+    set user [::xmpp::jid::stripResource $jid]
     set cw [winid [chatid $xlib $user]]
 
     if {[winfo exists $cw.status.icon]} {
@@ -1260,7 +1260,7 @@
 	    return $jid/[get_our_groupchat_nick $chatid]
 	}
 	chat {
-	    set group [node_and_server_from_jid $jid]
+	    set group [::xmpp::jid::stripResource $jid]
 	    set groupid [chatid $xlib $group]
 	    if {[is_groupchat $groupid]} {
 		return $group/[get_our_groupchat_nick $groupid]
@@ -1315,7 +1315,7 @@
 
     if {[catch { set nick [roster::get_label $user] }]} {
 	if {[catch {set nick [roster::get_label \
-				  [node_and_server_from_jid $user]] }]} {
+				  [::xmpp::jid::stripResource $user]] }]} {
 	    if {[catch { set nick [chat::get_nick $xlib \
 						  $user groupchat] }]} {
 		set nick $user
@@ -1327,7 +1327,7 @@
     set jids {}
     foreach chatid [lsort [lfilter [namespace current]::is_groupchat [opened $xlib]]] {
 	lappend jids $chatid [get_jid $chatid]
-        lappend titles $chatid [node_from_jid [get_jid $chatid]]
+        lappend titles $chatid [::xmpp::jid::node [get_jid $chatid]]
     }
     if {[llength $titles] == 0} {
         MessageDlg ${gw}_err -aspect 50000 -icon info \
@@ -1353,7 +1353,7 @@
     set gw .invite
     catch { destroy $gw }
 
-    set title [node_from_jid $jid]
+    set title [::xmpp::jid::node $jid]
 
     set choices {}
     set balloons {}

Modified: trunk/tkabber/examples/configs/mtr-config.tcl
===================================================================
--- trunk/tkabber/examples/configs/mtr-config.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/examples/configs/mtr-config.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -378,7 +378,7 @@
 	if {![cequal $type chat]} return
 
         if {[cequal [chat::get_nick $connid $from $type] jbot]} {
-            set from [node_and_server_from_jid $from]/syslog
+            set from [::xmpp::jid::stripResource $from]/syslog
         }
     }
 

Modified: trunk/tkabber/gpgme.tcl
===================================================================
--- trunk/tkabber/gpgme.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/gpgme.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -215,7 +215,7 @@
         }
     }
 
-    set dw .selectkey[string map {: #} $xlib]
+    set dw .selectkey[psuffix $xlib]
     catch {destroy $dw}
 
     set titles {}
@@ -249,7 +249,7 @@
     CbDialog $dw [::msgcat::mc "Select Key for Signing %s Traffic" $pattern] \
         [list [::msgcat::mc "Select"] "::ssj::once_only_aux $dw $xlib" \
 	      [::msgcat::mc "Cancel"] "destroy $dw"] \
-	::ssj::selectkey$xlib $titles $balloons \
+	::ssj::selectkey[psuffix $xlib] $titles $balloons \
 	-modal local
 }
 
@@ -274,11 +274,11 @@
 }
 
 proc ::ssj::once_only_aux {dw xlib} {
-    variable selectkey$xlib
+    variable selectkey[psuffix $xlib]
 
     set keys {}
-    foreach key [array names selectkey$xlib] {
-        if {[set selectkey${xlib}($key)]} {
+    foreach key [array names selectkey[psuffix $xlib]] {
+        if {[set selectkey[psuffix $xlib]($key)]} {
             lappend keys $key
         }
     }
@@ -316,7 +316,7 @@
         return $passphrase($keyid)
     }
 
-    set pw .passphrase[string map {: #} $xlib]
+    set pw .passphrase[psuffix $xlib]
     if {[winfo exists $pw]} {
         destroy $pw
     }
@@ -419,7 +419,7 @@
         if {![info exists warnings(verify-traffic,$xlib)]} {
 
             set warnings(verify-traffic,$xlib) 1
-            after idle [list NonmodalMessageDlg .verify_error[string map {: #} $xlib] -aspect 50000 -icon error \
+            after idle [list NonmodalMessageDlg .verify_error[psuffix $xlib] -aspect 50000 -icon error \
                 -message [::msgcat::mc "Error in signature verification software: %s." \
 				       $result]]
         }
@@ -601,9 +601,9 @@
 
 proc ::ssj::signed:Label {lb xlib jid pinfo} {
     if {[set rjid [muc::get_real_jid $xlib $jid]] == ""} {
-	set rjid [node_and_server_from_jid $jid]
+	set rjid [::xmpp::jid::stripResource $jid]
     } else {
-	set rjid [node_and_server_from_jid $rjid]
+	set rjid [::xmpp::jid::stripResource $rjid]
     }
 
     array set params $pinfo
@@ -829,7 +829,7 @@
         return
     }
 
-    set bto [node_and_server_from_jid $to]
+    set bto [::xmpp::jid::stripResource $to]
 
     if {[info exists j2k($to)]} {
         set name $j2k($to)
@@ -1008,7 +1008,7 @@
 	}
     }
 
-    set bjid [node_and_server_from_jid $jid]
+    set bjid [::xmpp::jid::stripResource $jid]
 
     if {[info exists options(encrypt,$xlib,$jid)]} {
         return $options(encrypt,$xlib,$jid)
@@ -1240,7 +1240,7 @@
 
     if {$editable} return
 
-    set bare_jid [node_and_server_from_jid $jid]
+    set bare_jid [::xmpp::jid::stripResource $jid]
     set chatid [chat::chatid $xlib $bare_jid]
     if {[chat::is_groupchat $chatid]} {
 	if {[info exists signed($xlib,$jid)]} {

Modified: trunk/tkabber/iface.tcl
===================================================================
--- trunk/tkabber/iface.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/iface.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -31,7 +31,7 @@
 
 	if {[info exists ::jlib::lib($xlib,sck)]} {
 	    if {![catch { tls::status $::jlib::lib($xlib,sck) } status]} {
-		set server [server_from_jid [connection_jid $xlib]]
+		set server [connection_server $xlib]
 		if {[lcontain $server_list $server]} {
 		    continue
 		} else {

Modified: trunk/tkabber/ifacetk/iroster.tcl
===================================================================
--- trunk/tkabber/ifacetk/iroster.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/ifacetk/iroster.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -443,7 +443,7 @@
 	}
 	if {$options(show_own_resources)} {
 	    set cgroup [list $own_resources_group_name]
-	    set jid [tolower_node_and_domain [connection_bare_jid $xlib]]
+	    set jid [::xmpp::jid::normalize [connection_bare_jid $xlib]]
 	    set jidsingroup($cgroup) [list $jid]
 	    set groups [linsert $groups 0 [list [join $cgroup "\u0000"] $cgroup]]
 	    roster::itemconfig $xlib $jid -subsc both
@@ -576,7 +576,7 @@
 			    
 			    if {!$roster(collapsed,$cjid)} {
 				foreach subjid $jids {
-				    set subjid_resource [resource_from_jid $subjid]
+				    set subjid_resource [::xmpp::jid::resource $subjid]
 				    if {$subjid_resource != ""} {
 					addline .roster jid2 \
 					    $subjid_resource [list $xlib $subjid] \
@@ -807,7 +807,7 @@
     if {!([cequal $subsc from] || [cequal $subsc none]) || \
 	    $status != "unavailable"} {
 	if {$show_transport_user_icons} {
-	    set service [server_from_jid $user]
+	    set service [::xmpp::jid::server $user]
 	    lassign [::roster::get_category_and_subtype $xlib $service] category type
 	    switch -glob -- $category/$type {
 		directory/* -
@@ -1253,9 +1253,9 @@
 	    set desc   [get_user_status_desc $xlib $user]
 	    if {[cequal $category1 conference] && $i > 0} {
 		if {$options(show_conference_user_info)} {
-		    set name "     [resource_from_jid $user]"
+		    set name "     [::xmpp::jid::resource $user]"
 		} else {
-		    set name "\t[resource_from_jid $user]"
+		    set name "\t[::xmpp::jid::resource $user]"
 		}
 	    }
 	}

Modified: trunk/tkabber/itemedit.tcl
===================================================================
--- trunk/tkabber/itemedit.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/itemedit.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -4,7 +4,7 @@
 
 proc itemedit::show_dialog {xlib jid} {
     set allowed_name [jid_to_tag $jid]
-    set w .gredit_[string map {: #} $xlib]_$allowed_name
+    set w .gredit_[psuffix $xlib]_$allowed_name
 
     if {[winfo exists $w]} {
 	destroy $w
@@ -102,10 +102,10 @@
 		![cequal $userinfo::userinfo(nickname,$jid) ""]} {
 	   set name $userinfo::userinfo(nickname,$jid)
         } else {
-	    set name [node_from_jid $jid]
+	    set name [::xmpp::jid::node $jid]
 	    ::xmpp::sendIQ $xlib get \
 		-query [::xmpp::xml::create vCard -xmlns vcard-temp] \
-		-to [node_and_server_from_jid [get_jid_of_user $xlib $jid]] \
+		-to [::xmpp::jid::stripResource [get_jid_of_user $xlib $jid]] \
 		-command [list [namespace current]::fetch_nickname $gn $name $jid]
 	}
     }

Modified: trunk/tkabber/joingrdialog.tcl
===================================================================
--- trunk/tkabber/joingrdialog.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/joingrdialog.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -169,7 +169,7 @@
 proc set_our_groupchat_nick {group nick} {
     global groupchats
 
-    set group [tolower_node_and_domain $group]
+    set group [::xmpp::jid::normalize $group]
     set groupchats(nick,$group) $nick
 }
 
@@ -191,7 +191,7 @@
 	    set pidentities [disco::get_jid_identities $pxlib $pjid $pnode]
 
 	    # JID with resource is not a room JID
-	    if {[node_and_server_from_jid $jid] != $jid} return
+	    if {[::xmpp::jid::resource $jid] != ""} return
 
 	    if {[lempty $identities]} {
 		set identities $pidentities
@@ -201,8 +201,8 @@
 		if {[::xmpp::xml::getAttr $id category] == "conference"} {
 		    $m add command -label [::msgcat::mc "Join group..."] \
 			-command [list join_group_dialog $xlib \
-				       -server [server_from_jid $jid] \
-				       -group [node_from_jid $jid]]
+				       -server [::xmpp::jid::server $jid] \
+				       -group [::xmpp::jid::node $jid]]
 		    break
 		}
 	    }

Modified: trunk/tkabber/messages.tcl
===================================================================
--- trunk/tkabber/messages.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/messages.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -661,7 +661,7 @@
     ::xmpp::sendPresence $xlib -to $jid -type subscribed
 
     switch -- [roster::itemconfig $xlib \
-				  [tolower_node_and_domain $jid] -subsc] {
+				  [::xmpp::jid::normalize $jid] -subsc] {
         {}   -
         none -
         from {
@@ -675,7 +675,7 @@
 ###############################################################################
 
 proc message::unsubscribe {mw xlib jid} {
-    ::roster::remove_item $xlib [tolower_node_and_domain $jid]
+    ::roster::remove_item $xlib [::xmpp::jid::normalize $jid]
     destroy $mw
 }
 
@@ -748,7 +748,7 @@
 ###############################################################################
 
 proc message::add_subscribe_menu_item {m xlib jid} {
-    set chatid [chat::chatid $xlib [node_and_server_from_jid $jid]]
+    set chatid [chat::chatid $xlib [::xmpp::jid::stripResource $jid]]
     if {[chat::is_groupchat $chatid]} {
 	set real_jid [muc::get_real_jid $xlib $jid]
 	if {$real_jid != ""} {
@@ -760,7 +760,7 @@
     } else {
 	set state normal
     }
-    set user [node_and_server_from_jid $jid]
+    set user [::xmpp::jid::stripResource $jid]
     if {[roster::itemconfig $xlib $user -subsc] != ""} {
 	set state disabled
     }
@@ -897,7 +897,7 @@
 		    -subelement [::xmpp::xml::create item \
 					-attrs [list jid $jid]]] \
         -command "itemedit::show_dialog \
-                      [list $xlib [tolower_node_and_domain $jid]] ;#"
+                      [list $xlib [::xmpp::jid::normalize $jid]] ;#"
 
     destroy $mw
 

Modified: trunk/tkabber/muc.tcl
===================================================================
--- trunk/tkabber/muc.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/muc.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -66,7 +66,7 @@
 ###############################################################################
 
 proc muc::add_groupchat_user_menu_items {m xlib jid} {
-    set group [node_and_server_from_jid $jid]
+    set group [::xmpp::jid::stripResource $jid]
 
     if {![is_compatible $group]} return
 
@@ -180,10 +180,10 @@
 	    set pfeatures [disco::get_jid_features $pxlib $pjid $pnode]
 
 	    # JID with resource is not a room JID
-	    if {[node_and_server_from_jid $jid] != $jid} return
+	    if {[::xmpp::jid::stripResource $jid] != $jid} return
 
 	    # A room must have non-empty node
-	    if {[node_from_jid $jid] == ""} return
+	    if {[::xmpp::jid::node $jid] == ""} return
 
 	    if {[lempty $identities]} {
 		set identities $pidentities
@@ -327,7 +327,7 @@
 }
 
 proc muc::whois {xlib user} {
-    set group [node_and_server_from_jid $user]
+    set group [::xmpp::jid::stripResource $user]
     set chatid [chat::chatid $xlib $group]
     set nick [chat::get_nick $xlib $user groupchat]
 
@@ -363,7 +363,7 @@
 proc muc::change_item_param {params dir xlib user reason} {
     variable users
 
-    set group [node_and_server_from_jid $user]
+    set group [::xmpp::jid::stripResource $user]
     set chatid [chat::chatid $xlib $group]
     set nick  [chat::get_nick $xlib $user groupchat]
 
@@ -419,7 +419,7 @@
 	# user's bare JID (which may be not known by admin)
 	set real_jid [get_real_jid $xlib $user]
 	if {$real_jid != ""} {
-	    set vars [list jid [node_and_server_from_jid $real_jid]]
+	    set vars [list jid [::xmpp::jid::stripResource $real_jid]]
 	}
 	
     }
@@ -456,7 +456,7 @@
 
     ::xmpp::xml::split $child tag xmlns attrs cdata subels
 
-    set jid [node_and_server_from_jid $jid]
+    set jid [::xmpp::jid::stripResource $jid]
     set found 0
     foreach item $subels {
 	::xmpp::xml::split $item stag sxmlns sattrs scdata ssubels
@@ -1066,7 +1066,7 @@
 		}
 	    }
 	    destroy {
-		set group [node_and_server_from_jid $user]
+		set group [::xmpp::jid::stripResource $user]
 		set chatid [chat::chatid $xlib $group]
 		set msg [::msgcat::mc "Room is destroyed"]
 		foreach ch $subels {
@@ -1086,7 +1086,7 @@
 	    }
 	    status {
 		set code [::xmpp::xml::getAttr $attrs code]
-		set group [node_and_server_from_jid $user]
+		set group [::xmpp::jid::stripResource $user]
 		set chatid [chat::chatid $xlib $group]
 		switch -- $code {
 		    201 {
@@ -1277,7 +1277,7 @@
     upvar 0 users(role,$xlib,$jid) _role \
 	users(affiliation,$xlib,$jid) _aff
 
-    set group  [node_and_server_from_jid $jid]
+    set group  [::xmpp::jid::stripResource $jid]
     if {![is_compatible $group]} return
 
     set chatid [chat::chatid $xlib $group]
@@ -1413,7 +1413,7 @@
 
     set muc_compatible($group) 0
 
-    disco::request_info $xlib [server_from_jid $group] \
+    disco::request_info $xlib [::xmpp::jid::server $group] \
 	-cache yes \
 	-command [list muc::recv_negotiation1 $xlib $group]
 }
@@ -1510,7 +1510,7 @@
     variable timestamps
     variable muc_password
 
-    set group [tolower_node_and_domain $group]
+    set group [::xmpp::jid::normalize $group]
     set chatid [chat::chatid $xlib $group]
 
     if {[info exists chat::chats(status,$chatid)] && \
@@ -1519,7 +1519,7 @@
 	return
     }
 
-    privacy::add_to_special_list $xlib conference [server_from_jid $group]
+    privacy::add_to_special_list $xlib conference [::xmpp::jid::server $group]
 
     set_our_groupchat_nick $chatid $nick
 
@@ -1724,10 +1724,10 @@
 	return
     }
 
-    if {![cequal [node_from_jid $jid] {}]} {
+    if {![cequal [::xmpp::jid::node $jid] {}]} {
 	::join_group $xlib $jid -nick [get_group_nick $jid $gr_nick]
     } else {
-	::join_group_dialog $xlib -server [server_from_jid $jid] -group {}
+	::join_group_dialog $xlib -server [::xmpp::jid::server $jid] -group {}
     }
 }
 

Modified: trunk/tkabber/plugins/chat/disco.tcl
===================================================================
--- trunk/tkabber/plugins/chat/disco.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/chat/disco.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -5,7 +5,7 @@
 proc cdisco::handle_disco_command {chatid user body type} {
     set xlib [chat::get_xlib $chatid]
     set jid [chat::get_jid $chatid]
-    set bjid [node_and_server_from_jid $jid]
+    set bjid [::xmpp::jid::stripResource $jid]
 
     if {![chat::is_groupchat [chat::chatid $xlib $bjid]]} {
 	set jid $bjid

Modified: trunk/tkabber/plugins/chat/histool.tcl
===================================================================
--- trunk/tkabber/plugins/chat/histool.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/chat/histool.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -629,11 +629,8 @@
 
     set items {}
     foreach jid $jids {
-	set parts [list \
-	    [node_from_jid $jid] \
-	    [server_from_jid $jid] \
-	    [resource_from_jid $jid] \
-	]
+	::xmpp::jid::split $jid node server resource
+	set parts [list $node $server $resource]
 	set ordered [list \
 	    [lindex $parts [lindex $norder 0]] \
 	    [lindex $parts [lindex $norder 1]] \

Modified: trunk/tkabber/plugins/chat/info_commands.tcl
===================================================================
--- trunk/tkabber/plugins/chat/info_commands.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/chat/info_commands.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -92,7 +92,7 @@
 	set vcard_jids $jids
     } else {
 	if {[cequal $name ""]} {
-	    set bare_jid [node_and_server_from_jid $jid]
+	    set bare_jid [::xmpp::jid::stripResource $jid]
 	    set full_jids [::get_jids_of_user $xlib $bare_jid]
 	    if {[lsearch $full_jids $jid] >= 0} {
 		set jids [list $jid]
@@ -137,7 +137,7 @@
     foreach jid [roster::get_jids $xlib] {
 	set rname [roster::get_label $xlib $jid]
 	if {[cequal $rname $name]} {
-	    set bare_jid [node_and_server_from_jid $jid]
+	    set bare_jid [::xmpp::jid::stripResource $jid]
 	    set full_jids [::get_jids_of_user $xlib $bare_jid]
 	    if {![cequal $full_jids {}]} {
 		set ret [concat $ret $full_jids]

Modified: trunk/tkabber/plugins/chat/irc_commands.tcl
===================================================================
--- trunk/tkabber/plugins/chat/irc_commands.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/chat/irc_commands.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -92,7 +92,7 @@
 		if {[cequal $room ""]} {
 		    set room $jid
 		} elseif {[::xmpp::jid::node $room] == ""} {
-		    set room [::xmpp::jid::jid $room [server_from_jid $jid]]
+		    set room [::xmpp::jid::jid $room [::xmpp::jid::server $jid]]
 		}
 	    }
 	    if {[catch {

Modified: trunk/tkabber/plugins/chat/log_on_open.tcl
===================================================================
--- trunk/tkabber/plugins/chat/log_on_open.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/chat/log_on_open.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -21,7 +21,7 @@
 
     set xlib [chat::get_xlib $chatid]
     set jid [chat::get_jid $chatid]
-    set bare_jid [node_and_server_from_jid $jid]
+    set bare_jid [::xmpp::jid::stripResource $jid]
     set gc [chat::is_groupchat [chat::chatid $xlib $bare_jid]]
 
     if {!$gc} {
@@ -46,7 +46,7 @@
 	    if {$tmp(jid) == ""} {
 		# Synthesized message
 		set from ""
-	    } elseif {(!$gc && [node_and_server_from_jid $tmp(jid)] != $bare_jid) || \
+	    } elseif {(!$gc && [::xmpp::jid::stripResource $tmp(jid)] != $bare_jid) || \
 		 $gc && $tmp(jid) != $jid} {
 		set from [connection_jid $xlib]
 	    } else {

Modified: trunk/tkabber/plugins/chat/logger.tcl
===================================================================
--- trunk/tkabber/plugins/chat/logger.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/chat/logger.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -66,7 +66,7 @@
 	    }
 	}
 	chat {
-	    set nas [node_and_server_from_jid $jid]
+	    set nas [::xmpp::jid::stripResource $jid]
 	    if {![chat::is_groupchat [chat::chatid $xlib $nas]]} {
 		set jid $nas
 	    }
@@ -198,7 +198,7 @@
 
     set xlib [chat::get_xlib $chatid]
     set jid [chat::get_jid $chatid]
-    set nas [node_and_server_from_jid $jid]
+    set nas [::xmpp::jid::stripResource $jid]
     if {$type == "chat" && ![chat::is_groupchat [chat::chatid $xlib $nas]]} {
 	set jid $nas
     }

Modified: trunk/tkabber/plugins/chat/muc_ignore.tcl
===================================================================
--- trunk/tkabber/plugins/chat/muc_ignore.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/chat/muc_ignore.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -128,7 +128,7 @@
 
 # Returns bare JID of the session identified by $xlib
 proc mucignore::session_bare_jid {xlib} {
-    ::node_and_server_from_jid [connection_jid $xlib]
+    ::::xmpp::jid::stripResource [connection_jid $xlib]
 }
 
 # Tries to get the real bare JID of the room occupant identified
@@ -137,7 +137,7 @@
 proc mucignore::get_real_bare_jid {xlib room_occupant_jid} {
     set real_jid [::muc::get_real_jid $xlib $room_occupant_jid]
     if {$real_jid != {}} {
-	return [::node_and_server_from_jid $real_jid]
+	return [::::xmpp::jid::stripResource $real_jid]
     } else {
 	return {}
     }
@@ -190,7 +190,7 @@
 }
 
 proc mucignore::setup_private_muc_chat_menu {m xlib jid} {
-    set room [::node_and_server_from_jid $jid]
+    set room [::::xmpp::jid::stripResource $jid]
     if {![::chat::is_groupchat [::chat::chatid $xlib $room]]} return
 
     setup_occupant_menu $m $xlib $jid
@@ -206,7 +206,7 @@
 
     set our_nick [::get_our_groupchat_nick [
 	::chat::chatid $xlib [
-	    ::node_and_server_from_jid $jid]]]
+	    ::::xmpp::jid::stripResource $jid]]]
     set nick [::chat::get_nick $xlib $jid groupchat]
 
     if {$nick == $our_nick} {
@@ -310,7 +310,7 @@
 
 # Hides or shows messages tagged as ignored for the $jid, if any.
 proc mucignore::room_weed_messages {xlib jid hide} {
-    set room [::node_and_server_from_jid $jid]
+    set room [::::xmpp::jid::stripResource $jid]
     set cw [::chat::chat_win [::chat::chatid $xlib $room]]
 
     $cw tag configure [ignore_tag_get $jid] -elide $hide
@@ -379,7 +379,7 @@
     variable options
     variable ignored
 
-    set room [::node_and_server_from_jid $from]
+    set room [::::xmpp::jid::stripResource $from]
     set rjid [get_real_bare_jid $xlib $from]
 
     if {$pres == "available"} {
@@ -441,11 +441,11 @@
 proc mucignore::explode_room_jid {xlib room_occupant_jid vroom voccupant} {
     upvar 1 $vroom room $voccupant occupant
 
-    set room [::node_and_server_from_jid $room_occupant_jid]
+    set room [::::xmpp::jid::stripResource $room_occupant_jid]
 
     set occupant [get_real_bare_jid $xlib $room_occupant_jid]
     if {$occupant == {}} {
-	set occupant [::resource_from_jid $room_occupant_jid]
+	set occupant [::::xmpp::jid::resource $room_occupant_jid]
     }
 }
 

Modified: trunk/tkabber/plugins/chat/nick_colors.tcl
===================================================================
--- trunk/tkabber/plugins/chat/nick_colors.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/chat/nick_colors.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -305,7 +305,7 @@
     variable options
 
     if {$options(use_colored_roster_nicks)} {
-	set chatid [chat::chatid $xlib [node_and_server_from_jid $jid]]
+	set chatid [chat::chatid $xlib [::xmpp::jid::stripResource $jid]]
 	set chatwin [chat::chat_win $chatid]
 	set nick [chat::get_nick $xlib $jid groupchat]
 	$m add command -label [::msgcat::mc "Edit nick color..."] \

Modified: trunk/tkabber/plugins/general/avatars.tcl
===================================================================
--- trunk/tkabber/plugins/general/avatars.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/general/avatars.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -172,7 +172,7 @@
 	::xmpp::sendIQ $xlib get \
 	    -query [::xmpp::xml::create query \
 			       -xmlns storage:client:avatar] \
-	    -to [node_and_server_from_jid $jid] \
+	    -to [::xmpp::jid::stripResource $jid] \
 	    -command [list avatar::recv_from_serv $xlib $jid]
 
 	return

Modified: trunk/tkabber/plugins/general/headlines.tcl
===================================================================
--- trunk/tkabber/plugins/general/headlines.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/general/headlines.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -66,7 +66,7 @@
 
     switch -- $options(multiple) {
         0 { return .headlines }
-        1 { return .headlines_[jid_to_tag [node_and_server_from_jid $from]] }
+        1 { return .headlines_[jid_to_tag [::xmpp::jid::stripResource $from]] }
         default { return .headlines_[jid_to_tag $from] }
     }
 }
@@ -95,13 +95,13 @@
             set tabtitle [::msgcat::mc "Headlines"]
         }
         1 {
-            set user [node_and_server_from_jid $from]
+            set user [::xmpp::jid::stripResource $from]
             set title [::msgcat::mc "%s Headlines" $user]
-            set tabtitle [node_from_jid $from]
+            set tabtitle [::xmpp::jid::node $from]
         }
         default {
             set title [::msgcat::mc "%s Headlines" $from]
-            set tabtitle [node_from_jid $from]/[resource_from_jid $from]
+            set tabtitle [::xmpp::jid::node $from]/[::xmpp::jid::resource $from]
         }
     }
 

Modified: trunk/tkabber/plugins/general/message_archive.tcl
===================================================================
--- trunk/tkabber/plugins/general/message_archive.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/general/message_archive.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -194,7 +194,7 @@
     }
     set q 0
     if {[info exists tmp(from)]} {
-	set str [node_and_server_from_jid $tmp(from)]
+	set str [::xmpp::jid::stripResource $tmp(from)]
 	if {$str == $myjid} {
 	    set q 1
 	    set fromto to
@@ -205,7 +205,7 @@
 	set tmp(from) {}
     }
     if {[info exists tmp(to)]} {
-	set str [node_and_server_from_jid $tmp(to)]
+	set str [::xmpp::jid::stripResource $tmp(to)]
 	if {$str == $myjid} {
 	    set q 1
 	    set fromto from
@@ -219,7 +219,7 @@
 	return
     } else {
 	lappend row $dir
-	set str [node_and_server_from_jid $tmp($fromto)]
+	set str [::xmpp::jid::stripResource $tmp($fromto)]
 	lappend row " $str "
 	set width(fromto) [max [string length " $str "] $width(fromto)]
 	set messages($id,fromto) $tmp($fromto)

Modified: trunk/tkabber/plugins/general/remote.tcl
===================================================================
--- trunk/tkabber/plugins/general/remote.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/general/remote.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -40,9 +40,9 @@
 
     set from [string tolower $from]
     set myjid [string tolower \
-		      [node_and_server_from_jid \
+		      [::xmpp::jid::stripResource \
 			   [connection_jid $xlib]]]
-    set bare_from [string tolower [node_and_server_from_jid $from]]
+    set bare_from [string tolower [::xmpp::jid::stripResource $from]]
 
     if {$options(accept_from_myjid) && [cequal $myjid $bare_from]} {
 	return 1

Modified: trunk/tkabber/plugins/pep/user_activity.tcl
===================================================================
--- trunk/tkabber/plugins/pep/user_activity.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/pep/user_activity.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -161,7 +161,7 @@
     set rjid [roster::find_jid $xlib $jid]
 
     if {$rjid == ""} {
- 	set rjid [node_and_server_from_jid $jid]
+ 	set rjid [::xmpp::jid::stripResource $jid]
     }
 
     set pm [pep::get_roster_menu_pep_submenu $m $xlib $rjid]
@@ -184,7 +184,7 @@
     variable node
     variable substatus
 
-    set to [node_and_server_from_jid $jid]
+    set to [::xmpp::jid::stripResource $jid]
     set cmd [linsert $args 0 [namespace current]::subscribe_result $xlib $to]
     pep::subscribe $xlib $to $node \
 	    -command $cmd
@@ -195,7 +195,7 @@
     variable node
     variable substatus
 
-    set to [node_and_server_from_jid $jid]
+    set to [::xmpp::jid::stripResource $jid]
     set cmd [linsert $args 0 [namespace current]::unsubscribe_result $xlib $to]
     pep::unsubscribe $xlib $to $node \
 	    -command $cmd
@@ -270,7 +270,7 @@
 
     upvar 0 $var info
 
-    set jid [node_and_server_from_jid $user]
+    set jid [::xmpp::jid::stripResource $user]
 
     if {[info exists activity(activity,$xlib,$jid)]} {
 	set m $activity(activity,$xlib,$jid)
@@ -738,7 +738,7 @@
 
     if {$editable} return
 
-    set barejid [node_and_server_from_jid $jid]
+    set barejid [::xmpp::jid::stripResource $jid]
     if {![info exists activity(activity,$xlib,$barejid)]} return
 
     if {[info exists m2d($activity(activity,$xlib,$barejid))]} {

Modified: trunk/tkabber/plugins/pep/user_location.tcl
===================================================================
--- trunk/tkabber/plugins/pep/user_location.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/pep/user_location.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -73,7 +73,7 @@
     set rjid [roster::find_jid $xlib $jid]
 
     if {$rjid == ""} {
- 	set rjid [node_and_server_from_jid $jid]
+ 	set rjid [::xmpp::jid::stripResource $jid]
     }
 
     set pm [pep::get_roster_menu_pep_submenu $m $xlib $rjid]
@@ -96,7 +96,7 @@
     variable node
     variable substatus
 
-    set to [node_and_server_from_jid $jid]
+    set to [::xmpp::jid::stripResource $jid]
     set cmd [linsert $args 0 [namespace current]::subscribe_result $xlib $to]
     pep::subscribe $xlib $to $node \
 	    -command $cmd
@@ -107,7 +107,7 @@
     variable node
     variable substatus
 
-    set to [node_and_server_from_jid $jid]
+    set to [::xmpp::jid::stripResource $jid]
     set cmd [linsert $args 0 [namespace current]::unsubscribe_result $xlib $to]
     pep::unsubscribe $xlib $to $node \
 	    -command $cmd
@@ -184,7 +184,7 @@
 
     upvar 0 $var info
 
-    set jid [node_and_server_from_jid $user]
+    set jid [::xmpp::jid::stripResource $user]
 
     if {[info exists geoloc(title,$xlib,$jid)]} {
 	append info [::msgcat::mc "\n\tLocation: %s : %s" \
@@ -573,7 +573,7 @@
 
     if {$editable} return
 
-    set barejid [node_and_server_from_jid $jid]
+    set barejid [::xmpp::jid::stripResource $jid]
     if {![info exists geoloc(alt,$xlib,$barejid)]} return
 
     foreach ff $fields {

Modified: trunk/tkabber/plugins/pep/user_mood.tcl
===================================================================
--- trunk/tkabber/plugins/pep/user_mood.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/pep/user_mood.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -121,7 +121,7 @@
     set rjid [roster::find_jid $xlib $jid]
 
     if {$rjid == ""} {
- 	set rjid [node_and_server_from_jid $jid]
+ 	set rjid [::xmpp::jid::stripResource $jid]
     }
 
     set pm [pep::get_roster_menu_pep_submenu $m $xlib $rjid]
@@ -144,7 +144,7 @@
     variable node
     variable substatus
 
-    set to [node_and_server_from_jid $jid]
+    set to [::xmpp::jid::stripResource $jid]
     set cmd [linsert $args 0 [namespace current]::subscribe_result $xlib $to]
     pep::subscribe $xlib $to $node \
 	    -command $cmd
@@ -155,7 +155,7 @@
     variable node
     variable substatus
 
-    set to [node_and_server_from_jid $jid]
+    set to [::xmpp::jid::stripResource $jid]
     set cmd [linsert $args 0 [namespace current]::unsubscribe_result $xlib $to]
     pep::unsubscribe $xlib $to $node \
 	    -command $cmd
@@ -231,7 +231,7 @@
 
     upvar 0 $var info
 
-    set jid [node_and_server_from_jid $user]
+    set jid [::xmpp::jid::stripResource $user]
 
     if {[info exists mood(mood,$xlib,$jid)]} {
 	set m $mood(mood,$xlib,$jid)
@@ -629,7 +629,7 @@
 
     if {$editable} return
 
-    set barejid [node_and_server_from_jid $jid]
+    set barejid [::xmpp::jid::stripResource $jid]
     if {![info exists mood(mood,$xlib,$barejid)]} return
 
     set userinfo(mood,$jid) $m2d($mood(mood,$xlib,$barejid))

Modified: trunk/tkabber/plugins/pep/user_tune.tcl
===================================================================
--- trunk/tkabber/plugins/pep/user_tune.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/pep/user_tune.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -69,7 +69,7 @@
     set rjid [roster::find_jid $xlib $jid]
 
     if {$rjid == ""} {
- 	set rjid [node_and_server_from_jid $jid]
+ 	set rjid [::xmpp::jid::stripResource $jid]
     }
 
     set pm [pep::get_roster_menu_pep_submenu $m $xlib $rjid]
@@ -92,7 +92,7 @@
     variable node
     variable substatus
 
-    set to [node_and_server_from_jid $jid]
+    set to [::xmpp::jid::stripResource $jid]
     set cmd [linsert $args 0 [namespace current]::subscribe_result $xlib $to]
     pep::subscribe $xlib $to $node \
 	    -command $cmd
@@ -103,7 +103,7 @@
     variable node
     variable substatus
 
-    set to [node_and_server_from_jid $jid]
+    set to [::xmpp::jid::stripResource $jid]
     set cmd [linsert $args 0 [namespace current]::unsubscribe_result $xlib $to]
     pep::unsubscribe $xlib $to $node \
 	    -command $cmd
@@ -177,7 +177,7 @@
 
     upvar 0 $var info
 
-    set jid [node_and_server_from_jid $user]
+    set jid [::xmpp::jid::stripResource $user]
 
     if {[info exists tune(available,$xlib,$jid)]} {
 	append info [::msgcat::mc "\n\tTune: %s - %s" \
@@ -686,7 +686,7 @@
 
     if {$editable} return
 
-    set barejid [node_and_server_from_jid $jid]
+    set barejid [::xmpp::jid::stripResource $jid]
     if {![info exists tune(available,$xlib,$barejid)]} return
 
     foreach tag {artist length source title track uri rating} {

Modified: trunk/tkabber/plugins/roster/annotations.tcl
===================================================================
--- trunk/tkabber/plugins/roster/annotations.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/roster/annotations.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -112,7 +112,7 @@
 
     set roster_jids {}
     foreach rjid [roster::get_jids $xlib] {
-	lappend roster_jids [node_and_server_from_jid $rjid]
+	lappend roster_jids [::xmpp::jid::stripResource $rjid]
     }
 
     foreach idx [array names notes $xlib,jid,*] {
@@ -195,7 +195,7 @@
     variable notes
     upvar 0 $infovar info
 
-    set jid [node_and_server_from_jid $jid]
+    set jid [::xmpp::jid::stripResource $jid]
 
     if {[info exists notes($xlib,note,$jid)] && \
 	    $notes($xlib,note,$jid) != ""} {
@@ -223,10 +223,10 @@
 proc annotations::show_dialog {xlib jid} {
     variable notes
 
-    set jid [node_and_server_from_jid $jid]
+    set jid [::xmpp::jid::stripResource $jid]
 
     set allowed_name [jid_to_tag $jid]
-    set w .note_edit_${xlib}_$allowed_name
+    set w .note_edit_[psuffix $xlib]_$allowed_name
 
     if {[winfo exists $w]} {
 	destroy $w
@@ -318,7 +318,7 @@
 
     if {$editable} return
 
-    set jid [node_and_server_from_jid $jid]
+    set jid [::xmpp::jid::stripResource $jid]
 
     if {![info exists notes($xlib,note,$jid)] || \
 	    $notes($xlib,note,$jid) == ""} {

Modified: trunk/tkabber/plugins/roster/cache_categories.tcl
===================================================================
--- trunk/tkabber/plugins/roster/cache_categories.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/roster/cache_categories.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -49,7 +49,7 @@
     variable category_and_subtype_list
     variable requested_categories
 
-    set server [server_from_jid $jid]
+    set server [::xmpp::jid::server $jid]
     if {[lsearch -exact $requested_categories($xlib) $server] >= 0} {
 	return
     }

Modified: trunk/tkabber/plugins/roster/conferenceinfo.tcl
===================================================================
--- trunk/tkabber/plugins/roster/conferenceinfo.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/roster/conferenceinfo.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -77,7 +77,7 @@
 	foreach jid $jids {
 	    lassign [roster::get_category_and_subtype $xlib $jid] \
 		category type
-	    if {$category == "conference" && [node_from_jid $jid] != "" && \
+	    if {$category == "conference" && [::xmpp::jid::node $jid] != "" && \
 		    ![chat::is_opened [chat::chatid $xlib $jid]]} {
 	    
 		set sec [clock seconds]

Modified: trunk/tkabber/plugins/roster/conferences.tcl
===================================================================
--- trunk/tkabber/plugins/roster/conferences.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/roster/conferences.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -301,8 +301,8 @@
 
     $m add command -label [::msgcat::mc "Add conference to roster..."] \
 	-command [list [namespace current]::add_conference_dialog $xlib \
-		       -group [node_from_jid $jid] \
-		       -server [server_from_jid $jid] \
+		       -group [::xmpp::jid::node $jid] \
+		       -server [::xmpp::jid::server $jid] \
 		       -password $password]
 }
 
@@ -486,7 +486,7 @@
     }
 
     if {![info exists name]} {
-	set name [node_from_jid $jid]
+	set name [::xmpp::jid::node $jid]
     }
     if {![info exists nick]} {
 	set nick [get_group_nick $jid ""]
@@ -787,8 +787,8 @@
 
     $m add command -label [::msgcat::mc "Join..."] \
 	-command [list eval [list join_group_dialog $xlib \
-				  -server [server_from_jid $jid] \
-				  -group [node_from_jid $jid]] \
+				  -server [::xmpp::jid::server $jid] \
+				  -group [::xmpp::jid::node $jid]] \
 				  $args]
 
     # TODO: Check for real MUC? Move to muc.tcl?
@@ -926,7 +926,7 @@
 	    set pidentities [disco::get_jid_identities $pxlib $pjid $pnode]
 
 	    # JID with resource is not a room JID
-	    if {[node_and_server_from_jid $jid] != $jid} return
+	    if {[::xmpp::jid::resource $jid] != ""} return
 
 	    if {[lempty $identities]} {
 		set identities $pidentities
@@ -936,8 +936,8 @@
 		if {[::xmpp::xml::getAttr $id category] == "conference"} {
 		    $m add command -label [::msgcat::mc "Add conference to roster..."] \
 			-command [list [namespace current]::add_conference_dialog $xlib \
-				       -group [node_from_jid $jid] \
-				       -server [server_from_jid $jid]]
+				       -group [::xmpp::jid::node $jid] \
+				       -server [::xmpp::jid::server $jid]]
 		    break
 		}
 	    }

Modified: trunk/tkabber/plugins/roster/fetch_nicknames.tcl
===================================================================
--- trunk/tkabber/plugins/roster/fetch_nicknames.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/roster/fetch_nicknames.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -5,7 +5,7 @@
 
 proc fetch_nickname::service_request {xlib service} {
     foreach jid [::roster::get_jids $xlib] {
-	if {[server_from_jid $jid] == [server_from_jid $service]} {
+	if {[::xmpp::jid::server $jid] == [::xmpp::jid::server $service]} {
 	    user_request $xlib $jid
 	}
     }

Modified: trunk/tkabber/plugins/si/socks5.tcl
===================================================================
--- trunk/tkabber/plugins/si/socks5.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/plugins/si/socks5.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -89,8 +89,8 @@
     }
 
     set myjid [encoding convertto utf-8 \
-		   [tolower_node_and_domain [my_jid $state(xlib) $state(jid)]]]
-    set hisjid [encoding convertto utf-8 [tolower_node_and_domain $state(jid)]]
+		   [::xmpp::jid::normalize [my_jid $state(xlib) $state(jid)]]]
+    set hisjid [encoding convertto utf-8 [::xmpp::jid::normalize $state(jid)]]
     set hash [::sha1::sha1 $state(id)$hisjid$myjid]
 
     set len [binary format c [string length $hash]]
@@ -163,8 +163,8 @@
     lassign [fconfigure $servsock -sockname] addr hostname port
     set ip [::xmpp::ip $state(xlib)]
     set myjid [encoding convertto utf-8 \
-		   [tolower_node_and_domain [my_jid $state(xlib) $state(jid)]]]
-    set hisjid [encoding convertto utf-8 [tolower_node_and_domain $state(jid)]]
+		   [::xmpp::jid::normalize [my_jid $state(xlib) $state(jid)]]]
+    set hisjid [encoding convertto utf-8 [::xmpp::jid::normalize $state(jid)]]
     set hash [::sha1::sha1 $state(id)$myjid$hisjid]
     set hash_sid($hash) $state(id)
 
@@ -370,8 +370,8 @@
     }
 
     set myjid [encoding convertto utf-8 \
-		   [tolower_node_and_domain [my_jid $state(xlib) $state(jid)]]]
-    set hisjid [encoding convertto utf-8 [tolower_node_and_domain $state(jid)]]
+		   [::xmpp::jid::normalize [my_jid $state(xlib) $state(jid)]]]
+    set hisjid [encoding convertto utf-8 [::xmpp::jid::normalize $state(jid)]]
     set hash [::sha1::sha1 $state(id)$myjid$hisjid]
 
     set len [binary format c [string length $hash]]

Modified: trunk/tkabber/presence.tcl
===================================================================
--- trunk/tkabber/presence.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/presence.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -23,7 +23,7 @@
 
     debugmsg presence "PRESENCE: $from; $type; $x; $args"
 
-    set from [tolower_node_and_domain $from]
+    set from [::xmpp::jid::normalize $from]
 
     switch -- $type {
 	error -
@@ -35,7 +35,7 @@
 	    catch { unset presence(x,$xlib,$from) }
 	    catch { unset presence(error,$xlib,$from) }
 
-	    set user [node_and_server_from_jid $from]
+	    set user [::xmpp::jid::stripResource $from]
 	    if {[info exists presence(user_jids,$xlib,$user)]} {
 		set idx [lsearch -exact $presence(user_jids,$xlib,$user) $from]
 		set presence(user_jids,$xlib,$user) \
@@ -85,7 +85,7 @@
 	    set presence(show,$xlib,$from) \
 		[normalize_show $presence(show,$xlib,$from)]
 
-	    set user [node_and_server_from_jid $from]
+	    set user [::xmpp::jid::stripResource $from]
 	    if {![info exists presence(user_jids,$xlib,$user)] || \
 		    ![lcontain $presence(user_jids,$xlib,$user) $from]} {
 		lappend presence(user_jids,$xlib,$user) $from
@@ -106,7 +106,7 @@
 
     if {[info exists presence(user_jids,$xlib,$user)]} {
 	return $presence(user_jids,$xlib,$user)
-    } elseif {![cequal [resource_from_jid $user] ""]} {
+    } elseif {![cequal [::xmpp::jid::resource $user] ""]} {
 	if {[info exists presence(type,$xlib,$user)]} {
 	    return [list $user]
 	}
@@ -539,7 +539,7 @@
 proc add_presence_to_popup_info {infovar xlib jid} {
     upvar 0 $infovar info
 
-    set bjid [node_and_server_from_jid $jid]
+    set bjid [::xmpp::jid::stripResource $jid]
     if {[chat::is_groupchat [chat::chatid $xlib $bjid]]} return
 
     set priority [get_jid_presence_info priority $xlib $jid]

Modified: trunk/tkabber/privacy.tcl
===================================================================
--- trunk/tkabber/privacy.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/privacy.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -1208,7 +1208,7 @@
 			    set_status \
 				[::msgcat::mc "Privacy list is not created"]
 
-			    NonmodalMessageDlg .privacy_list_error[string map {: #} $xlib] \
+			    NonmodalMessageDlg .privacy_list_error[psuffix $xlib] \
 				-aspect 50000 -icon error \
 				-title [::msgcat::mc "Privacy lists error"] \
 				-message \
@@ -1240,7 +1240,7 @@
 		    set_status \
 			[::msgcat::mc "Privacy list is not activated"]
 
-		    NonmodalMessageDlg .privacy_list_error[string map {: #} $xlib] \
+		    NonmodalMessageDlg .privacy_list_error[psuffix $xlib] \
 			-aspect 50000 -icon error \
 			-title [::msgcat::mc "Privacy lists error"] \
 			-message \
@@ -1335,7 +1335,7 @@
     set rjid [roster::find_jid $xlib $jid]
 
     if {$rjid == ""} {
- 	set rjid [node_and_server_from_jid $jid]
+ 	set rjid [::xmpp::jid::stripResource $jid]
     }
 
     if {![is_supported $xlib] || \

Modified: trunk/tkabber/roster.tcl
===================================================================
--- trunk/tkabber/roster.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/roster.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -16,7 +16,7 @@
 
     debugmsg roster "ROSTER_ITEM: $xlib; $jid; $name; $groups; $subsc; $ask"
 
-    set jid [tolower_node_and_domain $jid]
+    set jid [::xmpp::jid::normalize $jid]
 
     if {$subsc != "remove"} {
 	if {![lcontain $roster(jids,$xlib) $jid]} {
@@ -255,7 +255,7 @@
 proc roster::is_trusted {xlib jid} {
     set subsc [itemconfig $xlib [find_jid $xlib $jid] -subsc]
 
-    if {[node_and_server_from_jid $jid] == [connection_bare_jid $xlib]} {
+    if {[::xmpp::jid::stripResource $jid] == [connection_bare_jid $xlib]} {
 	return 1
     } elseif {$subsc == "both" || $subsc == "from"} {
 	return 1
@@ -307,7 +307,7 @@
 
     lassign [get_category_and_subtype $xlib $jid] category subtype
     if {$category == "user"} {
-	set rjid [node_and_server_from_jid $jid]
+	set rjid [::xmpp::jid::stripResource $jid]
 	if {[lsearch -exact $roster(jids,$xlib) $rjid] >= 0} {
 	    lassign [get_category_and_subtype $xlib $rjid] rcategory rsubtype
 	    if {$category == $rcategory} {
@@ -371,7 +371,7 @@
 	return $roster(overridden_category_and_subtype,$xlib,$jid)
     }
 
-    set server [server_from_jid $jid]
+    set server [::xmpp::jid::server $jid]
     if {[info exists roster(overridden_category_and_subtype,$xlib,$server)]} {
 	catch { unset roster(cached_category_and_subtype,$xlib,$jid) }
 	set cs [heuristically_get_category_and_subtype $xlib $jid]
@@ -393,9 +393,7 @@
 proc roster::heuristically_get_category_and_subtype {xlib jid} {
     variable roster
 
-    set node [node_from_jid $jid]
-    set server [server_from_jid $jid]
-    set resource [resource_from_jid $jid]
+    ::xmpp::jid::split $jid node server resource
 
     if {$node == "" && $resource == ""} {
 	set updomain [lindex [split $server .] 0]
@@ -436,7 +434,7 @@
 	return [get_category_and_subtype $xlib $server]
     }
 
-    if {[resource_from_jid $jid] == ""} {
+    if {[::xmpp::jid::resource $jid] == ""} {
 	lassign [get_category_and_subtype $xlib $server] scategory ssubtype
 
 	switch -glob -- $scategory/$ssubtype {
@@ -551,7 +549,7 @@
     if {(($category == "service") || \
 	 ($category == "server") || \
 	 ($category == "gateway")) && \
-	[string compare -nocase [node_and_server_from_jid $jid] \
+	[string compare -nocase [::xmpp::jid::stripResource $jid] \
 				[connection_server $xlib]]} {
 	::xmpp::sendIQ $xlib set \
 	    -query [::xmpp::xml::create query \

Modified: trunk/tkabber/userinfo.tcl
===================================================================
--- trunk/tkabber/userinfo.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/userinfo.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -408,7 +408,7 @@
 
     hook::run userinfo_hook $tab $xlib $jid $editable
 
-    set vjid [node_and_server_from_jid $jid]
+    set vjid [::xmpp::jid::stripResource $jid]
     if {[chat::is_groupchat [chat::chatid $xlib $vjid]]} {
 	set vjid $jid
     }

Modified: trunk/tkabber/utils.tcl
===================================================================
--- trunk/tkabber/utils.tcl	2008-10-19 06:23:24 UTC (rev 1559)
+++ trunk/tkabber/utils.tcl	2008-10-19 06:23:58 UTC (rev 1560)
@@ -4,61 +4,15 @@
     return [expr round(rand()*$num)]
 }
 
-proc user_from_jid {jid} {
-    set user $jid
-    regexp {(.*@.*)/.*} $jid temp user
-
-    return $user
+proc psuffix {xlib} {
+    return [string map {: #} $xlib]
 }
 
-proc node_and_server_from_jid {jid} {
-    set nas $jid
-    regexp {([^/]*)/.*} $jid temp nas
-
-    return $nas
-}
-
-proc server_from_jid {jid} {
-    set serv $jid
-    regexp {([^/]*)/.*} $jid temp serv
-    regexp {[^@]*@(.*)} $serv temp serv
-
-    return $serv
-}
-
-proc resource_from_jid {jid} {
-    set resource ""
-    regexp {[^/]*/(.*)} $jid temp resource
-
-    return $resource
-}
-
-proc node_from_jid {jid} {
-    set node ""
-    regexp {^([^@/]*)@.*} $jid temp node
-
-    return $node
-}
-
-
-proc tolower_node_and_domain {jid} {
-    
-    set nas [string tolower [node_and_server_from_jid $jid]]
-    set resource [resource_from_jid $jid]
-
-    if {![cequal $resource ""]} {
-	return $nas/$resource
-    } else {
-	return $nas
-    }
-    
-}
-
 # my_jid - returns JID for inclusion in queries. If the recipient
 # is from some conference room then JID is a room JID.
 
 proc my_jid {xlib recipient} {
-    set bare_recipient [node_and_server_from_jid $recipient]
+    set bare_recipient [::xmpp::jid::stripResource $recipient]
     set chatid [chat::chatid $xlib $bare_recipient]
     if {[chat::is_groupchat $chatid]} {
 	set myjid [chat::our_jid $chatid]



More information about the Tkabber-dev mailing list