[Tkabber-dev] r1521 - in trunk/tkabber-plugins: . attline browser checkers chess debug ejabberd floatinglog georoster gmail jidlink jidlink/plugins mute osd presencecmd receipts renju reversi tclchat traffic whiteboard

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Oct 17 21:16:48 MSD 2008


Author: sergei
Date: 2008-10-17 21:16:48 +0400 (Fri, 17 Oct 2008)
New Revision: 1521

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/attline/attline.tcl
   trunk/tkabber-plugins/browser/browser.tcl
   trunk/tkabber-plugins/checkers/checkers.tcl
   trunk/tkabber-plugins/chess/chess.tcl
   trunk/tkabber-plugins/debug/debug.tcl
   trunk/tkabber-plugins/ejabberd/ejabberd.tcl
   trunk/tkabber-plugins/floatinglog/floatinglog.tcl
   trunk/tkabber-plugins/georoster/georoster.tcl
   trunk/tkabber-plugins/gmail/gmail.tcl
   trunk/tkabber-plugins/jidlink/jidlink.tcl
   trunk/tkabber-plugins/jidlink/plugins/dtcp.tcl
   trunk/tkabber-plugins/jidlink/plugins/filetransfer.tcl
   trunk/tkabber-plugins/jidlink/plugins/ibb.tcl
   trunk/tkabber-plugins/mute/mute.tcl
   trunk/tkabber-plugins/osd/osd.tcl
   trunk/tkabber-plugins/presencecmd/presencecmd.tcl
   trunk/tkabber-plugins/receipts/receipts.tcl
   trunk/tkabber-plugins/renju/renju.tcl
   trunk/tkabber-plugins/reversi/reversi.tcl
   trunk/tkabber-plugins/tclchat/tclchat.tcl
   trunk/tkabber-plugins/tclchat/tclchat_messages.tcl
   trunk/tkabber-plugins/traffic/traffic.tcl
   trunk/tkabber-plugins/whiteboard/svgrender.tcl
   trunk/tkabber-plugins/whiteboard/whiteboard.tcl
