Author Topic: Write-only sync:: unexpected operation  (Read 6376 times)

darin

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Write-only sync:: unexpected operation
« on: July 15, 2010, 10:58:34 AM »
Using 3.0b2

The 'direction' setting in the gContactSync Accounts dialog does not appear to enforce Tbird->gmail direction.

Problem replication:
1. Create address book Test
2. Create gmail group Test
3. Create AB entry in TB
4. Sync will place new entry in gmail
5. Delete entry in gmail
6. 'gContactSync Accounts' entry for 'Test' account select Write-only
7. Sync will delete local (TB) copy of contact

Is this expected operation? The 'direction' description leads me to believe otherwise...

(BTW, the Book->Group sync is a GREAT feature!)

  -darin

tanstaafl

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 122
  • Karma: +1/-0
Re: Write-only sync:: unexpected operation
« Reply #1 on: July 21, 2010, 04:26:21 AM »
Just a guess, but I'd think you'd want to write protect the contact, then sync, *then* it would be considered write-protected from a delete from gmail...

darin

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: Write-only sync:: unexpected operation
« Reply #2 on: July 21, 2010, 05:42:27 AM »
Good suggestion, but I am not sure how tractable this would be for say, 900+ contacts (is there a way to group-select contacts and protect them? -- I can't check now, my IT department is 'fixing' my laptop ;-).

The point is not the mechanism involved in doing this (there are several ways to work around this behavior) but that the implication of the checkbox is that the sync is ONE WAY only. The reality appears otherwise, unless I have misunderstood something.

kc

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
Re: Write-only sync:: unexpected operation
« Reply #3 on: July 21, 2010, 11:00:29 AM »
If I'm reading your message correctly, I have just posted on this problem.
I'm trying to sync TB -> gmail only and it wants to delete all of my contacts.

darin

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: Write-only sync:: unexpected operation
« Reply #4 on: July 21, 2010, 11:16:20 AM »
Yes, that's essentially it.

kc

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
Re: Write-only sync:: unexpected operation
« Reply #5 on: July 22, 2010, 03:40:34 PM »
Please...can we get this fixed?  :)

Josh Geenen

  • gContactSync Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 720
  • Karma: +5/-0
    • Pi Rules.org
Re: Write-only sync:: unexpected operation
« Reply #6 on: July 22, 2010, 06:32:57 PM »
Hello,

Quote
Is this expected operation? The 'direction' description leads me to believe otherwise...

As you guessed, that wasn't supposed to happen.  I found the problem and it should be fixed in version 0.3.0 beta 3.  If you ever edit a contact that was deleted remotely that contact will be added to Google.

Could you update to 0.3.0b3 and try to sync again?  Contacts should no longer be removed from Thunderbird in write-only mode.  You shouldn't have to do anything other than re-enable synchronization for that address book in the Accounts dialog (click "Show Advanced Settings") then click Save Changes.

I apologize for my slowness in replying to you and fixing this bug, I should be faster in the future.  At least this time it was a better form of busy than normal.

Please let me know how 0.3.0b3 works for you.  If all goes well I will finally release 0.3.0 soon.

Josh
gContactSync: info FAQs

kc

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
Re: Write-only sync:: unexpected operation
« Reply #7 on: July 22, 2010, 10:33:26 PM »
Thanks, Josh. Sorry if I was whining.

I upgraded but only 9 out of 500+ contacts were uploaded to Gmail. Step in the right direction, though! They are not sequential contacts, either.
I did hit the 'refresh' button for that account and selected 'only contacts.' Let me know what to try next.

Kathleen

Josh Geenen

  • gContactSync Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 720
  • Karma: +5/-0
    • Pi Rules.org
Re: Write-only sync:: unexpected operation
« Reply #8 on: July 23, 2010, 06:49:25 AM »
Hello again,

The fix only prevents contacts from being deleted locally when the are deleted remotely.
Your contacts aren't being uploaded to Google because they are old and haven't been modified since the previous synchronization.

If you want them to all be added to Google I cam write a script that will update all of your contacts in that address book.  This will cause gContactSync to see that they were modified and upload them to Google.  Let me know if you want that script.  If so, I will write it and put it here with instructions once I get back from work.

The Refresh button refreshes the list of Address Books and the usernames of the Google Accounts they are synchronized with.

Josh
gContactSync: info FAQs

kc

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
Re: Write-only sync:: unexpected operation
« Reply #9 on: July 23, 2010, 09:16:45 AM »
I see. Thanks very much. Yes, I would like the script!
Appreciate you helping me with this, Josh.

Kathleen

tanstaafl

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 122
  • Karma: +1/-0
Re: Write-only sync:: unexpected operation
« Reply #10 on: July 23, 2010, 12:35:25 PM »
Your contacts aren't being uploaded to Google because they are old and haven't been modified since the previous synchronization.

Hi Josh,

