1.1 --- a/modules/fburl.js Sun Sep 28 00:12:15 2014 +0200
1.2 +++ b/modules/fburl.js Sun Sep 28 01:52:12 2014 +0200
1.3 @@ -22,6 +22,9 @@
1.4 this._result = null;
1.5 this._searched = false;
1.6 this._error = null;
1.7 + this._listener = null;
1.8 + this._url = null;
1.9 + this._fb = null;
1.10 };
1.11
1.12 fburl.fbUrlProvider.prototype = {
1.13 @@ -90,6 +93,7 @@
1.14 if (this._context) {
1.15 this._query.stopQuery(this._context);
1.16 this._context = null;
1.17 + this._listener = null;
1.18 }
1.19 },
1.20
1.21 @@ -100,10 +104,22 @@
1.22
1.23 onSearchFoundCard: function (aCard) {
1.24
1.25 - // NOTE: Will eventually use this to retrieve the free/busy document,
1.26 - // NOTE: extract the intervals, and then notify the listener.
1.27 + this._result = aCard;
1.28 +
1.29 + // Obtain the URL from the card.
1.30 +
1.31 + this._url = aCard.getProperty("FBURL", "");
1.32 +
1.33 + // Retrieve the resource and parse it.
1.34
1.35 - this._result = aCard;
1.36 + var parser = Cc["@mozilla.org/calendar/ics-service;1"].getService(Ci.calIICSService);
1.37 + //var parser = Cc["@mozilla.org/calendar/ics-parser;1"].createInstance(Ci.calIIcsParser);
1.38 + var service = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
1.39 + var stream = Cc["@mozilla.org/scriptableinputstream;1"].createInstance(Ci.nsIScriptableInputStream);
1.40 + var channel = service.newChannelFromURI(service.newURI(this._url, null, null));
1.41 +
1.42 + stream.init(channel.open());
1.43 + this._fb = parser.parseICS(stream.read(-1), null).getFirstSubcomponent("VFREEBUSY");
1.44 },
1.45
1.46 QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsIAbDirSearchListener])