Archive for July, 2008

gContactSync available for download

The first–and possibly only–alpha version of my extension is available for download.  You can watch a flash tutorial on basic use and download it herePlease watch the tutorial before using it or you might run into problems. Remember that it is an alpha version, so there might be bugs, and I might add more features.

You can read about the extension on my website.  I also have a mozdev project for it where you can view the source and download the extension.

Reporting Bugs and Suggesting Enhancements

I welcome any sort of feedback, enhancement request, or bug report.  If you encounter an error, please e-mail me with the details and the log file after removing any personal information from it.  There are several e-mail addresses you can use to do it.  gcontactsync at pirules.net is probably easiest.  You can also use the contact form on my blog or website.

If you encounter an error, you can find the log file in the extensions’s folder.  Read this to get to the profile directory, then go to the extensions folder and the folder named gcontactsync at pirules.net.  It is the file named log.txt, and you will probably want to remove any personal information in it before sending it.

Keep you eyes open for updates.  I’ll try to get a new version out soon after I receive some feedback.  Updates will have to be done manually, for now.

, , , , ,

No Comments

Update

I have been looking for and fixing bugs, so I am almost ready to release my extension either late today or tomorrow if everything works out as planned.  I’m going to be pretty busy today through Saturday, so I might not be able to respond to comments/bugs until then.

Mozdev

I have a project on mozdev for it now – http://gcontactsync.mozdev.org/ that I still have to update.  The source code is available there.

IM bug

I found a bug that might actually be on Google’s side.  When you create a new IM address it doesn’t have a default type (says “Choose”), unlike the other typed attributes.  The XML it sends to the client is as follows: <gd:im address=”: address” label=”CUSTOM”/> where the screenname is “address”.  Notice the “: ” added to it.  When this is sent back to Google for the first time, it is accepted, but the IM address has a colon and space added to the front.  So, the extension now checks for these IM addresses and removes the “: ” if present.  These IM addresses do not show up in Thunderbird since they don’t have a type.

, ,

No Comments

\Windows\System32\winload.exe missing or corrupt

After installing FreeBSD and its bootloader on my notebook I found myself unable to boot Vista:

\Windows\System32\winload.exe

The selected entry could not be loaded because the application is missing or corrupt

So, I booted from the CD and chose the repair option, but it didn’t find any installation (no, I didn’t need to load any drivers).  The startup repair found an error but couldn’t fix it.  So, I went to the command prompt and tried to mess around with bcdedit, but I got the following error:

The boot configuration data store could not be opened.  The system cannot find the specified file.

So, I created a new data store: bcdedit /CREATESTORE C:\BCD

I then rebooted and tried the repair option again.  This time, it found an install on an unknown location and the startup repair actually worked.  Upon reboot the FreeBSD bootloader still came up, but it was able to boot Vista this time after running CHKDSK.  Now I can try out my patch for 448165 in Windows.

,

1 Comment

Update

Contact Conversion Rewrite

I finally finished rewriting the code to convert contacts as it was overly complicated and some code was duplicated a few times.  Along the way I was greeted with an error message I’ve never seen:

Error: XML descendants internal method called on incompatible Object
The cause: I put two periods where only one was needed..

Copying/Moving Cards

I previously mentioned that copying or moving a card would make it lose the attributes added by this extension, but this is now fixed.  It does slow down copying and, more noticably, moving cards, so there is a new preference to disable this.

Miscellaneous Bug Fixes

I’ve been searching for bugs to fix and found a few.  Not all of the preferences worked, but I think they should be fixed now.  The Home section of the card view was sometimes visible when none of the relevant attributes were present, as well, due to a mistake I made in the overlay.

Bug 448165

While working on overriding the method to copy/move cards, I crashed Thunderbird by calling the deleteSelectedCards method of the address book view when no cards were selected.  After using gdb to look at the backtrace, I found that calling nsIAbMDBDirectory::DeleteCards crashes if null is passed to it.  I wrote a unit test and patch, but I am installing FreeBSD and compiling Gnome and it’s dependencies on my slow laptop (on which I test patches in Windows), so I have not tested the patch or test in Windows yet.

Removing the Auth Token

I have now added and tested a button to remove the auth token on the first tab of the extension preferences.  If you ever wish to remove the extension, I suggest you remove the auth token.  Additionally, if you are getting authentication errors, remove the auth token, close the Address Book if it was open, and re-open the Address Book to sign in again.

, , , , , ,

1 Comment

Extra Attributes now in Card View

The extra attributes added by gContactSync (ThirdEmail, FourthEmail, (Google)TalkScreenName, YahooScreenName, MSNScreenName, ICQScreenName, JabberScreenName, OtherAddress, OtherNumber, HomeFaxNumber, and Groups) are now easily viewed and should be indistinguishable from regular attributes in the GUI, but the extra properties will not be copied/moved with the card unless you have the patch for 413260 applied.  The extra attributes will work for every card, not just cards in the one address book.

  • There is an extra tab added the to Edit Card dialog that lets you set all of the attributes (except setting the Group will have no effect).
  • You can view and sort the cards by any of the attributes in the tree view
  • All of the properties are visible when the card is selected in the card view.  The e-mail addresses are linked to mailto: URIs and the address has a MapIt link that uses Google Maps to view the address.

I had to change the name of the Google Talk ™ screenname from GoogleTalkScreenName to TalkScreenName because the card viewer showed the GeneratedName instead of the screenname.

, ,

No Comments

New Extension

I made a new, simple, extension for changing the default file type for saved e-mail messages after BuBB1eS asked about it in #maildev.  You can change the type by going to the Preferences (Tools -> Add-ons -> Options under File Type Selector).  You should change it to only one of the following: txt, eml, html.  It will work if the period is included in the preference, too.  Let me know if you want to localize it; there are only two strings: “File Type Selector Preferences” and “Default extension for saved e-mail messages (ex txt, html, or eml)”. 😉

