Thunderbird addon

Talk about add-ons and extension development.
Post Reply
egoitz
Posts: 4
Joined: January 18th, 2016, 6:06 am

Thunderbird addon

Post by egoitz »

Good morning,

I was trying to do what should a pretty easy change to a Thunderbird add-on but that I'm not capable of achieving it.

In Thunderbird, Sogo Connector for CardDAV, allows you to right click mouse the Thunderbird addressbook and click Synchronize now. This is fine, until it allows you doing it five or six times consecuently without sync having finished and due this not to be properly handled either by ignoring you from the second to the last sync order while the own sync is in progress or by greying/hidding the synchonize menuitem for not allowing you to definitively order more than one sync at a time. The consequence of this improper handling (idiot behavior?) is that you end up with your contacts duplicated, triplicated or whatever.

So for achieving this I think I should edit the function (in origin) :

function SynchronizeGroupdavAddressbook(uri, callback, origin) {
var sync = GetSyncNotifyGroupdavAddressbook(uri, null, origin);
sync.notify();
}

to something like :

function SynchronizeGroupdavAddressbook(uri, callback, origin) {
Components.utils.import("resource://gre/modules/FileUtils.jsm");
var dir = new FileUtils.File("ProfD", ["SYNC-DEMANDA-EN-PROGRESO"], true);
if (!dir.exists())
{
dir = FileUtils.getDir("ProfD", ["SYNC-DEMANDA-EN-PROGRESO"], true);
var sync = GetSyncNotifyGroupdavAddressbook(uri, null, origin);
sync.notify();
dir.remove(true);
}
}

Which just tries to in some way achieve my idea. In this case, by creating a directory in the profile on the beggining of the sync... and destroying it at the end, so ignoring then new sync commands from the menuitem till the previous one ends... but am not able to get all this working, because either, works always the sync (as if I hadn't done nothing) or does never allow you to synchronize (because ignores you all except in the own start of Thunderbird of course... which is different code).

Have tried to :

function SynchronizeGroupdavAddressbook(uri, callback, origin) {
document.getElementById(dirTreeContext-syncGroupdav).disabled=true;
var sync = GetSyncNotifyGroupdavAddressbook(uri, null, origin);
sync.notify();
document.getElementById(dirTreeContext-syncGroupdav).disabled=false;
}

but I''m not seeing the grey effect or something in the menuitem. Just again that seems not work Syncronize never or always as if nothing had happened.

Could anyone help me?. I'm trying to avoid getting contact duplicates and similar issues by this uncontrolled possibility in Sogo Connector.

Very thankful in advance for your time,
Best regards,
User avatar
DanRaisch
Moderator
Posts: 127224
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

Re: Thunderbird addon

Post by DanRaisch »

Moving to Extension Development.
egoitz
Posts: 4
Joined: January 18th, 2016, 6:06 am

Re: Thunderbird addon

Post by egoitz »

Good morning,

Any help would be appreciated. Please could anyone point me in the proper direction?. Should not be hard... but I'm not able to get it work as I want...

Best regards,
Post Reply