[Tkabber-dev] r1362 - branches/xml-import-export/plugins/roster

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Wed Jan 30 16:03:20 MSK 2008


Author: kostix
Date: 2008-01-30 16:03:19 +0300 (Wed, 30 Jan 2008)
New Revision: 1362

Added:
   branches/xml-import-export/plugins/roster/bkup_conferences.tcl
Removed:
   branches/xml-import-export/plugins/roster/bkup_categories.tcl
Log:
plugins/roster/bkup_categories.tcl renamed to plugins/roster/bkup_conferences.tcl


Deleted: branches/xml-import-export/plugins/roster/bkup_categories.tcl
===================================================================
--- branches/xml-import-export/plugins/roster/bkup_categories.tcl	2008-01-30 13:02:37 UTC (rev 1361)
+++ branches/xml-import-export/plugins/roster/bkup_categories.tcl	2008-01-30 13:03:19 UTC (rev 1362)
@@ -1,89 +0,0 @@
-# $Id$
-# Support for backup/restore of "roster bookmarks" to MUC rooms (XEP-0048, v1.0)
-# Depends on: conferences.tcl, backup.tcl
-
-namespace eval mucbackup {
-    variable updated; array set updated {}
-
-    # Should probably go after the roster contacts, so we set prio to 70:
-    hook::add serialize_roster_hook \
-	[namespace current]::serialize_muc_bookmarks 70
-    hook::add deserialize_roster_hook \
-	[namespace current]::deserialize_muc_bookmarks 70
-    hook::add roster_deserializing_hook \
-	[namespace current]::prepare_deserialization
-    hook::add roster_deserialized_hook \
-	[namespace current]::push_bookmarks_to_roster
-}
-
-###############################################################################
-
-proc mucbackup::serialize_muc_bookmarks {connid level varName} {
-    upvar $level $varName subtags
-    global NS
-
-    foreach xmldata [::plugins::conferences::serialize_bookmarks $connid] {
-	lappend subtags [jlib::wrapper:createtag privstorage \
-	    -vars [list xmlns $NS(private)] \
-	    -subtags [list $xmldata]]
-    }
-}
-
-###############################################################################
-
-proc mucbackup::prepare_deserialization {connid} {
-    variable updated
-
-    set updated($connid) 0
-}
-
-###############################################################################
-
-proc mucbackup::deserialize_muc_bookmarks {connid data} {
-    variable updated
-    upvar 0 updated($connid) upd
-    global NS
-
-    jlib::wrapper:splitxml $data tag vars isempty cdata children
-    if {![string equal $tag privstorage]} return
-    set xmlns [jlib::wrapper:getattr $vars xmlns]
-    if {![string equal $xmlns $NS(private)]} {
-	return -code error "Bad roster element namespace \"$xmlns\":\
-	    must be \"$NS(private)\""
-    }
-
-    foreach storage $children {
-	jlib::wrapper:splitxml $storage ctag cvars cisempty ccdata cchildren
-	if {![string equal $ctag storage]} return
-	set xmlns [jlib::wrapper:getattr $cvars xmlns]
-	switch -- $xmlns \
-	    $NS(bookmarks) {
-		foreach child $cchildren {
-		    set added [::plugins::conferences::create_muc_bookmark \
-			    $connid $child -merge yes]
-		    set upd [expr {$upd || $added}]
-		}
-	    } \
-	    $NS(tkabber:groups) {
-		foreach child $cchildren {
-		    set added [::plugins::conferences::create_muc_bmgroup \
-			    $connid $child -merge yes]
-		    set upd [expr {$upd || $added}]
-		}
-	    }
-    }
-}
-
-###############################################################################
-
-proc mucbackup::push_bookmarks_to_roster {connid} {
-    variable updated
-
-    if {$updated($connid)} {
-	::plugins::conferences::push_bookmarks_to_roster $connid
-    }
-
-    unset updated($connid)
-}
-
-# vim:ts=8:sw=4:sts=4:noet

Copied: branches/xml-import-export/plugins/roster/bkup_conferences.tcl (from rev 1361, branches/xml-import-export/plugins/roster/bkup_categories.tcl)
===================================================================
--- branches/xml-import-export/plugins/roster/bkup_conferences.tcl	                        (rev 0)
+++ branches/xml-import-export/plugins/roster/bkup_conferences.tcl	2008-01-30 13:03:19 UTC (rev 1362)
@@ -0,0 +1,89 @@
+# $Id$
+# Support for backup/restore of "roster bookmarks" to MUC rooms (XEP-0048, v1.0)
+# Depends on: conferences.tcl, backup.tcl
+
+namespace eval mucbackup {
+    variable updated; array set updated {}
+
+    # Should probably go after the roster contacts, so we set prio to 70:
+    hook::add serialize_roster_hook \
+	[namespace current]::serialize_muc_bookmarks 70
+    hook::add deserialize_roster_hook \
+	[namespace current]::deserialize_muc_bookmarks 70
+    hook::add roster_deserializing_hook \
+	[namespace current]::prepare_deserialization
+    hook::add roster_deserialized_hook \
+	[namespace current]::push_bookmarks_to_roster
+}
+
+###############################################################################
+
+proc mucbackup::serialize_muc_bookmarks {connid level varName} {
+    upvar $level $varName subtags
+    global NS
+
+    foreach xmldata [::plugins::conferences::serialize_bookmarks $connid] {
+	lappend subtags [jlib::wrapper:createtag privstorage \
+	    -vars [list xmlns $NS(private)] \
+	    -subtags [list $xmldata]]
+    }
+}
+
+###############################################################################
+
+proc mucbackup::prepare_deserialization {connid} {
+    variable updated
+
+    set updated($connid) 0
+}
+
+###############################################################################
+
+proc mucbackup::deserialize_muc_bookmarks {connid data} {
+    variable updated
+    upvar 0 updated($connid) upd
+    global NS
+
+    jlib::wrapper:splitxml $data tag vars isempty cdata children
+    if {![string equal $tag privstorage]} return
+    set xmlns [jlib::wrapper:getattr $vars xmlns]
+    if {![string equal $xmlns $NS(private)]} {
+	return -code error "Bad roster element namespace \"$xmlns\":\
+	    must be \"$NS(private)\""
+    }
+
+    foreach storage $children {
+	jlib::wrapper:splitxml $storage ctag cvars cisempty ccdata cchildren
+	if {![string equal $ctag storage]} return
+	set xmlns [jlib::wrapper:getattr $cvars xmlns]
+	switch -- $xmlns \
+	    $NS(bookmarks) {
+		foreach child $cchildren {
+		    set added [::plugins::conferences::create_muc_bookmark \
+			    $connid $child -merge yes]
+		    set upd [expr {$upd || $added}]
+		}
+	    } \
+	    $NS(tkabber:groups) {
+		foreach child $cchildren {
+		    set added [::plugins::conferences::create_muc_bmgroup \
+			    $connid $child -merge yes]
+		    set upd [expr {$upd || $added}]
+		}
+	    }
+    }
+}
+
+###############################################################################
+
+proc mucbackup::push_bookmarks_to_roster {connid} {
+    variable updated
+
+    if {$updated($connid)} {
+	::plugins::conferences::push_bookmarks_to_roster $connid
+    }
+
+    unset updated($connid)
+}
+
+# vim:ts=8:sw=4:sts=4:noet



More information about the Tkabber-dev mailing list