1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/modules/fburl.js Sat Sep 27 17:43:21 2014 +0200
1.3 @@ -0,0 +1,40 @@
1.4 +var EXPORTED_SYMBOLS = [ "fburl" ];
1.5 +
1.6 +const Cc = Components.classes;
1.7 +const Ci = Components.interfaces;
1.8 +const Cu = Components.utils;
1.9 +
1.10 +Cu.import("resource://calendar/modules/calUtils.jsm");
1.11 +
1.12 +if ("undefined" == typeof(fburl)) {
1.13 + var fburl = {};
1.14 +};
1.15 +
1.16 +const calIFreeBusyInterval = Ci.calIFreeBusyInterval;
1.17 +const calIDateTime = Ci.calIDateTime;
1.18 +
1.19 +const fbUrlProviderClassID = Components.ID("{11291d94-b457-4322-bfba-ae9df4b6a3c1}");
1.20 +
1.21 +fburl.fbUrlProvider = function(cal) { this.cal = cal; };
1.22 +
1.23 +fburl.fbUrlProvider.prototype = {
1.24 + classID: fbUrlProviderClassID,
1.25 +
1.26 + getFreeBusyIntervals: function (aCalId, aRangeStart, aRangeEnd, aBusyTypes, aListener) {
1.27 +
1.28 + var start = this.cal.createDateTime("20140923T100000Z");
1.29 + var end = this.cal.createDateTime("20140923T120000Z");
1.30 +
1.31 + var periods = [];
1.32 + var interval = new this.cal.FreeBusyInterval(
1.33 + aCalId,
1.34 + calIFreeBusyInterval.BUSY, // fbType
1.35 + start, end);
1.36 + periods.push(interval);
1.37 + aListener.onResult(null, periods);
1.38 + }
1.39 +};
1.40 +
1.41 +fburl.initProvider = function() {
1.42 + cal.getFreeBusyService().addProvider(new fburl.fbUrlProvider(cal));
1.43 +}