Author Topic: Feature Request - Replace To/From Server (Google)...  (Read 1043 times)

tanstaafl

  • Global Moderator
  • Full Member
  • *****
  • Posts: 97
  • Karma: +0/-0
Feature Request - Replace To/From Server (Google)...
« on: March 03, 2010, 12:55:06 PM »
I used to use Scheduleworld back when it was free, and the SyncSW extension had some excellent flexibility when it came to 'resetting' Address Books... there were 3 different manual sync choices available under the Sync submenu:

'Replace To Server' - this would delete all contacts from the server and replace them with what is currently in the AB.

'Replace From Server' - this does the opposite - deletes all local copies and redownloads everything from the Server

'Slow/Full Sync' - this apparently iterated through every field in every contact, and anytime it found conflicting data, it replaced the older with the newer, regardless of which location had the newest data for that contact/field

I'd love to have this kind of flexibility with gContactSync...

Josh Geenen

  • gContactSync Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 453
  • Karma: +1/-0
    • Pi Rules.org
Re: Feature Request - Replace To/From Server (Google)...
« Reply #1 on: March 03, 2010, 03:35:16 PM »
That sounds like a good idea to me, and I just added an Advanced tab to the preferences with a lot of empty room.  I will almost certainly implement 'Replace To' and 'Replace From' in some form in 0.3.

Background/current status:

Currently, "Resetting" an address book just removes all contacts and mailing lists from it and sets the last synchronized date to 0.  The next time you sync everything should be pulled back from Google.  However, if the address book is in write-only mode then nothing will happen.

Since it removes mail lists, you must restart Thunderbird after a reset or there is some strange behavior, especially if you create a new address book (phantom mailing lists and even contacts can appear and sometimes stick).  The problem is that sort of limits the ability to 'Replace From Server'.  Basically, any operation with mailing lists can result in strange behavior if you don't restart Thunderbird first.  If you fail to do so the results can stick even after a restart.

I realize that a reset is very unclear, especially in 0.2.  0.3 will currently show the following when you try to reset an address book:

Quote
Resetting an address book will permanently remove all contacts and mailing lists from that address book, but will not remove your synchronization settings for that address book.  Contacts and groups will be pulled from Google back into the address book during the next synchronization.
Click OK to reset the address book or Cancel to stop.
Visit the forum if you have any questions.

Replace To Server

This can be implemented with relatively little effort on my part.  It would basically:
1. Delete everything from the server
2. Remove the GoogleID from every contact in the directory*
3. Remove the GoogleID from every mailing list in the directory*
4. Synchronize

*Steps 2 and 3 could probably be avoided by adding some flag (maybe set ReplaceToMode = true on the AB).  TBContact could return a blank string for the GoogleID if that mode is on, and mailing lists could do something similar.

No restart should be required since no mailing lists are removed.  However, for now I'd like to only allow synchronizing from the address book window (0.4 should fix this) so the changes will only be applied during the next manual or scheduled sync.

Replace From Server

This is essentially what a reset does right now, but gContactSync requires a restart and sync before everything is re-downloaded.

Slow/Full Sync

This sounds almost like what gContactSync does.  gContactSync checks the last modified date of every contact in the address book and Google account.  This date is compared to the last sync date of the address book.  If one or both is newer then, depending on the preference, one will get replaced with the other (by replaced that means all synchronized attributes are replaced, any non-synchronized data is not touched).

There are a few last modified date bugs in Thunderbird but I fix them within gContactSync by adding a listener (tells me when something is added, changed, or removed) and replacing the drag-and-drop method.
gContactSync: info FAQs

tanstaafl

  • Global Moderator
  • Full Member
  • *****
  • Posts: 97
  • Karma: +0/-0
Re: Feature Request - Replace To/From Server (Google)...
« Reply #2 on: March 04, 2010, 05:18:38 AM »
Sounds great Josh, thanks...

As for requiring a Restart - maybe a dialog could just inform the user of this prior to performing the action, and if the user clicks ok to do it, then just issue a Restart command to TB after the action is successfully performed?

Can you test for open compose windows? If so, you could tell the user to either save or finish/send their open compose windows (if they had any), then try again...

In other words, don't do the action, unless you can safely restart TB automatically.

I say this based on many years of experience with users who refuse to listen, refuse to read dialogs, and just flat out refuse to believe me when I tell them that 'if they do A, B will result' then come crying to me when this occurs. I have no sympathy for them, but I also hate dealing with them.

I'd much rather just control something like that programatically...

Josh Geenen

  • gContactSync Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 453
  • Karma: +1/-0
    • Pi Rules.org
Re: Feature Request - Replace To/From Server (Google)...
« Reply #3 on: March 04, 2010, 11:26:20 AM »
Right now gContactSync does not restart Thunderbird, it will just ask the user to do so.

