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

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Jan 29 18:52:03 MSK 2008


Author: kostix
Date: 2008-01-29 18:52:03 +0300 (Tue, 29 Jan 2008)
New Revision: 1359

Modified:
   branches/xml-import-export/plugins/roster/annotations.tcl
   branches/xml-import-export/plugins/roster/backup.tcl
   branches/xml-import-export/plugins/roster/bkup_annotations.tcl
Log:
plugins/roster/bkup_annotations.tcl: Renamed plugin namespace,
 removed stale debug calls to [puts].

plugins/roster/backup.tcl: Added insertion of the standard XML header
 to the XML backup files and stripping of BOM, if any, upon reading.
 Removed debug calls to [puts].

plugins/roster/annotations.tcl: Removed debug calls to [puts].


Modified: branches/xml-import-export/plugins/roster/annotations.tcl
===================================================================
--- branches/xml-import-export/plugins/roster/annotations.tcl	2008-01-29 15:21:15 UTC (rev 1358)
+++ branches/xml-import-export/plugins/roster/annotations.tcl	2008-01-29 15:52:03 UTC (rev 1359)
@@ -75,8 +75,6 @@
 	set cdate [clock seconds]
     }
 
-    puts "merge? $merge; $jid, $cdate, $mdate"
-
     if {!$merge || [more_recent $connid $jid $cdate $mdate]} {
 	set notes($connid,jid,$jid)   $jid
 	set notes($connid,cdate,$jid) $cdate

Modified: branches/xml-import-export/plugins/roster/backup.tcl
===================================================================
--- branches/xml-import-export/plugins/roster/backup.tcl	2008-01-29 15:21:15 UTC (rev 1358)
+++ branches/xml-import-export/plugins/roster/backup.tcl	2008-01-29 15:52:03 UTC (rev 1359)
@@ -74,6 +74,7 @@
     set fd [open $filename w]
     fconfigure $fd -encoding utf-8
 
+    puts $fd {<?xml version="1.0" encoding="UTF-8"?>}
     puts $fd [serialize_roster $connid]
 
     close $fd
@@ -127,8 +128,7 @@
 
     set fd [open $filename r]
     fconfigure $fd -encoding utf-8
-    #set xml [string map {\n "" \t ""} [read $fd]]
-    set xml [read $fd]
+    set xml [string trimleft [read $fd] [format %c 0xFEFF]] ;# strip BOM, if any
     close $fd
 
     deserialize_roster $connid $xml

Modified: branches/xml-import-export/plugins/roster/bkup_annotations.tcl
===================================================================
--- branches/xml-import-export/plugins/roster/bkup_annotations.tcl	2008-01-29 15:21:15 UTC (rev 1358)
+++ branches/xml-import-export/plugins/roster/bkup_annotations.tcl	2008-01-29 15:52:03 UTC (rev 1359)
@@ -3,7 +3,7 @@
 # for roster items.
 # Depends on: annotations.tcl, backup.tcl
 
-namespace eval annobakup {
+namespace eval annobackup {
     # Should probably go after the roster contacts, so we set prio to 60:
     hook::add serialize_roster_hook \
 	[namespace current]::serialize_annotations 60
@@ -13,7 +13,7 @@
 
 ###############################################################################
 
-proc annobakup::serialize_annotations {connid level varName} {
+proc annobackup::serialize_annotations {connid level varName} {
     upvar $level $varName subtags
     global NS
 
@@ -26,7 +26,7 @@
 
 ###############################################################################
 
-proc annobakup::deserialize_annotations {connid data} {
+proc annobackup::deserialize_annotations {connid data} {
     global NS
 
     jlib::wrapper:splitxml $data tag vars isempty cdata children
@@ -52,8 +52,6 @@
 	}
     }
 
-    puts "updated? $updated"
-
     if {$updated} {
 	::plugins::annotations::cleanup_and_store_notes $connid
     }



More information about the Tkabber-dev mailing list