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

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Wed Jan 30 22:19:10 MSK 2008


Author: kostix
Date: 2008-01-30 22:19:09 +0300 (Wed, 30 Jan 2008)
New Revision: 1363

Modified:
   branches/xml-import-export/plugins/roster/bkup_conferences.tcl
   branches/xml-import-export/plugins/roster/conferences.tcl
Log:
plugins/roster/bkup_conferences.tcl: Implemented actual sending of
 bookmarks to the server if they were updated during roster restore.

plugins/roster/conferences.tcl: Misc code cleanup, implemented an attempt
 to track reception of groups for bookmarks. Still doesn't work.


Modified: branches/xml-import-export/plugins/roster/bkup_conferences.tcl
===================================================================
--- branches/xml-import-export/plugins/roster/bkup_conferences.tcl	2008-01-30 13:03:19 UTC (rev 1362)
+++ branches/xml-import-export/plugins/roster/bkup_conferences.tcl	2008-01-30 19:19:09 UTC (rev 1363)
@@ -33,7 +33,6 @@
 
 proc mucbackup::prepare_deserialization {connid} {
     variable updated
-
     set updated($connid) 0
 }
 
@@ -81,6 +80,7 @@
 
     if {$updated($connid)} {
 	::plugins::conferences::push_bookmarks_to_roster $connid
+	::plugins::conferences::store_bookmarks $connid
     }
 
     unset updated($connid)

Modified: branches/xml-import-export/plugins/roster/conferences.tcl
===================================================================
--- branches/xml-import-export/plugins/roster/conferences.tcl	2008-01-30 13:03:19 UTC (rev 1362)
+++ branches/xml-import-export/plugins/roster/conferences.tcl	2008-01-30 19:19:09 UTC (rev 1363)
@@ -77,6 +77,7 @@
 proc conferences::process_bookmarks {connid res child} {
     variable bookmarks
     variable responds
+    global NS
 
     if {$res != "OK"} return
 
@@ -85,15 +86,17 @@
     foreach ch $child {
 	jlib::wrapper:splitxml $ch tag1 vars1 isempty1 cdata1 children1
 
-	if {[jlib::wrapper:getattr $vars1 xmlns] == $::NS(bookmarks)} {
-	    foreach bookmark $children1 {
-		create_muc_bookmark $connid $bookmark
+	switch -- [jlib::wrapper:getattr $vars1 xmlns] \
+	    $NS(bookmarks) {
+		foreach bookmark $children1 {
+		    create_muc_bookmark $connid $bookmark
+		}
+	    } \
+	    $NS(tkabber:groups) {
+		foreach bookmark $children1 {
+		    create_muc_bmgroup $connid $bookmark
+		}
 	    }
-	} elseif {[jlib::wrapper:getattr $vars1 xmlns] == $::NS(tkabber:groups)} {
-	    foreach bookmark $children1 {
-		create_muc_bmgroup $connid $bookmark
-	    }
-	}
     }
 
     if {$responds($connid) < 2} return
@@ -132,6 +135,9 @@
 	set bookmarks($connid,password,$jid) ""
 	if {![info exists bookmarks($connid,groups,$jid)]} {
 	    set bookmarks($connid,groups,$jid) {}
+	    set bookmarks($connid,rcvdgroups,$jid) 0
+	} else {
+	    set bookmarks($connid,rcvdgroups,$jid) 1
 	}
 
 	set autojoin [jlib::wrapper:getattr $bvars autojoin]
@@ -181,7 +187,8 @@
 	}
     }
 
-    if {$merge && [info exists bookmarks($connid,groups,$jid)]} {
+    if {$merge && !([info exists bookmarks($connid,jid,$jid)]
+		&& $bookmarks($connid,rcvdgroups,$jid))} {
 	return 0
     } else {
 	set bookmarks($connid,groups,$jid) $groups
@@ -492,6 +499,7 @@
     set bookmarks($connid,password,$jid) $password
     set bookmarks($connid,autojoin,$jid) $autojoin
     set bookmarks($connid,groups,$jid) $groups
+    set bookmarks($connid,rcvdgroups,$jid) 1
 
     # TODO should we remove $jid from the roster if it is here?
     client:roster_push $connid $jid $name $groups bookmark ""



More information about the Tkabber-dev mailing list