Here's the current reset all address books process (starting with 0.3.0a4):
1. User clicks Reset All Synced ABs
2. A confirmation dialog comes up: This will reset all synchronized address books.  All of their contacts and mailing lists will be removed and you must restart Thunderbird when this is finished.  Your account details will be saved, so your contacts and groups will be added to Thunderbird during the next synchronization.  Click OK to continue, or Cancel to stop.
3. If the user clicked OK, continue, otherwise abort reset
4. All "synchronized" address books (which are NOT disabled in 0.3) are reset.  Synchronized address books contain a gContactSyncUsername preference that is not blank or "none".
5.  The user sees Please close all Thunderbird windows and restart Thunderbird before synchronizing.

When an address book is reset in version 0.3, in order (starting with 0.3.0a4):
  • The AB is backed up with a prefix reset_YYYY_MM_DD_.  I'm starting to wonder if the hour and minute should be added in case anyone ever tries to reset twice in a day... (ie reset_2010_03_04_abook.mab.bak)
  • All mailing lists are removed from Thunderbird
  • All contacts are removed from Thunderbird
  • The lastSyncDate is set to 0
  • The lastBackup time is NOT reset, so the original backup is not overwritten

After the restart the user is supposed to synchronize again and all contacts should be restored.

Please let me know what you think about this process and the clarity of the dialog text.
gContactSync: info FAQs

tanstaafl

  • Global Moderator
  • Full Member
  • *****
  • Posts: 97
  • Karma: +0/-0
Re: Feature Request - Replace To/From Server (Google)...
« Reply #4 on: March 04, 2010, 03:11:17 PM »
Right now gContactSync does not restart Thunderbird, it will just ask the user to do so.

Understood, but the problem I have with this is because, in your own words, if TB isn't restarted:

Quote
there is some strange behavior, especially if you create a new address book (phantom mailing lists and even contacts can appear and sometimes stick).  The problem is that sort of limits the ability to 'Replace From Server'.  Basically, any operation with mailing lists can result in strange behavior if you don't restart Thunderbird first.  If you fail to do so the results can stick even after a restart.

Speaking from the standpoint of someone who has many years of experience supporting end-users, I really don't think it is a good idea to trust them to restart, especially if not doing so can cause problems. Many, if not most, will find some reason not to do so, and will promptly forget about the warning. It would be much better to simply force the Restart.

Quote
Here's the current reset all address books process (starting with 0.3.0a4):
1. User clicks Reset All Synced ABs
2. A confirmation dialog comes up: This will reset all synchronized address books.  All of their contacts and mailing lists will be removed and you must restart Thunderbird when this is finished.  Your account details will be saved, so your contacts and groups will be added to Thunderbird during the next synchronization.  Click OK to continue, or Cancel to stop.
3. If the user clicked OK, continue, otherwise abort reset
4. All "synchronized" address books (which are NOT disabled in 0.3) are reset.  Synchronized address books contain a gContactSyncUsername preference that is not blank or "none".
5.  The user sees Please close all Thunderbird windows and restart Thunderbird before synchronizing.

and the user promptly closes this dialog, 'forgets' to restart TB, and then either manually syncs his AB, or an auto-sync occurs.

Quote
When an address book is reset in version 0.3, in order (starting with 0.3.0a4):
  • The AB is backed up with a prefix reset_YYYY_MM_DD_.  I'm starting to wonder if the hour and minute should be added in case anyone ever tries to reset twice in a day... (ie reset_2010_03_04_abook.mab.bak)

I guarantee it will happen... ;)

Quote
  • All mailing lists are removed from Thunderbird
  • All contacts are removed from Thunderbird
  • The lastSyncDate is set to 0
  • The lastBackup time is NOT reset, so the original backup is not overwritten

After the restart the user is supposed to synchronize again and all contacts should be restored.

Please let me know what you think about this process and the clarity of the dialog text.

Other than the fact that I'd strongly encourage you to force a restart and change the wording accordingly, it seems fine to me.

As for the process...

Quote
After the restart the user is supposed to synchronize again and all contacts should be restored.

I'd recommend having some kind of flag to force an auto-sync for this when TB is restarted - relying on the user to do things like this is way too error-prone. Yes, the technically inclined would be ok most of the time, but average users? No way (cynical? maybe, but its still true).

Also...

1. Currently (with 0.2.12 and earlier), the AB syncs every time you open it. Hopefully 0.3 doesn't do that any more - if it does, consider this my strong suggestion to kill it.

2. I'd like to see two more auto-sync options: sync on startup, and sync on quit - maybe make these prompted syncs.

3. Can you limit the number of syncs per day? If so, I'd add an option with a sane default...

That's about all I can think of at the moment...

Josh Geenen

  • gContactSync Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 453
  • Karma: +1/-0
    • Pi Rules.org
Re: Feature Request - Replace To/From Server (Google)...
« Reply #5 on: September 06, 2010, 12:40:36 PM »
Sorry this took me so long, but I finally have something for you.  How do these screenshots look?

gContactSync: info FAQs