Wouldn't this kind of problem be resolvable by implementing one or more of the features in this feature request?

Josh Geenen

  • gContactSync Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 720
  • Karma: +5/-0
    • Pi Rules.org
Re: Write-only sync:: unexpected operation
« Reply #11 on: July 23, 2010, 10:53:30 PM »
Quote
I see. Thanks very much. Yes, I would like the script!
Appreciate you helping me with this, Josh.

Ok, here is the promised script but I strongly advise you to backup your contacts first just in case.  This will ask you for the name of an address book and make sure you type it exactly as it appears.

Instructions:
Copy the entire line below, it is a very long line.
Open Thunderbird and go to Tools -> Error Console
Paste the line and click Evaluate
You should see a popup.  Type the name of the address book with your contacts in.  It must be exact.
If it worked there will be a popup that says "Done"
Synchronize your contacts.  They should be added to Google or updated.

Code: [Select]
var Cc=Components.classes,Ci=Components.interfaces,ab,card,dt=(new Date()).getTime(),name=prompt("Name of the address book?"),it=Cc["@mozilla.org/abmanager;1"].getService(Ci.nsIAbManager).directories;while(it.hasMoreElements()){ab=it.getNext();if(ab instanceof Ci.nsIAbDirectory && ab.dirName==name){var it2=ab.childCards;while(it2.hasMoreElements()){card=it2.getNext();if(card instanceof Ci.nsIAbCard && !card.isMailList){card.setProperty("LastModifiedDate",dt);ab.modifyCard(card);}}alert('done');break;}}
Disclaimer: In my (futile) attempt to keep this line short I removed any error checking, so if you try to break this you will succeed in getting an error printed to the Error Console.

If it doesn't work on the first try I apologize; I didn't get around to it until now and I'm getting a bit tired.  Please copy any errors you may get and I'll fix them.

Quote
Wouldn't this kind of problem be resolvable by implementing one or more of the features in this feature request?

Yes, I forgot about that because I didn't make a bug report for it (it is now Bug 23052, thanks for the reminder.  Updating the lastModifiedDate of every contact in an address book will essentially "replace to server" during the next sync as long as read-only mode isn't on.

A reset is essentially a "replace from server" in that request.
gContactSync: info FAQs

darin

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: Write-only sync:: unexpected operation
« Reply #12 on: July 25, 2010, 10:35:00 AM »
Josh,

Quote
I apologize for my slowness in replying to you and fixing this bug, I should be faster in the future.  At least this time it was a better form of busy than normal.

Please. Thank YOU for the gContactSync utility,  it is compact, encapsulated and most importantly solves an ACTUAL (as opposed to perceived) problem.  You have bitten off quite a bit here, basically tackling a project that required maintaining the coherency of two non-colocated databases. Not copies, but different databases. I'd wish you luck, but it looks like you have the project well in hand.

The original problem has been addressed by the b3 fix. Confirmed: TB contacts are no longer deleted locally when deleted on Google Contacts AND Write only mode is selected for the account. Confirmed: contact deleted in Google Contacts can only be restored by running the script you provided for Kathleen.

I will continue testing (ok, actually using 0.3 beta) -- don't worry, I back things up religiously ;-)

Some notes from the interim:
  • The movement of changes seem to be based upon preference for 'last change', whether or not it was intended. Perhaps the solution to many problems and a simplification for the (my original question and Kathleen's followup) could be something like a 'force update action' address this? Sort of a 'hey, restore this contact/AB from here regardless of who is older'.
  • While useful and functional, the administration of the accounts (i.e. a separate dialog box popping up for each Address book - to - Google Account relationship) may get cumbersome with a large number of Google Contacts groups. Perhaps a table or matrix where all account attributes are edited together would be useful)

Just suggestions. Again, nice job.

  -darin

tanstaafl

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 122
  • Karma: +1/-0
Re: Write-only sync:: unexpected operation
« Reply #13 on: July 25, 2010, 11:22:36 AM »
Quote
Wouldn't this kind of problem be resolvable by implementing one or more of the features in this feature request?

Yes, I forgot about that because I didn't make a bug report for it (it is now Bug 23052, thanks for the reminder.  Updating the lastModifiedDate of every contact in an address book will essentially "replace to server" during the next sync as long as read-only mode isn't on.

A reset is essentially a "replace from server" in that request.

No worries - glad this is now an official FR...

Since you already said this is essentially what it does, maybe you could consider changing the term 'reset' to 'Replace From Server' since most people would understand what it meant without having to ask and/or read any docs...

Anyway, as always, thanks, v3 is looking great! :)
« Last Edit: July 25, 2010, 11:27:06 AM by tanstaafl »

kc

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
Re: Write-only sync:: unexpected operation
« Reply #14 on: July 26, 2010, 07:33:52 PM »
Josh, thanks very much for the script, it worked beautifully.
I'm still learning about your little gem, and I really appreciate your help.

Kathleen