/usr/lib/thunderbird-addons/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/calendar-js/calRecurrenceDate.js is in xul-ext-lightning 1:24.4.0+build1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource:///modules/XPCOMUtils.jsm");
Components.utils.import("resource://calendar/modules/calUtils.jsm");
function calRecurrenceDate() {
this.wrappedJSObject = this;
}
const calRecurrenceDateClassID = Components.ID("{806b6423-3aaa-4b26-afa3-de60563e9cec}");
const calRecurrenceDateInterfaces = [Components.interfaces.calIRecurrenceDate];
calRecurrenceDate.prototype = {
isMutable: true,
mIsNegative: false,
mDate: null,
classID: calRecurrenceDateClassID,
QueryInterface: XPCOMUtils.generateQI(calRecurrenceDateInterfaces),
classInfo: XPCOMUtils.generateCI({
classID: calRecurrenceDateClassID,
contractID: "@mozilla.org/calendar/recurrence-date;1",
classDescription: "The date of an occurrence of a recurring item",
interfaces: calRecurrenceDateInterfaces
}),
makeImmutable: function makeImmutable() {
this.isMutable = false;
},
ensureMutable: function ensureMutable() {
if (!this.isMutable) {
throw Components.results.NS_ERROR_OBJECT_IS_MUTABLE;
}
},
clone: function clone() {
let other = new calRecurrenceDate();
other.mDate = (this.mDate ? this.mDate.clone() : null);
other.mIsNegative = this.mIsNegative;
return other;
},
get isNegative() this.mIsNegative,
set isNegative(val) {
this.ensureMutable();
return (this.mIsNegative = val);
},
get isFinite() true,
get date() this.mDate,
set date(val) {
this.ensureMutable();
return (this.mDate = val);
},
getNextOccurrence: function getNextOccurrence(aStartTime, aOccurrenceTime) {
if (this.mDate && this.mDate.compare(aStartTime) > 0) {
return this.mDate;
} else {
return null;
}
},
getOccurrences: function getOccurrences(aStartTime, aRangeStart, aRangeEnd, aMaxCount, aCount) {
if (this.mDate &&
this.mDate.compare(aRangeStart) >= 0 &&
(!aRangeEnd || this.mDate.compare(aRangeEnd) < 0)) {
aCount.value = 1;
return [this.mDate];
} else {
aCount.value = 0;
return [];
}
},
get icalString() {
let comp = this.icalProperty;
return (comp ? comp.icalString : "");
},
set icalString(val) {
let prop = cal.getIcsService().createIcalPropertyFromString(val);
let propName = prop.propertyName;
if (propName != "RDATE" && propName != "EXDATE") {
throw Components.results.NS_ERROR_ILLEGAL_VALUE;
}
this.icalProperty = prop;
return val;
},
get icalProperty() {
let prop = cal.getIcsService().createIcalProperty(this.mIsNegative ? "EXDATE" : "RDATE");
prop.valueAsDatetime = this.mDate;
return prop;
},
set icalProperty(prop) {
if (prop.propertyName == "RDATE") {
this.mIsNegative = false;
if (prop.getParameter("VALUE") == "PERIOD") {
let period = Components.classes["@mozilla.org/calendar/period;1"]
.createInstance(Components.interfaces.calIPeriod);
period.icalString = prop.valueAsIcalString;
this.mDate = period.start;
} else {
this.mDate = prop.valueAsDatetime;
}
} else if (prop.propertyName == "EXDATE") {
this.mIsNegative = true;
this.mDate = prop.valueAsDatetime;
}
return prop;
}
};
|