X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbe%2Fnikiroo%2Fjvcard%2Fremote%2FSync.java;h=a1e5e2429cc75f5a7b35a854e440773df34cf6fb;hb=59597d59aa262e31c2e1b7f66b4cb299f88ebd1b;hp=609041eaaceef39e449df33a7d85781b99f6c2ab;hpb=e3fe983485916e0f3dbae73394f9dd8271623639;p=jvcard.git diff --git a/src/be/nikiroo/jvcard/remote/Sync.java b/src/be/nikiroo/jvcard/remote/Sync.java index 609041e..a1e5e24 100644 --- a/src/be/nikiroo/jvcard/remote/Sync.java +++ b/src/be/nikiroo/jvcard/remote/Sync.java @@ -24,6 +24,7 @@ import be.nikiroo.jvcard.launcher.CardResult; import be.nikiroo.jvcard.launcher.CardResult.MergeCallback; import be.nikiroo.jvcard.parsers.Format; import be.nikiroo.jvcard.parsers.Vcard21Parser; +import be.nikiroo.jvcard.remote.SimpleSocket.BlockAppendable; import be.nikiroo.jvcard.resources.StringUtils; import be.nikiroo.jvcard.resources.bundles.RemoteBundle; import be.nikiroo.jvcard.resources.enums.RemotingOption; @@ -276,7 +277,9 @@ public class Sync { } case POST_CARD: { s.sendCommand(Command.POST_CARD); - s.sendBlock(Vcard21Parser.toStrings(local)); + BlockAppendable app = s.createBlockAppendable(); + Vcard21Parser.write(app, local); + app.close(); local.saveAs(getCache(cacheDirOrig), Format.VCard21); setLastModified(s.receiveLine()); break; @@ -343,7 +346,9 @@ public class Sync { // ...but without starting with original since it is not // true here s.sendCommand(Command.POST_CARD); - s.sendBlock(Vcard21Parser.toStrings(merge)); + BlockAppendable app = s.createBlockAppendable(); + Vcard21Parser.write(app, merge); + app.close(); String serverLastModifTime = s.receiveLine(); // @@ -409,7 +414,9 @@ public class Sync { } for (Contact c : added) { s.sendCommand(Command.POST_CONTACT, c.getId()); - s.sendBlock(Vcard21Parser.toStrings(c, -1)); + BlockAppendable app = s.createBlockAppendable(); + Vcard21Parser.write(app, c, -1); + s.close(); } if (from.size() > 0) { for (int index = 0; index < from.size(); index++) { @@ -425,7 +432,9 @@ public class Sync { } for (Data d : subadded) { s.sendCommand(Command.POST_DATA, d.getContentState(true)); - s.sendBlock(Vcard21Parser.toStrings(d)); + BlockAppendable app = s.createBlockAppendable(); + Vcard21Parser.write(app, d); + app.close(); } s.sendCommand(Command.PUT_CONTACT); }