You can read about it and download it here.

How it works

It overrides the SaveAsFile function in mail/base/content/mailCommands.js from:

function SaveAsFile(uri)
{
  if (uri) {
    var filename = null;
    try {
      var subject = messenger.messageServiceFromURI(uri)
                             .messageURIToMsgHdr(uri).mime2DecodedSubject;
      filename = GenerateValidFilename(subject, ".eml");
    }
    catch (ex) {}
    messenger.saveAs(uri, true, null, filename);
  }
}

to:

function mySaveAsFile(aUri) {
  var type;
  try {
    // get the preference for the default extension type
    var prefBranch = Components.classes["@mozilla.org/preferences-service;1"]
                               .getService(Components.interfaces.nsIPrefService)
                               .getBranch("extensions.filetypeselector.")
                               .QueryInterface(Components.interfaces.nsIPrefBranch2);
    type = prefBranch.getCharPref("defaultExtension");
    if (type.indexOf(".") == -1)
      type = "." + type;
  } catch(e) {}
  // if there isn't a type set it to the .eml default
  if (!type)
    type = ".eml";
  if (aUri) {
   var filename = null;
    try {
      var subject = messenger.messageServiceFromURI(aUri)
                             .messageURIToMsgHdr(aUri)
                             .mime2DecodedSubject;
      filename = GenerateValidFilename(subject, type);
    } catch (ex) {}
    messenger.saveAs(aUri, true, null, filename);
  }
}

It overrides the SaveAsFile function by adding an overlay to both chrome://messenger/content/messenger.xul (the main TB window) and chrome://messenger/content/messageWindow.xul (the window for viewing messages) and setting an event listener that overrides the function when the window loads:

// when the window finishes loading, override the SaveAsFile function with
// the mySaveAsFile function below
window.addEventListener("load", function(e) { SaveAsFile = mySaveAsFile; }, false);

No Comments

Thunderbird 2 Support

I recently decided to support Thunderbird 2 (specifically 2.0.0.14 and above), but only had basic sync support (only the original attributes were synced) until figuring out a few bugs today.  As of now, the extension fully supports Thunderbird 2, 3, and 3 with the patch for Bug 413260 applied.  The only catch is that the extra attributes added by the extension (like Third and FourthEmail, different types of screennames, etc.) are only editable after the card has been created.  You cannot make a new card and set those attributes right away due to how the address book works before the refactoring in Bug 413260 is applied.  It detects the version and whether 413260 is applied when it starts, so the same extension will work with whatever version you have installed between 2.0.0.14 and 3.0a2.

Over the next week I plan on testing the features of the extension and fixing any bugs that appear.  When this is done, I will hopefully be able to release an alpha version for public use.  If you do decide to use it, I strongly suggest backing up all of your Google Contacts and your entire Thunderbird profile.  You can find info on backing up your Google Contacts here and info on backing up your profile here.

Edit: There is another problem without the patch from Bug 413260 applied.  Copying a card will not copy over the added attributes.

, ,

No Comments

Thunderbird 2 Support Added

As of 2 minutes ago, my extension now appears to work in Thunderbird 2 after some fun with nsIEnumerator and nsISupportsArray.  The array documentation didn’t show the AppendElement method which, combined with [notxpcom] and [noscript] caused me a headache until I tried it.  It also works in Thunderbird 3 with or without the patch from Bug 413260 applied.

, ,

1 Comment

New Preferences

After receiving a comment on a previous blog post, I added some preferences and redesigned my preferences dialog.

It now has three tabs: Main, Extended, and Address.  The wording and layout of the preferences will probably change, but any feedback is welcome.

Main Tab

All of the main preferences.

  • Name of the Address Book – The name of the Address Book that is synced.  The default is Google Contacts.  You should synchronize contacts before changing the name, and you will have to delete the old one if you want.
  • Synchronize Interval – The length of time, in minutes, between automatic synchronizations.  The default is 30 minutes. (Note: The screenshot was taken when this was still in milliseconds)
  • Initial sync delay – How long the extension should wait after the Address Book is opened, in milliseconds, before synchronizing.
  • Always update Google during conflicts – Check this if Thunderbird should have priority if a contact changes in Thunderbird and Google Contacts.
  • Confirm before deleting duplicates – Check this if you would like to be prompted to delete each “duplicate” that the extension finds.  Recommended.
  • Sync extended properties – Check if you would like more properties (like Department,  FirstName, LastName, NickName, etc.) synchronized.  They will not be visible from Google Contacts.  The next section explains this in more detail.

Extended Tab

The extended properties to synchronize.  As explained before, they are not visible from Google Contacts, but they are visible from the New and Edit Card dialogs.  Leave the last few blank if you don’t want to synchronize 10.  The last checkbox on the previous tab (Main) must be checked to sync these properties.

Address Tab

This tab determines how addresses are synchronized.  As explained in a previous post, Google only has one field that allows multiple lines for addresses while Thunderbird has 6: Address, Address2, City, State, ZipCode, and Country.  My solution is to separate different attributes in Thunderbird with a newline character.  You can choose up to 6 attributes to sync.  Don’t include Home or Work in these.  Valid choices are limited to Address, Address2, City, State, ZipCode, and Country.  If you type something else it will not sync.  If you do not want any or all attributes synced, leave blank line(s) at the end.

, , ,

No Comments

Why I love NoScript

Here’s why I love NoScript – http://noscript.net/

Firefox 3.0 w/ NoScript & AdblockPlus in Gentoo Linux:

NOTE: Do not go to the URL in the picture…I should have blurred it out.

No Comments