Log:
	* *: Massive update caused by moving to an external XMPP library
	  TclXMPP (http://code.google.com/p/tclxmpp/).


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/ChangeLog	2008-10-17 17:16:48 UTC (rev 1521)
@@ -2,6 +2,9 @@
 
 	* *: 0.11.1 is released.
 
+	* *: Massive update caused by moving to an external XMPP library
+	  TclXMPP (http://code.google.com/p/tclxmpp/).
+
 2008-10-15  Sergei Golovan <sgolovan at nes.ru>
 
 	* quotelastmsg/*, singularity/*, stripes/*: Added three new plugins

Modified: trunk/tkabber-plugins/attline/attline.tcl
===================================================================
--- trunk/tkabber-plugins/attline/attline.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/attline/attline.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -120,7 +120,7 @@
 }
 
 proc attline::on_draw_message {chatid from type body x} {
-    if {[is_delayed $x]} return
+    if {[::xmpp::delay::exists $x]} return
 
     set cw [chat::chat_win $chatid]
 
@@ -137,19 +137,6 @@
     return
 }
 
-proc attline::is_delayed {xml} {
-    foreach xelem $xml {
-	::jlib::wrapper:splitxml $xelem tag vars isempty chdata children
-	switch -- [::jlib::wrapper:getattr $vars xmlns] {
-	    urn:xmpp:delay -
-	    jabber:x:delay {
-		return 1
-	    }
-	}
-    }
-    return 0
-}
-
 proc attline::drawn {cw} {
     winfo exists [attline $cw]
 }

Modified: trunk/tkabber-plugins/browser/browser.tcl
===================================================================
--- trunk/tkabber-plugins/browser/browser.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/browser/browser.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -14,29 +14,23 @@
 }
 
 
-proc browser::open {args} {
+proc browser::open {{xlib ""}} {
     variable brwid
     variable browser
     variable config
     variable browse_list
     global brwserver$brwid
 
-    if {[llength [jlib::connections]] == 0} return
+    if {[llength [connections]] == 0} return
 
-    foreach {opt val} $args {
-	switch -- $opt {
-	    -connection { set connid $val }
-	}
+    if {$xlib == ""} {
+	set xlib [lindex [connections] 0]
     }
 
-    if {![info exists connid]} {
-	set connid [lindex [jlib::connections] 0]
-    }
+    set brwserver$brwid [connection_server $xlib]
 
-    set brwserver$brwid [jlib::connection_server $connid]
-
     set bw .brw$brwid
-    set browser(connid,$bw) $connid
+    set browser(xlib,$bw) $xlib
 
     add_win $bw -title [::msgcat::mc "Jabber Browser"] \
 	-tabtitle [::msgcat::mc "Browser"] \
@@ -104,11 +98,10 @@
     
     set jid [$bw.navigate.entry.e get]
 
-    jlib::send_iq get \
-	[jlib::wrapper:createtag query \
-	     -vars {xmlns jabber:iq:browse}] \
-	-to $jid -command [list [namespace current]::recv $bw $jid] \
-	-connection $browser(connid,$bw)
+    ::xmpp::sendIQ $browser(xlib,$bw) get \
+	-query [::xmpp::xml::create query \
+		    -xmlns jabber:iq:browse] \
+	-to $jid -command [list [namespace current]::recv $bw $jid]
 }
 
 proc browser::go {bw} {
@@ -123,22 +116,21 @@
 	set browse_list [update_combo_list $browse_list $jid 20]
 	$bw.navigate.entry configure -values $browse_list
 
-	jlib::send_iq get \
-	    [jlib::wrapper:createtag query \
-		 -vars {xmlns jabber:iq:browse}] \
-	    -to $jid -command [list [namespace current]::recv $bw $jid] \
-	    -connection $browser(connid,$bw)
+	::xmpp::sendIQ $browser(xlib,$bw) get \
+	    -query [::xmpp::xml::create query \
+			-xmlns jabber:iq:browse] \
+	    -to $jid -command [list [namespace current]::recv $bw $jid]
     }
 }
 
-proc browser::recv {bw jid res child} {
+proc browser::recv {bw jid status xml} {
     variable config
     variable browser
 
-    debugmsg browser "$res $child"
+    debugmsg browser "$status $xml"
 
     if {[winfo exists $bw]} {
-	if {![cequal $res OK]} {
+	if {![string equal $status ok]} {
 	    add_item_line $bw 0 $jid {} {} {} {} $jid
 
 	    set tw $browser(tree,$bw)
@@ -148,14 +140,14 @@
 	    set tnode [jid_to_tag "error $jid"]
 	    set data [list error $jid]
 	    set parent_tag [jid_to_tag $jid]
-	    set desc [format [::msgcat::mc "Browse error: %s"] [error_to_string $child]]
+	    set desc [::msgcat::mc "Browse error: %s" [error_to_string $xml]]
 	    set icon ""
 
 	    add_line $tw $parent_tag $tnode $icon $desc $data \
 		-fill $config(fill)
-	    set browser(nchilds,$bw,$jid) 1
+	    set browser(nchildren,$bw,$jid) 1
 	} else {
-	    process $bw $jid $child 0
+	    process $bw $jid $xml 0
 	}
     }
 }
@@ -163,64 +155,64 @@
 proc browser::process {bw from item level} {
     variable browser
 
-    jlib::wrapper:splitxml $item tag vars isempty chdata children
+    ::xmpp::xml::split $item tag xmlns attrs cdata subels
 
     switch -- $tag {
 	ns {
-	    debugmsg browser "$level; ns $chdata"
-	    if {![cequal $chdata ""]} {
-		return [add_ns_line $bw $from $level $chdata]
+	    debugmsg browser "$level; ns $cdata"
+	    if {![string equal $cdata ""]} {
+		return [add_ns_line $bw $from $level $cdata]
 	    }
 	    return ""
 	}
 	query -
 	item {
-	    set category [jlib::wrapper:getattr $vars category]
+	    set category [::xmpp::xml::getAttr $attrs category]
 	}
 	default {
 	    set category $tag
 	}
     }
 
-    set jid  [jlib::wrapper:getattr $vars jid]
+    set jid  [::xmpp::xml::getAttr $attrs jid]
     
     if {[cequal $jid ""]} {
 	set jid $from
     }
 
-    set type [jlib::wrapper:getattr $vars type]
-    set name [jlib::wrapper:getattr $vars name]
-    set version [jlib::wrapper:getattr $vars version]
+    set type [::xmpp::xml::getAttr $attrs type]
+    set name [::xmpp::xml::getAttr $attrs name]
+    set version [::xmpp::xml::getAttr $attrs version]
 
     debugmsg browser "$level; $jid; $category; $type; $name; $version"
     add_item_line $bw $level $jid $category $type $name $version $from
 
     set tw $browser(tree,$bw)
-    set childs {}
-    set nchilds 0
+    set children {}
+    set nchildren 0
 
-    foreach child $children {
-	lappend childs [process $bw $jid $child [expr {$level+1}]]
-	incr nchilds
+    foreach subel $subels {
+	lappend children [process $bw $jid $subels [expr {$level+1}]]
+	incr nchildren
     }
 
-    set browser(nchilds,$bw,$jid) $nchilds
+    set browser(nchildren,$bw,$jid) $nchildren
     set node [jid_to_tag $jid]
     if {![info exists browser(sort,$bw,$node)]} {
 	set browser(sort,$bw,$node) sort
     }
-    set curchilds [$tw nodes $node]
+    set curchildren [$tw nodes $node]
 
     if {$level == 0} {
-	foreach c $curchilds {
-	    if {![lcontain $childs $c]} {
+	foreach c $curchildren {
+	    if {[lsearch -exact $children $c] < 0} {
 		$tw delete $c
 	    }
 	}
 	browser_action $browser(sort,$bw,$node) $bw $node
 	update idletasks
     }
-    debugmsg browser [list $childs $curchilds]
+    debugmsg browser [list $children $curchildren]
 
     return $node
 }
@@ -319,7 +311,7 @@
     if {![cequal $version {}]} {
 	append text "$delim[::msgcat::mc Version:] $version"
     }
-    append text "\n[::msgcat::mc {Number of children:}] $browser(nchilds,$bw,$jid)"
+    append text "\n[::msgcat::mc {Number of children:}] $browser(nchildren,$bw,$jid)"
     return $text
 }
 
@@ -386,7 +378,7 @@
 
     debugmsg browser "BR: $item"
 
-    jlib::wrapper:splitxml $item tag vars isempty chdata children
+    ::xmpp::xml::split $item tag xmlns attrs cdata subels
 
     
     switch -- $tag {
@@ -394,22 +386,22 @@
 	    return
 	}
 	item {
-	    set category [jlib::wrapper:getattr $vars service]
+	    set category [::xmpp::xml::getAttr $attrs service]
 	}
 	default {
 	    set category $tag
 	}
     }
 
-    set jid  [jlib::wrapper:getattr $vars jid]
+    set jid  [::xmpp::xml::getAttr $attrs jid]
     
-    if {[cequal $jid ""]} {
+    if {[string equal $jid ""]} {
 	set jid $from
     }
 
-    set type [jlib::wrapper:getattr $vars type]
-    set name [jlib::wrapper:getattr $vars name]
-    set version [jlib::wrapper:getattr $vars version]
+    set type [::xmpp::xml::getAttr $attrs type]
+    set name [::xmpp::xml::getAttr $attrs name]
+    set version [::xmpp::xml::getAttr $attrs version]
 
     debugmsg browser "$jid; $category; $type; $name; $version"
 
@@ -417,8 +409,8 @@
     set browser(category,$jid) $category
     set browser(type,$jid) $type
 
-    foreach child $children {
-	parse_items $jid $child
+    foreach subel $subels {
+	parse_items $jid $subel
     }
 
 }
@@ -445,13 +437,11 @@
 	    debugmsg browser "$jid $ns"
 	    if {[info exists browser(ns_handler,$ns)]} {
 		if {$browser(ns_handler_node,$ns)} {
-		    eval $browser(ns_handler,$ns) [list $jid "" \
-			-category $category -type $subtype \
-			-connection $browser(connid,$bw)]
+		    eval $browser(ns_handler,$ns) [list $browser(xlib,$bw) $jid "" \
+			-category $category -type $subtype]
 		} else {
-		    eval $browser(ns_handler,$ns) [list $jid \
-			-category $category -type $subtype \
-			-connection $browser(connid,$bw)]
+		    eval $browser(ns_handler,$ns) [list $browser(xlib,$bw) $jid \
+			-category $category -type $subtype]
 		}
 	    }
 	}
@@ -465,13 +455,13 @@
 $m add command -label [::msgcat::mc "Join group..."] -command {
     join_group_dialog -server [server_from_jid $::plugins::browser::headjid] \
 	    -group [node_from_jid $::plugins::browser::headjid] \
-	    -connection $::plugins::browser::browser(connid,$::plugins::browser::headwindow)
+	    -connection $::plugins::browser::browser(xlib,$::plugins::browser::headwindow)
 }
 $m add command -label [::msgcat::mc "Add conference..."] -command {
     plugins::conferences::add_conference_dialog \
 	-group [node_from_jid $::plugins::browser::headjid] \
 	-server [server_from_jid $::plugins::browser::headjid] \
-	-connection $::plugins::browser::browser(connid,$::plugins::browser::headwindow)
+	-connection $::plugins::browser::browser(xlib,$::plugins::browser::headwindow)
 }
 $m add separator
 $m add command -label [::msgcat::mc "Browse"] \
@@ -521,7 +511,7 @@
 	jid {
 	    switch -- [lindex $data 2] {
 		user {
-		    message::subject_menu [set bm .b1popmenu] $browser(connid,$bw) \
+		    message::subject_menu [set bm .b1popmenu] $browser(xlib,$bw) \
 			   [lindex $data 1] message
 		}
 
@@ -638,9 +628,9 @@
 }
 
 proc browser::draginitcmd {bw t node top} {
-    set connid browser(connid,$bw)
+    set xlib browser(xlib,$bw)
     set data [$t itemcget $node -data]
-    set data2 [linsert [lassign $data type] 0 $connid]
+    set data2 [linsert [lassign $data type] 0 $xlib]
 
     if {$type == "jid"} {
 	if {[set img [$t itemcget $node -image]] != ""} {

Modified: trunk/tkabber-plugins/checkers/checkers.tcl
===================================================================
--- trunk/tkabber-plugins/checkers/checkers.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/checkers/checkers.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -75,15 +75,15 @@
 
 hook::add postload_hook [namespace current]::checkers::load_stored_theme 70
 
-proc checkers::get_nick {connid jid type} {
-    if {[catch {chat::get_nick $connid $jid $type} nick]} {
+proc checkers::get_nick {xlib jid type} {
+    if {[catch {chat::get_nick $xlib $jid $type} nick]} {
 	return [chat::get_nick $jid $type]
     } else {
 	return $nick
     }
 }
 
-proc checkers::invite_dialog {connid jid} {
+proc checkers::invite_dialog {xlib jid} {
     variable options
 
     set w .checkers_invite
@@ -98,7 +98,7 @@
     set wf [$w getframe]
     message $wf.message -aspect 50000 \
 	-text [format [::msgcat::mc "Sending checkers game invitation to %s (%s)"] \
-		      [get_nick $connid $jid chat] \
+		      [get_nick $xlib $jid chat] \
 		      $jid]
 
     pack $wf.message -pady 2m
@@ -123,16 +123,16 @@
     pack $wf.italian -padx 15m -anchor w
 
     $w add -text [::msgcat::mc "I want play white"] \
-	-command [list [namespace current]::invite $connid $jid white]
+	-command [list [namespace current]::invite $xlib $jid white]
     $w add -text [::msgcat::mc "I want play black"] \
-	-command [list [namespace current]::invite $connid $jid black]
+	-command [list [namespace current]::invite $xlib $jid black]
     $w add -text [::msgcat::mc "Cancel invitation"] \
 	-command [list destroy $w]
 
     $w draw
 }
 
-proc checkers::invite {connid jid color} {
+proc checkers::invite {xlib jid color} {
     variable game
 
     destroy .checkers_invite
@@ -142,27 +142,29 @@
     # FIX
     #set rjid [get_jid_of_user $jid]
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag create \
-	     -vars [list xmlns games:board type checkers:$game id $id color $color]] \
+    ::xmpp::sendIQ $xlib set \
+	query [::xmpp::xml::create create \
+			-xmlns games:board \
+			-attrs [list type checkers:$game \
+				     id $id \
+				     color $color]] \
 	-to $jid \
-	-command [list [namespace current]::invite_res $game $connid $jid $id $color] \
-	-connection $connid
+	-command [list [namespace current]::invite_res $game $xlib $jid $id $color]
 }
 
-proc checkers::invite_res {game connid jid id color res child} {
-    if {![cequal $res OK]} {
+proc checkers::invite_res {game xlib jid id color status xml} {
+    if {![string equal $status ok]} {
 	after idle [list NonmodalMessageDlg .checkers_invite_error -aspect 50000 -icon error \
-	    -message [format [::msgcat::mc "%s (%s) has refused checkers invitation: %s"] \
-			     [get_nick $connid $jid chat] \
-			     $jid [error_to_string $child]]]
+	    -message [::msgcat::mc "%s (%s) has refused checkers invitation: %s" \
+				   [get_nick $xlib $jid chat] \
+				   $jid [error_to_string $xml]]]
 	return ""
     }
 
-    start_play $game $connid $jid $id $color
+    start_play $game $xlib $jid $id $color
 }
 
-proc checkers::invited_dialog {game connid jid id color} {
+proc checkers::invited_dialog {game xlib jid id color} {
     variable invited_result
     variable game_names
 
@@ -179,7 +181,7 @@
 
     bind $wf <Destroy> [list [namespace current]::set_invited_res ""]
 
-    set nick [get_nick $connid $jid chat]
+    set nick [get_nick $xlib $jid chat]
     set message1 [format [::msgcat::mc "Checkers game invitation from %s (%s) is received."] \
 			 $nick $jid]
     set message2 [format [::msgcat::mc "%s wants play %s."] $nick $game_names($game)]
@@ -217,10 +219,10 @@
     if {$invited_result == 0} {
 	switch -- $color {
 	    white {
-		start_play $game $connid $jid $id black
+		start_play $game $xlib $jid $id black
 	    }
 	    black {
-		start_play $game $connid $jid $id white
+		start_play $game $xlib $jid $id white
 	    }
 	    default {
 		return [list error modify bad-request]
@@ -228,8 +230,10 @@
 	}
 
 	return [list result\
-		     [jlib::wrapper:createtag create \
-			  -vars [list xmlns games:board type checkers:$game id $id]]]
+		     [::xmpp::xml::create create \
+			    -xmlns games:board \
+			    -attrs [list type checkers:$game \
+					 id $id]]]
     } else {
 	return [list error modify not-acceptable]
     }
@@ -241,7 +245,7 @@
 }
 
 
-proc checkers::start_play {game connid jid id color} {
+proc checkers::start_play {game xlib jid id color} {
 
     set gid [make_gid $jid $id]
     variable $gid
@@ -249,7 +253,7 @@
     upvar 0 $gid flags
 
     set flags(window) [win_id checkers $gid]
-    set flags(connid) $connid
+    set flags(xlib) $xlib
     set flags(opponent) $jid
     set flags(id) $id
     set flags(flip) 0
@@ -374,7 +378,7 @@
     jid_to_tag [concat $jid $id]
 }
 
-proc checkers::turn_recv {gid childs} {
+proc checkers::turn_recv {gid xmlList} {
     variable options
     variable prom_rev
     variable $gid
@@ -383,11 +387,11 @@
     set move {}
     set draw 0
 
-    foreach child $childs {
-	jlib::wrapper:splitxml $child tag vars isempty chdata children
+    foreach xml $xmlList {
+	::xmpp::xml::split $xml tag xmlns attrs cdata subels
 	switch -- $tag {
 	    move {
-		set pos [jlib::wrapper:getattr $vars pos]
+		set pos [::xmpp::xml::getAttr $attrs pos]
 		set poss [split $pos ";"]
 		if {[llength $poss] >= 2} {
 		    foreach pos1 $poss {
@@ -410,10 +414,10 @@
 		update_controls $gid
 		draw_position $gid
 		highlight_last_move $gid
-		return [list result [jlib::wrapper:createtag turn \
-					 -vars [list xmlns games:board \
-						     type checkers:$flags(game) \
-						     id $flags(id)]]]
+		return [list result [::xmpp::xml::create turn \
+					    -xmlns games:board \
+					    -attrs [list type checkers:$flags(game) \
+							 id $flags(id)]]]
 	    }
 	    accept {
 		if {$flags(position,draw)} {
@@ -421,9 +425,9 @@
 		    update_controls $gid
 		    draw_position $gid
 		    highlight_last_move $gid
-		    return [list result [jlib::wrapper:createtag turn \
-					     -vars [list xmlns games:board \
-							 type checkers:$flags(game) \
+		    return [list result [::xmpp::xml::create turn \
+					    -xmlns games:board \
+					    -attrs [list type checkers:$flags(game) \
 							 id $flags(id)]]]
 		} else {
 		    return [list error modify not-acceptable]
@@ -440,10 +444,10 @@
 	draw_position $gid
 	highlight_last_move $gid
 
-	return [list result [jlib::wrapper:createtag turn \
-				 -vars [list xmlns games:board \
-					     type checkers:$flags(game) \
-					     id $flags(id)]]]
+	return [list result [::xmpp::xml::create turn \
+				    -xmlns games:board \
+				    -attrs [list type checkers:$flags(game) \
+						 id $flags(id)]]]
     } else {
 	return [list error modify not-acceptable]
     }
@@ -562,7 +566,7 @@
     }
 
     set title [format [::msgcat::mc "%s with %s"] \
-	$short_game_names($flags(game)) [get_nick $flags(connid) $jid chat]]
+	$short_game_names($flags(game)) [get_nick $flags(xlib) $jid chat]]
     add_win $w -title $title \
 	       -tabtitle $title \
 	       -class Checkers \
@@ -1072,14 +1076,13 @@
     variable $gid
     upvar 0 $gid flags
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag turn \
-	     -vars [list xmlns games:board \
-			type checkers:$flags(game) \
-			id $flags(id)] \
-	     -subtags [list [jlib::wrapper:createtag accept]]] \
-	-to $flags(opponent) \
-	-connection $flags(connid)
+    ::xmpp::sendIQ $flags(xlib) set \
+	-query [::xmpp::xml::create turn \
+			-xmlns games:board \
+			-attrs [list type checkers:$flags(game) \
+				     id $flags(id)] \
+			-subelement [::xmpp::xml::create accept]] \
+	-to $flags(opponent)
 
 	end_game $gid 0.5 [::msgcat::mc "Draw (You accepted)"]
 	update_controls $gid
@@ -1091,14 +1094,13 @@
     variable $gid
     upvar 0 $gid flags
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag turn \
-	     -vars [list xmlns games:board \
-			type checkers:$flags(game) \
-			id $flags(id)] \
-	     -subtags [list [jlib::wrapper:createtag resign]]] \
-	-to $flags(opponent) \
-	-connection $flags(connid)
+    ::xmpp::sendIQ $flags(xlib) set \
+	-query [::xmpp::xml::create turn \
+			-xmlns games:board \
+			-attrs [list type checkers:$flags(game) \
+				     id $flags(id)] \
+			-subelement [::xmpp::xml::create resign]] \
+	-to $flags(opponent)
 
 	end_game $gid 0 [::msgcat::mc "Opponent wins (You resigned)"]
 	update_controls $gid
@@ -1112,25 +1114,24 @@
 
     set move_tags [list [make_move_tag $gid $move]]
     if {$flags(position,draw)} {
-	lappend move_tags [jlib::wrapper:createtag draw]
+	lappend move_tags [::xmpp::xml::create draw]
     }
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag turn \
-	     -vars [list xmlns games:board \
-			type checkers:$flags(game) \
-			id $flags(id)] \
-	     -subtags $move_tags] \
+    ::xmpp::sendIQ $flags(xlib) set \
+	-query [::xmpp::xml::create turn \
+			-xmlns games:board \
+			-attrs [list type checkers:$flags(game) \
+				     id $flags(id)] \
+			-subelements $move_tags] \
 	-to $flags(opponent) \
-	-connection $flags(connid) \
 	-command [list [namespace current]::send_result $gid]
 }
 
-proc checkers::send_result {gid res child} {
-    if {$res == "ERR"} {
+proc checkers::send_result {gid status xml} {
+    if {$status == "error"} {
 	attention_message $gid \
-	    [format [::msgcat::mc "\n\n Opponent rejected move:\n %s\n\n"] \
-		[error_to_string $child]]
+	    [::msgcat::mc "\n\n Opponent rejected move:\n %s\n\n" \
+			  [error_to_string $xml]]
 	restore_position $gid
     }
 }
@@ -1141,7 +1142,7 @@
 	lappend move1 [join $pos ","]
     }
 
-    jlib::wrapper:createtag move -vars [list pos [join $move1 ";"]]
+    ::xmpp::xml::create move -attrs [list pos [join $move1 ";"]]
 }
 
 proc checkers::add_move_to_history {gid move opt suffix} {
@@ -1698,14 +1699,14 @@
     string equal -length 1 $f1 $f2
 }
 
-proc checkers::add_groupchat_user_menu_item {m connid jid} {
+proc checkers::add_groupchat_user_menu_item {m xlib jid} {
     set mm $m.gamesmenu
     if {![winfo exists $mm]} {
 	menu $mm -tearoff 0
 	$m add cascade -label [::msgcat::mc "Games"] -menu $mm
     }
     $mm add command -label [::msgcat::mc "Checkers..."] \
-	-command [list [namespace current]::invite_dialog $connid $jid]
+	-command [list [namespace current]::invite_dialog $xlib $jid]
 }
 
 hook::add roster_create_groupchat_user_menu_hook \
@@ -1715,12 +1716,12 @@
 hook::add roster_jid_popup_menu_hook \
     [namespace current]::checkers::add_groupchat_user_menu_item 49
 
-proc checkers::iq_create {varname connid from child} {
+proc checkers::iq_create {varname xlib from xml} {
     upvar 2 $varname var
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-    lassign [split [jlib::wrapper:getattr $vars type] ":"] cathegory game
+    lassign [split [::xmpp::xml::getAttr $attrs type] ":"] cathegory game
 
     if {$cathegory != "checkers"} {
 	return
@@ -1733,8 +1734,8 @@
 	brazilian -
 	spanish -
 	italian {
-	    if {[jlib::wrapper:isattr $vars color]} {
-		set color [jlib::wrapper:getattr $vars color]
+	    if {[::xmpp::xml::isAttr $attrs color]} {
+		set color [::xmpp::xml::getAttr $attrs color]
 		switch -- $color {
 		    white -
 		    black { }
@@ -1746,8 +1747,8 @@
 		set color white
 	    }
 	    set var [[namespace current]::invited_dialog \
-			 $game $connid $from \
-			 [jlib::wrapper:getattr $vars id] \
+			 $game $xlib $from \
+			 [::xmpp::xml::getAttr $attrs id] \
 			 $color]
 	}
     }
@@ -1756,12 +1757,12 @@
 
 hook::add games_board_create_hook [namespace current]::checkers::iq_create
 
-proc checkers::iq_turn {varname connid from child} {
+proc checkers::iq_turn {varname xlib from xml} {
     upvar 2 $varname var
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-    lassign [split [jlib::wrapper:getattr $vars type] ":"] cathegory game
+    lassign [split [::xmpp::xml::getAttr $attrs type] ":"] cathegory game
 
     if {$cathegory != "checkers"} {
 	return
@@ -1774,9 +1775,9 @@
 	brazilian -
 	spanish -
 	italian {
-	    set gid [make_gid $from [jlib::wrapper:getattr $vars id]]
+	    set gid [make_gid $from [::xmpp::xml::getAttr $attrs id]]
 	    if {[exists $gid]} {
-		set var [[namespace current]::turn_recv $gid $children]
+		set var [[namespace current]::turn_recv $gid $subels]
 	    } else {
 		set var [list error cancel item-not-found]
 	    }
@@ -1789,21 +1790,21 @@
 
 
 # Common games:board part
-proc iq_games_board_create {connid from lang child} {
+proc iq_games_board_create {xlib from xml args} {
     set res [list error cancel feature-not-implemented]
-    hook::run games_board_create_hook res $connid $from $child
+    hook::run games_board_create_hook res $xlib $from $xml
     return $res
 }
 
-iq::register_handler set create games:board \
-    [namespace current]::iq_games_board_create
+::xmpp::iq::register set create games:board \
+		     [namespace current]::iq_games_board_create
 
-proc iq_games_board_turn {connid from lang child} {
+proc iq_games_board_turn {xlib from xml args} {
     set res [list error cancel feature-not-implemented]
-    hook::run games_board_turn_hook res $connid $from $child
+    hook::run games_board_turn_hook res $xlib $from $xml
     return $res
 }
 
-iq::register_handler set turn games:board \
-    [namespace current]::iq_games_board_turn
+::xmpp::iq::register set turn games:board \
+		     [namespace current]::iq_games_board_turn
 

Modified: trunk/tkabber-plugins/chess/chess.tcl
===================================================================
--- trunk/tkabber-plugins/chess/chess.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/chess/chess.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -75,15 +75,15 @@
 
 hook::add postload_hook [namespace current]::chess::load_stored_theme 70
 
-proc chess::get_nick {connid jid type} {
-    if {[catch {chat::get_nick $connid $jid $type} nick]} {
+proc chess::get_nick {xlib jid type} {
+    if {[catch {chat::get_nick $xlib $jid $type} nick]} {
 	return [chat::get_nick $jid $type]
     } else {
 	return $nick
     }
 }
 
-proc chess::invite_dialog {connid jid} {
+proc chess::invite_dialog {xlib jid} {
     set w .chess_invite
 
     if {[winfo exists $w]} {
@@ -96,22 +96,22 @@
     set wf [$w getframe]
     message $wf.message -aspect 50000 \
 	-text [format [::msgcat::mc "Sending chess game invitation to %s (%s)"] \
-		      [get_nick $connid $jid chat] \
+		      [get_nick $xlib $jid chat] \
 		      $jid]
 
     pack $wf.message -pady 2m
 
     $w add -text [::msgcat::mc "I want play white"] \
-	-command [list [namespace current]::invite $connid $jid white]
+	-command [list [namespace current]::invite $xlib $jid white]
     $w add -text [::msgcat::mc "I want play black"] \
-	-command [list [namespace current]::invite $connid $jid black]
+	-command [list [namespace current]::invite $xlib $jid black]
     $w add -text [::msgcat::mc "Cancel invitation"] \
 	-command [list destroy $w]
 
     $w draw
 }
 
-proc chess::invite {connid jid color} {
+proc chess::invite {xlib jid color} {
     destroy .chess_invite
 
     set id chess[rand 1000000000]
@@ -119,28 +119,30 @@
     # FIX
     #set rjid [get_jid_of_user $jid]
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag create \
-	     -vars [list xmlns games:board type chess id $id color $color]] \
+    ::xmpp::sendIQ $xlib set \
+	-query [::xmpp::xml::create create \
+			-xmlns games:board \
+			-attrs [list type chess \
+				     id $id \
+				     color $color]] \
 	-to $jid \
-	-command [list [namespace current]::invite_res $connid $jid $id $color] \
-	-connection $connid
+	-command [list [namespace current]::invite_res $xlib $jid $id $color]
 }
 
-proc chess::invite_res {connid jid id color res child} {
-    if {![cequal $res OK]} {
+proc chess::invite_res {xlib jid id color status xml} {
+    if {![string equal $status ok]} {
 	after idle [list NonmodalMessageDlg .chess_invite_error -aspect 50000 -icon error \
-	    -message [format [::msgcat::mc "%s (%s) has refused chess invitation: %s"] \
-			     [get_nick $connid $jid chat] \
-			     $jid [error_to_string $child]]]
+	    -message [::msgcat::mc "%s (%s) has refused chess invitation: %s" \
+				   [get_nick $xlib $jid chat] \
+				   $jid [error_to_string $xml]]]
 	return ""
     }
 
-    start_play $connid $jid $id $color
+    start_play $xlib $jid $id $color
 }
 
 
-proc chess::invited_dialog {connid jid id color} {
+proc chess::invited_dialog {xlib jid id color} {
     variable invited_result
 
     set w .chess_invited
@@ -156,7 +158,7 @@
 
     bind $wf <Destroy> [list [namespace current]::set_invited_res ""]
 
-    set nick [get_nick $connid $jid chat]
+    set nick [get_nick $xlib $jid chat]
     set message1 [format [::msgcat::mc "Chess game invitation from %s (%s) is received."] \
 			 $nick $jid]
     switch -- $color {
@@ -191,10 +193,10 @@
     if {$invited_result == 0} {
 	switch -- $color {
 	    white {
-		start_play $connid $jid $id black
+		start_play $xlib $jid $id black
 	    }
 	    black {
-		start_play $connid $jid $id white
+		start_play $xlib $jid $id white
 	    }
 	    default {
 		return [list error modify bad-request]
@@ -202,8 +204,10 @@
 	}
 
 	return [list result\
-		     [jlib::wrapper:createtag create \
-			  -vars [list xmlns games:board type chess id $id]]]
+		     [::xmpp::xml::create create \
+			    -xmlns games:board \
+			    -attrs [list type chess \
+					 id $id]]]
     } else {
 	return [list error modify not-acceptable]
     }
@@ -214,7 +218,7 @@
     set invited_result $res
 }
 
-proc chess::start_play {connid jid id color} {
+proc chess::start_play {xlib jid id color} {
 
     set gid [make_gid $jid $id]
     variable $gid
@@ -222,7 +226,7 @@
     upvar 0 $gid flags
 
     set flags(window) [win_id chess $gid]
-    set flags(connid) $connid
+    set flags(xlib) $xlib
     set flags(opponent) $jid
     set flags(id) $id
     set flags(flip) 0
@@ -372,7 +376,7 @@
     jid_to_tag [concat $jid $id]
 }
 
-proc chess::turn_recv {gid childs} {
+proc chess::turn_recv {gid xmlList} {
     variable options
     variable prom_rev
     variable $gid
@@ -381,11 +385,11 @@
     set move 0
     set draw 0
 
-    foreach child $childs {
-	jlib::wrapper:splitxml $child tag vars isempty chdata children
+    foreach xml $xmlList {
+	::xmpp::xml::split $xml tag xmlns attrs cdata subels
 	switch -- $tag {
 	    move {
-		set pos [jlib::wrapper:getattr $vars pos]
+		set pos [::xmpp::xml::getAttr $attrs pos]
 		set poss [split $pos ";"]
 		if {[llength $poss] == 2} {
 		    set pos1 [split [lindex $poss 0] ,]
@@ -396,11 +400,11 @@
 			set ct [lindex $pos2 0]
 			set rt [lindex $pos2 1]
 			set prom ""
-			foreach child2 $children {
-			    jlib::wrapper:splitxml $child2 tag2 vars2 isempty2 chdata2 children2
-			    if {$tag2 == "promotion"} {
-				if {[info exists prom_rev($chdata2)]} {
-				    set prom $prom_rev($chdata2)
+			foreach subel $subels {
+			    ::xmpp::xml::split $subel stag sxmlns sattrs scdata ssubels
+			    if {$stag == "promotion"} {
+				if {[info exists prom_rev($scdata)]} {
+				    set prom $prom_rev($scdata)
 				}
 			    }
 			}
@@ -417,10 +421,10 @@
 		update_controls $gid
 		draw_position $gid
 		highlight_last_move $gid
-		return [list result [jlib::wrapper:createtag turn \
-					 -vars [list xmlns games:board \
-						     type chess \
-						     id $flags(id)]]]
+		return [list result [::xmpp::xml::create turn \
+					    -xmlns games:board \
+					    -attrs [list type chess \
+							 id $flags(id)]]]
 	    }
 	    accept {
 		if {$flags(position,draw)} {
@@ -428,10 +432,10 @@
 		    update_controls $gid
 		    draw_position $gid
 		    highlight_last_move $gid
-		    return [list result [jlib::wrapper:createtag turn \
-					     -vars [list xmlns games:board \
-							 type chess \
-							 id $flags(id)]]]
+		    return [list result [::xmpp::xml::create turn \
+						-xmlns games:board \
+						-attrs [list type chess \
+							     id $flags(id)]]]
 		} else {
 		    return [list error modify not-acceptable]
 		}
@@ -447,10 +451,10 @@
 	draw_position $gid
 	highlight_last_move $gid
 
-	return [list result [jlib::wrapper:createtag turn \
-				 -vars [list xmlns games:board \
-					     type chess \
-					     id $flags(id)]]]
+	return [list result [::xmpp::xml::create turn \
+				    -xmlns games:board \
+				    -attrs [list type chess \
+						 id $flags(id)]]]
     } else {
 	return [list error modify not-acceptable]
     }
@@ -571,7 +575,7 @@
 	return
     }
 
-    set title [format [::msgcat::mc "Chess with %s"] [get_nick $flags(connid) $jid chat]]
+    set title [format [::msgcat::mc "Chess with %s"] [get_nick $flags(xlib) $jid chat]]
     add_win $w -title $title \
 	       -tabtitle $title \
 	       -class Chess \
@@ -1189,14 +1193,13 @@
     variable $gid
     upvar 0 $gid flags
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag turn \
-	     -vars [list xmlns games:board \
-			type chess \
-			id $flags(id)] \
-	     -subtags [list [jlib::wrapper:createtag accept]]] \
-	-to $flags(opponent) \
-	-connection $flags(connid)
+    ::xmpp::sendIQ $flags(xlib) set \
+	-query [::xmpp::xml::create turn \
+			-xmlns games:board \
+			-attrs [list type chess \
+				     id $flags(id)] \
+			-subelement [::xmpp::xml::create accept]] \
+	-to $flags(opponent)
 
 	end_game $gid 0.5 [::msgcat::mc "Draw (You accepted)"]
 	update_controls $gid
@@ -1208,14 +1211,13 @@
     variable $gid
     upvar 0 $gid flags
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag turn \
-	     -vars [list xmlns games:board \
-			type chess \
-			id $flags(id)] \
-	     -subtags [list [jlib::wrapper:createtag resign]]] \
-	-to $flags(opponent) \
-	-connection $flags(connid)
+    ::xmpp::sendIQ $flags(xlib) set \
+	-query [::xmpp::xml::create turn \
+			-xmlns games:board \
+			-attrs [list type chess \
+				     id $flags(id)] \
+			-subelement [::xmpp::xml::create resign]] \
+	-to $flags(opponent)
 
 	end_game $gid 0 [::msgcat::mc "Opponent wins (You resigned)"]
 	update_controls $gid
@@ -1229,25 +1231,24 @@
 
     set move_tags [list [make_move_tag $gid $cf $rf $ct $rt $prom]]
     if {$flags(position,draw)} {
-	lappend move_tags [jlib::wrapper:createtag draw]
+	lappend move_tags [::xmpp::xml::create draw]
     }
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag turn \
-	     -vars [list xmlns games:board \
-			type chess \
-			id $flags(id)] \
-	     -subtags $move_tags] \
+    ::xmpp::sendIQ $flags(xlib) set \
+	-query [::xmpp::xml::create turn \
+			-xmlns games:board \
+			-attrs [list type chess \
+				     id $flags(id)] \
+			-subelements $move_tags] \
 	-to $flags(opponent) \
-	-connection $flags(connid) \
 	-command [list [namespace current]::send_result $gid]
 }
 
-proc chess::send_result {gid res child} {
-    if {$res == "ERR"} {
+proc chess::send_result {gid status xml} {
+    if {$status == "error"} {
 	attention_message $gid \
-	    [format [::msgcat::mc "\n\n Opponent rejected move:\n %s\n\n"] \
-		[error_to_string $child]]
+	    [::msgcat::mc "\n\n Opponent rejected move:\n %s\n\n" \
+			  [error_to_string $xml]]
 	restore_position $gid
     }
 }
@@ -1256,11 +1257,14 @@
     variable prom_name
 
     if {$prom == ""} {
-	jlib::wrapper:createtag move -vars [list pos "$cf,$rf;$ct,$rt"]
+	::xmpp::xml::create move \
+		-attrs [list pos "$cf,$rf;$ct,$rt"]
     } else {
 	set f [string index $prom 1]
-	jlib::wrapper:createtag move -vars [list pos "$cf,$rf;$ct,$rt"] \
-	    -subtags [list [jlib::wrapper:createtag promotion -chdata $prom_name($f)]]
+	::xmpp::xml::create move \
+		-attrs [list pos "$cf,$rf;$ct,$rt"] \
+		-subelement [::xmpp::xml::create promotion \
+				    -cdata $prom_name($f)]
     }
 }
 
@@ -1763,14 +1767,14 @@
     string equal -length 1 $f1 $f2
 }
 
-proc chess::add_groupchat_user_menu_item {m connid jid} {
+proc chess::add_groupchat_user_menu_item {m xlib jid} {
     set mm $m.gamesmenu
     if {![winfo exists $mm]} {
 	menu $mm -tearoff 0
 	$m add cascade -label [::msgcat::mc "Games"] -menu $mm
     }
     $mm add command -label [::msgcat::mc "Chess..."] \
-	-command [list [namespace current]::invite_dialog $connid $jid]
+	-command [list [namespace current]::invite_dialog $xlib $jid]
 }
 
 hook::add roster_create_groupchat_user_menu_hook \
@@ -1780,14 +1784,14 @@
 hook::add roster_jid_popup_menu_hook \
     [namespace current]::chess::add_groupchat_user_menu_item 48
 
-proc chess::iq_create {varname connid from child} {
+proc chess::iq_create {varname xlib from xml} {
     upvar 2 $varname var
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-    if {[jlib::wrapper:getattr $vars type] == "chess"} {
-	if {[jlib::wrapper:isattr $vars color]} {
-	    set color [jlib::wrapper:getattr $vars color]
+    if {[::xmpp::xml::getAttr $attrs type] == "chess"} {
+	if {[::xmpp::xml::isAttr $attrs color]} {
+	    set color [::xmpp::xml::getAttr $attrs color]
 	    switch -- $color {
 		white -
 		black { }
@@ -1799,8 +1803,8 @@
 	    set color white
 	}
 	set var [[namespace current]::invited_dialog \
-		     $connid $from \
-		     [jlib::wrapper:getattr $vars id] \
+		     $xlib $from \
+		     [::xmpp::xml::getAttr $attrs id] \
 		     $color]
     }
     return
@@ -1808,15 +1812,15 @@
 
 hook::add games_board_create_hook [namespace current]::chess::iq_create
 
-proc chess::iq_turn {varname connid from child} {
+proc chess::iq_turn {varname xlib from xml} {
     upvar 2 $varname var
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-    if {[jlib::wrapper:getattr $vars type] == "chess"} {
-	set gid [make_gid $from [jlib::wrapper:getattr $vars id]]
+    if {[::xmpp::xml::getAttr $attrs type] == "chess"} {
+	set gid [make_gid $from [::xmpp::xml::getAttr $attrs id]]
 	if {[exists $gid]} {
-	    set var [[namespace current]::turn_recv $gid $children]
+	    set var [[namespace current]::turn_recv $gid $subels]
 	} else {
 	    set var [list error cancel item-not-found]
 	}
@@ -1828,21 +1832,21 @@
 
 
 # Common games:board part
-proc iq_games_board_create {connid from lang child} {
+proc iq_games_board_create {xlib from xml args} {
     set res [list error cancel feature-not-implemented]
-    hook::run games_board_create_hook res $connid $from $child
+    hook::run games_board_create_hook res $xlib $from $xml
     return $res
 }
 
-iq::register_handler set create games:board \
-    [namespace current]::iq_games_board_create
+::xmpp::iq::register set create games:board \
+		     [namespace current]::iq_games_board_create
 
-proc iq_games_board_turn {connid from lang child} {
+proc iq_games_board_turn {xlib from xml args} {
     set res [list error cancel feature-not-implemented]
-    hook::run games_board_turn_hook res $connid $from $child
+    hook::run games_board_turn_hook res $xlib $from $xml
     return $res
 }
 
-iq::register_handler set turn games:board \
-    [namespace current]::iq_games_board_turn
+::xmpp::iq::register set turn games:board \
+		     [namespace current]::iq_games_board_turn
 

Modified: trunk/tkabber-plugins/debug/debug.tcl
===================================================================
--- trunk/tkabber-plugins/debug/debug.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/debug/debug.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -45,8 +45,7 @@
 			   iface        \
 			   iq           \
 			   jidlink      \
-			   jlib         \
-			   jlib::route  \
+			   xmpp         \
 			   logger       \
 			   login        \
 			   message      \

Modified: trunk/tkabber-plugins/ejabberd/ejabberd.tcl
===================================================================
--- trunk/tkabber-plugins/ejabberd/ejabberd.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/ejabberd/ejabberd.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -29,15 +29,15 @@
 
 proc ejabberd::ask_server_dialog {} {
     global ejabberd_server
-    global ejabberd_connid
+    global ejabberd_xlib
     variable ejabberd_server_list
 
     set gw .ejabberdserver
     catch { destroy $gw }
 
-    if {[llength [jlib::connections]] == 0} return
+    if {[llength [connections]] == 0} return
 
-    set ejabberd_connid [jlib::connection_jid [lindex [jlib::connections] 0]]
+    set ejabberd_xlib [connection_jid [lindex [connections] 0]]
 
     Dialog $gw -title [::msgcat::mc "ejabberd server"] -separator 1 -anchor e \
 	    -default 0 -cancel 1
@@ -58,20 +58,20 @@
     grid $gf.ljid -row 0 -column 0 -sticky e
     grid $gf.jid  -row 0 -column 1 -sticky ew
 
-    if {[llength [jlib::connections]] > 1} {
-	foreach c [jlib::connections] {
-	    lappend connections [jlib::connection_jid $c]
+    if {[llength [connections]] > 1} {
+	foreach c [connections] {
+	    lappend connections [connection_jid $c]
 	}
-	set ejabberd_connid [lindex $connections 0]
+	set ejabberd_xlib [lindex $connections 0]
 
-	label $gf.lconnid -text [::msgcat::mc "Connection:"]
-	ComboBox $gf.connid \
-		 -textvariable ejabberd_connid \
+	label $gf.lxlib -text [::msgcat::mc "Connection:"]
+	ComboBox $gf.xlib \
+		 -textvariable ejabberd_xlib \
 		 -values $connections \
 		 -editable 0
 
-	grid $gf.lconnid -row 1 -column 0 -sticky e
-	grid $gf.connid  -row 1 -column 1 -sticky ew
+	grid $gf.lxlib -row 1 -column 0 -sticky e
+	grid $gf.xlib  -row 1 -column 1 -sticky ew
     }
 
     $gw add -text [::msgcat::mc "Administrate"] -command "[namespace current]::administrate $gw"
@@ -82,7 +82,7 @@
 
 proc ejabberd::administrate {gw} {
     global ejabberd_server
-    global ejabberd_connid
+    global ejabberd_xlib
     variable ejabberd_server_list
 
     destroy $gw
@@ -90,31 +90,20 @@
     set ejabberd_server_list \
 	[update_combo_list $ejabberd_server_list $ejabberd_server 10]
 
-    foreach c [jlib::connections] {
-	if {[jlib::connection_jid $c] == $ejabberd_connid} {
-	    set connid $c
+    foreach c [connections] {
+	if {[connection_jid $c] == $ejabberd_xlib} {
+	    set xlib $c
 	}
     }
 
-    if {![info exists connid]} return
+    if {![info exists xlib]} return
 
-    open_win $ejabberd_server -connection $connid
+    open_win $xlib $ejabberd_server
 }
 
 
-proc ejabberd::open_win {jid args} {
-
-    foreach {key val} $args {
-	switch -- $key {
-	    -connection { set connid $val }
-	}
-    }
-
-    if {![info exists connid]} {
-	return -code error "ejabberd::open_win: -connection is mandatory"
-    }
-
-    set w [win_id ejabberd $connid:$jid]
+proc ejabberd::open_win {xlib jid args} {
+    set w [win_id ejabberd $xlib:$jid]
     if {[winfo exists $w]} {
 	raise_win $w
 	return
@@ -130,7 +119,7 @@
     pack $nb -fill both -expand yes
 
     # Binding $nb, not $w to avoid multiple calls if $w is a toplevel
-    bind $nb <Destroy> [list [namespace current]::cleanup $connid $jid]
+    bind $nb <Destroy> [list [namespace current]::cleanup $xlib $jid]
 
     foreach {page title} \
 	[list main   [::msgcat::mc "Main"] \
@@ -140,43 +129,43 @@
 	      last   [::msgcat::mc "Last Activity"]] {
 	set f [$nb insert end $page -text $title]
 
-	fill_page_$page $f $connid $jid
+	fill_page_$page $f $xlib $jid
     }
     $nb raise main
 }
 
-proc ejabberd::cleanup {connid jid} {
+proc ejabberd::cleanup {xlib jid} {
     variable data
 
-    catch {unset data($connid,$jid,total_users)}
-    catch {unset data($connid,$jid,online_users)}
-    catch {unset data($connid,$jid,running_nodes)}
-    catch {unset data($connid,$jid,stopped_nodes)}
-    catch {unset data($connid,$jid,outgoing_s2s)}
-    catch {unset data($connid,$jid,welcome_subj)}
-    catch {unset data($connid,$jid,welcome_body)}
-    catch {unset data($connid,$jid,reg_watchers)}
-    catch {unset data($connid,$jid,acls)}
-    catch {unset data($connid,$jid,access_rules)}
-    catch {unset data($connid,$jid,last)}
-    catch {unset data($connid,$jid,last_int)}
+    catch {unset data($xlib,$jid,total_users)}
+    catch {unset data($xlib,$jid,online_users)}
+    catch {unset data($xlib,$jid,running_nodes)}
+    catch {unset data($xlib,$jid,stopped_nodes)}
+    catch {unset data($xlib,$jid,outgoing_s2s)}
+    catch {unset data($xlib,$jid,welcome_subj)}
+    catch {unset data($xlib,$jid,welcome_body)}
+    catch {unset data($xlib,$jid,reg_watchers)}
+    catch {unset data($xlib,$jid,acls)}
+    catch {unset data($xlib,$jid,access_rules)}
+    catch {unset data($xlib,$jid,last)}
+    catch {unset data($xlib,$jid,last_int)}
 }
 
-proc ejabberd::add_grid_record {connid jid info name desc row} {
+proc ejabberd::add_grid_record {xlib jid info name desc row} {
     label $info.l$name -text $desc
-    label $info.v$name -textvariable [namespace current]::data($connid,$jid,$name)
+    label $info.v$name -textvariable [namespace current]::data($xlib,$jid,$name)
     grid $info.l$name -row $row -column 0 -sticky e
     grid $info.v$name -row $row -column 1 -sticky w
 }
 
-proc ejabberd::add_grid_edit {connid jid info name desc row} {
+proc ejabberd::add_grid_edit {xlib jid info name desc row} {
     label $info.l$name -text $desc
-    entry $info.v$name -textvariable [namespace current]::data($connid,$jid,$name)
+    entry $info.v$name -textvariable [namespace current]::data($xlib,$jid,$name)
     grid $info.l$name -row $row -column 0 -sticky e
     grid $info.v$name -row $row -column 1 -sticky we
 }
 
-proc ejabberd::add_grid_text {connid jid info name desc row} {
+proc ejabberd::add_grid_text {xlib jid info name desc row} {
     label $info.l$name -text $desc
     set sw [ScrolledWindow $info.s$name -scrollbar vertical]
     text $info.v$name -height 6 -wrap word
@@ -185,7 +174,7 @@
     grid $info.s$name -row $row -column 1 -sticky we
 }
 
-proc ejabberd::fill_page_main {f connid jid} {
+proc ejabberd::fill_page_main {f xlib jid} {
     variable data
 
     set info [frame $f.info]
@@ -193,49 +182,48 @@
 
     grid columnconfigure $info 1 -weight 2
 
-    add_grid_record $connid $jid $info total_users   [::msgcat::mc "Registered users:"] 0
-    add_grid_record $connid $jid $info online_users  [::msgcat::mc "Online users:"]     1
-    add_grid_record $connid $jid $info running_nodes [::msgcat::mc "Running nodes:"]    2
-    add_grid_record $connid $jid $info stopped_nodes [::msgcat::mc "Stopped nodes:"]    3
-    add_grid_record $connid $jid $info outgoing_s2s  [::msgcat::mc "Outgoing S2S:"]     4
+    add_grid_record $xlib $jid $info total_users   [::msgcat::mc "Registered users:"] 0
+    add_grid_record $xlib $jid $info online_users  [::msgcat::mc "Online users:"]     1
+    add_grid_record $xlib $jid $info running_nodes [::msgcat::mc "Running nodes:"]    2
+    add_grid_record $xlib $jid $info stopped_nodes [::msgcat::mc "Stopped nodes:"]    3
+    add_grid_record $xlib $jid $info outgoing_s2s  [::msgcat::mc "Outgoing S2S:"]     4
 
     set reload \
 	[button $f.reload -text [::msgcat::mc "Reload"] \
-	     -command [list [namespace current]::reload_page_main $f $connid $jid]]
+	     -command [list [namespace current]::reload_page_main $f $xlib $jid]]
     pack $reload -side bottom -anchor e
-    reload_page_main $f $connid $jid
+    reload_page_main $f $xlib $jid
 }
 
-proc ejabberd::reload_page_main {f connid jid} {
-    jlib::send_iq get \
-	[jlib::wrapper:createtag info \
-	     -vars [list xmlns $::NS_ECONFIGURE]] \
+proc ejabberd::reload_page_main {f xlib jid} {
+    ::xmpp::sendIQ $xlib get \
+	-query [::xmpp::xml::create info \
+			-xmlns $::NS_ECONFIGURE] \
 	-to $jid \
-	-connection $connid \
-	-command [list [namespace current]::parse_main_info $f $connid $jid]
+	-command [list [namespace current]::parse_main_info $f $xlib $jid]
 }
 
-proc ejabberd::parse_main_info {f connid jid res child} {
+proc ejabberd::parse_main_info {f xlib jid status xml} {
     variable data
 
-    if {![cequal $res OK]} {
+    if {![string equal $status ok]} {
 	return
     }
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-    set data($connid,$jid,total_users)   [jlib::wrapper:getattr $vars registered-users]
-    set data($connid,$jid,online_users)  [jlib::wrapper:getattr $vars online-users]
-    set data($connid,$jid,running_nodes) [jlib::wrapper:getattr $vars running-nodes]
-    set data($connid,$jid,stopped_nodes) [jlib::wrapper:getattr $vars stopped-nodes]
-    set data($connid,$jid,outgoing_s2s)  [jlib::wrapper:getattr $vars outgoing-s2s-servers]
+    set data($xlib,$jid,total_users)   [::xmpp::xml::getAttr $attrs registered-users]
+    set data($xlib,$jid,online_users)  [::xmpp::xml::getAttr $attrs online-users]
+    set data($xlib,$jid,running_nodes) [::xmpp::xml::getAttr $attrs running-nodes]
+    set data($xlib,$jid,stopped_nodes) [::xmpp::xml::getAttr $attrs stopped-nodes]
+    set data($xlib,$jid,outgoing_s2s)  [::xmpp::xml::getAttr $attrs outgoing-s2s-servers]
 }
 
 
-proc ejabberd::fill_page_nodes {f connid jid} {
+proc ejabberd::fill_page_nodes {f xlib jid} {
 }
 
-proc ejabberd::fill_page_reg {f connid jid} {
+proc ejabberd::fill_page_reg {f xlib jid} {
     variable data
 
     set info [frame $f.info]
@@ -243,36 +231,35 @@
 
     grid columnconfigure $info 1 -weight 2
 
-    add_grid_edit $connid $jid $info welcome_subj [::msgcat::mc "Welcome message subject:"] 0
-    add_grid_text $connid $jid $info welcome_body [::msgcat::mc "Welcome message body:"]    1
-    add_grid_text $connid $jid $info reg_watchers [::msgcat::mc "Registration watchers:"]   2
+    add_grid_edit $xlib $jid $info welcome_subj [::msgcat::mc "Welcome message subject:"] 0
+    add_grid_text $xlib $jid $info welcome_body [::msgcat::mc "Welcome message body:"]    1
+    add_grid_text $xlib $jid $info reg_watchers [::msgcat::mc "Registration watchers:"]   2
 
 
     #set set_b [button $f.set -text [::msgcat::mc "Set"]]
     #pack $set_b -side right -anchor se
     set reload \
 	[button $f.reload -text [::msgcat::mc "Reload"] \
-	     -command [list [namespace current]::reload_page_reg $f $connid $jid]]
+	     -command [list [namespace current]::reload_page_reg $f $xlib $jid]]
     pack $reload -side right -anchor se
-    reload_page_reg $f $connid $jid
+    reload_page_reg $f $xlib $jid
 }
 
-proc ejabberd::reload_page_reg {f connid jid} {
-    jlib::send_iq get \
-	[jlib::wrapper:createtag welcome-message \
-	     -vars [list xmlns $::NS_ECONFIGURE]] \
+proc ejabberd::reload_page_reg {f xlib jid} {
+    ::xmpp::sendIQ $xlib get \
+	-query [::xmpp::xml::create welcome-message \
+			-xmlns $::NS_ECONFIGURE] \
 	-to $jid \
-	-connection $connid \
-	-command [list [namespace current]::parse_welcome_message $f $connid $jid]
-    jlib::send_iq get \
-	[jlib::wrapper:createtag registration-watchers \
-	     -vars [list xmlns $::NS_ECONFIGURE]] \
+	-command [list [namespace current]::parse_welcome_message $f $xlib $jid]
+
+    ::xmpp::sendIQ $xlib get \
+	-query [::xmpp::xml::create registration-watchers \
+			-xmlns $::NS_ECONFIGURE] \
 	-to $jid \
-	-connection $connid \
-	-command [list [namespace current]::parse_registration_watchers $f $connid $jid]
+	-command [list [namespace current]::parse_registration_watchers $f $xlib $jid]
 }
 
-proc ejabberd::parse_welcome_message {f connid jid res child} {
+proc ejabberd::parse_welcome_message {f xlib jid status xml} {
     variable data
 
     set wsubj $f.info.vwelcome_subj
@@ -282,32 +269,32 @@
 	return
     }
 
-    if {![cequal $res OK]} {
+    if {![string equal $status ok]} {
 	return
     }
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     set subj ""
     set body ""
 
-    foreach ch $children {
-	jlib::wrapper:splitxml $ch tag1 vars1 isempty1 chdata1 children1
+    foreach subel $subels {
+	::xmpp::xml::split $xml stag sxmlns sattrs scdata ssubels
 
-	switch -- $tag1 {
-	    subject {set subj $chdata1}
-	    body {set body $chdata1}
+	switch -- $stag {
+	    subject {set subj $scdata}
+	    body {set body $scdata}
 	}
     }
 
-    set data($connid,$jid,welcome_subj) $subj
-    set data($connid,$jid,welcome_body) $body
+    set data($xlib,$jid,welcome_subj) $subj
+    set data($xlib,$jid,welcome_body) $body
     $wbody delete 0.0 end
     $wbody insert 0.0 $body
 }
 
 
-proc ejabberd::parse_registration_watchers {f connid jid res child} {
+proc ejabberd::parse_registration_watchers {f xlib jid status xml} {
     variable data
 
     set wwatchers $f.info.vreg_watchers
@@ -316,30 +303,30 @@
 	return
     }
 
-    if {![cequal $res OK]} {
+    if {![string equal $status ok]} {
 	return
     }
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     set jids {}
 
-    foreach ch $children {
-	jlib::wrapper:splitxml $ch tag1 vars1 isempty1 chdata1 children1
+    foreach subel $subels {
+	::xmpp::xml::split $xml stag sxmlns sattrs scdata ssubels
 
 	switch -- $tag1 {
-	    jid {lappend jids $chdata1}
+	    jid {lappend jids $scdata}
 	}
     }
 
-    set data($connid,$jid,reg_watchers) $jids
+    set data($xlib,$jid,reg_watchers) $jids
     $wwatchers delete 0.0 end
     $wwatchers insert 0.0 [join $jids \n]
 }
 
 
 
-proc ejabberd::fill_page_access {f connid jid} {
+proc ejabberd::fill_page_access {f xlib jid} {
     variable data
 
     set info [frame $f.info]
@@ -347,36 +334,35 @@
 
     grid columnconfigure $info 1 -weight 2
 
-    add_grid_text $connid $jid $info acls         [::msgcat::mc "ACLs:"]         0
-    add_grid_text $connid $jid $info access_rules [::msgcat::mc "Access rules:"] 1
+    add_grid_text $xlib $jid $info acls         [::msgcat::mc "ACLs:"]         0
+    add_grid_text $xlib $jid $info access_rules [::msgcat::mc "Access rules:"] 1
 
 
     #set set_b [button $f.set -text [::msgcat::mc "Set"]]
     #pack $set_b -side right -anchor se
     set reload \
 	[button $f.reload -text [::msgcat::mc "Reload"] \
-	     -command [list [namespace current]::reload_page_access $f $connid $jid]]
+	     -command [list [namespace current]::reload_page_access $f $xlib $jid]]
     pack $reload -side right -anchor se
 
-    reload_page_access $f $connid $jid
+    reload_page_access $f $xlib $jid
 }
 
-proc ejabberd::reload_page_access {f connid jid} {
-    jlib::send_iq get \
-	[jlib::wrapper:createtag acls \
-	     -vars [list xmlns $::NS_ECONFIGURE]] \
+proc ejabberd::reload_page_access {f xlib jid} {
+    ::xmpp::sendIQ $xlib get \
+	-query [::xmpp::xml::create acls \
+			-xmlns $::NS_ECONFIGURE] \
 	-to $jid \
-	-connection $connid \
-	-command [list [namespace current]::parse_access acls $f $connid $jid]
-    jlib::send_iq get \
-	[jlib::wrapper:createtag access \
-	     -vars [list xmlns $::NS_ECONFIGURE]] \
+	-command [list [namespace current]::parse_access acls $f $xlib $jid]
+
+    ::xmpp::sendIQ $xlib get \
+	-query [::xmpp::xml::create access \
+			-xmlns $::NS_ECONFIGURE] \
 	-to $jid \
-	-connection $connid \
-	-command [list [namespace current]::parse_access access_rules $f $connid $jid]
+	-command [list [namespace current]::parse_access access_rules $f $xlib $jid]
 }
 
-proc ejabberd::parse_access {var f connid jid res child} {
+proc ejabberd::parse_access {var f xlib jid status xml} {
     variable data
 
     set w $f.info.v$var
@@ -385,19 +371,19 @@
 	return
     }
 
-    if {![cequal $res OK]} {
+    if {![string equal $status ok]} {
 	return
     }
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-    set data($connid,$jid,$var) $chdata
+    set data($xlib,$jid,$var) $cdata
     $w delete 0.0 end
-    $w insert 0.0 $chdata
+    $w insert 0.0 $cdata
 }
 
 
-proc ejabberd::fill_page_last {f connid jid} {
+proc ejabberd::fill_page_last {f xlib jid} {
     variable data
 
     set info [frame $f.info]
@@ -405,8 +391,8 @@
 
     #grid columnconfigure $info 1 -weight 2
 
-    #add_grid_text $connid $jid $info acls         [::msgcat::mc "ACLs:"]         0
-    #add_grid_text $connid $jid $info access_rules [::msgcat::mc "Access rules:"] 1
+    #add_grid_text $xlib $jid $info acls         [::msgcat::mc "ACLs:"]         0
+    #add_grid_text $xlib $jid $info access_rules [::msgcat::mc "Access rules:"] 1
 
     label $info.lplot \
 	-text [::msgcat::mc \
@@ -418,31 +404,30 @@
     set plot [canvas $info.plot -background white]
     $sw setwidget $plot
 
-    set data($connid,$jid,last) {}
-    set data($connid,$jid,last_int) 0
+    set data($xlib,$jid,last) {}
+    set data($xlib,$jid,last_int) 0
 
     set integral \
 	[checkbutton $f.integral -text [::msgcat::mc "Integral"] \
-	     -variable [namespace current]::data($connid,$jid,last_int) \
-	     -command [list [namespace current]::redraw_last $f $connid $jid]]
+	     -variable [namespace current]::data($xlib,$jid,last_int) \
+	     -command [list [namespace current]::redraw_last $f $xlib $jid]]
     pack $integral -side left -anchor se
 
     set reload \
 	[button $f.reload -text [::msgcat::mc "Reload"] \
-	     -command [list [namespace current]::reload_page_last $f $connid $jid]]
+	     -command [list [namespace current]::reload_page_last $f $xlib $jid]]
     pack $reload -side right -anchor se
 }
 
-proc ejabberd::reload_page_last {f connid jid} {
-    jlib::send_iq get \
-	[jlib::wrapper:createtag last \
-	     -vars [list xmlns $::NS_ECONFIGURE]] \
+proc ejabberd::reload_page_last {f xlib jid} {
+    ::xmpp::sendIQ $xlib get \
+	-query [::xmpp::xml::create last \
+			-xmlns $::NS_ECONFIGURE] \
 	-to $jid \
-	-connection $connid \
-	-command [list [namespace current]::parse_last $f $connid $jid]
+	-command [list [namespace current]::parse_last $f $xlib $jid]
 }
 
-proc ejabberd::parse_last {f connid jid res child} {
+proc ejabberd::parse_last {f xlib jid status xml} {
     variable data
 
     set plot $f.info.plot
@@ -451,25 +436,25 @@
 	return
     }
 
-    if {![cequal $res OK]} {
+    if {![string equal $status ok]} {
 	return
     }
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-    set data($connid,$jid,last) $chdata
+    set data($xlib,$jid,last) $cdata
 
-    redraw_last $f $connid $jid
+    redraw_last $f $xlib $jid
 }
 
-proc ejabberd::redraw_last {f connid jid} {
+proc ejabberd::redraw_last {f xlib jid} {
     variable data
 
     set plot $f.info.plot
 
     set maxdays 0
 
-    foreach t $data($connid,$jid,last) {
+    foreach t $data($xlib,$jid,last) {
 	set days [expr {$t / (60*60*24)}]
 	if {$days > $maxdays} {set maxdays $days}
 
@@ -493,7 +478,7 @@
 	    set v 0
 	}
 
-	if {$data($connid,$jid,last_int)} {
+	if {$data($xlib,$jid,last_int)} {
 	    incr val $v
 	} else {
 	    set val $v

Modified: trunk/tkabber-plugins/floatinglog/floatinglog.tcl
===================================================================
--- trunk/tkabber-plugins/floatinglog/floatinglog.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/floatinglog/floatinglog.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -145,12 +145,12 @@
     }
 }
 
-proc floatinglog::left_double_click_message {connid jid type} {
+proc floatinglog::left_double_click_message {xlib jid type} {
     switch -- $type {
 	groupchat {
 	}
 	chat {
-	    chat::open_to_user $connid $jid
+	    chat::open_to_user $xlib $jid
 	}
 	message {
 	    #message::send_dialog -to $jid
@@ -158,7 +158,7 @@
     }
 }
 
-proc floatinglog::add_text {text {from ""} {connid ""} {type ""} \
+proc floatinglog::add_text {text {from ""} {xlib ""} {type ""} \
 				 {is_subject ""} {subject ""}} {
     variable options
     variable id
@@ -179,9 +179,9 @@
 
     incr id
     if {$options(simple_show_scheme)} {
-	add_text_scheme_simple $text $from $connid $type $is_subject $subject
+	add_text_scheme_simple $text $from $xlib $type $is_subject $subject
     } else {
-	add_text_scheme_01 $text $from $connid $type $is_subject $subject
+	add_text_scheme_01 $text $from $xlib $type $is_subject $subject
     }
     
     wm deiconify $winname
@@ -189,14 +189,14 @@
     set_window
 }
 
-proc floatinglog::add_text_scheme_simple {body from connid type is_subject subject} {
+proc floatinglog::add_text_scheme_simple {body from xlib type is_subject subject} {
     variable options
     variable id
     variable winname
     variable logfileId
 
     if { $from != "" } {
-	if {[catch {::chat::get_nick $connid $from $type} nick]} {
+	if {[catch {::chat::get_nick $xlib $from $type} nick]} {
 	    set nick [chat::get_nick $from $type]
 	}
 	if {!$options(show_message_body)} {
@@ -223,17 +223,17 @@
 			       -side bottom -fill x -padx 2 -pady 2
 	}
 
-	if {($connid != "") && ($from != "") && ($type != "")} {
+	if {($xlib != "") && ($from != "") && ($type != "")} {
 	    bind $message_name <Double-ButtonPress-1> \
 		 +[list [namespace current]::left_double_click_message \
-			$connid [double% $from] [double% $type]]
+			$xlib [double% $from] [double% $type]]
 	}
 	after [expr {$options(livetime) * 1000}] \
 	      [namespace current]::del_text "$message_name"
     }
 } 
 
-proc floatinglog::add_text_scheme_01 {text from connid type is_subject subject} {
+proc floatinglog::add_text_scheme_01 {text from xlib type is_subject subject} {
     variable options
     variable id
     variable winname
@@ -252,7 +252,7 @@
 		-relief solid -bd 1 -padx 3 -pady 3
     }
     if {$from != ""} {
-	if {[catch {::chat::get_nick $connid $from $type} nick]} {
+	if {[catch {::chat::get_nick $xlib $from $type} nick]} {
 	    set nick [chat::get_nick $from $type]
 	}
 	if {$nick != "" } {
@@ -286,16 +286,16 @@
 	}
     }
 
-    if {($connid != "") && ($from != "") && ($type != "")} {
+    if {($xlib != "") && ($from != "") && ($type != "")} {
 	if {$from != ""} { 
 	    bind $message_name_head <Double-ButtonPress-1> \
 		 +[list [namespace current]::left_double_click_message \
-			$connid [double% $from] [double% $type]]
+			$xlib [double% $from] [double% $type]]
 	}
 	if {$text != "" } { 
 	    bind $message_name <Double-ButtonPress-1> \
 		 +[list [namespace current]::left_double_click_message \
-			$connid [double% $from] [double% $type]]
+			$xlib [double% $from] [double% $type]]
 	}
     }
     if {$text != ""} {
@@ -335,7 +335,7 @@
     }
 }
 
-proc floatinglog::process_message {connid from id type is_subject \
+proc floatinglog::process_message {xlib from id type is_subject \
 				   subject body err thread priority x} {
     variable options
 
@@ -346,15 +346,15 @@
 	    }
 	    groupchat { 
 		if {!$options(show_groupchat)} return
-		if {[is_delayed $x]} return
+		if {[::xmpp::delay::exists $x]} return
 		if {![catch {
-		    ::plugins::mucignore::is_ignored $connid $from $type
+		    ::plugins::mucignore::is_ignored $xlib $from $type
 		} ignore] && $ignore != ""} return
 		if {$options(show_only_personal)} {
-		    set chatid [chat::chatid $connid \
+		    set chatid [chat::chatid $xlib \
 			[node_and_server_from_jid $from]]
 		    set myjid [chat::our_jid $chatid]
-		    set mynick [chat::get_nick $connid $myjid $type]
+		    set mynick [chat::get_nick $xlib $myjid $type]
 		    if {![check_message $mynick $body]} return
 		}
 	    }
@@ -364,25 +364,12 @@
 	}
 
 	catch {
-	    add_text $body $from $connid $type $is_subject $subject
+	    add_text $body $from $xlib $type $is_subject $subject
 	}
     }
 }
 
 
-proc floatinglog::is_delayed {xml} {
-    foreach xelem $xml {
-	::jlib::wrapper:splitxml $xelem tag vars isempty chdata children
-	switch -- [::jlib::wrapper:getattr $vars xmlns] {
-	    urn:xmpp:delay -
-	    jabber:x:delay {
-		return 1
-	    }
-	}
-    }
-    return 0
-}
-
 proc floatinglog::set_window {args} {
     variable options
     variable winname

Modified: trunk/tkabber-plugins/georoster/georoster.tcl
===================================================================
--- trunk/tkabber-plugins/georoster/georoster.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/georoster/georoster.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -238,7 +238,7 @@
 proc georoster::drop_jid {c target source x y op type data} {
     variable georoster
 
-    lassign $data connid jid
+    lassign $data xlib jid
 
     set x [$c canvasx [expr {$x - [winfo rootx $c]}]]
     set y [$c canvasy [expr {$y - [winfo rooty $c]}]]
@@ -246,7 +246,7 @@
     set lo [lo $x $y]
     set la [la $x $y]
 
-    update_jid $c $connid $jid $la $lo
+    update_jid $c $xlib $jid $la $lo
 }
 
 ###############################################################################
@@ -260,25 +260,25 @@
 
     redraw_cities $c
 
-    foreach nconnid [array names georoster jids,*] {
-	set connid [string range $nconnid 5 end]
+    foreach nxlib [array names georoster jids,*] {
+	set xlib [string range $nxlib 5 end]
 
-	foreach jid $georoster(jids,$connid) {
-	    set lo $georoster(lo,$connid,$jid)
-	    set la $georoster(la,$connid,$jid)
+	foreach jid $georoster(jids,$xlib) {
+	    set lo $georoster(lo,$xlib,$jid)
+	    set la $georoster(la,$xlib,$jid)
 	    set x [x $lo $la]
 	    set y [y $lo $la]
 
 	    set icon roster/user/unavailable
-	    catch {set icon [ifacetk::roster::get_jid_icon $connid $jid]}
+	    catch {set icon [ifacetk::roster::get_jid_icon $xlib $jid]}
 
 	    set tag [jid_to_tag $jid]
 
 	    $c create image $x $y -image $icon \
-		-tags [list icon connid$connid jid$tag] -anchor c
+		-tags [list icon xlib$xlib jid$tag] -anchor c
 
 	    set doubledjid [double% $jid]
-	    set jids [ifacetk::roster::get_jids_of_user $connid $jid]
+	    set jids [ifacetk::roster::get_jids_of_user $xlib $jid]
 
 	    if {[llength $jids] > 0} {
 		set doubledjids [double% $jids]
@@ -302,12 +302,12 @@
 	    $c bind jid$tag <Any-Enter> \
 		+[list [namespace current]::set_balloon_text \
 		      balloon::set_text \
-		      $connid $doubledjid %X %Y]
+		      $xlib $doubledjid %X %Y]
 
 	    $c bind jid$tag <Any-Motion> \
 		[list [namespace current]::set_balloon_text \
 		     balloon::on_mouse_move \
-		     $connid $doubledjid %X %Y]
+		     $xlib $doubledjid %X %Y]
 
 	    $c bind jid$tag <Any-Leave> {+
 		balloon::destroy
@@ -318,7 +318,7 @@
 
 ###############################################################################
 
-proc georoster::set_balloon_text {op connid jid sx sy} {
+proc georoster::set_balloon_text {op xlib jid sx sy} {
     set c .georoster.c
     set x [$c canvasx [expr {$sx - [winfo rootx $c]}]]
     set y [$c canvasy [expr {$sy - [winfo rooty $c]}]]
@@ -344,23 +344,23 @@
 
 	if {![lcontain $tags icon]} continue
 
-	set connid [crange [lmatch -glob $tags connid*] 6 end]
+	set xlib [crange [lmatch -glob $tags xlib*] 6 end]
 
 	set jidtag [crange [lmatch -glob $tags jid*] 3 end]
 	set jid [tag_to_jid $jidtag]
 
 	set jids {}
-	foreach j [ifacetk::roster::get_jids_of_user $connid $jid] {
-	    lappend jids [list $connid $j]
+	foreach j [ifacetk::roster::get_jids_of_user $xlib $jid] {
+	    lappend jids [list $xlib $j]
 	}
 
 	if {[llength $jids] == 0} {
-	    if {[catch { list [list $connid $jid] } jids]} {
+	    if {[catch { list [list $xlib $jid] } jids]} {
 		set jids {}
 	    }
 	    if {$ifacetk::roster::use_aliases && [info exists roster::aliases($jid)]} {
 		foreach j $roster::aliases($jid) {
-		    lappend jids [list $connid $j]
+		    lappend jids [list $xlib $j]
 		}
 	    }
 	}
@@ -372,11 +372,11 @@
     set text ""
     set i 0
     foreach cj $all_jids {
-	lassign $cj connid j
+	lassign $cj xlib j
 	append text "\n"
-	append text [::msgcat::mc "Connection: %s" [jlib::connection_jid $connid]]
+	append text [::msgcat::mc "Connection: %s" [connection_jid $xlib]]
 	append text "\n"
-	append text [ifacetk::roster::user_popup_info $connid $j $i]
+	append text [ifacetk::roster::user_popup_info $xlib $j $i]
 	incr i
     }
     set text [string trimleft $text "\n"]
@@ -390,12 +390,12 @@
 
 ###############################################################################
 
-proc georoster::presence_change {connid from type x args} {
+proc georoster::presence_change {xlib from type x args} {
     variable options
     variable georoster
 
-    if {![info exists georoster(jids,$connid)]} {
-	set georoster(jids,$connid) {}
+    if {![info exists georoster(jids,$xlib)]} {
+	set georoster(jids,$xlib) {}
     }
 
     set jid [node_and_server_from_jid $from]
@@ -411,8 +411,8 @@
 
 	unavailable {
 	    if {!$options(show_last_known)} {
-		if {[set x [lsearch -exact $georoster(jids,$connid) $jid]] >= 0} {
-		    set georoster(jids,$connid) [lreplace $georoster(jids,$connid) $x $x]
+		if {[set x [lsearch -exact $georoster(jids,$xlib) $jid]] >= 0} {
+		    set georoster(jids,$xlib) [lreplace $georoster(jids,$xlib) $x $x]
 		}
 		return
 	    }
@@ -427,15 +427,14 @@
     }
 
     if {($options(check_vcard)) \
-	    && ([lsearch -exact $georoster(jids,$connid) $jid] < 0) \
+	    && ([lsearch -exact $georoster(jids,$xlib) $jid] < 0) \
 	    && ([string compare conference \
-			[lindex [roster::get_category_and_subtype $connid \
+			[lindex [roster::get_category_and_subtype $xlib \
 					 $jid] 0]])} {
-	jlib::send_iq get \
-	    [jlib::wrapper:createtag vCard -vars [list xmlns vcard-temp]] \
+	::xmpp::sendIQ $xlib get \
+	    -query [::xmpp::xml::create vCard -xmlns vcard-temp] \
 	    -to $to \
-	    -connection $connid \
-	    -command [list [namespace current]::parse_vcard .georoster.c $connid $jid]
+	    -command [list [namespace current]::parse_vcard .georoster.c $xlib $jid]
     }
 
     if {$options(automatic)} {
@@ -448,45 +447,43 @@
 
 ###############################################################################
 
-proc georoster::parse_vcard {w connid jid res child} {
+proc georoster::parse_vcard {w xlib jid status xml} {
     variable geo3166
     variable georoster
     variable options
 
-    if {![cequal $res OK]} {
+    if {![cequal $status ok]} {
 	return
     }
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     array set info [list CTRY "" COUNTRY ""]
-    foreach item $children {
-	jlib::wrapper:splitxml $item tag vars isempty chdata children
+    foreach item $subels {
+	::xmpp::xml::split $item tag xmlns attrs cdata subels
 
 	switch -- $tag {
 	    ADR {
-		foreach item $children {
-		    jlib::wrapper:splitxml $item tag vars isempty chdata \
-					   children
-		    array set info [list $tag [string trim $chdata]]
+		foreach item $subels {
+		    ::xmpp::xml::split $item tag xmlns attrs cdata subels
+		    array set info [list $tag [string trim $cdata]]
 		}
 	    }
 
 	    EMAIL {
-		set georoster(email,$connid,$jid) [string trim $chdata]
+		set georoster(email,$xlib,$jid) [string trim $cdata]
 	    }
 
 	    GEO {
-		foreach item $children {
-		    jlib::wrapper:splitxml $item tag vars isempty chdata \
-					   children
-		    array set info [list $tag [string trim $chdata]]
+		foreach item $subels {
+		    ::xmpp::xml::split $item tag xmlns attrs cdata subels
+		    array set info [list $tag [string trim $chata]]
 		}
 		if {([info exists info(LAT)]) \
 			&& ([string is double -strict $info(LAT)]) \
 			&& ([info exists info(LON)]) \
 			&& ([string is double -strict $info(LON)])} {
-		    update_jid $w $connid $jid $info(LAT) $info(LON)
+		    update_jid $w $xlib $jid $info(LAT) $info(LON)
 		    return
 		}
 	    }
@@ -499,8 +496,8 @@
     unset info(CTRY)
     if {[cequal $info(COUNTRY) ""]} {
 	set args [list $jid]
-	if {[info exists georoster(email,$connid,$jid)]} {
-	    lappend args $georoster(email,$connid,$jid)
+	if {[info exists georoster(email,$xlib,$jid)]} {
+	    lappend args $georoster(email,$xlib,$jid)
 	}
 	foreach addr $args {
 	    if {([set x [string last . $addr]] > 0) \
@@ -542,8 +539,8 @@
 		      http://www.census.gov/cgi-bin/gazetteer?$query \
 		      -timeout 300 \
 		      -command [list [namespace current]::parse_vcard_aux $w \
-				     $connid $jid [array get info]] }]} {
-		    debugmsg georoster "async http: $connid $jid"
+				     $xlib $jid [array get info]] }]} {
+		    debugmsg georoster "async http: $xlib $jid"
 		    return
 		}
 	    }
@@ -553,13 +550,13 @@
 	}
     }
 
-    parse_vcard_aux2 $w $connid $jid [array get info]
+    parse_vcard_aux2 $w $xlib $jid [array get info]
 }
 
 ###############################################################################
 
-proc georoster::parse_vcard_aux {w connid jid xinfo httpT} {
-    debugmsg georoster "  aux http: $connid $jid"
+proc georoster::parse_vcard_aux {w xlib jid xinfo httpT} {
+    debugmsg georoster "  aux http: $xlib $jid"
 
     set data ""
     if {![cequal [set status [::http::status $httpT]] ok]} {
@@ -587,21 +584,21 @@
 			[set la [string range $data 0 [expr $x-1]]]]) \
 	    && ([string is double -strict \
 			[set lo [string range $data [expr $x+5] end]]])} {
-	debugmsg georoster " gazetteer: $connid $jid $la $lo"
+	debugmsg georoster " gazetteer: $xlib $jid $la $lo"
 
-	update_jid $w $connid $jid $la $lo
+	update_jid $w $xlib $jid $la $lo
 	return
     }
 
-    parse_vcard_aux2 $w $connid $jid $xinfo
+    parse_vcard_aux2 $w $xlib $jid $xinfo
 }
 
 ###############################################################################
 
-proc georoster::parse_vcard_aux2 {w connid jid xinfo} {
+proc georoster::parse_vcard_aux2 {w xlib jid xinfo} {
     variable options
 
-    debugmsg georoster "     vcard: $connid $jid $xinfo"
+    debugmsg georoster "     vcard: $xlib $jid $xinfo"
 
     array set info $xinfo
 
@@ -647,8 +644,8 @@
 					    [set lo [lindex $elems 3]]])} {
 			    close $fd
 
-			    debugmsg georoster "    coords: $connid $jid $la $lo"
-			    update_jid $w $connid $jid $la $lo
+			    debugmsg georoster "    coords: $xlib $jid $la $lo"
+			    update_jid $w $xlib $jid $la $lo
 			    return
 			}
 
@@ -662,21 +659,21 @@
 	close $fd
     }
 
-    hook::run georoster:locate_hook $connid $jid \
-	[list [namespace current]::update_jid $w $connid $jid]
+    hook::run georoster:locate_hook $xlib $jid \
+	[list [namespace current]::update_jid $w $xlib $jid]
 }
 
 ###############################################################################
 
-proc georoster::update_jid {w connid jid latitude longitude} {
+proc georoster::update_jid {w xlib jid latitude longitude} {
     variable georoster
 
-    if {![lcontain $georoster(jids,$connid) $jid]} {
-	lappend georoster(jids,$connid) $jid
+    if {![lcontain $georoster(jids,$xlib) $jid]} {
+	lappend georoster(jids,$xlib) $jid
     }
 
-    set georoster(la,$connid,$jid) $latitude
-    set georoster(lo,$connid,$jid) $longitude
+    set georoster(la,$xlib,$jid) $latitude
+    set georoster(lo,$xlib,$jid) $longitude
     redraw $w
 }
 
@@ -696,8 +693,8 @@
 	set move(lastx) $x
 	set move(lasty) $y
 
-	set connid [crange [lmatch -glob $tags connid*] 6 end]
-	set move(connid) $connid
+	set xlib [crange [lmatch -glob $tags xlib*] 6 end]
+	set move(xlib) $xlib
 
 	set jidtag [crange [lmatch -glob $tags jid*] 3 end]
 	set jid [tag_to_jid $jidtag]
@@ -715,15 +712,15 @@
     variable status
 
     if {[info exists move(jid)]} {
-	set ctag connid$move(connid)
+	set ctag xlib$move(xlib)
 	set tag jid[jid_to_tag $move(jid)]
 	set x [$c canvasx $x]
 	set y [$c canvasy $y]
 
-	set connid $move(connid)
+	set xlib $move(xlib)
 	set jid $move(jid)
-	set lo $georoster(lo,$connid,$jid)
-	set la $georoster(la,$connid,$jid)
+	set lo $georoster(lo,$xlib,$jid)
+	set la $georoster(la,$xlib,$jid)
 	set oldx [x $lo $la]
 	set oldy [y $lo $la]
 
@@ -749,16 +746,16 @@
     variable georoster
 
     if {[info exists move(jid)]} {
-	set ctag connid$move(connid)
+	set ctag xlib$move(xlib)
 	set tag jid[jid_to_tag $move(jid)]
 
-	set connid $move(connid)
+	set xlib $move(xlib)
 	set jid $move(jid)
 	set x $move(lastx)
 	set y $move(lasty)
 
-	set lo $georoster(lo,$connid,$jid)
-	set la $georoster(la,$connid,$jid)
+	set lo $georoster(lo,$xlib,$jid)
+	set la $georoster(la,$xlib,$jid)
 	set oldx [x $lo $la]
 	set oldy [y $lo $la]
 
@@ -768,7 +765,7 @@
 	set newlo [lo $newx $newy]
 	set newla [la $newx $newy]
 
-	update_jid $c $connid $jid $newla $newlo
+	update_jid $c $xlib $jid $newla $newlo
     }
 }
 
@@ -783,13 +780,13 @@
 	set x [$c canvasx $x]
 	set y [$c canvasy $y]
 
-	set connid [crange [lmatch -glob $tags connid*] 6 end]
+	set xlib [crange [lmatch -glob $tags xlib*] 6 end]
 
 	set jidtag [crange [lmatch -glob $tags jid*] 3 end]
 	set jid [tag_to_jid $jidtag]
 
-	set idx [lsearch -exact $georoster(jids,$connid) $jid]
-	set georoster(jids,$connid) [lreplace $georoster(jids,$connid) $idx $idx]
+	set idx [lsearch -exact $georoster(jids,$xlib) $jid]
+	set georoster(jids,$xlib) [lreplace $georoster(jids,$xlib) $idx $idx]
 
 	redraw $c
     }
@@ -800,35 +797,34 @@
 proc georoster::store {} {
     variable georoster
 
-    foreach nconnid [array names georoster jids,*] {
-	set connid [string range $nconnid 5 end]
+    foreach nxlib [array names georoster jids,*] {
+	set xlib [string range $nxlib 5 end]
 
-	set items($connid) {}
+	set items($xlib) {}
 
-	foreach jid $georoster(jids,$connid) {
-	    set lo $georoster(lo,$connid,$jid)
-	    set la $georoster(la,$connid,$jid)
+	foreach jid $georoster(jids,$xlib) {
+	    set lo $georoster(lo,$xlib,$jid)
+	    set la $georoster(la,$xlib,$jid)
 
-	    lappend items($connid) [jlib::wrapper:createtag item \
-				    -vars [list jid $jid lo $lo la $la]]
+	    lappend items($xlib) [::xmpp::xml::create item \
+					-attrs [list jid $jid lo $lo la $la]]
 	}
     }
 
-    foreach connid [array names items] {
-	private::store [list [jlib::wrapper:createtag query \
-				  -vars {xmlns tkabber:georoster} \
-				  -subtags $items($connid)]] \
-	-connection $connid
+    foreach xlib [array names items] {
+	private::store $xlib [list [::xmpp::xml::create query \
+					-xmlns tkabber:georoster \
+					-subelements $items($xlib)]]
     }
 }
 
 ###############################################################################
 
-proc georoster::init {connid} {
+proc georoster::init {xlib} {
     variable georoster
 
-    if {![info exists georoster(jids,$connid)]} {
-	set georoster(jids,$connid) {}
+    if {![info exists georoster(jids,$xlib)]} {
+	set georoster(jids,$xlib) {}
     }
 }
 
@@ -836,38 +832,37 @@
 
 ###############################################################################
 
-proc georoster::retrieve {connid} {
-    private::retrieve [list [jlib::wrapper:createtag query \
-				 -vars {xmlns tkabber:georoster}]] \
-	-command [list [namespace current]::recv $connid] \
-	-connection $connid
+proc georoster::retrieve {xlib} {
+    private::retrieve $xlib [list [::xmpp::xml::create query \
+					-xmlns tkabber:georoster]] \
+	-command [list [namespace current]::recv $xlib]
 }
 
 hook::add connected_hook [namespace current]::georoster::retrieve
 
 ###############################################################################
 
-proc georoster::recv {connid res child} {
+proc georoster::recv {xlib status xml} {
     variable georoster
 
-    if {$res != "OK"} {
+    if {$status != "ok"} {
 	return
     }
 
-    set georoster(jids,$connid) {}
+    set georoster(jids,$xlib) {}
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-    foreach ch $children {
-	jlib::wrapper:splitxml $ch tag1 vars1 isempty1 chdata1 children1
+    foreach subel $subels {
+	::xmpp::xml::split $subel stag sxmlns sattrs scdata ssubels
 
-	foreach item $children1 {
-	    jlib::wrapper:splitxml $item tag2 vars2 isempty2 chdata2 children2
-	    set jid [jlib::wrapper:getattr $vars2 jid]
+	foreach item $ssubels {
+	    ::xmpp::xml::split $item sstag ssxmlns sattrs sscdata sssubels
+	    set jid [::xmpp::xml::getAttr $sattrs jid]
 	    if {$jid != ""} {
-		lappend georoster(jids,$connid) $jid
-		set georoster(lo,$connid,$jid) [jlib::wrapper:getattr $vars2 lo]
-		set georoster(la,$connid,$jid) [jlib::wrapper:getattr $vars2 la]
+		lappend georoster(jids,$xlib) $jid
+		set georoster(lo,$xlib,$jid) [::xmpp::xml::getAttr $ssattrs lo]
+		set georoster(la,$xlib,$jid) [::xmpp::xml::getAttr $ssattrs la]
 	    }
 	}
     }

Modified: trunk/tkabber-plugins/gmail/gmail.tcl
===================================================================
--- trunk/tkabber-plugins/gmail/gmail.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/gmail/gmail.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -39,18 +39,18 @@
 ############################################################################
 
 proc gmail::request_all_notifications {args} {
-    foreach connid [jlib::connections] {
-	request_notifications $connid
+    foreach xlib [connections] {
+	request_notifications $xlib
     }
 }
 
 ############################################################################
 
-proc gmail::request_notifications {connid} {
+proc gmail::request_notifications {xlib} {
     variable options
     variable last_mail_time
 
-    set jid [jlib::connection_bare_jid $connid]
+    set jid [connection_bare_jid $xlib]
     catch {array set tmp $last_mail_time}
 
     if {[info exists tmp($jid)]} {
@@ -60,12 +60,11 @@
     }
 
     if {$options(gmail_notifications)} {
-	jlib::send_iq get \
-	    [jlib::wrapper:createtag query \
-		 -vars [list xmlns $::NS(gnotify) \
-			     newer-than-time $time]] \
-	    -command [list [namespace current]::receive_notifications $jid] \
-	    -connection $connid
+	::xmpp::sendIQ $xlib get \
+	    -query [::xmpp::xml::create query \
+			    -xmlns $::NS(gnotify) \
+			    -attrs [list  newer-than-time $time]] \
+	    -command [list [namespace current]::receive_notifications $jid]
     }
 }
 
@@ -73,22 +72,22 @@
 
 ############################################################################
 
-proc gmail::receive_notifications {jid res child} {
+proc gmail::receive_notifications {jid status xml} {
     variable last_mail_time
 
-    if {$res != "OK"} {
+    if {$status != "ok"} {
 	return
     }
 
-    jlib::wrapper:splitxml $child tag vars isempty cdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-    if {[jlib::wrapper:isattr $vars result-time]} {
+    if {[::xmpp::xml::isAttr $attrs result-time]} {
 	catch {array set tmp $last_mail_time}
-	set tmp($jid) [jlib::wrapper:getattr $vars result-time]
+	set tmp($jid) [::xmpp::xml::getAttr $attrs result-time]
 	set last_mail_time [array get tmp]
     }
 
-    fill_tree $jid $children
+    fill_tree $jid $subels
 }
 
 #############################################################################
@@ -163,25 +162,25 @@
 
 #############################################################################
 
-proc gmail::fill_tree {jid children} {
+proc gmail::fill_tree {jid xmlList} {
     variable options
 
-    if {[lempty $children]} {
+    if {[llength $xmlList] == 0} {
 	return
     }
     
     open_window
 
-    foreach ch $children {
-	jlib::wrapper:splitxml $ch tag1 vars1 isempty1 cdata1 children1
+    foreach xml $xmlList {
+	::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-	switch -- $tag1 {
+	switch -- $tag {
 	    mail-thread-info {
-		set tid [jlib::wrapper:getattr $vars1 tid]
-		set messages [jlib::wrapper:getattr $vars1 messages]
-		set date [jlib::wrapper:getattr $vars1 date]
-		set url [jlib::wrapper:getattr $vars1 url]
-		add_thread $jid $tid $messages $date $url $children1 1
+		set tid [::xmpp::xml::getAttr $attrs tid]
+		set messages [::xmpp::xml::getAttr $attrs messages]
+		set date [::xmpp::xml::getAttr $attrs date]
+		set url [::xmpp::xml::getAttr $attrs url]
+		add_thread $jid $tid $messages $date $url $subels 1
 	    }
 	}
     }
@@ -189,7 +188,7 @@
 
 package require md5
 
-proc gmail::add_thread {jid tid messages date url children unseen} {
+proc gmail::add_thread {jid tid messages date url xmlList unseen} {
     variable options
 
     set w .gmail_messages
@@ -204,20 +203,20 @@
 
     set senders [list]
     set subject ""
-    foreach ch $children {
-	jlib::wrapper:splitxml $ch tag1 vars1 isempty1 cdata1 children1
+    foreach xml $xmlList {
+	::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-	switch -- $tag1 {
+	switch -- $tag {
 	    senders {
-		foreach ch1 $children1 {
-		    jlib::wrapper:splitxml $ch1 tag2 vars2 isempty2 cdata2 children2
-		    if {$tag2 == "sender"} {
-			lappend senders [jlib::wrapper:getattr $vars2 name]
+		foreach subel $subels {
+		    ::xmpp::xml::split $subel stag sxmlns sattrs scdata ssubels
+		    if {$stag == "sender"} {
+			lappend senders [::xmpp::xml::getAttr $sattrs name]
 		    }
 		}
 	    }
 	    subject {
-		set subject $cdata1
+		set subject $cdata
 	    }
 	}
     }
@@ -234,7 +233,7 @@
 	-fill $options(unseencolor) \
 	-data [list type thread jid $jid tid $tid \
 		    messages $messages date $date url $url \
-		    children $children unseen $unseen]
+		    xml $xmlList unseen $unseen]
 
     if {$options(delete_old_notifications)} {
 	message_action deleteold $tw $fnode
@@ -521,7 +520,7 @@
     } elseif {![catch {array set props [$tw itemcget $node -data]}]} {
         puts $fd [list [namespace current]::add_thread \
 		       $props(jid) $props(tid) $props(messages) \
-		       $props(date) $props(url) $props(children) \
+		       $props(date) $props(url) $props(xml) \
 		       $props(unseen)]
     }
 }
@@ -544,32 +543,32 @@
 
 #############################################################################
 
-proc gmail::notify_response {connid from lang child} {
+proc gmail::notify_response {xlib from xml args} {
     variable options
 
     if {$from != "" && \
-	    $from != [jlib::connection_bare_jid $connid] && \
-	    $from != [jlib::connection_jid $connid]} {
+	    $from != [connection_bare_jid $xlib] && \
+	    $from != [connection_jid $xlib]} {
 	return {error cancel not-allowed}
     }
 
-    jlib::wrapper:splitxml $child tag vars isempty cdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     if {$tag != "new-mail"} {
 	return {error modify bad-request}
     }
 
-    request_notifications $connid
+    request_notifications $xlib
 
     return [list result ""]
 }
 
-iq::register_handler set "" $::NS(gnotify) \
-    [namespace current]::gmail::notify_response
+::xmpp::iq::register set * $::NS(gnotify) \
+		     [namespace current]::gmail::notify_response
 
 #############################################################################
 
-proc gmail::restore_window {from connid jid} {
+proc gmail::restore_window {from xlib jid} {
     open_window -raise 1
 }
 

Modified: trunk/tkabber-plugins/jidlink/jidlink.tcl
===================================================================
--- trunk/tkabber-plugins/jidlink/jidlink.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/jidlink/jidlink.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -9,7 +9,7 @@
     set transport(list) {}
 }
 
-proc ::jidlink::connect {connid jid {key {}}} {
+proc ::jidlink::connect {xlib jid {key {}}} {
     variable connection
 
     if {$key == ""} {
@@ -18,28 +18,27 @@
 
     #set connection(sf,$key) $send_func
     #set connection(rf,$key) $recv_func
-    set connection(connid,$key) $connid
+    set connection(xlib,$key) $xlib
     set connection(jid,$key) $jid
 
     set_status [::msgcat::mc "Opening Jidlink connection"]
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag query \
-	     -vars {xmlns jabber:iq:jidlink} \
-	     -subtags [list [jlib::wrapper:createtag key -chdata $key]]] \
+    ::xmpp::sendIQ $xlib set \
+	-query [::xmpp::xml::create query \
+			-xmlns jabber:iq:jidlink} \
+			-subelement [::xmpp::xml::create key -cdata $key]] \
 	-to $jid \
-	-command [list [namespace current]::connect_response $connid $jid $key] \
-	-connection $connid
+	-command [list [namespace current]::connect_response $xlib $jid $key]
 
     vwait [namespace current]::connection(status,$key)
     return connection(status,$key)
 }
 
-proc ::jidlink::connect_response {connid jid key res child} {
+proc ::jidlink::connect_response {xlib jid key status xml} {
     variable connection
     variable transport
 
-    if {$res != "OK"} {
+    if {$status != "ok"} {
 	# TODO
 	set connection(status,$key) 0
 	return
@@ -61,12 +60,12 @@
 	return
     }
 
-    lassign [negotiate::send_request $connid $jid jabber:iq:jidlink $options] res opts
+    lassign [negotiate::send_request $xlib $jid jabber:iq:jidlink $options] res opts
 
     if {[llength $opts] == 1 && [lcontain $options [lindex $opts 0]]} {
 	set name [lindex $opts 0]
 	set connection(transport,$key) $name
-	eval $transport(connect,$name) [list $connid $jid $key]
+	eval $transport(connect,$name) [list $xlib $jid $key]
 	set connection(status,$key) 1
 	return
     }
@@ -123,7 +122,7 @@
 }
 
 
-# TODO: connid
+# TODO: xlib
 proc ::jidlink::negotiate_handler {from type options} {
     variable transport
 
@@ -152,22 +151,22 @@
 negotiate::register_handler jabber:iq:jidlink ::jidlink::negotiate_handler
 
 
-proc ::jidlink::set_handler {connid from lang child} {
-    debugmsg jidlink "set: [list $from $child]"
+proc ::jidlink::set_handler {xlib from xml args} {
+    debugmsg jidlink "set: [list $from $xml]"
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     if {$tag == "query"} {
-	foreach item $children {
-	    jlib::wrapper:splitxml $item tag1 vars1 isempty1 chdata1 children1
-	    if {$tag1 == "key"} {
-		set key $chdata1
+	foreach item $subels {
+	    ::xmpp::xml::split $item stag sxmlns sattrs scdata ssubels
+	    if {$stag == "key"} {
+		set key $scdata
 		debugmsg jidlink "KEY: $key"
 	    }
 	}
 
 	if {[info exists key]} {
-	    return [list result $child]
+	    return [list result $xml]
 
 	} else {
 	    # TODO
@@ -177,7 +176,7 @@
     }
 }
 
-iq::register_handler set query jabber:iq:jidlink ::jidlink::set_handler
+::xmpp::iq::register set query jabber:iq:jidlink ::jidlink::set_handler
 
 
 proc ::jidlink::register_transport {name oppos prio connect send close} {

Modified: trunk/tkabber-plugins/jidlink/plugins/dtcp.tcl
===================================================================
--- trunk/tkabber-plugins/jidlink/plugins/dtcp.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/jidlink/plugins/dtcp.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -4,50 +4,48 @@
 namespace eval ::dtcp::active {}
 namespace eval ::dtcp::passive {}
 
-proc ::dtcp::active::connect {connid jid key} {
+proc ::dtcp::active::connect {xlib jid key} {
     variable connection
 
     set_status [::msgcat::mc "Opening DTCP active connection"]
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag query \
-	     -vars {xmlns jabber:iq:dtcp} \
-	     -subtags [list \
-			   [jlib::wrapper:createtag key \
-				-chdata $key] \
-			   [jlib::wrapper:createtag comment \
-				-subtags [list [jlib::wrapper:createtag key \
-						    -chdata $key]]]]] \
+    ::xmpp::sendIQ $xlib set \
+	-query [::xmpp::xml::create query \
+			-xmlns jabber:iq:dtcp \
+			-subelement [::xmpp::xml::create key \
+					    -cdata $key] \
+			-subelement [::xmpp::xml::create comment \
+					    -subelement [::xmpp::xml::create key \
+								-cdata $key]]] \
 	-to $jid \
-	-command [list ::dtcp::active::recv_connect_response $connid $jid $key] \
-	-connection $connid
-	 
+	-command [list ::dtcp::active::recv_connect_response $xlib $jid $key]
+
     vwait [namespace current]::connection(status,$key)
 }
 
-proc ::dtcp::active::recv_connect_response {connid jid key res child} {
+proc ::dtcp::active::recv_connect_response {xlib jid key status xml} {
     variable connection
 
-    if {$res != "OK"} {
+    if {$status != "ok"} {
 	# TODO
 	set connection(status,$key) 0
 	return
     }
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     if {$tag == "query"} {
 	set hosts {}
-	foreach item $children {
-	    jlib::wrapper:splitxml $item tag1 vars1 isempty1 chdata1 children1
-	    switch -- $tag1 {
+	foreach item $subels {
+	    ::xmpp::xml::split $item stag sxmlns sattrs scdata ssubels
+	    switch -- $stag {
 		verify {
-		    set verify $chdata1
+		    set verify $scdata
 		    debugmsg jidlink "VERIFY: $verify"
 		}
 		host {
-		    lappend hosts [list $chdata1 \
-				       [jlib::wrapper:getattr $vars1 port]]
+		    lappend hosts [list $scdata \
+				       [::xmpp::xml::getAttr $sattrs port]]
 		}
 	    }
 	}
@@ -59,7 +57,7 @@
 	    set verify_key($verify) $key
 	    set key_verify($key) $verify
 
-	    set connection(connid,$key) $connid
+	    set connection(xlib,$key) $xlib
 	    set connection(jid,$key) $jid
 
 	    foreach host $hosts {
@@ -76,7 +74,7 @@
 		    [list ::dtcp::active::wait_for_verify $key $sock]
 		return
 	    }
-	    
+
 	    debugmsg jidlink "FAILED"
 
 	    set connection(status,$key) 0
@@ -105,14 +103,14 @@
 	set connection(sock,$key) $sock
 	puts $sock "key:$key"
 	flush $sock
-	
+
 	fileevent $sock readable \
 	    [list ::dtcp::active::wait_for_verify $key $sock]
 	return
     }
 
     debugmsg jidlink "FAILED"
-    
+
     set connection(status,$key) 0
 
 }
@@ -159,57 +157,55 @@
 jidlink::register_transport dtcp-active dtcp-passive 25 \
     ::dtcp::active::connect ::dtcp::active::send_data ::dtcp::active::close
 
-proc ::dtcp::passive::connect {connid jid key} {
+proc ::dtcp::passive::connect {xlib jid key} {
     variable connection
 
     set_status [::msgcat::mc "Opening DTCP passive connection"]
 
     set servsock [socket -server [list ::dtcp::passive::accept $key] 0]
     lassign [fconfigure $servsock -sockname] addr hostname port
-    set ip [lindex [fconfigure $jlib::lib($connid,sck) -sockname] 0]
+    set ip [::xmpp::ip $xlib]
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag query \
-	     -vars {xmlns jabber:iq:dtcp} \
-	     -subtags [list \
-			   [jlib::wrapper:createtag key \
-				-chdata $key] \
-			   [jlib::wrapper:createtag host \
-				-vars [list port $port] \
-				-chdata $ip] \
-			   [jlib::wrapper:createtag comment \
-				-subtags [list [jlib::wrapper:createtag key \
-						    -chdata $key]]]]] \
+    ::xmpp::sendIQ $xlib set \
+	-query [::xmpp::xml::create query \
+			-xmlns jabber:iq:dtcp \
+			-subelement [::xmpp::xml::create key \
+					    -cdata $key] \
+			-subelement [::xmpp::xml::create host \
+					    -attrs [list port $port] \
+					    -cdata $ip] \
+			-subelement [::xmpp::xml::create comment \
+					    -subelement [::xmpp::xml::create key \
+							    -cdata $key]]] \
 	-to $jid \
-	-command [list ::dtcp::passive::recv_connect_response $connid $jid $key] \
-	-connection $connid
-	 
+	-command [list ::dtcp::passive::recv_connect_response $xlib $jid $key]
+
     vwait [namespace current]::connection(status,$key)
 }
 
-proc ::dtcp::passive::recv_connect_response {connid jid key res child} {
+proc ::dtcp::passive::recv_connect_response {xlib jid key status xml} {
     variable connection
 
-    if {$res != "OK"} {
+    if {$status != "ok"} {
 	# TODO
 	set connection(status,$key) 0
 	return
     }
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     if {$tag == "query"} {
 	set hosts {}
-	foreach item $children {
-	    jlib::wrapper:splitxml $item tag1 vars1 isempty1 chdata1 children1
-	    switch -- $tag1 {
+	foreach item $subels {
+	    ::xmpp::xml::split $item stag sxmlns sattrs scdata ssubels
+	    switch -- $stag {
 		verify {
-		    set verify $chdata1
+		    set verify $scdata
 		    debugmsg jidlink "VERIFY: $verify"
 		}
 		host {
-		    lappend hosts [list $chdata1 \
-				       [jlib::wrapper:getattr $vars port]]
+		    lappend hosts [list $scdata \
+				       [::xmpp::xml::getAttr $attrs port]]
 		}
 	    }
 	}
@@ -221,7 +217,7 @@
 	    set verify_key($verify) $key
 	    set key_verify($key) $verify
 
-	    set connection(connid,$key) $connid
+	    set connection(xlib,$key) $xlib
 	    set connection(jid,$key) $jid
 
 	    #set connection(status,$key) 1
@@ -297,31 +293,30 @@
     }
 }
 
-proc ::dtcp::iq_set_handler {connid from lang child} {
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+proc ::dtcp::iq_set_handler {xlib from xml args} {
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     if {$tag == "query"} {
 	set hosts {}
-	foreach item $children {
-	    jlib::wrapper:splitxml $item tag1 vars1 isempty1 chdata1 children1
-	    switch -- $tag1 {
+	foreach item $subels {
+	    ::xmpp::xml::split $item stag sxmlns sattrs scdata ssubels
+	    switch -- $stag {
 		comment {
-		    foreach item1 $children1 {
-			jlib::wrapper:splitxml $item1 tag2 vars2 isempty2 \
-			    chdata2 children2
-			if {$tag2 == "key"} {
-			    set key $chdata2
+		    foreach sitem $ssubels {
+			::xmpp::xml::split $sitem sstag ssxmlns ssattrs sscdata sssubels
+			if {$sstag == "key"} {
+			    set key $sscdata
 			    debugmsg jidlink "KEY: $key"
 			}
 		    }
 		}
 		key {
-		    set key $chdata1
+		    set key $scdata
 		    debugmsg jidlink "KEY: $key"
 		}
 		host {
-		    lappend hosts [list $chdata1 \
-				       [jlib::wrapper:getattr $vars1 port]]
+		    lappend hosts [list $scdata \
+				       [::xmpp::xml::getAttr $sattrs port]]
 		}
 	    }
 	}
@@ -339,17 +334,16 @@
 		    [socket -server \
 			 [list ::dtcp::passive::accept $key] 0]
 		lassign [fconfigure $servsock -sockname] addr hostname port
-		set ip [lindex [fconfigure $jlib::lib($connid,sck) -sockname] 0]
+		set ip [::xmpp::ip $xlib]
 
-		
-		set res [jlib::wrapper:createtag query \
-			     -vars {xmlns jabber:iq:dtcp} \
-			     -subtags [list \
-					   [jlib::wrapper:createtag verify \
-						-chdata $verify] \
-					   [jlib::wrapper:createtag host \
-						-vars [list port $port] \
-						-chdata $ip]]]
+
+		set res [::xmpp::xml::create query \
+				-xmlns jabber:iq:dtcp \
+				-subelement [::xmpp::xml::create verify \
+						    -cdata $verify] \
+				-subelement [::xmpp::xml::create host \
+						    -attrs [list port $port] \
+						    -cdata $ip]]
 	    } else {
 		variable active::verify_key
 		variable active::key_verify
@@ -358,10 +352,10 @@
 
 		debugmsg jidlink [list $hosts]
 		after idle [list ::dtcp::active::sock_connect $key $hosts]
-		set res [jlib::wrapper:createtag query \
-			     -vars {xmlns jabber:iq:dtcp} \
-			     -subtags [list [jlib::wrapper:createtag verify \
-						 -chdata $verify]]]
+		set res [::xmpp::xml::create query \
+				-xmlns jabber:iq:dtcp \
+				-subelement [::xmpp::xml::create verify \
+						    -cdata $verify]]
 	    }
 	    return [list result $res]
 	} else {
@@ -372,7 +366,7 @@
     }
 }
 
-iq::register_handler set query jabber:iq:dtcp ::dtcp::iq_set_handler
+::xmpp::iq::register set query jabber:iq:dtcp ::dtcp::iq_set_handler
 
 jidlink::register_transport dtcp-passive dtcp-active 50 \
     ::dtcp::passive::connect ::dtcp::passive::send_data ::dtcp::passive::close

Modified: trunk/tkabber-plugins/jidlink/plugins/filetransfer.tcl
===================================================================
--- trunk/tkabber-plugins/jidlink/plugins/filetransfer.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/jidlink/plugins/filetransfer.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -28,35 +28,34 @@
     set state(id) $id
     set files(token,$id) $token
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag query \
-	     -vars {xmlns jabber:iq:filexfer} \
-	     -subtags [list [jlib::wrapper:createtag file \
-				 -vars [list id $id \
-					    name $state(name) \
-					    size $state(size)] \
-				 -chdata $state(desc)]]] \
+    ::xmpp::sendIQ $state(xlib) set \
+	-query [::xmpp::xml::create query \
+		    -xmlns jabber:iq:filexfer \
+		    -subelement [::xmpp::xml::create file \
+					-attrs [list id $id \
+						     name $state(name) \
+						     size $state(size)] \
+					-cdata $state(desc)]] \
 	-to $state(jid) \
-	-command [list [namespace current]::send_file_result $token] \
-	-connection $state(connid)
+	-command [list [namespace current]::send_file_result $token]
 }
 
 ###############################################################################
 
-proc ftjl::send_file_result {token res child} {
+proc ftjl::send_file_result {token status xml} {
     upvar #0 $token state
 
     if {![info exists state(fd)]} return
 
-    if {[cequal $res OK]} return
+    if {[cequal $status ok]} return
 
-    eval $state(command) ERR \
-	 [list [::msgcat::mc "Request failed: %s" [error_to_string $child]]]
+    eval $state(command) error \
+	 [list [::msgcat::mc "Request failed: %s" [error_to_string $xml]]]
 }
 
 ###############################################################################
 
-proc ftjl::send_file_request {connid from lang id offset} {
+proc ftjl::send_file_request {xlib from lang id offset} {
     variable files
 
     if {![info exists files(token,$id)]} {
@@ -72,7 +71,7 @@
 		     -text [::trans::trans $lang "Transfer is expired"]]
     }
 
-    if {$state(connid) != $connid || $state(jid) != $from} {
+    if {$state(xlib) != $xlib || $state(jid) != $from} {
 	return [list error cancel not-allowed \
 		     -text [::trans::trans $lang "Invalid file ID"]]
     }
@@ -80,12 +79,12 @@
     set state(key) [rand 1000000000]
     set state(offset) $offset
     set res \
-	[jlib::wrapper:createtag query \
-	     -vars {xmlns jabber:iq:filexfer} \
-	     -subtags [list [jlib::wrapper:createtag file \
-				 -vars [list id $id] \
-				 -subtags [list [jlib::wrapper:createtag key \
-						     -chdata $state(key)]]]]]
+	[::xmpp::xml::create query \
+	     -xmlns jabber:iq:filexfer \
+	     -subelement [::xmpp::xml::create file \
+				-attrs [list id $id] \
+				-subelement [::xmpp::xml::create key \
+						    -cdata $state(key)]]]
     after idle [list [namespace current]::send_file_setup_connection $token]
     return [list result $res]
 }
@@ -98,11 +97,11 @@
 
     if {![info exists state(fd)]} return
 
-    set res [jidlink::connect $state(connid) $state(jid) $state(key)]
+    set res [jidlink::connect $state(xlib) $state(jid) $state(key)]
 
     if {$res == 0} {
 	if {[info exists state(command)]} {
-	    eval $state(command) ERR [::msgcat::mc "Jidlink connection failed"]
+	    eval $state(command) error [::msgcat::mc "Jidlink connection failed"]
 	}
 	return
     }
@@ -123,12 +122,12 @@
 	     }
 	 }]} {
 	if {[info exists state(command)]} {
-	    eval $state(command) ERR [::msgcat::mc "Jidlink transfer failed"]
+	    eval $state(command) error [::msgcat::mc "Jidlink transfer failed"]
 	}
 	return
     }
 
-    eval $state(command) OK
+    eval $state(command) ok
 }
 
 ###############################################################################
@@ -146,7 +145,7 @@
 ###############################################################################
 ###############################################################################
 
-proc ftjl::recv_file_dialog {connid from lang id name size date hash desc} {
+proc ftjl::recv_file_dialog {xlib from lang id name size date hash desc} {
     variable winid
     variable files
     variable result
@@ -205,7 +204,7 @@
     grid rowconfigure $f 2 -weight 1
     
     $w add -text [::msgcat::mc "Receive"] -command \
-	[list [namespace current]::recv_file_start $winid $size $pbvar $connid $from $lang $id]
+	[list [namespace current]::recv_file_start $winid $size $pbvar $xlib $from $lang $id]
     $w add -text [::msgcat::mc "Cancel"] -command \
 	[list [namespace current]::recv_file_cancel $winid $lang]
     bind .rfd$winid <Destroy> \
@@ -232,7 +231,7 @@
 
 ###############################################################################
 
-proc ftjl::recv_file_start {winid size pbvar connid user lang id} {
+proc ftjl::recv_file_start {winid size pbvar xlib user lang id} {
     variable saveas$winid
     variable files
 
@@ -243,43 +242,41 @@
 
     #set files(filename,$key) $filename
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag query \
-	     -vars {xmlns jabber:iq:filexfer} \
-	     -subtags [list [jlib::wrapper:createtag file \
-				 -vars [list id $id]]]] \
+    ::xmpp::sendIQ $xlib set \
+	-query [::xmpp::xml::create query \
+		    -xmlns jabber:iq:filexfer \
+		    -subelement [::xmpp::xml::create file \
+					-attrs [list id $id]]]] \
 	-to $user \
 	-command [list [namespace current]::recv_file_reply \
-		       $winid $size $pbvar $user $lang $id $filename] \
-	-connection $connid
+		       $winid $size $pbvar $user $lang $id $filename]
 }
 
 ###############################################################################
 
-proc ftjl::recv_file_reply {winid size pbvar user lang id filename res child} {
+proc ftjl::recv_file_reply {winid size pbvar user lang id filename status xml} {
     variable files
 
-    if {$res != "OK"} {
+    if {$status != "ok"} {
 	recv_file_failed $winid $lang
 	after idle \
 	    [list MessageDlg .auth_err -aspect 50000 -icon error \
-		  -message [format [::msgcat::mc "Receiving file failed: %s"] \
-			        [error_to_string $child]] -type user \
+		  -message [::msgcat::mc "Receiving file failed: %s" \
+					 [error_to_string $xml]] -type user \
 		  -buttons ok -default 0 -cancel 0]
 	return
     }
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     if {$tag == "query"} {
-	foreach item $children {
-	    jlib::wrapper:splitxml $item tag1 vars1 isempty1 chdata1 children1
-	    if {$tag1 == "file"} {
-		foreach item1 $children1 {
-		    jlib::wrapper:splitxml $item1 tag2 vars2 isempty2 \
-			chdata2 children2
-		    if {$tag2 == "key"} {
-			set key $chdata2
+	foreach item $subels {
+	    ::xmpp::xml::split $item stag sxmlns sattrs scdata ssubels
+	    if {$stag == "file"} {
+		foreach sitem $ssubels {
+		    ::xmpp::xml::split $sitem sstag ssxmlns ssattrs sscdata sssubels
+		    if {$sstag == "key"} {
+			set key $sscdata
 			set files(filename,$key) $filename
 			debugmsg filetransfer "RECV KEY: $key"
 
@@ -379,37 +376,39 @@
 
 ###############################################################################
 
-proc ftjl::iq_set_handler {connid from lang child} {
+proc ftjl::iq_set_handler {xlib from xml args} {
     debugmsg filetransfer "FTJL set: [list $from $child]"
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $child tag xmlns attrs cdata subels
 
     if {$tag != "query"} {
 	return {error modify bad-request}
     }
 
-    foreach item $children {
-	jlib::wrapper:splitxml $item tag1 vars1 isempty1 chdata1 children1
-	if {$tag1 == "file"} {
-	    if {[jlib::wrapper:getattr $vars1 name] != ""} {
-		return [recv_file_dialog $connid $from $lang \
-		       [jlib::wrapper:getattr $vars1 id] \
-		       [jlib::wrapper:getattr $vars1 name] \
-		       [jlib::wrapper:getattr $vars1 size] \
-		       [jlib::wrapper:getattr $vars1 date] \
-		       [jlib::wrapper:getattr $vars1 hash] \
-		       $chdata1]
+    set lang [::xmpp::xml::getAttr $args -lang en]
+
+    foreach item $subels {
+	::xmpp::xml::split $item stag sxmlns sattrs scdata ssubels
+	if {$stag == "file"} {
+	    if {[::xmpp::xml::getAttr $sattrs name] != ""} {
+		return [recv_file_dialog $xlib $from $lang \
+		       [::xmpp::xml::getAttr $sattrs id] \
+		       [::xmpp::xml::getAttr $sattrs name] \
+		       [::xmpp::xml::getAttr $sattrs size] \
+		       [::xmpp::xml::getAttr $sattrs date] \
+		       [::xmpp::xml::getAttr $sattrs hash] \
+		       $scdata]
 	    } else {
-		return [send_file_request $connid $from $lang \
-			    [jlib::wrapper:getattr $vars1 id] \
-			    [jlib::wrapper:getattr $vars1 offset]]
+		return [send_file_request $xlib $from $lang \
+			    [::xmpp::xml::getAttr $sattrs id] \
+			    [::xmpp::xml::getAttr $sattrs offset]]
 	    }
 	}
     }
 }
 
-iq::register_handler set query jabber:iq:filexfer \
-    [namespace current]::ftjl::iq_set_handler
+::xmpp::iq::register set query jabber:iq:filexfer \
+		     [namespace current]::ftjl::iq_set_handler
 
 ###############################################################################
 

Modified: trunk/tkabber-plugins/jidlink/plugins/ibb.tcl
===================================================================
--- trunk/tkabber-plugins/jidlink/plugins/ibb.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/jidlink/plugins/ibb.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -2,39 +2,39 @@
 
 namespace eval ::ibb {}
 
-proc ::ibb::connect {connid jid key} {
+proc ::ibb::connect {xlib jid key} {
     variable connection
 
     set_status [::msgcat::mc "Opening IBB connection"]
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag query \
-	     -vars {xmlns jabber:iq:ibb} \
-	     -subtags [list [jlib::wrapper:createtag comment \
-				 -subtags [list [jlib::wrapper:createtag key \
-						     -chdata $key]]]]] \
-	-to $jid -command [list ibb::recv_connect_response $connid $jid $key] \
-	-connection $connid
+    ::xmpp::sendIQ $xlib set \
+	-query [::xmpp::xml::create query \
+		    -xmlns jabber:iq:ibb \
+		    -subelement [::xmpp::xml::create comment \
+				    -subelement [::xmpp::xml::create key \
+							-cdata $key]]] \
+	-to $jid \
+	-command [list ibb::recv_connect_response $xlib $jid $key]
 	 
     vwait [namespace current]::connection(status,$key)
 }
 
-proc ::ibb::recv_connect_response {connid jid key res child} {
+proc ::ibb::recv_connect_response {xlib jid key status xml} {
     variable connection
 
-    if {$res != "OK"} {
+    if {$status != "ok"} {
 	# TODO
 	set connection(status,$key) 0
 	return
     }
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     if {$tag == "query"} {
-	foreach item $children {
-	    jlib::wrapper:splitxml $item tag1 vars1 isempty1 chdata1 children1
-	    if {$tag1 == "streamid"} {
-		set streamid $chdata1
+	foreach item $subels {
+	    ::xmpp::xml::split $item stag sxmlns sattrs scdata ssubels
+	    if {$stag == "streamid"} {
+		set streamid $scdata
 		debugmsg jidlink "STREAMID: $streamid"
 	    }
 	}
@@ -46,7 +46,7 @@
 	    set stream_key($streamid) $key
 	    set key_stream($key) $streamid
 
-	    set connection(connid,$key) $connid
+	    set connection(xlib,$key) $xlib
 	    set connection(jid,$key) $jid
 	    set connection(status,$key) 1
 
@@ -67,25 +67,24 @@
 
     debugmsg jidlink [array get stream_key]
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag query \
-	     -vars {xmlns jabber:iq:inband} \
-	     -subtags [list [jlib::wrapper:createtag streamid \
-				 -chdata $key_stream($key)] \
-			   [jlib::wrapper:createtag data \
-				-chdata [base64::encode $data]]]] \
+    ::xmpp::sendIQ $connection(xlib,$key) set \
+	-query [::xmpp::xml::create query \
+		    -xmlns jabber:iq:inband \
+		    -subelement [::xmpp::xml::create streamid \
+					-cdata $key_stream($key)] \
+		    -subelement [::xmpp::xml::create data \
+					-cdata [base64::encode $data]]] \
 	-to $connection(jid,$key) \
-	-command [list ibb::send_data_ack $key] \
-	-connection $connection(connid,$key)
+	-command [list ibb::send_data_ack $key]
 
     vwait [namespace current]::connection(ack,$key)
 
     return $connection(ack,$key)
 }
 
-proc ::ibb::send_data_ack {key res child} {
+proc ::ibb::send_data_ack {key status xml} {
     variable connection
-    if {$res != "OK"} {
+    if {$status != "ok"} {
 	# TODO
 	set connection(ack,$key) 0
 	return
@@ -97,29 +96,26 @@
     variable connection
     variable key_stream
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag query \
-	     -vars {xmlns jabber:iq:inband} \
-	     -subtags [list [jlib::wrapper:createtag streamid \
-				 -chdata $key_stream($key)] \
-			   [jlib::wrapper:createtag close]]] \
-	-to $connection(jid,$key) \
-	-connection $connection(connid,$key)
-
+    ::xmpp::sendIQ $connection(xlib,$key) set \
+	-query [::xmpp::xml::create query \
+		    -xmlns jabber:iq:inband \
+		    -subelement [::xmpp::xml::create streamid \
+					-cdata $key_stream($key)] \
+		    -subelement [::xmpp::xml::create close]] \
+	-to $connection(jid,$key)
 }
 
-proc ::ibb::iq_set_handler {connid from lang child} {
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+proc ::ibb::iq_set_handler {xlib from xml args} {
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     if {$tag == "query"} {
-	foreach item $children {
-	    jlib::wrapper:splitxml $item tag1 vars1 isempty1 chdata1 children1
-	    if {$tag1 == "comment"} {
-		foreach item1 $children1 {
-		    jlib::wrapper:splitxml $item1 tag2 vars2 isempty2 \
-			chdata2 children2
-		    if {$tag2 == "key"} {
-			set key $chdata2
+	foreach item $subels {
+	    ::xmpp::xml::split $item stag sxmlns sattrs scdata ssubels
+	    if {$stag == "comment"} {
+		foreach sitem $ssubels {
+		    ::xmpp::xml::split $sitem sstag ssxmlns ssattrs sscdata sssubels
+		    if {$sstag == "key"} {
+			set key $sscdata
 			debugmsg jidlink "KEY: $key"
 		    }
 		}
@@ -134,10 +130,10 @@
 	    set stream_key($streamid) $key
 	    set key_stream($key) $streamid
 
-	    set res [jlib::wrapper:createtag query \
-			 -vars {xmlns jabber:iq:ibb} \
-			 -subtags [list [jlib::wrapper:createtag streamid \
-					     -chdata $streamid]]]
+	    set res [::xmpp::xml::create query \
+			 -xmlns jabber:iq:ibb \
+			 -subelement [::xmpp::xml::create streamid \
+					     -cdata $streamid]]
 	    return [list result $res]
 	} else {
 	    # TODO
@@ -147,22 +143,22 @@
     }
 }
 
-iq::register_handler set query jabber:iq:ibb ibb::iq_set_handler
+::xmpp::iq::register set query jabber:iq:ibb ibb::iq_set_handler
 
-proc ::ibb::iq_inband_set_handler {connid from lang child} {
+proc ::ibb::iq_inband_set_handler {xlib from xml args} {
     variable stream_key
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     if {$tag == "query"} {
-	foreach item $children {
-	    jlib::wrapper:splitxml $item tag1 vars1 isempty1 chdata1 children1
-	    switch -- $tag1 {
+	foreach item $subels {
+	    ::xmpp::xml::split $item stag sxmlns sattrs scdata ssubels
+	    switch -- $stag {
 		streamid {
-		    set streamid $chdata1
+		    set streamid $scdata
 		}
 		data {
-		    set data $chdata1
+		    set data $scdata
 		}
 		close {
 		    set close 1
@@ -195,8 +191,8 @@
     }
 }
 
-iq::register_handler set query jabber:iq:inband ibb::iq_inband_set_handler
+::xmpp::iq::register set query jabber:iq:inband ibb::iq_inband_set_handler
 
 jidlink::register_transport inband-bytestream inband-bytestream 75 \
-    ibb::connect ibb::send_data ibb::close
+			    ibb::connect ibb::send_data ibb::close
 

Modified: trunk/tkabber-plugins/mute/mute.tcl
===================================================================
--- trunk/tkabber-plugins/mute/mute.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/mute/mute.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -10,14 +10,14 @@
     ::msgcat::mcload [file join [file dirname [info script]] msgs]
 }
 
-proc mute::editor::get_winid {connid jid id} {
-    return [win_id mute [list $connid $jid]//@mute@//$id]
+proc mute::editor::get_winid {xlib jid id} {
+    return [win_id mute [list $xlib $jid]//@mute@//$id]
 }
 
-proc mute::editor::add_user_menu_item {m connid jid} {
+proc mute::editor::add_user_menu_item {m xlib jid} {
     $m add command \
 	-label [::msgcat::mc "MUTE"] \
-	-command [list [namespace current]::list_request $connid $jid]
+	-command [list [namespace current]::list_request $xlib $jid]
 }
 
 hook::add roster_create_groupchat_user_menu_hook \
@@ -28,34 +28,33 @@
     [namespace current]::mute::editor::add_user_menu_item 49
 
 
-proc mute::editor::list_request {connid jid} {
-    jlib::send_iq get \
-	[jlib::wrapper:createtag list \
-	     -vars [list xmlns $::NS(mute_ancestor)]] \
+proc mute::editor::list_request {xlib jid} {
+    ::xmpp::sendIQ $xlib get \
+	query [::xmpp::xml::create list \
+			-xmlns $::NS(mute_ancestor)] \
 	-to $jid \
-	-command [list [namespace current]::list_recv $connid $jid] \
-	-connection $connid
+	-command [list [namespace current]::list_recv $xlib $jid]
 }
 
-proc mute::editor::list_recv {connid jid res child} {
+proc mute::editor::list_recv {xlib jid status xml} {
     variable txts
 
-    if {$res != "OK"} {
+    if {$status != "ok"} {
 	after idle [list MessageDlg .mute_list_error -icon error \
 			 -message [::msgcat::mc "Error getting list: %s" \
-						[error_to_string $child]] \
+						[error_to_string $xml]] \
 			 -type ok]
 	return ""
     }
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     set ids {}
-    foreach ch $children {
-	jlib::wrapper:splitxml $ch tag1 vars1 isempty1 chdata1 children1
-	set id [jlib::wrapper:getattr $vars1 id]
+    foreach subel $subels {
+	::xmpp::xml::split $subel stag sxmlns sattrs scdata ssubels
+	set id [::xmpp::xml::getAttr $sattrs id]
 	lappend ids $id
-	set desc($id) [jlib::wrapper:getattr $vars1 desc]
+	set desc($id) [::xmpp::xml::getAttr $sattrs desc]
     }
 
     set w .mute_invite
@@ -69,7 +68,7 @@
 
     foreach id $ids {
 	$w add -text "$id: $desc($id)" \
-	    -command [list [namespace current]::subscribe_request $connid $jid $id]
+	    -command [list [namespace current]::subscribe_request $xlib $jid $id]
     }
 
     $w add -text Cancel -command [list destroy $w]
@@ -77,33 +76,32 @@
     $w draw
 }
 
-proc mute::editor::subscribe_request {connid jid id} {
-    jlib::send_iq set \
-	[jlib::wrapper:createtag subscribe \
-	     -vars [list xmlns $::NS(mute_ancestor)] \
-	     -subtags [list [jlib::wrapper:createtag item \
-				 -vars [list id $id]]]] \
+proc mute::editor::subscribe_request {xlib jid id} {
+    ::xmpp::sendIQ $xlib set \
+	-query [::xmpp::xml::create subscribe \
+			-xmlns $::NS(mute_ancestor) \
+			-subelement [::xmpp::xml::create item \
+					    -attrs [list id $id]]] \
 	-to $jid \
-	-command [list [namespace current]::subscribe_recv $connid $jid $id] \
-	-connection $connid
+	-command [list [namespace current]::subscribe_recv $xlib $jid $id]
 }
 
-proc mute::editor::subscribe_recv {connid jid id res child} {
+proc mute::editor::subscribe_recv {xlib jid id status xml} {
     variable txts
 
-    if {$res != "OK"} {
+    if {$status != "OK"} {
 	after idle [list MessageDlg .mute_list_error -icon error \
 			 -message [::msgcat::mc "Error getting list: %s" \
-						[error_to_string $child]] \
+						[error_to_string $xml]] \
 			 -type ok]
 	return ""
     }
 }
 
-proc mute::editor::open_win {connid jid id} {
+proc mute::editor::open_win {xlib jid id} {
     variable txts
 
-    set w [get_winid $connid $jid $id]
+    set w [get_winid $xlib $jid $id]
     if {[winfo exists $w]} {
 	return
     }
@@ -116,9 +114,9 @@
     pack $bbox -side bottom -anchor e
 
     $bbox add -text [::msgcat::mc "Commit current version"] \
-	-command [list [namespace current]::commit $connid $jid $id]
+	-command [list [namespace current]::commit $xlib $jid $id]
     $bbox add -text [::msgcat::mc "Revert to master version"] \
-	-command [list [namespace current]::revert $connid $jid $id]
+	-command [list [namespace current]::revert $xlib $jid $id]
 
     set sep [Separator::create $w.sep -orient horizontal]
     pack $sep -pady 2m -fill x -side bottom
@@ -129,25 +127,25 @@
     $sw setwidget $text
 }
 
-proc mute::editor::get_textw {connid jid id} {
-    return "[get_winid $connid $jid $id].text"
+proc mute::editor::get_textw {xlib jid id} {
+    return "[get_winid $xlib $jid $id].text"
 }
 
-proc mute::editor::set_text {connid jid id text} {
+proc mute::editor::set_text {xlib jid id text} {
     variable txts
 
-    set txts(text,$connid,$jid,$id) $text
-    set t [get_textw $connid $jid $id]
+    set txts(text,$xlib,$jid,$id) $text
+    set t [get_textw $xlib $jid $id]
 
     $t delete 1.0 end
     $t insert 0.0 $text
 }
 
-proc mute::editor::revert {connid jid id} {
+proc mute::editor::revert {xlib jid id} {
     variable txts
 
-    set text $txts(text,$connid,$jid,$id)
-    set tw [get_textw $connid $jid $id]
+    set text $txts(text,$xlib,$jid,$id)
+    set tw [get_textw $xlib $jid $id]
 
     lassign [split [$tw index insert] .] line pos
     $tw delete 1.0 end
@@ -155,12 +153,12 @@
     $tw mark set insert "$line.$pos"
 }
 
-proc mute::editor::commit {connid jid id} {
+proc mute::editor::commit {xlib jid id} {
     variable txts
 
-    set orig $txts(text,$connid,$jid,$id)
+    set orig $txts(text,$xlib,$jid,$id)
 
-    set tw [get_textw $connid $jid $id]
+    set tw [get_textw $xlib $jid $id]
     set edit [$tw get 1.0 "end -1 chars"]
 
     if {[cindex $edit end] != "\n"} {
@@ -192,30 +190,30 @@
     file delete $fn.orig $fn.edit $fn.diff
 
     if {$diff != ""} {
-	jlib::send_iq set \
-	    [jlib::wrapper:createtag patch \
-		 -vars [list xmlns $::NS(mute_ancestor) id $id] \
-		 -chdata $diff] \
+	::xmpp::sendIQ $xlib set \
+	    -query [::xmpp::xml::create patch \
+			    -xmlns $::NS(mute_ancestor) \
+			    -attrs [list id $id] \
+			    -cdata $diff] \
 	    -to $jid \
-	    -command [list [namespace current]::patch_res $connid $jid $id] \
-	    -connection $connid
+	    -command [list [namespace current]::patch_res $xlib $jid $id]
     }
 }
 
-proc mute::editor::patch_res {connid jid id res child} {
+proc mute::editor::patch_res {xlib jid id status xml} {
     variable txts
 
-    if {$res != "OK"} {
+    if {$status != "ok"} {
 	after idle [list MessageDlg .mute_list_error -icon error \
 			 -message [::msgcat::mc "Error patching: %s" \
-						[error_to_string $child]] \
+						[error_to_string $xml]] \
 			 -type ok]
 	return ""
     }
 
-    set text $txts(text,$connid,$jid,$id)
+    set text $txts(text,$xlib,$jid,$id)
 
-    set tw [get_textw $connid $jid $id]
+    set tw [get_textw $xlib $jid $id]
 
     lassign [split [$tw index insert] .] line pos
     $tw delete 1.0 end
@@ -223,16 +221,16 @@
     $tw mark set insert "$line.$pos"
 }
 
-proc mute::editor::patch {connid jid id patch} {
+proc mute::editor::patch {xlib jid id patch} {
     variable txts
 
-    set tw [get_textw $connid $jid $id]
+    set tw [get_textw $xlib $jid $id]
 
-    if {![info exists txts(text,$connid,$jid,$id)] || ![winfo exists $tw]} {
+    if {![info exists txts(text,$xlib,$jid,$id)] || ![winfo exists $tw]} {
 	return [list error cancel not-allowed]
     }
 
-    set text $txts(text,$connid,$jid,$id)
+    set text $txts(text,$xlib,$jid,$id)
 
     set edit [$tw get 1.0 "end -1 chars"]
 
@@ -280,7 +278,7 @@
 
     file delete $fn.old $fn.orig $fn.patch $fn.edit
 
-    set txts(text,$connid,$jid,$id) $new
+    set txts(text,$xlib,$jid,$id) $new
 
     $tw delete 1.0 end
     $tw insert 0.0 $newedit
@@ -300,19 +298,18 @@
     return [list result ""]
 }
 
-proc mute::editor::recv_set_iq {connid from lang child} {
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+proc mute::editor::recv_set_iq {xlib from xml args} {
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     switch -- $tag {
 	text {
-	    set id [jlib::wrapper:getattr $vars id]
-	    open_win $connid $from $id
-	    set_text $connid $from $id $chdata
+	    set id [::xmpp::xml::getAttr $attrs id]
+	    open_win $xlib $from $id
+	    set_text $xlib $from $id $cdata
 	}
 	patch {
-	    set id [jlib::wrapper:getattr $vars id]
-	    set patch $chdata
-	    return [patch $connid $from $id $patch]
+	    set id [::xmpp::xml::getAttr $attrs id]
+	    return [patch $xlib $from $id $cdata]
 	}
 	default {
 	    return [list error cancel feature-not-implemented]
@@ -320,8 +317,8 @@
     }
 }
 
-iq::register_handler set {} $::NS(mute_editor) \
-    [namespace current]::mute::editor::recv_set_iq
+::xmpp::iq::register set * $::NS(mute_editor) \
+		     [namespace current]::mute::editor::recv_set_iq
 
 
 
@@ -348,23 +345,23 @@
     set txts(text,id2) ""
 }
 
-proc mute::ancestor::send_text {connid jid id} {
+proc mute::ancestor::send_text {xlib jid id} {
     variable txts
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag text \
-	     -vars [list xmlns $::NS(mute_editor) id $id] \
-	     -chdata $txts(text,$connid,$id)] \
-	-to $jid \
-	-connection $connid
-#	-command [list [namespace current]::subscribe_recv $connid $jid $id]
+    ::xmpp::sendIQ $xlib set \
+	-query [::xmpp::xml::create text \
+			-xmlns $::NS(mute_editor) \
+			-attrs [list id $id] \
+			-cdata $txts(text,$xlib,$id)] \
+	-to $jid
+#	-command [list [namespace current]::subscribe_recv $xlib $jid $id]
 }
 
 
-proc mute::ancestor::patch {connid jid id patch} {
+proc mute::ancestor::patch {xlib jid id patch} {
     variable txts
 
-    set text $txts(text,$connid,$id)
+    set text $txts(text,$xlib,$id)
 
     # TODO: check temp files
     set fn "/tmp/mute[rand 1000000]"
@@ -390,60 +387,61 @@
 
     file delete $fn.orig $fn.patch
 
-    set txts(text,$connid,$id) $new
-    after idle [list [namespace current]::distribute_patch $connid $id $patch]
+    set txts(text,$xlib,$id) $new
+    after idle [list [namespace current]::distribute_patch $xlib $id $patch]
 
     return [list result ""]
 }
 
-proc mute::ancestor::distribute_patch {connid id patch} {
+proc mute::ancestor::distribute_patch {xlib id patch} {
     variable txts
 
-    foreach subscriber $txts(subscribed,$connid,$id) {
-	jlib::send_iq set \
-	    [jlib::wrapper:createtag patch \
-		 -vars [list xmlns $::NS(mute_editor) id $id] \
-		 -chdata $patch] \
+    foreach subscriber $txts(subscribed,$xlib,$id) {
+	::xmpp::sendIQ $xlib set \
+	    -query [::xmpp::xml::create patch \
+			    -xmlns $::NS(mute_editor) \
+			    -attrs [list id $id] \
+			    -cdata $patch] \
 	    -to $subscriber \
 	    -command [list [namespace current]::unsubscribe_on_error \
-			  $connid $subscriber $id] \
-	    -connection $connid
+			  $xlib $subscriber $id]
     }
 }
 
-proc mute::ancestor::unsubscribe_on_error {connid jid id res child} {
+proc mute::ancestor::unsubscribe_on_error {xlib jid id status xml} {
     variable txts
 
-    if {$res != "OK"} {
-	set idx [lsearch -exact $txts(subscribed,$connid,$id) $jid]
-	set txts(subscribed,$connid,$id) [lreplace $txts(subscribed,$connid,$id) $idx $idx]
-	puts "REMOVE $connid $jid"
+    if {$status != "OK"} {
+	set idx [lsearch -exact $txts(subscribed,$xlib,$id) $jid]
+	set txts(subscribed,$xlib,$id) [lreplace $txts(subscribed,$xlib,$id) $idx $idx]
+	puts "REMOVE $xlib $jid"
     }
 }
 
-proc mute::ancestor::recv_get_iq {connid from lang child} {
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+proc mute::ancestor::recv_get_iq {xlib from xml args} {
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     switch -- $tag {
 	list {
 	    variable txts
 	    # TODO
-	    if {![info exists txts(ids,$connid)]} {
-		set txts(ids,$connid) $txts(ids)
+	    if {![info exists txts(ids,$xlib)]} {
+		set txts(ids,$xlib) $txts(ids)
 		foreach id $txts(ids) {
-		    set txts(desc,$connid,$id) $txts(desc,$id)
-		    set txts(text,$connid,$id) $txts(text,$id)
+		    set txts(desc,$xlib,$id) $txts(desc,$id)
+		    set txts(text,$xlib,$id) $txts(text,$id)
 		}
 	    }
 
 	    set items {}
-	    foreach id $txts(ids,$connid) {
-		lappend items [jlib::wrapper:createtag item \
-				   -vars [list id $id desc $txts(desc,$connid,$id)]]
+	    foreach id $txts(ids,$xlib) {
+		lappend items [::xmpp::xml::create item \
+				   -attrs [list id $id \
+						desc $txts(desc,$xlib,$id)]]
 	    }
-	    return [list result [jlib::wrapper:createtag list \
-				     -vars [list xmlns $::NS(mute_ancestor)] \
-				     -subtags $items]]
+	    return [list result [::xmpp::xml::create list \
+				     -xmlns $::NS(mute_ancestor) \
+				     -subelements $items]]
 	}
 	default {
 	    return [list error cancel feature-not-implemented]
@@ -452,25 +450,25 @@
     return ""
 }
 
-iq::register_handler get {} $::NS(mute_ancestor) \
-    [namespace current]::mute::ancestor::recv_get_iq
+::xmpp::iq::register get * $::NS(mute_ancestor) \
+		     [namespace current]::mute::ancestor::recv_get_iq
 
 
-proc mute::ancestor::recv_set_iq {connid from lang child} {
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+proc mute::ancestor::recv_set_iq {xlib from xml args} {
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
     switch -- $tag {
 	subscribe {
 	    variable txts
 
-	    foreach ch $children {
-		jlib::wrapper:splitxml $ch tag1 vars1 isempty1 chdata1 children1
+	    foreach subel $subels {
+		::xmpp::xml::split $subel stag sxmlns sattrs scdata ssubels
 
-		set id [jlib::wrapper:getattr $vars1 id]
-		if {[lcontain $txts(ids,$connid) $id]} {
-		    lappend txts(subscribed,$connid,$id) $from
-		    set txts(subscribed,$connid,$id) [lrmdups $txts(subscribed,$connid,$id)]
-		    after idle [list [namespace current]::send_text $connid $from $id]
+		set id [::xmpp::xml::getAttr $sattrs id]
+		if {[lcontain $txts(ids,$xlib) $id]} {
+		    lappend txts(subscribed,$xlib,$id) $from
+		    set txts(subscribed,$xlib,$id) [lrmdups $txts(subscribed,$xlib,$id)]
+		    after idle [list [namespace current]::send_text $xlib $from $id]
 		    return [list result ""]
 		} else {
 		    return [list error modify bad-request]
@@ -479,9 +477,8 @@
 	    return [list error modify bad-request]
 	}
 	patch {
-	    set id [jlib::wrapper:getattr $vars id]
-	    set patch $chdata
-	    return [patch $connid $from $id $patch]
+	    set id [::xmpp::xml::getAttr $attrs id]
+	    return [patch $xlib $from $id $cdata]
 	}
 	default {
 	    return [list error cancel feature-not-implemented]
@@ -490,8 +487,8 @@
     return ""
 }
 
-iq::register_handler set {} $::NS(mute_ancestor) \
-    [namespace current]::mute::ancestor::recv_set_iq
+::xmpp::iq::register set * $::NS(mute_ancestor) \
+		     [namespace current]::mute::ancestor::recv_set_iq
 
 
 

Modified: trunk/tkabber-plugins/osd/osd.tcl
===================================================================
--- trunk/tkabber-plugins/osd/osd.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/osd/osd.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -40,10 +40,10 @@
     }
 }
 
-proc ::osd::presence_notify {connid from type x args} {
+proc ::osd::presence_notify {xlib from type x args} {
     variable statuses
 
-    if {[catch  { set nick [get_nick $connid $from chat] }]} {
+    if {[catch  { set nick [get_nick $xlib $from chat] }]} {
         set nick "$from" 
     }
     
@@ -85,22 +85,21 @@
     }
 
     foreach xelem $extras {
-	jlib::wrapper:splitxml $xelem tag vars isempty chdata children
+	::xmpp::xml::split $xelem tag xmlns attrs cdata subels
 	
 	# Don't notify if this 'empty' tag is present. It indicates
 	# messages history in chat window.
-	if {[cequal $tag ""] && \
-		[cequal [jlib::wrapper:getattr $vars xmlns] tkabber:x:nolog]} {
+	if {[string equal $tag ""] && [string equal $xmlns tkabber:x:nolog]} {
 	    return
 	}
     }
 
-    set nick [get_nick [chat::get_connid $chatid] $from $type]
+    set nick [get_nick [chat::get_xlib $chatid] $from $type]
     osd::try_write "New message from $nick"
 }
 
-proc ::osd::get_nick {connid jid type} {
-    if {[catch {chat::get_nick $connid $jid $type} nick]} {
+proc ::osd::get_nick {xlib jid type} {
+    if {[catch {chat::get_nick $xlib $jid $type} nick]} {
 	return [chat::get_nick $jid $type]
     } else {
 	return $nick

Modified: trunk/tkabber-plugins/presencecmd/presencecmd.tcl
===================================================================
--- trunk/tkabber-plugins/presencecmd/presencecmd.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/presencecmd/presencecmd.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -102,11 +102,11 @@
 
     set cmd [list send_presence $pres \
 		      -to [chat::get_jid $chatid] \
-		      -pri $userpriority \
+		      -priority $userpriority \
 		      -connection [chat::get_connid $chatid]]
 
     if {$sendstatus} {
-	lappend cmd -stat $status
+	lappend cmd -status $status
     }
 
     eval $cmd

Modified: trunk/tkabber-plugins/receipts/receipts.tcl
===================================================================
--- trunk/tkabber-plugins/receipts/receipts.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/receipts/receipts.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -53,48 +53,45 @@
 # * Receipt request is attached to a groupchat private
 #   message or to a message from a user who subscribed
 #   to our presence.
-proc receipts::reply_allowed {connid from type} {
+proc receipts::reply_allowed {xlib from type} {
     variable options
 
     if {!$options(reply)} { return 0 }
     if {[string equal $type chat]} {
-	set chatid [chat::chatid $connid [node_and_server_from_jid $from]]
+	set chatid [chat::chatid $xlib [node_and_server_from_jid $from]]
 	if {[chat::is_groupchat $chatid]} { return 1 }
     }
-    return [roster::is_trusted $connid $from]
+    return [roster::is_trusted $xlib $from]
 }
 
 proc receipts::process_message \
-	{connid from id type is_subject subject body err thread priority x} {
+	{xlib from id type is_subject subject body err thread priority x} {
     foreach element $x {
-	jlib::wrapper:splitxml $element tag vars isempty chdata children
+	::xmpp::xml::split $element tag xmlns attrs cdata subels
 	switch -- $tag {
 	    request {
-		set xmlns [jlib::wrapper:getattr $vars xmlns]
 		if {![string equal $xmlns $::NS(receipts)]} continue
-		if {![reply_allowed $connid $from $type]} continue
-		process_receipt_request $connid $from $id
+		if {![reply_allowed $xlib $from $type]} continue
+		process_receipt_request $xlib $from $id
 	    }
 	    received {
-		set xmlns [jlib::wrapper:getattr $vars xmlns]
 		if {![string equal $xmlns $::NS(receipts)]} continue
-		process_receipt_response $connid $from $id $type
+		process_receipt_response $xlib $from $id $type
 	    }
 	}
     }
 }
 
-proc receipts::process_receipt_request {connid from id} {
-    jlib::send_msg $from -id $id \
-	-xlist [list [jlib::wrapper:createtag received \
-	    -vars [list xmlns $::NS(receipts)]]] \
-	-connection $connid
+proc receipts::process_receipt_request {xlib from id} {
+    ::xmpp::sendMessage $xlib $from -id $id \
+	-xlist [list [::xmpp::xml::create received \
+				-xmlns $::NS(receipts)]]
 }
 
-proc receipts::process_receipt_response {connid from id type} {
+proc receipts::process_receipt_response {xlib from id type} {
     variable requests
 
-    set chatid [chat::chatid $connid $from]
+    set chatid [chat::chatid $xlib $from]
     if {![chat::is_opened $chatid]} return
     set cw [chat::chat_win $chatid]
 
@@ -122,8 +119,8 @@
     global chat_msg_id
     upvar 2 $xlistVar xlist
 
-    lappend xlist [jlib::wrapper:createtag request \
-		    -vars [list xmlns $::NS(receipts)]]
+    lappend xlist [::xmpp::xml::create request \
+			    -xmlns $::NS(receipts)]
 
     richtext::property_update msgid $chat_msg_id
 }

Modified: trunk/tkabber-plugins/renju/renju.tcl
===================================================================
--- trunk/tkabber-plugins/renju/renju.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/renju/renju.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -68,15 +68,15 @@
 
 hook::add postload_hook [namespace current]::renju::load_stored_theme 70
 
-proc renju::get_nick {connid jid type} {
-    if {[catch {chat::get_nick $connid $jid $type} nick]} {
+proc renju::get_nick {xlib jid type} {
+    if {[catch {chat::get_nick $xlib $jid $type} nick]} {
 	return [chat::get_nick $jid $type]
     } else {
 	return $nick
     }
 }
 
-proc renju::invite_dialog {connid jid} {
+proc renju::invite_dialog {xlib jid} {
     variable options
 
     set w .renju_invite
@@ -91,7 +91,7 @@
     set wf [$w getframe]
     message $wf.message -aspect 50000 \
 	-text [format [::msgcat::mc "Sending Gomoku/Renju game invitation to %s (%s)"] \
-		      [get_nick $connid $jid chat] \
+		      [get_nick $xlib $jid chat] \
 		      $jid]
 
     pack $wf.message -pady 2m
@@ -111,16 +111,16 @@
     pack $wf.tournament -padx 15m -anchor w
 
     $w add -text [::msgcat::mc "I want to move first"] \
-	-command [list [namespace current]::invite $connid $jid black]
+	-command [list [namespace current]::invite $xlib $jid black]
     $w add -text [::msgcat::mc "I want to move second"] \
-	-command [list [namespace current]::invite $connid $jid white]
+	-command [list [namespace current]::invite $xlib $jid white]
     $w add -text [::msgcat::mc "Cancel invitation"] \
 	-command [list destroy $w]
 
     $w draw
 }
 
-proc renju::invite {connid jid color} {
+proc renju::invite {xlib jid color} {
     variable game
 
     destroy .renju_invite
@@ -130,28 +130,30 @@
     # FIX
     #set rjid [get_jid_of_user $jid]
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag create \
-	     -vars [list xmlns games:board type $game id $id color $color]] \
+    ::xmpp::sendIQ $xlib set \
+	-query [::xmpp::xml::createtag create \
+			-xmlns games:board \
+			-attrs [list type $game \
+				     id $id \
+				     color $color]] \
 	-to $jid \
-	-command [list [namespace current]::invite_res $game $connid $jid $id $color] \
-	-connection $connid
+	-command [list [namespace current]::invite_res $game $xlib $jid $id $color]
 }
 
-proc renju::invite_res {game connid jid id color res child} {
-    if {![cequal $res OK]} {
+proc renju::invite_res {game xlib jid id color status xml} {
+    if {![string equal $status ok]} {
 	after idle [list NonmodalMessageDlg .renju_invite_error -aspect 50000 -icon error \
-	    -message [format [::msgcat::mc "%s (%s) has refused Gomoku/Renju invitation: %s"] \
-			     [get_nick $connid $jid chat] \
-			     $jid [error_to_string $child]]]
+	    -message [::msgcat::mc "%s (%s) has refused Gomoku/Renju invitation: %s" \
+				   [get_nick $xlib $jid chat] \
+				   $jid [error_to_string $xml]]]
 	return ""
     }
 
-    start_play $game $connid $jid $id $color
+    start_play $game $xlib $jid $id $color
 }
 
 
-proc renju::invited_dialog {game connid jid id color} {
+proc renju::invited_dialog {game xlib jid id color} {
     variable invited_result
     variable game_names
 
@@ -161,14 +163,14 @@
 	destroy $w
     }
 
-    Dialog $w -title [format [::msgcat::mc "Gomoku/Renju Invitation from %s"] $jid] \
+    Dialog $w -title [::msgcat::mc "Gomoku/Renju Invitation from %s" $jid] \
 	-modal none -separator 1 -anchor e -default 0
 
     set wf [$w getframe]
 
     bind $wf <Destroy> [list [namespace current]::set_invited_res ""]
 
-    set nick [get_nick $connid $jid chat]
+    set nick [get_nick $xlib $jid chat]
     set message1 [format [::msgcat::mc "Gomoku/Renju game invitation from %s (%s) is received."] \
 			 $nick $jid]
     set message2 [format [::msgcat::mc "%s wants play %s."] $nick $game_names($game)]
@@ -206,10 +208,10 @@
     if {$invited_result == 0} {
 	switch -- $color {
 	    white {
-		start_play $game $connid $jid $id black
+		start_play $game $xlib $jid $id black
 	    }
 	    black {
-		start_play $game $connid $jid $id white
+		start_play $game $xlib $jid $id white
 	    }
 	    default {
 		return [list error modify bad-request]
@@ -217,8 +219,10 @@
 	}
 
 	return [list result\
-		     [jlib::wrapper:createtag create \
-			  -vars [list xmlns games:board type $game id $id]]]
+		     [::xmpp::xml::createtag create \
+				-xmlns games:board \
+				-attrs [list type $game \
+					     id $id]]]
     } else {
 	return [list error modify not-acceptable]
     }
@@ -229,14 +233,14 @@
     set invited_result $res
 }
 
-proc renju::start_play {game connid jid id color} {
+proc renju::start_play {game xlib jid id color} {
 
     set gid [make_gid $jid $id]
     variable $gid
     upvar 0 $gid flags
 
     set flags(window) [win_id renju $gid]
-    set flags(connid) $connid
+    set flags(xlib) $xlib
     set flags(opponent) $jid
     set flags(id) $id
     set flags(game) $game
@@ -313,7 +317,7 @@
     jid_to_tag [concat $jid $id]
 }
 
-proc renju::turn_recv {gid children} {
+proc renju::turn_recv {gid xmlList} {
     variable options
     variable $gid
     upvar 0 $gid flags
@@ -322,11 +326,11 @@
     set skip 0
     set draw 0
 
-    foreach child $children {
-	jlib::wrapper:splitxml $child tag vars isempty chdata children1
+    foreach xml $xmlList {
+	::xmpp::xml::split $xml tag xmlns attrs cdata subels
 	switch -- $tag {
 	    put {
-		set pos [jlib::wrapper:getattr $vars pos]
+		set pos [::xmpp::xml::getAttr $attrs pos]
 		set poss [split $pos ","]
 		if {[llength $poss] == 2} {
 		    set ct [lindex $poss 0]
@@ -352,10 +356,10 @@
 		update_controls $gid
 		draw_position $gid
 		highlight_last_move $gid
-		return [list result [jlib::wrapper:createtag turn \
-					 -vars [list xmlns games:board \
-						     type $flags(game) \
-						     id $flags(id)]]]
+		return [list result [::xmpp::xml::createtag turn \
+					    -xmlns games:board \
+					    -attrs [list type $flags(game) \
+							 id $flags(id)]]]
 	    }
 	    accept {
 		if {$flags(position,draw)} {
@@ -363,9 +367,9 @@
 		    update_controls $gid
 		    draw_position $gid
 		    highlight_last_move $gid
-		    return [list result [jlib::wrapper:createtag turn \
-					     -vars [list xmlns games:board \
-							 type $flags(game) \
+		    return [list result [::xmpp::xml::createtag turn \
+					    -xmlns games:board \
+					    -attrs [list type $flags(game) \
 							 id $flags(id)]]]
 		} else {
 		    return [list error modify not-acceptable]
@@ -386,10 +390,10 @@
 	draw_position $gid
 	highlight_last_move $gid
 
-	return [list result [jlib::wrapper:createtag turn \
-				 -vars [list xmlns games:board \
-					     type $flags(game) \
-					     id $flags(id)]]]
+	return [list result [::xmpp::xml::createtag turn \
+				    -xmlns games:board \
+				    -attrs [list type $flags(game) \
+						 id $flags(id)]]]
     } else {
 	return [list error modify not-acceptable]
     }
@@ -477,7 +481,7 @@
     }
 
     set title [::msgcat::mc "%s with %s" $game_names($flags(game)) \
-			    [get_nick $flags(connid) $jid chat]]
+			    [get_nick $flags(xlib) $jid chat]]
     add_win $w -title $title \
 	       -tabtitle $title \
 	       -class renju \
@@ -902,14 +906,13 @@
     variable $gid
     upvar 0 $gid flags
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag turn \
-	     -vars [list xmlns games:board \
-			type $flags(game) \
-			id $flags(id)] \
-	     -subtags [list [jlib::wrapper:createtag accept]]] \
-	-to $flags(opponent) \
-	-connection $flags(connid)
+    ::xmpp::sendIQ $flags(xlib) set \
+	-query [::xmpp::xml::createtag turn \
+			-xmlns games:board \
+			-attrs [list type $flags(game) \
+				     id $flags(id)] \
+			-subelement [::xmpp::xml::createtag accept]] \
+	-to $flags(opponent)
 
 	end_game $gid 0.5 [::msgcat::mc "Draw (You accepted)"]
 	update_controls $gid
@@ -929,14 +932,13 @@
     }
     find_legal_moves $gid $flags(position,turn)
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag turn \
-	     -vars [list xmlns games:board \
-			type $flags(game) \
-			id $flags(id)] \
-	     -subtags [list [jlib::wrapper:createtag skip]]] \
+    ::xmpp::sendIQ $flags(xlib) set \
+	-query [::xmpp::xml::createtag turn \
+			-xmlns games:board \
+			-attrs [list type $flags(game) \
+				     id $flags(id)] \
+			-subelement [::xmpp::xml::createtag skip]] \
 	-to $flags(opponent) \
-	-connection $flags(connid) \
 	-command [list [namespace current]::send_result $gid]
 
     if {[lindex $flags(position,history) end] == "skip" && \
@@ -952,14 +954,13 @@
     variable $gid
     upvar 0 $gid flags
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag turn \
-	     -vars [list xmlns games:board \
-			type $flags(game) \
-			id $flags(id)] \
-	     -subtags [list [jlib::wrapper:createtag resign]]] \
-	-to $flags(opponent) \
-	-connection $flags(connid)
+    ::xmpp::sendIQ $flags(xlib) set \
+	-query [::xmpp::xml::createtag turn \
+			-xmlns games:board \
+			-attrs [list type $flags(game) \
+				     id $flags(id)] \
+			-subelement [::xmpp::xml::createtag resign]] \
+	-to $flags(opponent)
 
     end_game $gid 0 [::msgcat::mc "Opponent wins (You resigned)"]
     update_controls $gid
@@ -971,27 +972,27 @@
     variable $gid
     upvar 0 $gid flags
 
-    set put_tags [list [jlib::wrapper:createtag put -vars [list pos "$ct,$rt"]]]
+    set put_tags [list [::xmpp::xml::createtag put \
+				-attrs [list pos "$ct,$rt"]]]
     if {$flags(position,draw)} {
-	lappend put_tags [jlib::wrapper:createtag draw]
+	lappend put_tags [::xmpp::xml::createtag draw]
     }
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag turn \
-	     -vars [list xmlns games:board \
-			type $flags(game) \
-			id $flags(id)] \
-	     -subtags $put_tags] \
+    ::xmpp::sendIQ $flags(xlib) set \
+	-query [::xmpp::xml::createtag turn \
+			-xmlns games:board \
+			-attrs [list type $flags(game) \
+				     id $flags(id)] \
+			-subelements $put_tags] \
 	-to $flags(opponent) \
-	-connection $flags(connid) \
 	-command [list [namespace current]::send_result $gid]
 }
 
-proc renju::send_result {gid res child} {
-    if {$res == "ERR"} {
+proc renju::send_result {gid status xml} {
+    if {$status == "error"} {
 	attention_message $gid \
-	    [format [::msgcat::mc "\n\n Opponent rejected move:\n %s\n\n"] \
-		[error_to_string $child]]
+	    [::msgcat::mc "\n\n Opponent rejected move:\n %s\n\n" \
+			  [error_to_string $xml]]
 	restore_position $gid
     }
 }
@@ -1441,14 +1442,14 @@
     string equal -length 1 $f1 $f2
 }
 
-proc renju::add_groupchat_user_menu_item {m connid jid} {
+proc renju::add_groupchat_user_menu_item {m xlib jid} {
     set mm $m.gamesmenu
     if {![winfo exists $mm]} {
 	menu $mm -tearoff 0
 	$m add cascade -label [::msgcat::mc "Games"] -menu $mm
     }
     $mm add command -label [::msgcat::mc "Gomoku/Renju..."] \
-	-command [list [namespace current]::invite_dialog $connid $jid]
+	-command [list [namespace current]::invite_dialog $xlib $jid]
 }
 
 hook::add roster_create_groupchat_user_menu_hook \
@@ -1458,12 +1459,12 @@
 hook::add roster_jid_popup_menu_hook \
     [namespace current]::renju::add_groupchat_user_menu_item 51
 
-proc renju::iq_create {varname connid from child} {
+proc renju::iq_create {varname xlib from xml} {
     upvar 2 $varname var
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-    set game [jlib::wrapper:getattr $vars type]
+    set game [::xmpp::xml::getAttr $attrs type]
 
     switch -- $game {
 	gomoku:freestyle -
@@ -1475,8 +1476,8 @@
 	}
     }
 
-    if {[jlib::wrapper:isattr $vars color]} {
-	set color [jlib::wrapper:getattr $vars color]
+    if {[::xmpp::xml::isattr $attrs color]} {
+	set color [::xmpp::xml::getAttr $attrs color]
 	switch -- $color {
 	    white -
 	    black { }
@@ -1488,19 +1489,19 @@
 	set color white
     }
     set var [[namespace current]::invited_dialog \
-		 $game $connid $from \
-		 [jlib::wrapper:getattr $vars id] \
+		 $game $xlib $from \
+		 [::xmpp::xml::getAttr $attrs id] \
 		 $color]
 }
 
 hook::add games_board_create_hook [namespace current]::renju::iq_create
 
-proc renju::iq_turn {varname connid from child} {
+proc renju::iq_turn {varname xlib from xml} {
     upvar 2 $varname var
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-    switch -- [jlib::wrapper:getattr $vars type] {
+    switch -- [::xmpp::xml::getAttr $attrs type] {
 	gomoku:freestyle -
 	gomoku:standard -
 	gomoku:tournament -
@@ -1510,9 +1511,9 @@
 	}
     }
 
-    set gid [make_gid $from [jlib::wrapper:getattr $vars id]]
+    set gid [make_gid $from [::xmpp::xml::getAttr $attrs id]]
     if {[exists $gid]} {
-	set var [[namespace current]::turn_recv $gid $children]
+	set var [[namespace current]::turn_recv $gid $subels]
     } else {
 	set var [list error cancel item-not-found]
     }
@@ -1522,21 +1523,21 @@
 
 
 # Common games:board part
-proc iq_games_board_create {connid from lang child} {
+proc iq_games_board_create {xlib from xml args} {
     set res [list error cancel feature-not-implemented]
-    hook::run games_board_create_hook res $connid $from $child
+    hook::run games_board_create_hook res $xlib $from $xml
     return $res
 }
 
-iq::register_handler set create games:board \
-    [namespace current]::iq_games_board_create
+::xmpp::iq::register set create games:board \
+		     [namespace current]::iq_games_board_create
 
-proc iq_games_board_turn {connid from lang child} {
+proc iq_games_board_turn {xlib from xml args} {
     set res [list error cancel feature-not-implemented]
-    hook::run games_board_turn_hook res $connid $from $child
+    hook::run games_board_turn_hook res $xlib $from $xml
     return $res
 }
 
-iq::register_handler set turn games:board \
-    [namespace current]::iq_games_board_turn
+::xmpp::iq::register set turn games:board \
+		     [namespace current]::iq_games_board_turn
 

Modified: trunk/tkabber-plugins/reversi/reversi.tcl
===================================================================
--- trunk/tkabber-plugins/reversi/reversi.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/reversi/reversi.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -57,15 +57,15 @@
 
 hook::add postload_hook [namespace current]::reversi::load_stored_theme 70
 
-proc reversi::get_nick {connid jid type} {
-    if {[catch {chat::get_nick $connid $jid $type} nick]} {
+proc reversi::get_nick {xlib jid type} {
+    if {[catch {chat::get_nick $xlib $jid $type} nick]} {
 	return [chat::get_nick $jid $type]
     } else {
 	return $nick
     }
 }
 
-proc reversi::invite_dialog {connid jid} {
+proc reversi::invite_dialog {xlib jid} {
     set w .reversi_invite
 
     if {[winfo exists $w]} {
@@ -78,22 +78,22 @@
     set wf [$w getframe]
     message $wf.message -aspect 50000 \
 	-text [format [::msgcat::mc "Sending reversi game invitation to %s (%s)"] \
-		      [get_nick $connid $jid chat] \
+		      [get_nick $xlib $jid chat] \
 		      $jid]
 
     pack $wf.message -pady 2m
 
     $w add -text [::msgcat::mc "I want play black"] \
-	-command [list [namespace current]::invite $connid $jid black]
+	-command [list [namespace current]::invite $xlib $jid black]
     $w add -text [::msgcat::mc "I want play white"] \
-	-command [list [namespace current]::invite $connid $jid white]
+	-command [list [namespace current]::invite $xlib $jid white]
     $w add -text [::msgcat::mc "Cancel invitation"] \
 	-command [list destroy $w]
 
     $w draw
 }
 
-proc reversi::invite {connid jid color} {
+proc reversi::invite {xlib jid color} {
     destroy .reversi_invite
 
     set id reversi[rand 1000000000]
@@ -101,28 +101,30 @@
     # FIX
     #set rjid [get_jid_of_user $jid]
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag create \
-	     -vars [list xmlns games:board type reversi id $id color $color]] \
+    ::xmpp::sendIQ $xlib set \
+	query [::xmpp::xml::create create \
+			-xmlns games:board \
+			-attrs [list type reversi \
+				     id $id \
+				     color $color]] \
 	-to $jid \
-	-command [list [namespace current]::invite_res $connid $jid $id $color] \
-	-connection $connid
+	-command [list [namespace current]::invite_res $xlib $jid $id $color]
 }
 
-proc reversi::invite_res {connid jid id color res child} {
-    if {![cequal $res OK]} {
+proc reversi::invite_res {xlib jid id color status xml} {
+    if {![string equal $status ok]} {
 	after idle [list NonmodalMessageDlg .reversi_invite_error -aspect 50000 -icon error \
-	    -message [format [::msgcat::mc "%s (%s) has refused reversi invitation: %s"] \
-			     [get_nick $connid $jid chat] \
-			     $jid [error_to_string $child]]]
+	    -message [::msgcat::mc "%s (%s) has refused reversi invitation: %s" \
+				   [get_nick $xlib $jid chat] \
+				   $jid [error_to_string $xml]]]
 	return ""
     }
 
-    start_play $connid $jid $id $color
+    start_play $xlib $jid $id $color
 }
 
 
-proc reversi::invited_dialog {connid jid id color} {
+proc reversi::invited_dialog {xlib jid id color} {
     variable invited_result
 
     set w .reversi_invited
@@ -138,7 +140,7 @@
 
     bind $wf <Destroy> [list [namespace current]::set_invited_res ""]
 
-    set nick [get_nick $connid $jid chat]
+    set nick [get_nick $xlib $jid chat]
     set message1 [format [::msgcat::mc "Reversi game invitation from %s (%s) is received."] \
 			 $nick $jid]
     switch -- $color {
@@ -173,10 +175,10 @@
     if {$invited_result == 0} {
 	switch -- $color {
 	    white {
-		start_play $connid $jid $id black
+		start_play $xlib $jid $id black
 	    }
 	    black {
-		start_play $connid $jid $id white
+		start_play $xlib $jid $id white
 	    }
 	    default {
 		return [list error modify bad-request]
@@ -184,8 +186,10 @@
 	}
 
 	return [list result\
-		     [jlib::wrapper:createtag create \
-			  -vars [list xmlns games:board type reversi id $id]]]
+		     [::xmpp::xml::create create \
+			    -xmlns games:board \
+			    -attrs [list type reversi \
+					 id $id]]]
     } else {
 	return [list error modify not-acceptable]
     }
@@ -196,14 +200,14 @@
     set invited_result $res
 }
 
-proc reversi::start_play {connid jid id color} {
+proc reversi::start_play {xlib jid id color} {
 
     set gid [make_gid $jid $id]
     variable $gid
     upvar 0 $gid flags
 
     set flags(window) [win_id reversi $gid]
-    set flags(connid) $connid
+    set flags(xlib) $xlib
     set flags(opponent) $jid
     set flags(id) $id
     set flags(flip) 0
@@ -284,7 +288,7 @@
     jid_to_tag [concat $jid $id]
 }
 
-proc reversi::turn_recv {gid children} {
+proc reversi::turn_recv {gid xmlList} {
     variable options
     variable $gid
     upvar 0 $gid flags
@@ -292,11 +296,11 @@
     set move 0
     set draw 0
 
-    foreach child $children {
-	jlib::wrapper:splitxml $child tag vars isempty chdata children1
+    foreach xml $xmlList {
+	::xmpp::xml::split $xml tag xmlns attrs cdata subels
 	switch -- $tag {
 	    put {
-		set pos [jlib::wrapper:getattr $vars pos]
+		set pos [::xmpp::xml::getAttr $attrs pos]
 		set poss [split $pos ","]
 		if {[llength $poss] == 2} {
 		    set ct [lindex $poss 0]
@@ -312,10 +316,10 @@
 		update_controls $gid
 		draw_position $gid
 		highlight_last_move $gid
-		return [list result [jlib::wrapper:createtag turn \
-					 -vars [list xmlns games:board \
-						     type reversi \
-						     id $flags(id)]]]
+		return [list result [::xmpp::xml::create turn \
+					    -xmlns games:board \
+					    -attrs [list type reversi \
+							 id $flags(id)]]]
 	    }
 	    accept {
 		if {$flags(position,draw)} {
@@ -323,10 +327,10 @@
 		    update_controls $gid
 		    draw_position $gid
 		    highlight_last_move $gid
-		    return [list result [jlib::wrapper:createtag turn \
-					     -vars [list xmlns games:board \
-							 type reversi \
-							 id $flags(id)]]]
+		    return [list result [::xmpp::xml::create turn \
+						-xmlns games:board \
+						-attrs [list type reversi \
+							     id $flags(id)]]]
 		} else {
 		    return [list error modify not-acceptable]
 		}
@@ -342,10 +346,10 @@
 	draw_position $gid
 	highlight_last_move $gid
 
-	return [list result [jlib::wrapper:createtag turn \
-				 -vars [list xmlns games:board \
-					     type reversi \
-					     id $flags(id)]]]
+	return [list result [::xmpp::xml::create turn \
+					-xmlns games:board \
+					-attrs [list type reversi \
+						     id $flags(id)]]]
     } else {
 	return [list error modify not-acceptable]
     }
@@ -431,7 +435,7 @@
 	return
     }
 
-    set title [format [::msgcat::mc "Reversi with %s"] [get_nick $flags(connid) $jid chat]]
+    set title [format [::msgcat::mc "Reversi with %s"] [get_nick $flags(xlib) $jid chat]]
     add_win $w -title $title \
 	       -tabtitle $title \
 	       -class Reversi \
@@ -905,14 +909,13 @@
     variable $gid
     upvar 0 $gid flags
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag turn \
-	     -vars [list xmlns games:board \
-			type reversi \
-			id $flags(id)] \
-	     -subtags [list [jlib::wrapper:createtag accept]]] \
-	-to $flags(opponent) \
-	-connection $flags(connid)
+    ::xmpp::sendIQ $flags(xlib) set \
+	-query [::xmpp::xml::create turn \
+			-xmlns games:board \
+			-attrs [list type reversi \
+				     id $flags(id)] \
+			-subelement [::xmpp::xml::create accept]] \
+	-to $flags(opponent)
 
 	end_game $gid 0.5 [::msgcat::mc "Draw (You accepted)"]
 	update_controls $gid
@@ -924,14 +927,13 @@
     variable $gid
     upvar 0 $gid flags
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag turn \
-	     -vars [list xmlns games:board \
-			type reversi \
-			id $flags(id)] \
-	     -subtags [list [jlib::wrapper:createtag resign]]] \
-	-to $flags(opponent) \
-	-connection $flags(connid)
+    ::xmpp::sendIQ $flags(xlib) set \
+	-query [::xmpp::xml::create turn \
+			-xmlns games:board \
+			-attrs [list type reversi \
+				     id $flags(id)] \
+			-subelement [::xmpp::xml::create resign]] \
+	-to $flags(opponent)
 
 	end_game $gid 0 [::msgcat::mc "Opponent wins (You resigned)"]
 	update_controls $gid
@@ -943,27 +945,26 @@
     variable $gid
     upvar 0 $gid flags
 
-    set put_tags [list [jlib::wrapper:createtag put -vars [list pos "$ct,$rt"]]]
+    set put_tags [list [::xmpp::xml::create put -attrs [list pos "$ct,$rt"]]]
     if {$flags(position,draw)} {
-	lappend put_tags [jlib::wrapper:createtag draw]
+	lappend put_tags [::xmpp::xml::create draw]
     }
 
-    jlib::send_iq set \
-	[jlib::wrapper:createtag turn \
-	     -vars [list xmlns games:board \
-			type reversi \
-			id $flags(id)] \
-	     -subtags $put_tags] \
+    ::xmpp::sendIQ $flags(xlib) set \
+	-query [::xmpp::xml::create turn \
+			-xmlns games:board \
+			-attrs [list type reversi \
+				     id $flags(id)] \
+			-subelements $put_tags] \
 	-to $flags(opponent) \
-	-connection $flags(connid) \
 	-command [list [namespace current]::send_result $gid]
 }
 
-proc reversi::send_result {gid res child} {
-    if {$res == "ERR"} {
+proc reversi::send_result {gid status xml} {
+    if {$status == "error"} {
 	attention_message $gid \
-	    [format [::msgcat::mc "\n\n Opponent rejected move:\n %s\n\n"] \
-		[error_to_string $child]]
+	    [::msgcat::mc "\n\n Opponent rejected move:\n %s\n\n" \
+			  [error_to_string $xml]]
 	restore_position $gid
     }
 }
@@ -1134,14 +1135,14 @@
     string equal -length 1 $f1 $f2
 }
 
-proc reversi::add_groupchat_user_menu_item {m connid jid} {
+proc reversi::add_groupchat_user_menu_item {m xlib jid} {
     set mm $m.gamesmenu
     if {![winfo exists $mm]} {
 	menu $mm -tearoff 0
 	$m add cascade -label [::msgcat::mc "Games"] -menu $mm
     }
     $mm add command -label [::msgcat::mc "Reversi..."] \
-	-command [list [namespace current]::invite_dialog $connid $jid]
+	-command [list [namespace current]::invite_dialog $xlib $jid]
 }
 
 hook::add roster_create_groupchat_user_menu_hook \
@@ -1151,14 +1152,14 @@
 hook::add roster_jid_popup_menu_hook \
     [namespace current]::reversi::add_groupchat_user_menu_item 51
 
-proc reversi::iq_create {varname connid from child} {
+proc reversi::iq_create {varname xlib from xml} {
     upvar 2 $varname var
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-    if {[jlib::wrapper:getattr $vars type] == "reversi"} {
-	if {[jlib::wrapper:isattr $vars color]} {
-	    set color [jlib::wrapper:getattr $vars color]
+    if {[::xmpp::xml::getAttr $attrs type] == "reversi"} {
+	if {[::xmpp::xml::isAttr $attrs color]} {
+	    set color [::xmpp::xml::getAttr $attrs color]
 	    switch -- $color {
 		white -
 		black { }
@@ -1170,8 +1171,8 @@
 	    set color white
 	}
 	set var [[namespace current]::invited_dialog \
-		     $connid $from \
-		     [jlib::wrapper:getattr $vars id] \
+		     $xlib $from \
+		     [::xmpp::xml::getAttr $attrs id] \
 		     $color]
     }
     return
@@ -1179,15 +1180,15 @@
 
 hook::add games_board_create_hook [namespace current]::reversi::iq_create
 
-proc reversi::iq_turn {varname connid from child} {
+proc reversi::iq_turn {varname xlib from xml} {
     upvar 2 $varname var
 
-    jlib::wrapper:splitxml $child tag vars isempty chdata children
+    ::xmpp::xml::split $xml tag xmlns attrs cdata subels
 
-    if {[jlib::wrapper:getattr $vars type] == "reversi"} {
-	set gid [make_gid $from [jlib::wrapper:getattr $vars id]]
+    if {[::xmpp::xml::getAttr $attrs type] == "reversi"} {
+	set gid [make_gid $from [::xmpp::xml::getAttr $attrs id]]
 	if {[exists $gid]} {
-	    set var [[namespace current]::turn_recv $gid $children]
+	    set var [[namespace current]::turn_recv $gid $subels]
 	} else {
 	    set var [list error cancel item-not-found]
 	}
@@ -1199,21 +1200,21 @@
 
 
 # Common games:board part
-proc iq_games_board_create {connid from lang child} {
+proc iq_games_board_create {xlib from xml args} {
     set res [list error cancel feature-not-implemented]
-    hook::run games_board_create_hook res $connid $from $child
+    hook::run games_board_create_hook res $xlib $from $xml
     return $res
 }
 
-iq::register_handler set create games:board \
-    [namespace current]::iq_games_board_create
+::xmpp::iq::register set create games:board \
+		     [namespace current]::iq_games_board_create
 
-proc iq_games_board_turn {connid from lang child} {
+proc iq_games_board_turn {xlib from xml args} {
     set res [list error cancel feature-not-implemented]
-    hook::run games_board_turn_hook res $connid $from $child
+    hook::run games_board_turn_hook res $xlib $from $xml
     return $res
 }
 
-iq::register_handler set turn games:board \
-    [namespace current]::iq_games_board_turn
+::xmpp::iq::register set turn games:board \
+		     [namespace current]::iq_games_board_turn
 

Modified: trunk/tkabber-plugins/tclchat/tclchat.tcl
===================================================================
--- trunk/tkabber-plugins/tclchat/tclchat.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/tclchat/tclchat.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -380,9 +380,9 @@
 
 	set color [plugins::nickcolors::get_color $user]
         if {[string length $color] > 0} {
-            lappend var [jlib::wrapper:createtag x \
-                             -vars [list xmlns urn:tkchat:chat \
-                                         color [color_to_hex $color]]]
+            lappend var [::xmpp::xml::create x \
+				-xmlns urn:tkchat:chat \
+                                -attrs [list color [color_to_hex $color]]]
         }
     }
 }

Modified: trunk/tkabber-plugins/tclchat/tclchat_messages.tcl
===================================================================
--- trunk/tkabber-plugins/tclchat/tclchat_messages.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/tclchat/tclchat_messages.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -39,7 +39,7 @@
 }
 
 # VERY DIRTY HACK. Tkabber doesn't have appropriate hook, so using inappropriate
-proc tclchat::request_users_list {vxlist connid stat} {
+proc tclchat::request_users_list {vxlist xlib stat} {
     upvar 2 newargs args
     variable irc_users
     variable options
@@ -58,7 +58,7 @@
     # If the presence doesn't go to Tclers' chat, do nothing
     if {![cequal $group $options(tclers_chat_jid)]} return
 
-    set chatid [chat::chatid $connid $group]
+    set chatid [chat::chatid $xlib $group]
 
     # If the chat is disconnected then we're trying to connect. Then it's
     # time to request IRC users list
@@ -66,38 +66,37 @@
 	    $chat::chats(status,$chatid) == "disconnected"} {
 	# Setting the flag to show that the answer is to be processed
 	# programmatically
-	set irc_users($connid) {}
-	message::send_msg $options(bridge_jid) \
+	set irc_users($xlib) {}
+	message::send_msg $xlib $options(bridge_jid) \
 			  -type chat \
-			  -body names \
-			  -connection $connid
+			  -body names
     }
 }
 
 proc tclchat::fill_irc_users \
-     {connid from id type is_subject subject body err thread priority x} {
+     {xlib from id type is_subject subject body err thread priority x} {
     variable irc_users
     variable options
 
     # Don't process message if we didn't ask the list or this message isn't
     # from bridge JID
-    if {![info exists irc_users($connid)]} return
+    if {![info exists irc_users($xlib)]} return
     if {![cequal $from $options(bridge_jid)]} return
 
-    unset irc_users($connid)
-    after idle [list [namespace current]::inject_irc_users $connid $body]
+    unset irc_users($xlib)
+    after idle [list [namespace current]::inject_irc_users $xlib $body]
     return stop
 }
 
-proc tclchat::inject_irc_users {connid users args} {
+proc tclchat::inject_irc_users {xlib users args} {
     variable options
 
     set group $options(tclers_chat_jid)
 
-    set chatid [chat::chatid $connid $group]
+    set chatid [chat::chatid $xlib $group]
 
     trace vdelete chat::chats(status,$chatid) w \
-	  [list [namespace current]::inject_irc_users $connid $users]
+	  [list [namespace current]::inject_irc_users $xlib $users]
 
     if {![chat::is_opened $chatid]} return
 
@@ -105,21 +104,21 @@
     # a change in chat status
     if {$chat::chats(status,$chatid) == "disconnected"} {
 	trace variable chat::chats(status,$chatid) w \
-	      [list [namespace current]::inject_irc_users $connid $users]
+	      [list [namespace current]::inject_irc_users $xlib $users]
 	return
     }
 
-    set px [jlib::wrapper:createtag x \
-		-vars [list xmlns $::NS(muc#user)] \
-		-subtags [list [jlib::wrapper:createtag item \
-				    -vars [list affiliation none]]]]
+    set px [::xmpp::xml::create x \
+		-xmlns $::NS(muc#user) \
+		-subelement [::xmpp::xml::create item \
+				    -attrs [list affiliation none]]]
     foreach nick $users {
 	set nickid $group/$nick
 	if {[lsearch -exact $::grouproster(users,$chatid) $nickid] < 0 || \
-		[cequal $::muc::users(role,$connid,$nickid) ""]} {
-	    client:presence $connid $nickid available [list $px]
+		[cequal $::muc::users(role,$xlib,$nickid) ""]} {
+	    client:presence $xlib $nickid available [list $px]
 	} else {
-	    client:message $connid $group "" groupchat 0 "" \
+	    client:message $xlib $group "" groupchat 0 "" \
 			   [::msgcat::mc "%s has joined IRC channel,\
 					  but he/she is already in Jabber room" \
 					 $nick] [list "" ""] "" "" {}
@@ -130,13 +129,13 @@
 ###############################################################################
 
 proc tclchat::jid_in_chat {chatid jid} {
-    set connid [chat::get_connid $chatid]
+    set xlib [chat::get_xlib $chatid]
     return [expr {[lsearch -exact $::grouproster(users,$chatid) $jid] >= 0 && \
-		  ![cequal $::muc::users(role,$connid,$jid) ""]}]
+		  ![cequal $::muc::users(role,$xlib,$jid) ""]}]
 }
 
 proc tclchat::process_ijchain_message \
-     {connid from id type is_subject subject body err thread priority x} {
+     {xlib from id type is_subject subject body err thread priority x} {
     variable options
 
     # Filter groupchat messages only
@@ -144,12 +143,12 @@
 
     set group [node_and_server_from_jid $from]
 
-    set chatid [chat::chatid $connid $group]
+    set chatid [chat::chatid $xlib $group]
 
     # Filter messages from tcl at tach.tclers.tk only
     if {![cequal $group $options(tclers_chat_jid)]} return
 
-    set nick [chat::get_nick $connid $from $type]
+    set nick [chat::get_nick $xlib $from $type]
 
     # Filter messages from ijchain only
     if {$nick != $options(bridge_nickname)} return
@@ -166,15 +165,15 @@
 	    joins {
 		debugmsg chat "Handle \"$nick\" joined message."
 
-		set px [jlib::wrapper:createtag x \
-			    -vars [list xmlns $::NS(muc#user)] \
-			    -subtags [list [jlib::wrapper:createtag item \
-						-vars [list affiliation none]]]]
+		set px [::xmpp::xml::create x \
+			    -xmlns $::NS(muc#user) \
+			    -subelement [::xmpp::xml::create item \
+						-attrs [list affiliation none]]]
 
 		if {![jid_in_chat $chatid $nickid]} {
-		    client:presence $connid $nickid available [list $px]
+		    client:presence $xlib $nickid available [list $px]
 		} else {
-		    client:message $connid $group $id $type 0 "" \
+		    client:message $xlib $group $id $type 0 "" \
 				   [::msgcat::mc "%s has joined IRC channel,\
 						  but %s is already in Jabber room" \
 						 $nick $nick] \
@@ -185,9 +184,9 @@
 		debugmsg chat "Handle \"$nick\" left message."
 
 		if {![jid_in_chat $chatid $nickid]} {
-		    client:presence $connid $nickid unavailable {}
+		    client:presence $xlib $nickid unavailable {}
 		} else {
-		    client:message $connid $group $id $type 0 "" \
+		    client:message $xlib $group $id $type 0 "" \
 				   [::msgcat::mc "%s has left IRC channel,\
 						  but %s is still in Jabber room" \
 						 $nick $nick] \
@@ -209,29 +208,29 @@
 
 	if {[cequal [join [lrange $lbody 2 5] " "] "is now known as"]} {
 	    
-	    set ux [jlib::wrapper:createtag x \
-			-vars [list xmlns $::NS(muc#user)] \
-			-subtags [list [jlib::wrapper:createtag item \
-					    -vars [list affiliation none \
-							nick $to_nick]] \
-				       [jlib::wrapper:createtag status \
-					    -vars [list code 303]]]]
+	    set ux [::xmpp::xml::create x \
+			-xmlns $::NS(muc#user) \
+			-subelement [::xmpp::xml::create item \
+					    -attrs [list affiliation none \
+							 nick $to_nick]] \
+			-subelement [::xmpp::xml::create status \
+					    -attrs [list code 303]]]
 
-	    set px [jlib::wrapper:createtag x \
-			-vars [list xmlns $::NS(muc#user)] \
-			-subtags [list [jlib::wrapper:createtag item \
-					    -vars [list affiliation none]]]]
+	    set px [::xmpp::xml::create x \
+			-xmlns $::NS(muc#user) \
+			-subelement [::xmpp::xml::create item \
+					    -attrs [list affiliation none]]]
 
 	    set from_nickid $group/$from_nick
 	    set to_nickid $group/$to_nick
 
 	    if {![jid_in_chat $chatid $from_nickid]} {
 		if {![jid_in_chat $chatid $to_nickid]} {
-		    client:presence $connid $from_nickid unavailable [list $ux]
-		    client:presence $connid $to_nickid available [list $px]
+		    client:presence $xlib $from_nickid unavailable [list $ux]
+		    client:presence $xlib $to_nickid available [list $px]
 		} else {
-		    client:presence $connid $from_nickid unavailable {}
-		    client:message $connid $group $id $type 0 "" \
+		    client:presence $xlib $from_nickid unavailable {}
+		    client:message $xlib $group $id $type 0 "" \
 				   [::msgcat::mc "%s has changed nick to %s in the IRC channel,\
 						  but %s is already in Jabber room" \
 						 $from_nick $to_nick $to_nick] \
@@ -239,14 +238,14 @@
 		}
 	    } else {
 		if {![jid_in_chat $chatid $to_nickid]} {
-		    client:message $connid $group $id $type 0 "" \
+		    client:message $xlib $group $id $type 0 "" \
 				   [::msgcat::mc "%s has changed nick to %s in the IRC channel,\
 						  but %s is still in Jabber room" \
 						 $from_nick $to_nick $from_nick] \
 				   $err $thread $priority $x
-		    client:presence $connid $to_nickid available [list $px]
+		    client:presence $xlib $to_nickid available [list $px]
 		} else {
-		    client:message $connid $group $id $type 0 "" \
+		    client:message $xlib $group $id $type 0 "" \
 				   [::msgcat::mc "%s has changed nick to %s in the IRC channel,\
 						  but %s is still in Jabber room and\
 						  %s is already in Jabber room" \
@@ -263,12 +262,12 @@
     # Filter out nicks
     if {[regexp {^<(\S+)>\s+(.*)} $body -> nick body]} {
 	set nickid $group/$nick
-	client:message $connid $nickid $id $type $is_subject $subject $body \
+	client:message $xlib $nickid $id $type $is_subject $subject $body \
 		       $err $thread $priority $x
 	return stop
     } elseif {[regexp {^\*\s+(\S+)\s+(.*)} $body -> nick body]} {
 	set nickid $group/$nick
-	client:message $connid $nickid $id $type $is_subject $subject "/me $body" \
+	client:message $xlib $nickid $id $type $is_subject $subject "/me $body" \
 		       $err $thread $priority $x
 	return stop
     }
@@ -285,12 +284,12 @@
 #	and refresh.
 #
 proc tclchat::check_color {chatid from type body x} {
-    set connid [chat::get_connid $chatid]
-    set nick [chat::get_nick $connid $from $type]
+    set xlib [chat::get_xlib $chatid]
+    set nick [chat::get_nick $xlib $from $type]
     foreach node $x {
-        jlib::wrapper:splitxml $node tag attr isempty body children
-        if {[jlib::wrapper:getattr $attr xmlns] == "urn:tkchat:chat"} {
-            set color [string trim [jlib::wrapper:getattr $attr "color"] "#"]
+        ::xmpp::xml::split $node tag xmlns attrs cdata subels
+        if {$xmlns == "urn:tkchat:chat"} {
+            set color [string trim [::xmpp::xml::getAttr $attrs "color"] "#"]
             if {[string length $color] > 0} {
                 set orig [::plugins::nickcolors::get_color $nick]
                 debugmsg chat "Checking color for $nick ('$orig' eq '#$color')"

Modified: trunk/tkabber-plugins/traffic/traffic.tcl
===================================================================
--- trunk/tkabber-plugins/traffic/traffic.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/traffic/traffic.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -23,8 +23,8 @@
     set columns [list presence,in presence,out iq,in iq,out message,in message,out total,in total,out]
     set sort_order total,in
 
-    set current_connid 0
-    set wished_connid "0 None"
+    set current_xlib 0
+    set wished_xlib "0 None"
 
     set timer 5
     set timer_state 0
@@ -51,45 +51,45 @@
 # ############################
 # Handlers
 
-proc traffic::handle_inout {connid xmldata size prefix attr} {
+proc traffic::handle_inout {xlib xmldata size prefix attr} {
     variable stat
     variable jids
     variable columns
     variable names
 
-    jlib::wrapper:splitxml $xmldata tag vars isempty chdata children
+    ::xmpp::xml::split $xmldata tag xmlns attrs cdata subels
 
-    set jid [jlib::wrapper:getattr $vars $attr]
+    set jid [::xmpp::xml::getAttr $attrs $attr]
     if {[cequal $jid ""]} {
 	set jid "SERVER"
     } else {
 	catch { set jid [node_and_server_from_jid $jid] }
     }
 
-    if {![info exists jids($connid,$jid)]} {
+    if {![info exists jids($xlib,$jid)]} {
 
 	# create
-        set jids($connid,$jid) 1
-	lappend jids($connid,jids) $jid
+        set jids($xlib,$jid) 1
+	lappend jids($xlib,jids) $jid
 
 	# initialize counters
 	foreach column $columns {
-	    set stat($connid,$jid,$column) 0
+	    set stat($xlib,$jid,$column) 0
 	}
     }
 
     # increment counters
     if {[info exists names($tag,$prefix)]} {
-        incr stat($connid,$jid,$tag,$prefix) $size
+        incr stat($xlib,$jid,$tag,$prefix) $size
     }
-    incr stat($connid,$jid,total,$prefix) $size
+    incr stat($xlib,$jid,total,$prefix) $size
 }
 
-proc ::LOG_INPUT_SIZE {connid xmldata size} \
-    "[namespace current]::traffic::handle_inout \$connid \$xmldata \$size in from"
+proc ::LOG_INPUT_SIZE {xlib xmldata size} \
+    "[namespace current]::traffic::handle_inout \$xlib \$xmldata \$size in from"
 
-proc ::LOG_OUTPUT_SIZE {connid xmldata size} \
-    "[namespace current]::traffic::handle_inout \$connid \$xmldata \$size out to"
+proc ::LOG_OUTPUT_SIZE {xlib xmldata size} \
+    "[namespace current]::traffic::handle_inout \$xlib \$xmldata \$size out to"
 
 
 # ############################
@@ -97,8 +97,8 @@
 
 proc traffic::get_connections {} {
     set res [list "0 None"]
-    foreach con [jlib::connections] {
-	lappend res [list $con [jlib::connection_jid $con]]
+    foreach con [connections] {
+	lappend res [list $con [connection_jid $con]]
     }
     return $res
 }
@@ -106,7 +106,7 @@
 proc traffic::open_window {} {
     variable columns
     variable names
-    variable current_connid
+    variable current_xlib
     variable timer_state
     variable timer_names
 
@@ -132,7 +132,7 @@
     pack $tools.refresh -side right -anchor w
 
     set connections [get_connections]
-    ComboBox $tools.connection -textvariable [namespace current]::wished_connid \
+    ComboBox $tools.connection -textvariable [namespace current]::wished_xlib \
 	-values $connections -height [expr [llength $connections] + 1] -editable 0 \
 	-modifycmd [list [namespace current]::refresh]
     pack $tools.connection -side right -anchor w
@@ -192,8 +192,8 @@
     variable stat
     variable jids
     variable columns
-    variable wished_connid
-    variable current_connid
+    variable wished_xlib
+    variable current_xlib
     variable options
 
     set w .traffic_stats
@@ -202,12 +202,12 @@
 
 
     # clear if connection was changed
-    if {![cequal [lindex $wished_connid 0] $current_connid]} {
+    if {![cequal [lindex $wished_xlib 0] $current_xlib]} {
 	clear_table $f
-	set current_connid [lindex $wished_connid 0]
+	set current_xlib [lindex $wished_xlib 0]
     }
 
-    if {!$current_connid} return
+    if {!$current_xlib} return
 
     # init sum counters
     array set sum {}
@@ -217,7 +217,7 @@
 
     # fill the table
     set row 1
-    foreach jid [lsort -decreasing -command compare $jids($current_connid,jids)] {
+    foreach jid [lsort -decreasing -command compare $jids($current_xlib,jids)] {
 
 	set tag [jid_to_tag $jid]
 
@@ -226,7 +226,7 @@
 	    label $f.jid$tag -text $jid
 
 	    if {$options(show_nick)} {
-		set nick [roster::itemconfig $current_connid [roster::find_jid $current_connid $jid] -name]
+		set nick [roster::itemconfig $current_xlib [roster::find_jid $current_xlib $jid] -name]
 		if {$nick != ""} {
 		    $f.jid$tag configure -text $nick
 		}
@@ -243,7 +243,7 @@
 	    if {![winfo exists $f.value$i$tag]} {
 		label $f.value$i$tag
 	    }
-	    set value $stat($current_connid,$jid,$col)
+	    set value $stat($current_xlib,$jid,$col)
 
 	    incr sum($col) $value
 	    $f.value$i$tag configure -text [convert_to_hr $value 10]
@@ -315,22 +315,22 @@
     refresh
 }
 
-proc traffic::update_connections {type connid} {
-    variable wished_connid
+proc traffic::update_connections {type xlib} {
+    variable wished_xlib
 
     set w .traffic_stats
     if {![winfo exists $w]} return
 
     set connections [get_connections]
 
-    if {[cequal $type off] && [lsearch $connections $wished_connid] < 0} {
-	set wished_connid "0 None"
+    if {[cequal $type off] && [lsearch $connections $wished_xlib] < 0} {
+	set wished_xlib "0 None"
     }
 
     $w.tools.connection configure -values $connections  -height [expr [llength $connections] + 1]
 
-    if {[cequal $type on] && [cequal $wished_connid "0 None"]} {
-	set wished_connid [list $connid [jlib::connection_jid $connid]]
+    if {[cequal $type on] && [cequal $wished_xlib "0 None"]} {
+	set wished_xlib [list $xlib [connection_jid $xlib]]
     }
 
     refresh
@@ -370,10 +370,10 @@
 proc traffic::compare {arg1 arg2} {
     variable stat
     variable sort_order
-    variable current_connid
+    variable current_xlib
 
-    return [expr $stat($current_connid,$arg1,$sort_order) - \
-		 $stat($current_connid,$arg2,$sort_order)]
+    return [expr $stat($current_xlib,$arg1,$sort_order) - \
+		 $stat($current_xlib,$arg2,$sort_order)]
 }
 
 proc traffic::sort {tag} {
@@ -387,7 +387,7 @@
     variable names
     variable columns
     variable stat
-    variable current_connid
+    variable current_xlib
     variable jids
 
     set filename [tk_getSaveFile \
@@ -404,11 +404,11 @@
 	puts $fd [join $str "\t"]
 
 	# Data
-	foreach jid $jids($current_connid,jids) {
+	foreach jid $jids($current_xlib,jids) {
 	    set str {}
 	    lappend str $jid
 	    foreach col $columns {
-		lappend str $stat($current_connid,$jid,$col)
+		lappend str $stat($current_xlib,$jid,$col)
 	    }
 	    puts $fd [join $str "\t"]
 	}
@@ -417,12 +417,12 @@
 }
 
 proc traffic::reset {} {
-    variable current_connid
+    variable current_xlib
     variable columns
     variable jids
     variable stat
 
-    if {!$current_connid} return
+    if {!$current_xlib} return
 
     if {[MessageDlg .request_reset_traffic \
 	     -aspect 50000 \
@@ -436,13 +436,13 @@
     }
 
     # clear stats
-    foreach jid $jids($current_connid,jids) {
+    foreach jid $jids($current_xlib,jids) {
 	foreach col $columns {
-	    unset stat($current_connid,$jid,$col)
+	    unset stat($current_xlib,$jid,$col)
 	}
-	unset jids($current_connid,$jid)
+	unset jids($current_xlib,$jid)
     }
-    set jids($current_connid,jids) {}
+    set jids($current_xlib,jids) {}
 
     # clear table
     clear_and_refresh

Modified: trunk/tkabber-plugins/whiteboard/svgrender.tcl
===================================================================
--- trunk/tkabber-plugins/whiteboard/svgrender.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/whiteboard/svgrender.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -16,16 +16,12 @@
     set file [read $f]
     close $f
 
-    set parser [jlib::wrapper:new "#" "#" \
-				  [list [namespace current]::parseSVG $c]]
-    jlib::wrapper:elementstart $parser stream:stream {} {}
-    jlib::wrapper:parser $parser parse $file
-    jlib::wrapper:parser $parser configure -final 0
+    ::xmpp::xml::parseData $file [namespace code [list parseSVGFile $c]]
 }
 
-proc svg::parseSVG {c xmldata} {
+proc svg::parseSVGFile {c xmldata} {
     Debug 2 $xmldata
-    jlib::wrapper:splitxml $xmldata tag vars isempty chdata children
+    ::xmpp::xml::split $xmldata tag xmlns attrs cdata subels
 
     if {$tag != "svg"} {
 	return -code error "Not a SVG file"
@@ -35,7 +31,7 @@
 }
 
 proc svg::parseSVGItem {c transform curAttrs item} {
-    jlib::wrapper:splitxml $item tag vars isempty chdata children
+    ::xmpp::xml::split $item tag xmlns attrs cdata subels
 
     switch -- $tag {
 	svg {
@@ -63,7 +59,7 @@
 	    ParseText $c $transform $curAttrs $item
 	}
 	g {
-	    ParseG $c $transform $curAttrs $vars $children
+	    ParseG $c $transform $curAttrs $attrs $subels
 	}
 	default {
 	    Debug 1 Unknown SVG tag '$tag'
@@ -73,23 +69,23 @@
 }
 
 proc svg::ParseSVG {c transform curAttrs item} {
-    jlib::wrapper:splitxml $item tag vars isempty chdata children
+    ::xmpp::xml::split $item tag xmlns attrs cdata subels
 
     # TODO
 
-    foreach child $children {
-	parseSVGItem $c $transform $curAttrs $child
+    foreach subel $subels {
+	parseSVGItem $c $transform $curAttrs $subel
     }
     return ""
 }
 
-proc svg::ParseG {c transform curAttrs vars items} {
+proc svg::ParseG {c transform curAttrs attrs items} {
     eval lappend transform \
-	 [ParseTransform [jlib::wrapper:getattr $vars transform]]
+	 [ParseTransform [::xmpp::xml::getAttr $attrs transform]]
 
-    array set attrs $curAttrs
-    array set attrs $vars
-    set curAttrs [array get attrs]
+    array set Attrs $curAttrs
+    array set Attrs $attrs
+    set curAttrs [array get Attrs]
 
     foreach item $items {
 	parseSVGItem $c $transform $curAttrs $item
@@ -98,16 +94,16 @@
 }
 
 proc svg::ParsePolygon {c transform curAttrs item} {
-    jlib::wrapper:splitxml $item tag vars isempty chdata children
+    ::xmpp::xml::split $item tag xmlns attrs cdata subels
 
     eval lappend transform \
-	 [ParseTransform [jlib::wrapper:getattr $vars transform]]
+	 [ParseTransform [::xmpp::xml::getAttr $attrs transform]]
 
-    set p [TransformPoints $transform [jlib::wrapper:getattr $vars points]]
+    set p [TransformPoints $transform [::xmpp::xml::getAttr $attrs points]]
 
-    array set attrs $curAttrs
-    array set attrs $vars
-    set styles [split [jlib::wrapper:getattr $vars style] \;]
+    array set Attrs $curAttrs
+    array set Attrs $attrs
+    set styles [split [::xmpp::xml::getAttr $attrs style] \;]
     set drawitem line
 
     foreach s $styles {
@@ -120,7 +116,7 @@
 	    stroke -
 	    stroke-width -
 	    stroke-linejoin {
-		set attrs($attr) $val
+		set Attrs($attr) $val
 	    }
 	    default {
 		Debug 1 Unknown style attr '$attr'
@@ -128,7 +124,7 @@
 	}
     }
 
-    if {[info exists attrs(fill)]} {
+    if {[info exists Attrs(fill)]} {
 	set opts [PolygonOpts]
 	set drawitem polygon
     } else {
@@ -145,15 +141,15 @@
     variable Smooth
     variable Unitcircle
 
-    jlib::wrapper:splitxml $item tag vars isempty chdata children
+    ::xmpp::xml::split $item tag xmlns attrs cdata subels
 
     eval lappend transform \
-	 [ParseTransform [jlib::wrapper:getattr $vars transform]]
+	 [ParseTransform [::xmpp::xml::getAttr $attrs transform]]
 
-    array set attrs $curAttrs
-    array set attrs {cx 0 cy 0 r 0}
-    array set attrs $vars
-    set styles [split [jlib::wrapper:getattr $vars style] \;]
+    array set Attrs $curAttrs
+    array set Attrs {cx 0 cy 0 r 0}
+    array set Attrs $attrs
+    set styles [split [::xmpp::xml::getAttr $attrs style] \;]
     set drawitem circle
 
     foreach s $styles {
@@ -168,7 +164,7 @@
 	    fill -
 	    stroke -
 	    stroke-width {
-		set attrs($attr) $val
+		set Attrs($attr) $val
 	    }
 	    default {
 		Debug 1 Unknown style attr '$attr'
@@ -182,15 +178,15 @@
 	set points {}
 	for {set i 0} {$i < 30} {incr i} {
 	    set a [expr {3.1415926 * $i / 15}]
-	    lappend points [expr {$attrs(cx) + $attrs(r)*cos($a)}] \
-		           [expr {$attrs(cy) + $attrs(r)*sin($a)}]
+	    lappend points [expr {$Attrs(cx) + $Attrs(r)*cos($a)}] \
+		           [expr {$Attrs(cy) + $Attrs(r)*sin($a)}]
 	}
     } else {
 	set points {}
 	for {set i 0} {$i < 180} {incr i} {
 	    set a [expr {3.1415926 * $i / 90}]
-	    lappend points [expr {$attrs(cx) + $attrs(r)*cos($a)}] \
-		           [expr {$attrs(cy) + $attrs(r)*sin($a)}]
+	    lappend points [expr {$Attrs(cx) + $Attrs(r)*cos($a)}] \
+		           [expr {$Attrs(cy) + $Attrs(r)*sin($a)}]
 	}
     }
 
@@ -204,15 +200,15 @@
     variable Smooth
     variable Unitcircle
 
-    jlib::wrapper:splitxml $item tag vars isempty chdata children
+    ::xmpp::xml::split $item tag xmlns attrs cdata subels
 
     eval lappend transform \
-	 [ParseTransform [jlib::wrapper:getattr $vars transform]]
+	 [ParseTransform [::xmpp::xml::getAttr $attrs transform]]
 
-    array set attrs $curAttrs
-    array set attrs {cx 0 cy 0 rx 0 ry 0}
-    array set attrs $vars
-    set styles [split [jlib::wrapper:getattr $vars style] \;]
+    array set Attrs $curAttrs
+    array set Attrs {cx 0 cy 0 rx 0 ry 0}
+    array set Attrs $attrs
+    set styles [split [::xmpp::xml::getAttr $attrs style] \;]
     set drawitem circle
 
     foreach s $styles {
@@ -228,7 +224,7 @@
 	    fill -
 	    stroke -
 	    stroke-width {
-		set attrs($attr) $val
+		set Attrs($attr) $val
 	    }
 	    default {
 		Debug 1 Unknown style attr '$attr'
@@ -242,15 +238,15 @@
 	set points {}
 	for {set i 0} {$i < 30} {incr i} {
 	    set a [expr {3.1415926 * $i / 15}]
-	    lappend points [expr {$attrs(cx) + $attrs(rx)*cos($a)}] \
-		           [expr {$attrs(cy) + $attrs(ry)*sin($a)}]
+	    lappend points [expr {$Attrs(cx) + $Attrs(rx)*cos($a)}] \
+		           [expr {$Attrs(cy) + $Attrs(ry)*sin($a)}]
 	}
     } else {
 	set points {}
 	for {set i 0} {$i < 180} {incr i} {
 	    set a [expr {3.1415926 * $i / 90}]
-	    lappend points [expr {$attrs(cx) + $attrs(rx)*cos($a)}] \
-		           [expr {$attrs(cy) + $attrs(ry)*sin($a)}]
+	    lappend points [expr {$Attrs(cx) + $Attrs(rx)*cos($a)}] \
+		           [expr {$Attrs(cy) + $Attrs(ry)*sin($a)}]
 	}
     }
 
@@ -261,22 +257,22 @@
 }
 
 proc svg::ParseLine {c transform curAttrs item} {
-    jlib::wrapper:splitxml $item tag vars isempty chdata children
+    ::xmpp::xml::split $item tag xmlns attrs cdata subels
 
     eval lappend transform \
-	 [ParseTransform [jlib::wrapper:getattr $vars transform]]
+	 [ParseTransform [::xmpp::xml::getAttr $attrs transform]]
 
-    set x1 [jlib::wrapper:getattr $vars x1]
-    set y1 [jlib::wrapper:getattr $vars y1]
-    set x2 [jlib::wrapper:getattr $vars x2]
-    set y2 [jlib::wrapper:getattr $vars y2]
+    set x1 [::xmpp::xml::getAttr $attrs x1]
+    set y1 [::xmpp::xml::getAttr $attrs y1]
+    set x2 [::xmpp::xml::getAttr $attrs x2]
+    set y2 [::xmpp::xml::getAttr $attrs y2]
 
     foreach {x1 y1} [TransformCoord $transform $x1 $y1] break
     foreach {x2 y2} [TransformCoord $transform $x2 $y2] break
 
-    array set attrs $curAttrs
-    array set attrs $vars
-    set styles [split [jlib::wrapper:getattr $vars style] \;]
+    array set Attrs $curAttrs
+    array set Attrs $vars
+    set styles [split [::xmpp::xml::getAttr $attrs style] \;]
     set drawitem line
 
     foreach s $styles {
@@ -289,7 +285,7 @@
 	    stroke-width -
 	    stroke-linecap -
 	    stroke-linejoin {
-		set attrs($attr) $val
+		set Attrs($attr) $val
 	    }
 	    default {
 		Debug 1 Unknown style attr '$attr'
@@ -304,17 +300,17 @@
 }
 
 proc svg::ParseRect {c transform curAttrs item} {
-    jlib::wrapper:splitxml $item tag vars isempty chdata children
+    ::xmpp::xml::split $item tag xmlns attrs cdata subels
 
     eval lappend transform \
-	 [ParseTransform [jlib::wrapper:getattr $vars transform]]
+	 [ParseTransform [::xmpp::xml::getAttr $attrs transform]]
 
-    set x      [jlib::wrapper:getattr $vars x]
-    set y      [jlib::wrapper:getattr $vars y]
-    set width  [jlib::wrapper:getattr $vars width]
-    set height [jlib::wrapper:getattr $vars height]
-    set rx     [jlib::wrapper:getattr $vars rx]
-    set ry     [jlib::wrapper:getattr $vars ry]
+    set x      [::xmpp::xml::getAttr $attrs x]
+    set y      [::xmpp::xml::getAttr $attrs y]
+    set width  [::xmpp::xml::getAttr $attrs width]
+    set height [::xmpp::xml::getAttr $attrs height]
+    set rx     [::xmpp::xml::getAttr $attrs rx]
+    set ry     [::xmpp::xml::getAttr $attrs ry]
     if {$rx != ""} {
 	Debug 1 Round corners are ignored
     }
@@ -326,9 +322,9 @@
     foreach {xx2 yy2} [TransformCoord $transform $x2 $y2] break
     foreach {xx3 yy3} [TransformCoord $transform $x $y2] break
 
-    array set attrs $curAttrs
-    array set attrs $vars
-    set styles [split [jlib::wrapper:getattr $vars style] \;]
+    array set Attrs $curAttrs
+    array set Attrs $attrs
+    set styles [split [::xmpp::xml::getAttr $attrs style] \;]
     set drawitem line
 
     foreach s $styles {
@@ -340,7 +336,7 @@
 	    stroke -
 	    stroke-width -
 	    stroke-linejoin {
-		set attrs($attr) $val
+		set Attrs($attr) $val
 	    }
 	    default {
 		Debug 1 Unknown style attr '$attr'
@@ -355,13 +351,13 @@
 }
 
 proc svg::ParsePolyline {c transform curAttrs item} {
-    jlib::wrapper:splitxml $item tag vars isempty chdata children
+    ::xmpp::xml::split $item tag xmlns attrs cdata subels
 
-    set p [TransformPoints $transform [jlib::wrapper:getattr $vars points]]
+    set p [TransformPoints $transform [::xmpp::xml::getAttr $attrs points]]
 
-    array set attrs $curAttrs
-    array set attrs $vars
-    set styles [split [jlib::wrapper:getattr $vars style] \;]
+    array set Attrs $curAttrs
+    array set Attrs $attrs
+    set styles [split [::xmpp::xml::getAttr $attrs style] \;]
     set drawitem line
 
     foreach s $styles {
@@ -375,7 +371,7 @@
 	    stroke-width -
 	    stroke-linecap -
 	    stroke-linejoin {
-		set attrs($attr) $val
+		set Attrs($attr) $val
 	    }
 	    default {
 		Debug 1 Unknown style attr '$attr'
@@ -390,28 +386,28 @@
 }
 
 proc svg::ParseText {c transform curAttrs item} {
-    jlib::wrapper:splitxml $item tag vars isempty chdata children
+    ::xmpp::xml::split $item tag xmlns attrs cdata subels
 
     eval lappend transform \
-	 [ParseTransform [jlib::wrapper:getattr $vars transform]]
+	 [ParseTransform [::xmpp::xml::getAttr $attrs transform]]
 
-    set x  [jlib::wrapper:getattr $vars x]
-    set y  [jlib::wrapper:getattr $vars y]
+    set x  [::xmpp::xml::getAttr $attrs x]
+    set y  [::xmpp::xml::getAttr $attrs y]
 
     if {$x == ""} {set x 0}
     if {$y == ""} {set y 0}
 
     foreach {x y} [TransformCoord $transform $x $y] break
 
-    array set attrs $curAttrs
-    array set attrs $vars
-    set styles [split [jlib::wrapper:getattr $vars style] \;]
+    array set Attrs $curAttrs
+    array set Attrs $attrs
+    set styles [split [::xmpp::xml::getAttr $attrs style] \;]
 
     foreach s $styles {
 	foreach {attr val} [split $s :] break
 	set attr [string trim $attr]
 	set val [string trim $val]
-	set attrs($attr) $val
+	set Attrs($attr) $val
     }
 
     set allopts [TextOpts]
@@ -433,10 +429,10 @@
 }
 
 proc svg::LineOpts {} {
-    upvar attrs attrs
+    upvar Attrs Attrs
     upvar c c
     set opts {-joinstyle miter -capstyle butt}
-    foreach {attr val} [array get attrs] {
+    foreach {attr val} [array get Attrs] {
 	switch -- $attr {
 	    "" {}
 	    stroke {lappend opts -fill [color $c $val]}
@@ -460,10 +456,10 @@
 }
 
 proc svg::PolygonOpts {} {
-    upvar attrs attrs
+    upvar Attrs Attrs
     upvar c c
     set opts {-joinstyle miter -fill "" -outline ""}
-    foreach {attr val} [array get attrs] {
+    foreach {attr val} [array get Attrs] {
 	switch -- $attr {
 	    "" {}
 	    fill {
@@ -491,13 +487,13 @@
 
 proc svg::CircleOpts {} {
     variable Smooth
-    upvar attrs attrs
+    upvar Attrs Attrs
     upvar c c
     set opts {-joinstyle round -fill "" -outline ""}
     if {$Smooth} {
 	lappend opts -smooth bezier
     }
-    foreach {attr val} [array get attrs] {
+    foreach {attr val} [array get Attrs] {
 	switch -- $attr {
 	    "" {}
 	    fill {
@@ -518,11 +514,11 @@
 }
 
 proc svg::TextOpts {} {
-    upvar attrs attrs
+    upvar Attrs Attrs
     upvar c c
     set opts {-anchor w}
     set fontopts {}
-    foreach {attr val} [array get attrs] {
+    foreach {attr val} [array get Attrs] {
 	switch -- $attr {
 	    "" {}
 	    fill {lappend opts -fill [color $c $val]}

Modified: trunk/tkabber-plugins/whiteboard/whiteboard.tcl
===================================================================
--- trunk/tkabber-plugins/whiteboard/whiteboard.tcl	2008-10-17 17:16:09 UTC (rev 1520)
+++ trunk/tkabber-plugins/whiteboard/whiteboard.tcl	2008-10-17 17:16:48 UTC (rev 1521)
@@ -10,9 +10,9 @@
     set id_base [pid]	;# used in proc create_id
 }
 
-proc wb::add_whiteboard_menu_item {m connid jid} {
+proc wb::add_whiteboard_menu_item {m xlib jid} {
     $m add command -label [::msgcat::mc "Whiteboard"] \
-	-command [list [namespace current]::open_wb $connid $jid -raise 1]
+	-command [list [namespace current]::open_wb $xlib $jid -raise 1]
 }
 
 hook::add chat_create_user_menu_hook \
@@ -22,7 +22,7 @@
 hook::add roster_jid_popup_menu_hook \
     [namespace current]::wb::add_whiteboard_menu_item 47
 
-proc wb::open_wb {connid jid args} {
+proc wb::open_wb {xlib jid args} {
     global dofill
 
     set raise 0
@@ -32,7 +32,7 @@
 	}
     }
 
-    set chatid [chat::chatid $connid $jid]
+    set chatid [chat::chatid $xlib $jid]
 
     set w [win_id whiteboard $chatid]
     if {[winfo exists $w]} {
@@ -306,15 +306,14 @@
     } else {
 	set type chat
     }
-    set connid [chat::get_connid $chatid]
+    set xlib [chat::get_xlib $chatid]
     set jid [chat::get_jid $chatid]
-    jlib::send_msg $jid \
-	-connection $connid \
+    ::xmpp::sendMessage $xlib $jid \
 	-type $type \
-	-xlist [list [jlib::wrapper:createtag x \
-			  -vars {xmlns tkabber:whiteboard} \
-			  -subtags [list [jlib::wrapper:createtag svg \
-					      -subtags [list $tag]]]]]
+	-xlist [list [::xmpp::xml::create x \
+			  -xmlns tkabber:whiteboard \
+			  -subelement [::xmpp::xml::create svg \
+					      -subelement $tag]]]
 }
 
 proc wb::send_clear {chatid} {
@@ -324,27 +323,25 @@
 	set type chat
         [win_id whiteboard $chatid].c delete all
     }
-    set connid [chat::get_connid $chatid]
+    set xlib [chat::get_xlib $chatid]
     set jid [chat::get_jid $chatid]
-    jlib::send_msg $jid -type $type \
-	-connection $connid \
-	-xlist [list [jlib::wrapper:createtag x \
-			  -vars {xmlns tkabber:whiteboard} \
-			  -subtags [list [jlib::wrapper:createtag clear]]]]
+    ::xmpp::sendMessage $xlib $jid -type $type \
+	-xlist [list [::xmpp::xml::create x \
+			  -xmlns tkabber:whiteboard \
+			  -subelement [::xmpp::xml::create clear]]]
 }
 
 proc wb::handle_wb {chatid from type body x} {
-    set seconds [jlib::x_delay $x]
+    set seconds [::xmpp::delay::parse $x]
 
     foreach xelem $x {
-	jlib::wrapper:splitxml $xelem tag vars isempty chdata children
+	::xmpp::xml::split $xelem tag xmlns attrs cdata subels
 
-	if {[string equal [jlib::wrapper:getattr $vars xmlns] \
-			  tkabber:whiteboard]} {
-	    open_wb [chat::get_connid $chatid] [chat::get_jid $chatid]
+	if {[string equal $xmlns tkabber:whiteboard]} {
+	    open_wb [chat::get_xlib $chatid] [chat::get_jid $chatid]
 	    set w [win_id whiteboard $chatid]
-	    foreach child $children {
-		parse_item $chatid $from $seconds $child
+	    foreach subel $subels {
+		parse_item $chatid $from $seconds $subel
 	    }
 	    tab_set_updated $w 1 message
 
@@ -356,21 +353,21 @@
 
 proc wb::parse_item {chatid from seconds item} {
     set w [win_id whiteboard $chatid]
-    jlib::wrapper:splitxml $item tag vars isempty chdata children
+    ::xmpp::xml::split $xelem tag xmlns attrs cdata subels
 
     switch -- $tag {
 	svg {
-	    foreach child $children {
-		set id [svg::parseSVGItem $w.c {} {} $child]
+	    foreach subel $subels {
+		set id [svg::parseSVGItem $w.c {} {} $subel]
 		if {$id != ""} {
-		    $w.c addtag [list tag $child] withtag $id
+		    $w.c addtag [list tag $subel] withtag $id
 		    $w.c addtag [time_tag created $from $seconds] withtag $id
 		}
 	    }
 	}
 	transform {
-	    set id [jlib::wrapper:getattr $vars id]
-	    set transform [jlib::wrapper:getattr $vars transform]
+	    set id [::xmpp::xml::getAttr $attrs id]
+	    set transform [::xmpp::xml::getAttr $attrs transform]
 	    set transform1 $transform
 	    set tags [$w.c gettags [list id $id]]
 	    set child {}
@@ -399,9 +396,9 @@
 	    }
 	}
 	move {
-	    set id [jlib::wrapper:getattr $vars id]
-	    set dx [jlib::wrapper:getattr $vars dx]
-	    set dy [jlib::wrapper:getattr $vars dy]
+	    set id [::xmpp::xml::getAttr $attrs id]
+	    set dx [::xmpp::xml::getAttr $attrs dx]
+	    set dy [::xmpp::xml::getAttr $attrs dy]
 	    if {![string is double $dx] || $dx == ""} {set dx 0}
 	    if {![string is double $dy] || $dy == ""} {set dy 0}
 	    add_transform_tag $w.c $id translate($dx,$dy)
@@ -409,7 +406,7 @@
 	    $w.c move [list id $id] $dx $dy
 	}
 	remove {
-	    $w.c delete [list id [jlib::wrapper:getattr $vars id]]
+	    $w.c delete [list id [::xmpp::xml::getAttr $attrs id]]
 	}
 	clear {
 	    $w.c delete all
@@ -539,22 +536,21 @@
 	set type groupchat
     } else {
 	set type chat
-	set jid [jlib::connection_jid [chat::get_connid $chatid]]
+	set jid [connection_jid [chat::get_xlib $chatid]]
 	add_transform_tag $c $id $transform
 	$c addtag [time_tag transformed $jid] withtag [list id $id]
     }
 
-    set vars [list id $id transform $transform]
+    set attrs [list id $id transform $transform]
 
-    set connid [chat::get_connid $chatid]
+    set xlib [chat::get_xlib $chatid]
     set jid [chat::get_jid $chatid]
-    jlib::send_msg $jid \
-	-connection $connid \
+    ::xmpp::sendMessage $xlib $jid \
 	-type $type \
-	-xlist [list [jlib::wrapper:createtag x \
-			  -vars {xmlns tkabber:whiteboard} \
-			  -subtags [list [jlib::wrapper:createtag transform \
-					      -vars $vars]]]]
+	-xlist [list [::xmpp::xml::create x \
+			  -xmlns tkabber:whiteboard \
+			  -subelement [::xmpp::xml::create transform \
+					      -attrs $attrs]]]
 }
 
 ###############################################################################
@@ -626,7 +622,7 @@
 	if {[chat::is_groupchat $chatid]} {
 	    $c delete $line(temp)
 	} else {
-	    set jid [jlib::connection_jid [chat::get_connid $chatid]]
+	    set jid [connection_jid [chat::get_xlib $chatid]]
 	    $c addtag [list tag $tag] withtag $line(temp)
 	    $c addtag [time_tag created $jid] withtag $line(temp)
 	}
@@ -641,12 +637,12 @@
 proc wb::line_tag {id} {
     variable line
 
-    set vars $line(options)
-    lappend vars points $line(coords)
+    set arrts $line(options)
+    lappend arrts points $line(coords)
     if {$id != ""} {
-	lappend vars id $id
+	lappend arrts id $id
     }
-    return [jlib::wrapper:createtag polyline -vars $vars]
+    return [::xmpp::xml::create polyline -attrs $arrts]
 }
 
 ###############################################################################
@@ -742,7 +738,7 @@
 	    if {[chat::is_groupchat $chatid]} {
 		$c delete $polygon(temp)
 	    } else {
-		set jid [jlib::connection_jid [chat::get_connid $chatid]]
+		set jid [connection_jid [chat::get_xlib $chatid]]
 		$c addtag [list tag $tag] withtag $polygon(temp)
 		$c addtag [time_tag created $jid] withtag $polygon(temp)
 	    }
@@ -757,12 +753,12 @@
 proc wb::polygon_tag {id} {
     variable polygon
 
-    set vars $polygon(options)
-    lappend vars points $polygon(coords)
+    set arrts $polygon(options)
+    lappend arrts points $polygon(coords)
     if {$id != ""} {
-	lappend vars id $id
+	lappend arrts id $id
     }
-    return [jlib::wrapper:createtag polygon -vars $vars]
+    return [::xmpp::xml::create polygon -attrs $arrts]
 }
 
 ###############################################################################
@@ -818,7 +814,7 @@
 	if {[chat::is_groupchat $chatid]} {
 	    $c delete $rectangle(temp)
 	} else {
-	    set jid [jlib::connection_jid [chat::get_connid $chatid]]
+	    set jid [connection_jid [chat::get_xlib $chatid]]
 	    $c addtag [list tag $tag] withtag $rectangle(temp)
 	    $c addtag [time_tag created $jid] withtag $rectangle(temp)
 	}
@@ -850,25 +846,25 @@
 proc wb::rectangle_tag {id} {
     variable rectangle
 
-    set vars $rectangle(options)
+    set arrts $rectangle(options)
     if {$rectangle(x2) > $rectangle(x1)} {
-	lappend vars x $rectangle(x1) \
+	lappend arrts x $rectangle(x1) \
 		     width [expr {$rectangle(x2) - $rectangle(x1)}]
     } else {
-	lappend vars x $rectangle(x2) \
+	lappend arrts x $rectangle(x2) \
 		     width [expr {$rectangle(x1) - $rectangle(x2)}]
     }
     if {$rectangle(y2) > $rectangle(y1)} {
-	lappend vars y $rectangle(y1) \
+	lappend arrts y $rectangle(y1) \
 		     height [expr {$rectangle(y2) - $rectangle(y1)}]
     } else {
-	lappend vars y $rectangle(y2) \
+	lappend arrts y $rectangle(y2) \
 		     height [expr {$rectangle(y1) - $rectangle(y2)}]
     }
     if {$id != ""} {
-	lappend vars id $id
+	lappend arrts id $id
     }
-    return [jlib::wrapper:createtag rect -vars $vars]
+    return [::xmpp::xml::create rect -attrs $arrts]
 }
 
 ###############################################################################
@@ -927,7 +923,7 @@
 	if {[chat::is_groupchat $chatid]} {
 	    $c delete $circle(temp)
 	} else {
-	    set jid [jlib::connection_jid [chat::get_connid $chatid]]
+	    set jid [connection_jid [chat::get_xlib $chatid]]
 	    $c addtag [list tag $tag] withtag $circle(temp)
 	    $c addtag [time_tag created $jid] withtag $circle(temp)
 	}
@@ -960,12 +956,12 @@
 proc wb::circle_tag {id r} {
     variable circle
 
-    set vars $circle(options)
-    lappend vars r $r
+    set arrts $circle(options)
+    lappend arrts r $r
     if {$id != ""} {
-	lappend vars id $id
+	lappend arrts id $id
     }
-    return [jlib::wrapper:createtag circle -vars $vars]
+    return [::xmpp::xml::create circle -attrs $arrts]
 }
 
 ###############################################################################
@@ -1031,7 +1027,7 @@
 	if {[chat::is_groupchat $chatid]} {
 	    $c delete $line(temp)
 	} else {
-	    set jid [jlib::connection_jid [chat::get_connid $chatid]]
+	    set jid [connection_jid [chat::get_xlib $chatid]]
 	    $c addtag [list tag $tag] withtag $line(temp)
 	    $c addtag [time_tag created $jid] withtag $line(temp)
 	}
@@ -1046,12 +1042,12 @@
 proc wb::freehand_tag {id} {
     variable line
 
-    set vars $line(options)
-    lappend vars points $line(coords)
+    set arrts $line(options)
+    lappend arrts points $line(coords)
     if {$id != ""} {
-	lappend vars id $id
+	lappend arrts id $id
     }
-    return [jlib::wrapper:createtag polyline -vars $vars]
+    return [::xmpp::xml::create polyline -attrs $arrts]
 }
 
 ###############################################################################
@@ -1060,7 +1056,7 @@
 # Remove
 
 proc wb::remove_b1p {c chatid id} {
-    set connid [chat::get_connid $chatid]
+    set xlib [chat::get_xlib $chatid]
     set jid [chat::get_jid $chatid]
     if {[chat::is_groupchat $chatid]} {
 	set type groupchat
@@ -1069,13 +1065,12 @@
 	$c delete [list id $id]
     }
     if {$id != ""} {
-	jlib::send_msg $jid \
-	    -connection $connid \
+	::xmpp::sendMessage $xlib $jid \
 	    -type $type \
-	    -xlist [list [jlib::wrapper:createtag x \
-			      -vars {xmlns tkabber:whiteboard} \
-			      -subtags [list [jlib::wrapper:createtag remove \
-						  -vars [list id $id]]]]]
+	    -xlist [list [::xmpp::xml::create x \
+			      -xmlns tkabber:whiteboard \
+			      -subelement [::xmpp::xml::create remove \
+						  -attrs [list id $id]]]]
     }
 }
 
@@ -1162,21 +1157,20 @@
 	    $c move [list id $id] [expr {-$dx}] [expr {-$dy}]
 	} else {
 	    set type chat
-	    set jid [jlib::connection_jid [chat::get_connid $chatid]]
+	    set jid [connection_jid [chat::get_xlib $chatid]]
 	    $c addtag [time_tag moved $jid] withtag [list id $id]
 	}
 
-	set vars [list id $id dx $dx dy $dy]
+	set arrts [list id $id dx $dx dy $dy]
 
-	set connid [chat::get_connid $chatid]
+	set xlib [chat::get_xlib $chatid]
 	set jid [chat::get_jid $chatid]
-	jlib::send_msg $jid \
-	    -connection $connid \
+	::xmpp::sendMessage $xlib $jid \
 	    -type $type \
-	    -xlist [list [jlib::wrapper:createtag x \
-			      -vars {xmlns tkabber:whiteboard} \
-			      -subtags [list [jlib::wrapper:createtag move \
-						  -vars $vars]]]]
+	    -xlist [list [::xmpp::xml::create x \
+			      -xmlns tkabber:whiteboard \
+			      -subelement [::xmpp::xml::create move \
+						  -attrs $arrts]]]
 	$c configure -cursor ""
     }
 }
@@ -1228,12 +1222,12 @@
 
     set text [set [namespace current]::text_entered($chatid)]
 
-    set vars [list id $id x $text_info(x) y $text_info(y) \
+    set arrts [list id $id x $text_info(x) y $text_info(y) \
 		   fill [get_text_color $chatid]]
     set font [get_text_font $chatid]
     if {[info exists app_font($font)]} {
 	array set font_opt [font configure $font]
-	lappend vars font-size $font_opt(-size) \
+	lappend arrts font-size $font_opt(-size) \
 		     font-family $font_opt(-family)
 	if {$font_opt(-underline) || $font_opt(-overstrike)} {
 	    set dec {}
@@ -1243,22 +1237,22 @@
 	    if {$font_opt(-overstrike)} {
 		lappend dec line-through
 	    }
-	    lappend vars text-decoration $dec
+	    lappend arrts text-decoration $dec
 	}
 	if {[string equal $font_opt(-slant) italic]} {
-	    lappend vars font-style italic
+	    lappend arrts font-style italic
 	}
 	if {[string equal $font_opt(-weight) bold]} {
-	    lappend vars font-weight bold
+	    lappend arrts font-weight bold
 	}
 	unset font_opt
     }
 
-    set tag [jlib::wrapper:createtag text -vars $vars -chdata $text]
+    set tag [::xmpp::xml::create text -attrs $arrts -cdata $text]
 
     if {![chat::is_groupchat $chatid]} {
 	set textid [svg::parseSVGItem $c {} {} $tag]
-	set jid [jlib::connection_jid [chat::get_connid $chatid]]
+	set jid [connection_jid [chat::get_xlib $chatid]]
 	$c addtag [list tag $tag] withtag $textid
 	$c addtag [time_tag created $jid] withtag $textid
     }



More information about the Tkabber-dev mailing list