Bug 1579020 - Remove WCAP provider. r=darktrojan

This commit is contained in:
Philipp Kewisch 2019-12-05 11:55:21 +02:00
Родитель 163d0112fe
Коммит fa45d9375b
21 изменённых файлов: 6 добавлений и 5134 удалений

Просмотреть файл

@ -297,7 +297,7 @@ var caldata = {
* @param aIID IID to use in comparison, undefined/null defaults to nsISupports
*/
compareObjects: function(aObject, aOtherObject, aIID) {
// xxx todo: seems to work fine e.g. for WCAP, but I still mistrust this trickery...
// xxx todo: seems to work fine, but I still mistrust this trickery...
// Anybody knows an official API that could be used for this purpose?
// For what reason do clients need to pass aIID since
// every XPCOM object has to implement nsISupports?

Просмотреть файл

@ -97,11 +97,11 @@ interface calIErrors : nsISupports
const unsigned long ICS_UNKNOWN = ICS_ERROR_BASE + 10;
/**
* WCAP specific errors, defined in
* calendar/providers/wcap/public/calIWcapErrors.idl
* Range claimed is [ERROR_BASE + 0x200, ERROR_BASE + 0x300)
* Range for former WCAP provider. This could be re-used now in theory, but
* you might as well just add to the end.
* Range previously claimed is [ERROR_BASE + 0x200, ERROR_BASE + 0x300)
*/
const unsigned long WCAP_ERROR_BASE = ERROR_BASE + 0x200;
const unsigned long EX_WCAP_ERROR_BASE = ERROR_BASE + 0x200;
/**
* (Cal)DAV specific errors

Просмотреть файл

@ -353,7 +353,6 @@
<!ENTITY calendarproperties.color.label "Color:">
<!ENTITY calendarproperties.webdav.label "iCalendar (ICS)">
<!ENTITY calendarproperties.caldav.label "CalDAV">
<!ENTITY calendarproperties.wcap.label "Sun Java System Calendar Server (WCAP)">
<!ENTITY calendarproperties.format.label "Format:">
<!ENTITY calendarproperties.location.label "Location:">
<!ENTITY calendarproperties.refreshInterval.label "Refresh Calendar:">

Просмотреть файл

@ -1,23 +0,0 @@
# 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/.
# args: host
accessingServerFailedError.text=Cannot access server %1$S!
loginFailed.text=Login failed or invalid session Id.
accessDenied.text=The user is denied access.
# args: host
noHttpsConfirmation.text=Insecure login on %1$S!\nContinue?
noHttpsConfirmation.check.text=Don't ask again.
noHttpsConfirmation.label=Warning!
# args: host, prodId, serverVersion, wcapVersion
insufficientWcapVersionConfirmation.text=Server %1$S (%2$S, v%3$S, WCAP v%4$S) doesn't support a sufficient WCAP version! The required version is at least 3.0.0.\nContinue?
insufficientWcapVersionConfirmation.label=Insufficient WCAP version!
loginDialog.label=Calendar Server Password Required
privateItem.title.text=Private
confidentialItem.title.text=Confidential
busyItem.title.text=Busy

Просмотреть файл

@ -32,7 +32,6 @@ calendar-@AB_CD@.jar:
preferences/preferences.dtd (%chrome/calendar/preferences/preferences.dtd)
preferences/views.dtd (%chrome/calendar/preferences/views.dtd)
provider-uninstall.dtd (%chrome/calendar/provider-uninstall.dtd)
wcap.properties (%chrome/calendar/providers/wcap/wcap.properties)
timezones.properties (%chrome/calendar/timezones.properties)
lightning-@AB_CD@.jar:

Просмотреть файл

@ -9,6 +9,4 @@ DIRS += [
'ics',
'memory',
'storage',
'wcap',
]

Просмотреть файл

@ -1,387 +0,0 @@
/* 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/. */
/* import-globals-from calWcapCalendarModule.js */
var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
/**
* The calendar provider class for WCAP calendars. Usually instantiated through
* the calendar manager, but may also be created by the wcap session, hence the
* following optional parameters.
*
* @param session (optional) The calWcapSession for this calendar
* @param calProps (optional) The XML node containing the WCAP calendar properties
*/
function calWcapCalendar(session, calProps) {
this.initProviderBase();
this.m_session = session;
this.m_calProps = calProps;
}
var calWcapCalendarClassID = Components.ID("{cf4d93e5-af79-451a-95f3-109055b32ef0}");
var calWcapCalendarInterfaces = [
calIWcapCalendar,
calICalendar,
Ci.calISchedulingSupport,
Ci.calIChangeLog,
Ci.calICalendarProvider,
];
calWcapCalendar.prototype = {
__proto__: cal.provider.BaseClass.prototype,
classID: calWcapCalendarClassID,
QueryInterface: cal.generateQI(calWcapCalendarInterfaces),
classInfo: cal.generateCI({
classID: calWcapCalendarClassID,
contractID: "@mozilla.org/calendar/calendar;1?type=wcap",
classDescription: "Sun Java System Calendar Server WCAP Provider",
interfaces: calWcapCalendarInterfaces,
}),
toString: function() {
let str = this.session.toString();
if (this.m_calId) {
str += ", calId=" + this.calId;
} else {
str += ", default calendar";
}
return str;
},
notifyError_: function(err, msg, context) {
let rc = getResultCode(err);
switch (rc) {
case calIWcapErrors.WCAP_COMPONENT_NOT_FOUND:
case NS_ERROR_OFFLINE:
return;
default:
msg = errorToString(err);
log("error: " + msg, context);
break;
}
this.__proto__.__proto__.notifyError.apply(
this,
err instanceof Ci.nsIException
? [err.result, err.message]
: [isNaN(err) ? Cr.NS_ERROR_FAILURE : err, msg]
);
},
notifyError: function(err, msg) {
this.notifyError_(err, msg, this);
},
// calICalendarProvider:
get prefChromeOverlay() {
return null;
},
// displayName attribute already part of calIWcapCalendar
createCalendar: function(name, url, listener) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
deleteCalendar: function(calendar, listener) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
getCalendar: function(url) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
// calICalendar:
get name() {
let name = this.getProperty("name");
if (!name) {
name = this.displayName;
}
return name;
},
set name(aValue) {
return this.setProperty("name", aValue);
},
get type() {
return "wcap";
},
m_uri: null,
get uri() {
return this.m_uri;
},
set uri(thatUri) {
this.m_uri = thatUri;
let path = thatUri.pathQueryRef;
let qmPos = path.indexOf("?");
if (qmPos != -1) {
let pos = path.indexOf("?calid=", qmPos);
if (pos != -1) {
let start = pos + "?calid=".length;
let end = path.indexOf("&", start);
this.m_calId = decodeURIComponent(path.substring(start, end == -1 ? path.length : end));
}
}
return this.uri;
},
getProperty: function(aName) {
switch (aName) {
case "cache.supported":
return true;
case "timezones.provider":
return this.m_session && this.session.isLoggedIn ? this.session : null;
case "organizerId":
return this.ownerId;
case "organizerCN":
return this.getCalendarProperties("X-S1CS-CALPROPS-COMMON-NAME");
case "itip.disableRevisionChecks":
return true;
case "capabilities.timezones.floating.supported":
case "capabilities.timezones.UTC.supported":
case "capabilities.attachments.supported":
case "capabilities.alarms.popup.supported":
// CS cannot store X-props reliably
// (thus writing X-MOZ stamps etc is not possible).
// Popup alarms not available no matter what; wtf.
return false;
case "capabilities.alarms.actionValues":
return ["EMAIL"];
case "capabilities.alarms.maxCount":
return 1;
}
let value = this.__proto__.__proto__.getProperty.apply(this, arguments);
switch (aName) {
case "readOnly":
if (value === null) {
// tweak readOnly default to true for non-owned calendars,
// all secondary calendars to readOnly unless we're logged in
value =
this.m_session && this.session.isLoggedIn
? !this.isOwnedCalendar
: !this.isDefaultCalendar;
}
break;
case "calendar-main-in-composite":
if (value === null && !this.isDefaultCalendar) {
// tweak in-composite to false for secondary calendars:
value = false;
}
break;
}
return value;
},
setProperty: function(aName, aValue) {
switch (aName) {
case "disabled":
if (this.isDefaultCalendar) {
// disabling/enabling the default calendar will enable/disable all calendars
// belonging to the same session:
for (let calendar of this.session.getRegisteredCalendars()) {
if (!calendar.isDefaultCalendar) {
calendar.setProperty("disabled", aValue);
}
}
}
// falls through
default:
this.__proto__.__proto__.setProperty.apply(this, arguments);
break;
}
},
notifyObservers: function(func, args) {
if (g_bShutdown) {
return;
}
this.observers.notify(func, args);
},
// xxx todo: batch currently not used
startBatch: function() {
this.notifyObservers("onStartBatch");
},
endBatch: function() {
this.notifyObservers("onEndBatch");
},
get canRefresh() {
return true;
},
refresh: function() {
log("refresh.", this);
// invalidate cached results:
delete this.m_cachedResults;
// notify about refreshed calendar:
this.notifyObservers("onLoad", [this]);
},
issueNetworkRequest: function(
request,
respFunc,
dataConvFunc,
wcapCommand,
params,
accessRights
) {
let self = this;
// - bootstrap problem: no cal_props, no access check, no default calId
// - assure being logged in, thus the default cal_props are available
// - every subscribed calendar will come along with cal_props
return this.session.getSessionId(request, (err, sessionId) => {
try {
if (err) {
throw err;
}
self.assureAccess(accessRights);
params += "&calid=" + encodeURIComponent(self.calId);
self.session.issueNetworkRequest(request, respFunc, dataConvFunc, wcapCommand, params);
} catch (exc) {
request.execSubRespFunc(respFunc, exc);
}
});
},
// calIWcapCalendar:
m_session: null,
get session() {
if (!this.m_session) {
this.m_session = getWcapSessionFor(this);
}
return this.m_session;
},
m_calId: null,
get calId() {
return this.m_calId || this.session.defaultCalId;
},
get ownerId() {
let owner = this.getCalendarProperties("X-NSCP-CALPROPS-PRIMARY-OWNER");
if (owner.length == 0) {
let calId = this.calId;
log("cannot determine primary owner of calendar " + calId, this);
// fallback to calId prefix:
let nColon = calId.indexOf(":");
if (nColon >= 0) {
calId = calId.substring(0, nColon);
}
return calId;
}
return owner[0];
},
get description() {
let descr = this.getCalendarProperties("X-NSCP-CALPROPS-DESCRIPTION");
if (descr.length == 0) {
// fallback to display name:
return this.displayName;
}
return descr[0];
},
get displayName() {
let displayName = this.getCalendarProperties("X-NSCP-CALPROPS-NAME");
if (displayName.length == 0) {
// fallback to common name:
displayName = this.getCalendarProperties("X-S1CS-CALPROPS-COMMON-NAME");
if (displayName.length == 0) {
displayName = [this.calId];
}
}
return displayName[0];
},
get isOwnedCalendar() {
if (this.isDefaultCalendar) {
return true; // default calendar is owned
}
return this.ownerId == this.session.userId;
},
get isDefaultCalendar() {
return !this.m_calId;
},
m_calProps: null,
getCalendarProperties: function(propName) {
if (!this.m_calProps) {
log("soft error: no calprops available, most possibly not logged in.", this);
}
let ret = filterXmlNodes(propName, this.m_calProps);
return ret;
},
get defaultTimezone() {
let tzid = this.getCalendarProperties("X-NSCP-CALPROPS-TZID");
if (tzid.length > 0) {
// first try server-configured tz:
return tzid[0];
} else {
logWarning("defaultTimezone: cannot get X-NSCP-CALPROPS-TZID!", this);
// try to use local one if supported:
tzid = cal.getTimezoneService().defaultTimezone.tzid;
return this.session.getTimezone(tzid) ? tzid : "UTC";
}
},
getAlignedTzid: function(timezone) {
let tzid = timezone.tzid;
// check whether it is one cs supports:
if (timezone.isFloating || !this.session.getTimezone(tzid)) {
log("not a supported timezone: " + tzid);
// bug 435436:
// xxx todo: we could further on search for a matching region,
// e.g. CET (in TZNAME), but for now stick to
// user's default if not supported directly
let ret = this.defaultTimezone;
// use calendar's default:
log(tzid + " not supported, falling back to default: " + ret, this);
return ret;
}
return tzid;
},
checkAccess: function(accessControlBits) {
// xxx todo: take real acl into account
// for now, optimistically assuming that everybody has full access, server will check:
let granted = calIWcapCalendar.AC_FULL;
if (this.getProperty("readOnly")) {
granted &= ~(calIWcapCalendar.AC_COMP_WRITE | calIWcapCalendar.AC_PROP_WRITE);
}
// check whether every bit fits:
return (accessControlBits & granted) == accessControlBits;
},
assureAccess: function(accessControlBits) {
if (
!this.checkAccess(
accessControlBits & (calIWcapCalendar.AC_COMP_WRITE | calIWcapCalendar.AC_PROP_WRITE)
)
) {
// throw different error code for read-only:
throw new Components.Exception(
errorToString(calIErrors.CAL_IS_READONLY),
calIErrors.CAL_IS_READONLY
);
}
if (!this.checkAccess(accessControlBits)) {
throw new Components.Exception(
errorToString(calIWcapErrors.WCAP_ACCESS_DENIED_TO_CALENDAR),
calIWcapErrors.WCAP_ACCESS_DENIED_TO_CALENDAR
);
// xxx todo: throwing different error here, no
// calIErrors.CAL_IS_READONLY anymore
}
},
defineAccessControl: function(userId, accessControlBits) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
resetAccessControl: function(userId) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
getAccessControlDefinitions: function(out_count, out_users, out_accessControlBits) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
};

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,100 +0,0 @@
/* 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/. */
/* exported NS_OK, NS_ERROR_UNEXPECTED, nsIException, calIWcapSession,
* calIWcapCalendar, calIWcapErrors, calICalendar, calIItemBase,
* calIOperationListener, calIFreeBusyProvider, calIFreeBusyInterval,
* calICalendarSearchProvider, calIErrors, g_privateItemTitle,
* g_confidentialItemTitle, g_busyItemTitle,
* g_busyPhantomItemUuidPrefix, CACHE_LAST_RESULTS,
* CACHE_LAST_RESULTS_INVALIDATE, LOG_LEVEL
*/
/* import-globals-from calWcapUtils.js */
/* import-globals-from calWcapErrors.js */
/* import-globals-from calWcapRequest.js */
/* import-globals-from calWcapSession.js */
/* import-globals-from calWcapCalendar.js */
/* import-globals-from calWcapCalendarItems.js */
var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
//
// init code for globals, prefs:
//
// constants:
var NS_OK = Cr.NS_OK;
var NS_ERROR_UNEXPECTED = Cr.NS_ERROR_UNEXPECTED;
var nsIException = Ci.nsIException;
var calIWcapSession = Ci.calIWcapSession;
var calIWcapCalendar = Ci.calIWcapCalendar;
var calIWcapErrors = Ci.calIWcapErrors;
var calICalendar = Ci.calICalendar;
var calIItemBase = Ci.calIItemBase;
var calIOperationListener = Ci.calIOperationListener;
var calIFreeBusyProvider = Ci.calIFreeBusyProvider;
var calIFreeBusyInterval = Ci.calIFreeBusyInterval;
var calICalendarSearchProvider = Ci.calICalendarSearchProvider;
var calIErrors = Ci.calIErrors;
// some string resources:
var g_privateItemTitle;
var g_confidentialItemTitle;
var g_busyItemTitle;
var g_busyPhantomItemUuidPrefix;
// global preferences:
// caching the last data retrievals:
var CACHE_LAST_RESULTS = 4;
// timer secs for invalidation:
var CACHE_LAST_RESULTS_INVALIDATE = 120;
// logging:
var LOG_LEVEL = 0;
function initWcapProvider() {
try {
initLogging();
// some string resources:
g_privateItemTitle = getWcapString("privateItem.title.text");
g_confidentialItemTitle = getWcapString("confidentialItem.title.text");
g_busyItemTitle = getWcapString("busyItem.title.text");
g_busyPhantomItemUuidPrefix = "PHANTOM_uuid_" + cal.getUUID();
CACHE_LAST_RESULTS = Services.prefs.getIntPref("calendar.wcap.cache_last_results", 4);
CACHE_LAST_RESULTS_INVALIDATE = Services.prefs.getIntPref(
"calendar.wcap.cache_last_results_invalidate",
120
);
} catch (exc) {
logError(exc, "error in init sequence");
}
}
/** Module Registration */
this.NSGetFactory = cid => {
let scriptLoadOrder = [
"resource://calendar/calendar-js/calWcapUtils.js",
"resource://calendar/calendar-js/calWcapErrors.js",
"resource://calendar/calendar-js/calWcapRequest.js",
"resource://calendar/calendar-js/calWcapSession.js",
"resource://calendar/calendar-js/calWcapCalendar.js",
"resource://calendar/calendar-js/calWcapCalendarItems.js",
];
for (let script of scriptLoadOrder) {
Services.scriptloader.loadSubScript(script, this);
}
initWcapProvider();
let components = [calWcapCalendar, calWcapNetworkRequest, calWcapSession];
this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
return this.NSGetFactory(cid);
};

Просмотреть файл

@ -1,8 +0,0 @@
component {cf4d93e5-af79-451a-95f3-109055b32ef0} calWcapCalendarModule.js
contract @mozilla.org/calendar/calendar;1?type=wcap {cf4d93e5-af79-451a-95f3-109055b32ef0}
component {cbf803fd-4469-4999-ae39-367af1c7b077} calWcapCalendarModule.js
contract @mozilla.org/calendar/wcap/session;1 {cbf803fd-4469-4999-ae39-367af1c7b077}
component {e3c62b37-83cf-41ec-9872-0af9f952430a} calWcapCalendarModule.js
contract @mozilla.org/calendar/wcap/network-request;1 {e3c62b37-83cf-41ec-9872-0af9f952430a}

Просмотреть файл

@ -1,501 +0,0 @@
/* 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/. */
/* exported checkErrorCode, checkWcapXmlErrno, checkWcapIcalErrno,
* errorToString
*/
/* import-globals-from calWcapCalendarModule.js */
var NS_ERROR_INVALID_ARG = Cr.NS_ERROR_INVALID_ARG;
//
// Common netwerk errors:
//
var NS_ERROR_MODULE_BASE_OFFSET = 0x45;
var NS_ERROR_MODULE_NETWORK = 6;
function generateFailure(module, code) {
// 1<<31 generates negative number, so use literal, don't use logical operators:
return 0x80000000 + ((module + NS_ERROR_MODULE_BASE_OFFSET) << 16) + code;
}
function generateNetFailure(code) {
return generateFailure(NS_ERROR_MODULE_NETWORK, code);
}
function getResultCode(err) {
if (err === undefined || err === null) {
return NS_OK;
}
if (isNaN(err)) {
return err instanceof nsIException ? err.result : Cr.NS_ERROR_FAILURE;
}
return err;
}
function getErrorModule(err) {
let rc = getResultCode(err);
return ((rc >>> 16) & 0x7fff) - NS_ERROR_MODULE_BASE_OFFSET;
}
function checkErrorCode(err, rcBits, maskBits) {
if (!maskBits) {
maskBits = 0;
}
let rc = getResultCode(err);
return (rc ^ rcBits) >>> maskBits == 0;
}
// Cannot perform operation, because user is offline.
// The following error codes have been adopted from
// xpcom/base/nsError.h
// and ought to be defined in IDL. xxx todo
// The requested action could not be completed while the networking
// is in the offline state.
var NS_ERROR_OFFLINE = generateNetFailure(16);
var NS_BINDING_FAILED = generateNetFailure(1);
var NS_BINDING_ABORTED = generateNetFailure(2);
var NS_BINDING_REDIRECTED = generateNetFailure(3);
var NS_BINDING_RETARGETED = generateNetFailure(4);
var g_nsNetErrorCodes = [
NS_BINDING_FAILED,
"The async request failed for some unknown reason.",
NS_BINDING_ABORTED,
"The async request failed because it was aborted by some user action.",
NS_BINDING_REDIRECTED,
"The async request has been redirected to a different async request.",
NS_BINDING_RETARGETED,
"The async request has been retargeted to a different handler.",
/* NS_ERROR_MALFORMED_URI */ generateNetFailure(10),
"The URI is malformed.",
/* NS_ERROR_UNKNOWN_PROTOCOL */ generateNetFailure(18),
"The URI scheme corresponds to an unknown protocol handler.",
/* NS_ERROR_CONNECTION_REFUSED */ generateNetFailure(13),
"The connection attempt failed, for example, because no server was listening at specified host:port.",
/* NS_ERROR_PROXY_CONNECTION_REFUSED */ generateNetFailure(72),
"The connection attempt to a proxy failed.",
/* NS_ERROR_NET_TIMEOUT */ generateNetFailure(14),
"The connection was lost due to a timeout error.",
NS_ERROR_OFFLINE,
"The requested action could not be completed while the networking library is in the offline state.",
/* NS_ERROR_PORT_ACCESS_NOT_ALLOWED */ generateNetFailure(19),
"The requested action was prohibited because it would have caused the networking library to establish a connection to an unsafe or otherwise banned port.",
/* NS_ERROR_NET_RESET */ generateNetFailure(20),
"The connection was established, but no data was ever received.",
/* NS_ERROR_NET_INTERRUPT */ generateNetFailure(71),
"The connection was established, but the data transfer was interrupted.",
/* NS_ERROR_NOT_RESUMABLE */ generateNetFailure(25),
"This request is not resumable, but it was tried to resume it, or to request resume-specific data.",
/* NS_ERROR_ENTITY_CHANGED */ generateNetFailure(32),
"It was attempted to resume the request, but the entity has changed in the meantime.",
/* NS_ERROR_REDIRECT_LOOP */ generateNetFailure(31),
"The request failed as a result of a detected redirection loop.",
/* NS_ERROR_UNKNOWN_HOST */ generateNetFailure(30),
"The lookup of a hostname failed. This generally refers to the hostname from the URL being loaded.",
/* NS_ERROR_UNKNOWN_PROXY_HOST */ generateNetFailure(42),
"The lookup of a proxy hostname failed.",
/* NS_ERROR_UNKNOWN_SOCKET_TYPE */ generateNetFailure(51),
"The specified socket type does not exist.",
/* NS_ERROR_SOCKET_CREATE_FAILED */ generateNetFailure(52),
"The specified socket type could not be created.",
];
function netErrorToString(rc) {
if (!isNaN(rc) && getErrorModule(rc) == NS_ERROR_MODULE_NETWORK) {
let i = 0;
while (i < g_nsNetErrorCodes.length) {
// however rc is kept unsigned, our generated code signed,
// so == won't work here:
if ((g_nsNetErrorCodes[i] ^ rc) == 0) {
return g_nsNetErrorCodes[i + 1];
}
i += 2;
}
}
throw new Components.Exception(
"No known network error code: " + rc.toString(0x10),
NS_ERROR_INVALID_ARG
);
}
//
// WCAP error handling helpers
//
var g_wcapErrorCodes = [
/* -1 */ NS_OK,
"Logout successful.",
/* 0 */ NS_OK,
"Command successful.",
/* 1 */ calIWcapErrors.WCAP_LOGIN_FAILED,
getWcapString("loginFailed.text"),
/* 2 */ calIWcapErrors.WCAP_LOGIN_OK_DEFAULT_CALENDAR_NOT_FOUND,
"login.wcap was successful, but the default calendar for this user was not found. A new default calendar set to the userid was created.",
/* 3 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 4 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 5 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 6 */ calIWcapErrors.WCAP_DELETE_EVENTS_BY_ID_FAILED,
"WCAP_DELETE_EVENTS_BY_ID_FAILED",
/* 7 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 8 */ calIWcapErrors.WCAP_SETCALPROPS_FAILED,
"WCAP_SETCALPROPS_FAILED",
/* 9 */ calIWcapErrors.WCAP_FETCH_EVENTS_BY_ID_FAILED,
"WCAP_FETCH_EVENTS_BY_ID_FAILED",
/* 10 */ calIWcapErrors.WCAP_CREATECALENDAR_FAILED,
"WCAP_CREATECALENDAR_FAILED",
/* 11 */ calIWcapErrors.WCAP_DELETECALENDAR_FAILED,
"WCAP_DELETECALENDAR_FAILED",
/* 12 */ calIWcapErrors.WCAP_ADDLINK_FAILED,
"WCAP_ADDLINK_FAILED",
/* 13 */ calIWcapErrors.WCAP_FETCHBYDATERANGE_FAILED,
"WCAP_FETCHBYDATERANGE_FAILED",
/* 14 */ calIWcapErrors.WCAP_STOREEVENTS_FAILED,
"WCAP_STOREEVENTS_FAILED",
/* 15 */ calIWcapErrors.WCAP_STORETODOS_FAILED,
"WCAP_STORETODOS_FAILED",
/* 16 */ calIWcapErrors.WCAP_DELETE_TODOS_BY_ID_FAILED,
"WCAP_DELETE_TODOS_BY_ID_FAILED",
/* 17 */ calIWcapErrors.WCAP_FETCH_TODOS_BY_ID_FAILED,
"WCAP_FETCH_TODOS_BY_ID_FAILED",
/* 18 */ calIWcapErrors.WCAP_FETCHCOMPONENTS_FAILED_BAD_TZID,
"Command failed to find correct tzid. Applies to fetchcomponents_by_range.wcap, fetchevents_by_id.wcap, fetchtodos_by_id.wcap.",
/* 19 */ calIWcapErrors.WCAP_SEARCH_CALPROPS_FAILED,
"WCAP_SEARCH_CALPROPS_FAILED",
/* 20 */ calIWcapErrors.WCAP_GET_CALPROPS_FAILED,
"WCAP_GET_CALPROPS_FAILED",
/* 21 */ calIWcapErrors.WCAP_DELETECOMPONENTS_BY_RANGE_FAILED,
"WCAP_DELETECOMPONENTS_BY_RANGE_FAILED",
/* 22 */ calIWcapErrors.WCAP_DELETEEVENTS_BY_RANGE_FAILED,
"WCAP_DELETEEVENTS_BY_RANGE_FAILED",
/* 23 */ calIWcapErrors.WCAP_DELETETODOS_BY_RANGE_FAILED,
"WCAP_DELETETODOS_BY_RANGE_FAILED",
/* 24 */ calIWcapErrors.WCAP_GET_ALL_TIMEZONES_FAILED,
"WCAP_GET_ALL_TIMEZONES_FAILED",
/* 25 */ calIWcapErrors.WCAP_CREATECALENDAR_ALREADY_EXISTS_FAILED,
"The command createcalendar.wcap failed. A calendar with that name already exists in the database.",
/* 26 */ calIWcapErrors.WCAP_SET_USERPREFS_FAILED,
"WCAP_SET_USERPREFS_FAILED",
/* 27 */ calIWcapErrors.WCAP_CHANGE_PASSWORD_FAILED,
"WCAP_CHANGE_PASSWORD_FAILED",
/* 28 */ calIWcapErrors.WCAP_ACCESS_DENIED_TO_CALENDAR,
getWcapString("accessDenied.text"),
/* 29 */ calIWcapErrors.WCAP_CALENDAR_DOES_NOT_EXIST,
"Command failed. The requested calendar does not exist in the database.",
/* 30 */ calIWcapErrors.WCAP_ILLEGAL_CALID_NAME,
"createcalendar.wcap failed. Invalid calid passed in.",
/* 31 */ calIWcapErrors.WCAP_CANNOT_MODIFY_LINKED_EVENTS,
"storeevents.wcap failed. The event to modify was a linked event.",
/* 32 */ calIWcapErrors.WCAP_CANNOT_MODIFY_LINKED_TODOS,
"storetodos.wcap failed. The todo to modify was a linked todo.",
/* 33 */ calIWcapErrors.WCAP_CANNOT_SENT_EMAIL,
"Command failed. Email notification failed. Usually caused by the server not being properly configured to send email. This can occur in storeevents.wcap, storetodos.wcap, deleteevents_by_id.wcap, deletetodos_by_id.wcap.",
/* 34 */ calIWcapErrors.WCAP_CALENDAR_DISABLED,
"Command failed. The calendar is disabled in the database.",
/* 35 */ calIWcapErrors.WCAP_WRITE_IMPORT_FAILED,
"Import failed when writing files to the server.",
/* 36 */ calIWcapErrors.WCAP_FETCH_BY_LAST_MODIFIED_FAILED,
"WCAP_FETCH_BY_LAST_MODIFIED_FAILED",
/* 37 */ calIWcapErrors.WCAP_CAPI_NOT_SUPPORTED,
"Failed trying to read from unsupported format calendar data.",
/* 38 */ calIWcapErrors.WCAP_CALID_NOT_SPECIFIED,
"Calendar ID was not specified.",
/* 39 */ calIWcapErrors.WCAP_GET_FREEBUSY_FAILED,
"WCAP_GET_FREEBUSY_FAILED",
/* 40 */ calIWcapErrors.WCAP_STORE_FAILED_DOUBLE_BOOKED,
"If double booking is not allowed in this calendar, storeevents.wcap fails with this error when attempting to store an event in a time slot that was already filled.",
/* 41 */ calIWcapErrors.WCAP_FETCH_BY_ALARM_RANGE_FAILED,
"WCAP_FETCH_BY_ALARM_RANGE_FAILED",
/* 42 */ calIWcapErrors.WCAP_FETCH_BY_ATTENDEE_ERROR_FAILED,
"WCAP_FETCH_BY_ATTENDEE_ERROR_FAILED",
/* 43 */ calIWcapErrors.WCAP_ATTENDEE_GROUP_EXPANSION_CLIPPED,
"An LDAP group being expanded was too large and exceeded the maximum number allowed in an expansion. The expansion stopped at the specified maximum limit. The maximum limit defaults to 200. To change the maximum limit, set the server configuration preference calstore.group.attendee.maxsize.",
/* 44 */ calIWcapErrors.WCAP_USERPREFS_ACCESS_DENIED,
"Either the server does not allow this administrator access to get or modify user preferences, or the requester is not an administrator.",
/* 45 */ calIWcapErrors.WCAP_NOT_ALLOWED_TO_REQUEST_PUBLISH,
"The requester was not an organizer of the event, and, therefore, is not allowed to edit the component using the PUBLISH or REQUEST method.",
/* 46 */ calIWcapErrors.WCAP_INSUFFICIENT_PARAMETERS,
"The caller tried to invoke verifyevents_by_ids.wcap, or verifytodos_by_ids.wcap with insufficient arguments (mismatched number of uid's and rid's).",
/* 47 */ calIWcapErrors.WCAP_MUSTBEOWNER_OPERATION,
"The user needs to be an owner or co-owner of the calendar in questions to complete this operation. (Probably related to private or confidential component.)",
/* 48 */ calIWcapErrors.WCAP_DWP_CONNECTION_FAILED,
"GSE scheduling engine failed to make connection to DWP.",
/* 49 */ calIWcapErrors.WCAP_DWP_MAX_CONNECTION_REACHED,
"Reached the maximum number of connections. When some of the connections are freed, users can successfully connect. Same as error 11001.",
/* 50 */ calIWcapErrors.WCAP_DWP_CANNOT_RESOLVE_CALENDAR,
"Front end can't resolve to a particular back end. Same as error 11002.",
/* 51 */ calIWcapErrors.WCAP_DWP_BAD_DATA,
"Generic response. Check all DWP servers. One might be down. Same as error 11003.",
/* 52 */ calIWcapErrors.WCAP_BAD_COMMAND,
"The command sent in was not recognized. This is an internal only error code. It should not appear in the error logs.",
/* 53 */ calIWcapErrors.WCAP_NOT_FOUND,
"Returned for all errors from a write to the Berkeley DB. This is an internal only error code. It should not appear in the error logs.",
/* 54 */ calIWcapErrors.WCAP_WRITE_IMPORT_CANT_EXPAND_CALID,
"Can't expand calid when importing file.",
/* 55 */ calIWcapErrors.WCAP_GETTIME_FAILED,
"Get server time failed.",
/* 56 */ calIWcapErrors.WCAP_FETCH_DELETEDCOMPONENTS_FAILED,
"fetch_deletedcomponents.wcap failed.",
/* 57 */ calIWcapErrors.WCAP_FETCH_DELETEDCOMPONENTS_PARTIAL_RESULT,
"Success but partial result.",
/* 58 */ calIWcapErrors.WCAP_WCAP_NO_SUCH_FORMAT,
"Returned in any of the commands when supplied fmt-out is not a supported format.",
/* 59 */ calIWcapErrors.WCAP_COMPONENT_NOT_FOUND,
"Returned when a fetch or delete is attempted that does not exist.",
/* 60 */ calIWcapErrors.WCAP_BAD_ARGUMENTS,
"Currently used when attendee or organizer specified does not have a valid email address.",
/* 61 */ calIWcapErrors.WCAP_GET_USERPREFS_FAILED,
"get_userprefs.wcap failed. The following error conditions returns error code 61: LDAP access denied, no results found, LDAP limit exceeded, LDAP connection failed.",
/* 62 */ calIWcapErrors.WCAP_WCAP_MODIFY_NO_EVENT,
"storeevents.wcap issued with storetype set to 2 (WCAP_STORE_TYPE_MODIFY) and the event doesn't exist.",
/* 63 */ calIWcapErrors.WCAP_WCAP_CREATE_EXISTS,
"storeevents.wcap issued with storetype set to 1 (WCAP_STORE_TYPE_CREATE) and the event already exists.",
/* 64 */ calIWcapErrors.WCAP_WCAP_MODIFY_CANT_MAKE_COPY,
"storevents.wcap issued and copy of event failed during processing.",
/* 65 */ calIWcapErrors.WCAP_STORE_FAILED_RECUR_SKIP,
"One instance of a recurring event skips over another.",
/* 66 */ calIWcapErrors.WCAP_STORE_FAILED_RECUR_SAMEDAY,
"Two instances of a recurring event can't occur on the same day.",
/* 67 */ calIWcapErrors.WCAP_BAD_ORG_ARGUMENTS,
'Bad organizer arguments. orgCalid or orgEmail must be passed if any other "org" parameter is sent. That is, orgUID can\'t be sent alone on a storeevents.wcap or a storetodos.wcao command if it is trying about to "create" the event or task. Note, if no "org" information is passed, the organizer defaults to the calid being passed with the command.',
/* 68 */ calIWcapErrors.WCAP_STORE_FAILED_RECUR_PRIVACY,
"Error returned if you try to change the privacy or transparency of a single instance in a recurring series.",
/* 69 */ calIWcapErrors.WCAP_LDAP_ERROR,
"For get_calprops.wcap, when there is an error is getting LDAP derived token values (X-S1CS-CALPROPS-FB-INCLUDE, X-S1CS-CALPROPS-COMMON-NAME).",
/* 70 */ calIWcapErrors.WCAP_GET_INVITE_COUNT_FAILED,
"Error in getting invite count (for get_calprops.wcap and fetchcomponents_by_range.wcap commands).",
/* 71 */ calIWcapErrors.WCAP_LIST_FAILED,
"list.wcap failed.",
/* 72 */ calIWcapErrors.WCAP_LIST_SUBSCRIBED_FAILED,
"list_subscribed.wcap failed.",
/* 73 */ calIWcapErrors.WCAP_SUBSCRIBE_FAILED,
"subscribe.wcap failed.",
/* 74 */ calIWcapErrors.WCAP_UNSUBSCRIBE_FAILED,
"unsubscribe.wcap failed.",
/* 75 */ calIWcapErrors.WCAP_ANONYMOUS_NOT_ALLOWED,
"Command cannot be executed as anonymous. Used only for list.wcap, list_subscribed.wcap, subscribe.wcap, and unsubscribe.wcap commands.",
/* 76 */ calIWcapErrors.WCAP_ACCESS_DENIED,
"Generated if a non-administrator user tries to read or set the calendar-owned list or the calendar-subscribed list of some other user, or if the option is not turned on in the server.",
/* 77 */ calIWcapErrors.WCAP_BAD_IMPORT_ARGUMENTS,
"Incorrect parameter received by import.wcap.",
/* 78 */ calIWcapErrors.WCAP_READONLY_DATABASE,
"Database is in read-only mode (returned for all attempts to write to the database).",
/* 79 */ calIWcapErrors.WCAP_ATTENDEE_NOT_ALLOWED_TO_REQUEST_ON_MODIFY,
"Attendee is not allowed to modify an event with method=request.",
/* 80 */ calIWcapErrors.WCAP_TRANSP_RESOURCE_NOT_ALLOWED,
"Resources do not permit the transparency parameter.",
/* 81 */ calIWcapErrors.WCAP_RECURRING_COMPONENT_NOT_FOUND,
"Recurring component not found. Only happens when recurring=1 is passed in by fetch commands. This code is returned if part of the recurring series (either the master or an exception) is missing.",
/* new by WCAP 4.0: */
/* 82 */ calIWcapErrors.WCAP_BAD_MIME_TYPE,
"The mime headers supplied while storing the attachment using storeevents.wcap/storetodos.wcap is malformatted.",
/* 83 */ calIWcapErrors.WCAP_MISSING_BOUNDARY,
"While supplying attachments to the storeveents/storetodos commands the mime boundary was not found.",
/* 84 */ calIWcapErrors.WCAP_INVALID_ATTACHMENT,
"The attachment supplied to be stored on the server is malformatted.",
/* 85 */ calIWcapErrors.WCAP_ATTACH_DELETE_SUCCESS,
"All the attachments requested to be deleted from the server by supplying deleteattach were deleted successsfully.",
/* 86 */ calIWcapErrors.WCAP_ATTACH_DELETE_PARTIAL,
"Of All attachments requested to be deleted from the server by supplying deleteattach , only few were deleted successfully.",
/* 87 */ calIWcapErrors.WCAP_ATTACHMENT_NOT_FOUND,
"The attachent requested to be fetched or deleted from the server was not found.",
/* / new by WCAP 4.0 */
/* 88 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 89 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 90 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 91 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 92 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 93 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 94 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 95 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 96 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 97 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 98 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 99 */ NS_ERROR_INVALID_ARG,
"No WCAP error code.",
/* 11000 */ calIWcapErrors.WCAP_CDWP_ERR_MAX_CONNECTION_REACHED,
"Maximum connections to back-end database reached. As connections are freed up, users can connect to the back-end.",
/* 11001 */ calIWcapErrors.WCAP_CDWP_ERR_CANNOT_CONNECT,
"Cannot connect to back-end server. Back-end machine might be down or DWP server is not up and running.",
/* 11002 */ calIWcapErrors.WCAP_CDWP_ERR_CANNOT_RESOLVE_CALENDAR,
"Front-end can't resolve calendar to a particular back-end server.",
/* 11003 */ calIWcapErrors.WCAP_CDWP_ERR_BAD_DATA,
"Bad data received from DWP connection. This is a generic formatting error. Check all DWP servers. One might be down.",
/* 11004 */ calIWcapErrors.WCAP_CDWP_ERR_DWPHOST_CTX_DOES_NOT_EXIST,
"For the back-end host, context doesn't exist in the context table.",
/* 11005 */ calIWcapErrors.WCAP_CDWP_ERR_HOSTNAME_NOT_RESOLVABLE,
"DNS or NIS files, or hostname resolver is not set up properly or machine does not exist.",
/* 11006 */ calIWcapErrors.WCAP_CDWP_ERR_NO_DATA,
"No data was received from reading the calendar properties from the DWP connection.",
/* 11007 */ calIWcapErrors.WCAP_CDWP_ERR_AUTH_FAILED,
"DWP authentication failed.",
/* 11008 */ calIWcapErrors.WCAP_CDWP_ERR_CHECKVERSION_FAILED,
"DWP version check failed.",
];
function wcapErrorToString(rc) {
if (isNaN(rc)) {
throw new Components.Exception(
"No known WCAP error code: " + rc.toString(0x10),
NS_ERROR_INVALID_ARG
);
}
if (rc == calIWcapErrors.WCAP_NO_ERRNO) {
return "No WCAP errno (missing X-NSCP-WCAP-ERRNO).";
}
let index = rc - calIWcapErrors.WCAP_ERROR_BASE + 1;
if (index >= 1 && index <= 108 && g_wcapErrorCodes[index * 2] != NS_ERROR_INVALID_ARG) {
return g_wcapErrorCodes[index * 2 + 1];
}
throw new Components.Exception(
"No known WCAP error code: " + rc.toString(0x10),
NS_ERROR_INVALID_ARG
);
}
function getWcapErrorCode(errno) {
if (errno == -5000) {
// semantically same error
errno = 59;
}
let index = -1;
if (errno >= -1 && errno <= 81) {
index = errno + 1;
} else if (errno >= 11000 && errno <= 11008) {
index = errno - 11000 + 100 + 1;
}
if (index >= 0 && g_wcapErrorCodes[index * 2] != NS_ERROR_INVALID_ARG) {
return g_wcapErrorCodes[index * 2];
}
throw new Components.Exception("No known WCAP error no: " + errno, NS_ERROR_INVALID_ARG);
}
function getWcapXmlErrno(xml) {
let elem = xml.getElementsByTagName("X-NSCP-WCAP-ERRNO");
if (elem) {
elem = elem.item(0);
if (elem) {
return parseInt(elem.textContent, 10);
}
}
// some commands just respond with an empty calendar, no errno. WTF.
// assume success:
return undefined;
}
function getWcapIcalErrno(icalRootComp) {
let prop = icalRootComp.getFirstProperty("X-NSCP-WCAP-ERRNO");
if (prop) {
return parseInt(prop.value, 10);
}
// some commands just respond with an empty calendar, no errno. WTF.
// assume success:
return undefined;
}
function checkWcapErrno(errno, expectedErrno) {
if (expectedErrno === undefined) {
expectedErrno = 0; // i.e. Command successful.
}
if (errno !== undefined && errno != expectedErrno) {
let rc = getWcapErrorCode(errno);
throw new Components.Exception(wcapErrorToString(rc), rc);
}
}
function checkWcapXmlErrno(xml, expectedErrno) {
checkWcapErrno(getWcapXmlErrno(xml), expectedErrno);
}
function checkWcapIcalErrno(icalRootComp, expectedErrno) {
checkWcapErrno(getWcapIcalErrno(icalRootComp), expectedErrno);
}
function errorToString(err) {
if (err) {
if (typeof err == "string") {
return err;
}
if (err instanceof Error) {
return err.message;
}
if (err instanceof nsIException) {
return err.toString(); // xxx todo: or just message?
}
if (isNaN(err)) {
return "[" + err + "] unknown error.";
}
}
// numeric codes:
switch (err) {
case undefined:
case null:
case NS_OK:
return "NS_OK";
case NS_ERROR_INVALID_ARG:
return "NS_ERROR_INVALID_ARG";
case Cr.NS_ERROR_NO_INTERFACE:
return "NS_ERROR_NO_INTERFACE";
case Cr.NS_ERROR_NOT_IMPLEMENTED:
return "NS_ERROR_NOT_IMPLEMENTED";
case Cr.NS_ERROR_NOT_AVAILABLE:
return "NS_ERROR_NOT_AVAILABLE";
case Cr.NS_ERROR_FAILURE:
return "NS_ERROR_FAILURE";
case Cr.NS_ERROR_BASE:
return "NS_ERROR_BASE";
case Cr.NS_ERROR_NOT_INITIALIZED:
return "NS_ERROR_NOT_INITIALIZED";
case Cr.NS_ERROR_ALREADY_INITIALIZED:
return "NS_ERROR_ALREADY_INITIALIZED";
case Cr.NS_ERROR_NULL_POINTER:
return "NS_ERROR_NULL_POINTER";
case Cr.NS_ERROR_ABORT:
return "NS_ERROR_ABORT";
case Cr.NS_ERROR_UNEXPECTED:
return "NS_ERROR_UNEXPECTED";
case Cr.NS_ERROR_OUT_OF_MEMORY:
return "NS_ERROR_OUT_OF_MEMORY";
case Cr.NS_ERROR_ILLEGAL_VALUE:
return "NS_ERROR_ILLEGAL_VALUE";
default:
// probe for WCAP error:
try {
return wcapErrorToString(err);
} catch (exc) {
// probe for netwerk error:
try {
return netErrorToString(err);
} catch (exc2) {
if (err & calIErrors.ERROR_BASE) {
for (let err_ in calIErrors) {
if (calIErrors[err_] == err) {
return err_;
}
}
}
return "[0x" + err.toString(0x10) + "] unknown error.";
}
}
}
}

Просмотреть файл

@ -1,459 +0,0 @@
/* 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/. */
/**
A request object is used to track an async action.
While the action is running, isPending is true.
Functions issuing an async action usually take a response function along
with their parameters, typically named respFunc.
That function is called *after* the action has ended (i.e. isPending of the
issued action/request is false when called, status remains stable).
The response function gets the ended request as first parameter to check
whether the request has been successful and get its data.
The request function itself may return either
- a further calIOperation request object, i.e. an async continuation
- some data (incl null/undefined) which is the result of the async function,
indicating that there is no further continuation
*/
/* exported issueNetworkRequest, getWcapRequestStatusString, stringToIcal, stringToXml */
/* import-globals-from calWcapCalendarModule.js */
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
function generateRequestId() {
if (!generateRequestId.mRequestPrefix) {
generateRequestId.mRequestPrefix = cal.getUUID() + "-";
generateRequestId.mRequestId = 0;
}
++generateRequestId.mRequestId;
return generateRequestId.mRequestPrefix + generateRequestId.mRequestId;
}
function calWcapRequest(respFunc, logContext) {
this.wrappedJSObject = this;
this.m_logContext = logContext;
this.m_id = generateRequestId();
this.m_isPending = true;
this.m_status = NS_OK;
this.m_respFunc = respFunc;
this.m_attachedRequests = [];
}
calWcapRequest.prototype = {
m_logContext: null,
m_parentRequest: null,
m_id: 0,
m_isPending: true,
m_status: NS_OK,
m_respFunc: null,
m_attachedRequests: null,
m_locked: false,
get parentRequest() {
return this.m_parentRequest;
},
set parentRequest(req) {
if (this.parentRequest) {
logError("already has parent!", this);
}
this.detachFromParent(); // detach without error
return (this.m_parentRequest = req);
},
/** The following locking is necessary when scheduling multiple async
requests; one cannot be sure that e.g. the first completes quickly
and responds the whole parent request when detaching.
*/
lockPending: function() {
this.m_locked = true;
},
unlockPending: function() {
if (this.m_locked) {
this.m_locked = false;
// assures that respFunc is executed:
if (this.m_attachedRequests.length == 0) {
this.execRespFunc();
}
}
},
toString: function() {
let ret =
"calWcapRequest id=" +
this.id +
", parent-id=" +
(this.parentRequest ? this.parentRequest.id : "<none>") +
" (" +
this.m_logContext +
")";
if (LOG_LEVEL > 2 && this.m_attachedRequests.length > 0) {
ret += "\nattached requests:";
for (let req of this.m_attachedRequests) {
ret += "\n#" + req.id + "\t" + req;
}
}
ret += ", isPending=" + this.isPending;
ret += ", status=" + errorToString(this.status);
return ret;
},
attachSubRequest: function(req) {
if (req) {
if (this.m_attachedRequests.some(req_ => req.id == req_.id)) {
logError("request already attached: " + req.id, this);
} else if (req.isPending) {
this.m_attachedRequests.push(req);
req.parentRequest = this;
log("attachSubRequest()", this);
} else if (!this.m_locked && this.m_attachedRequests.length == 0) {
this.execRespFunc(req.status);
}
}
},
detachSubRequest: function(req, err) {
this.m_attachedRequests = this.m_attachedRequests.filter(req_ => req.id != req_.id);
if (err) {
// first failing sub request stops parent request:
this.execRespFunc(err);
} else if (!this.m_locked && this.m_attachedRequests.length == 0) {
// assures that respFunc is executed after all sub requests have been completed:
this.execRespFunc();
}
},
cancelAllSubRequests: function(status) {
let attachedRequests = this.m_attachedRequests;
this.m_attachedRequests = [];
attachedRequests.forEach(req => req.cancel(null));
},
detachFromParent: function(err) {
let parentRequest = this.m_parentRequest;
if (parentRequest) {
this.m_parentRequest = null;
parentRequest.detachSubRequest(this, err);
}
},
execRespFunc: function(err, data) {
if (this.isPending) {
this.m_isPending = false;
if (err) {
this.m_status = err;
}
this.cancelAllSubRequests();
let respFunc = this.m_respFunc;
if (respFunc) {
this.m_respFunc = null; // call once only
if (LOG_LEVEL > 2) {
log("response exec: " + errorToString(err), this);
}
try {
respFunc(this, err, data);
} catch (exc) {
this.m_status = exc;
// don't pump into error console, may be handled:
log("error: " + errorToString(exc), this);
}
}
this.detachFromParent(this.m_status);
}
},
execSubRespFunc: function(func, err, data) {
try {
func(err, data);
} catch (exc) {
this.execRespFunc(exc);
}
},
// calIOperation:
get id() {
return this.m_id;
},
get isPending() {
return this.m_isPending;
},
get status() {
return this.m_status === null ? NS_OK : this.m_status;
},
cancel: function(status) {
if (!status) {
status = calIErrors.OPERATION_CANCELLED;
}
this.execRespFunc(status);
},
};
function calWcapNetworkRequest(url, respFunc, bLogging) {
this.wrappedJSObject = this;
this.m_id = generateRequestId();
this.m_url = url;
this.m_respFunc = respFunc;
this.m_bLogging = bLogging === undefined ? true : bLogging;
}
var calWcapNetworkRequestClassID = Components.ID("{e3c62b37-83cf-41ec-9872-0af9f952430a}");
var calWcapNetworkRequestInterfaces = [
Ci.nsIInterfaceRequestor,
Ci.nsIChannelEventSink,
Ci.calIOperation,
];
calWcapNetworkRequest.prototype = {
m_id: 0,
m_url: null,
m_loader: null,
m_respFunc: null,
m_bLogging: false,
classID: calWcapNetworkRequestClassID,
QueryInterface: cal.generateQI(calWcapNetworkRequestInterfaces),
classInfo: cal.generateCI({
classID: calWcapNetworkRequestClassID,
contractID: "@mozilla.org/calendar/wcap/network-request;1",
classDescription: "Sun Java System Calendar Server WCAP Network Request",
interfaces: calWcapNetworkRequestInterfaces,
}),
/**
* @see nsIInterfaceRequestor
* @see calProviderUtils.jsm
*/
getInterface: cal.provider.InterfaceRequestor_getInterface,
/**
* prepareChannel
* Prepares the passed channel to match this objects properties
*
* @param aChannel The Channel to be prepared
*/
prepareChannel: function(aChannel) {
// No caching
aChannel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
aChannel = aChannel.QueryInterface(Ci.nsIHttpChannel);
aChannel.requestMethod = "GET";
},
/**
* @see nsIChannelEventSink
*/
asyncOnChannelRedirect: function(aOldChannel, aNewChannel, aFlags, aCallback) {
// all we need to do to the new channel is the basic preparation
this.prepareChannel(aNewChannel);
aCallback.onRedirectVerifyCallback(Cr.NS_OK);
},
onStreamComplete: function(aLoader, aContext, aStatus, aResultLength, aResult) {
this.m_loader = null;
if (LOG_LEVEL > 0 && this.m_bLogging) {
log("status: " + errorToString(aStatus), this);
}
if (aStatus != Cr.NS_OK) {
this.execRespFunc(aStatus);
return;
}
let httpChannel = aLoader.request.QueryInterface(Ci.nsIHttpChannel);
let encoding = httpChannel.contentCharset || "utf-8";
let result = aResultLength ? new TextDecoder(encoding).decode(Uint8Array.from(aResult)) : "";
if (LOG_LEVEL > 2 && this.m_bLogging) {
log("contentCharset = " + encoding + "\nrequest result:\n" + result, this);
}
switch (httpChannel.responseStatus / 100) {
case 2 /* 2xx codes */:
// Everything worked out, we are done
this.execRespFunc(aStatus, result);
break;
default: {
// Something else went wrong
let error =
"A request Error Occurred. Status Code: " +
httpChannel.responseStatus +
" " +
httpChannel.responseStatusText +
" Body: " +
result;
this.execRespFunc(Components.Exception(error, NS_BINDING_FAILED));
break;
}
}
},
toString: function() {
let ret =
"calWcapNetworkRequest id=" +
this.id +
", parent-id=" +
(this.parentRequest ? this.parentRequest.id : "<none>");
if (this.m_bLogging) {
ret += " (" + this.m_url + ")";
}
ret += ", isPending=" + this.isPending;
ret += ", status=" + errorToString(this.status);
return ret;
},
m_parentRequest: null,
get parentRequest() {
return this.m_parentRequest;
},
set parentRequest(req) {
if (this.parentRequest) {
logError("already has parent!", this);
}
this.detachFromParent(); // detach without error
return (this.m_parentRequest = req);
},
// calIOperation:
get id() {
return this.m_id;
},
m_isPending: true,
get isPending() {
return this.m_isPending;
},
get status() {
return this.request ? this.request.status : NS_OK;
},
detachFromParent: function(err) {
let parentRequest = this.m_parentRequest;
if (parentRequest) {
this.m_parentRequest = null;
parentRequest.detachSubRequest(this, err);
}
},
get request() {
return this.m_loader ? this.m_loader.channel : null;
},
cancel: function(status) {
if (!status) {
status = calIErrors.OPERATION_CANCELLED;
}
this.execRespFunc(status);
// xxx todo: check whether this works on redirected channels!
let request = this.request;
if (request && request.isPending()) {
log("canceling netwerk request...", this);
request.cancel(NS_BINDING_FAILED);
this.m_loader = null;
}
},
execRespFunc: function(err, str) {
if (this.isPending) {
this.m_isPending = false;
let respFunc = this.m_respFunc;
if (respFunc) {
this.m_respFunc = null; // call once only
if (LOG_LEVEL > 2 && this.m_bLogging) {
log("response exec: " + errorToString(err), this);
}
try {
respFunc(err, str);
err = null; // may have been handled
} catch (exc) {
// don't pump into error console, may be handled:
log("error: " + errorToString(exc), this);
err = exc;
}
}
this.detachFromParent(err);
}
},
execSubRespFunc: function(func, err, data) {
try {
func(err, data);
} catch (exc) {
this.execRespFunc(exc);
}
},
};
function issueNetworkRequest(parentRequest, respFunc, url, bLogging) {
let netRequest = new calWcapNetworkRequest(url, respFunc, bLogging);
if (parentRequest) {
parentRequest.attachSubRequest(netRequest);
}
try {
let uri = Services.io.newURI(url);
let channel = Services.io.newChannelFromURI(
uri,
null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
Ci.nsIContentPolicy.TYPE_OTHER
);
netRequest.prepareChannel(channel);
channel = channel.QueryInterface(Ci.nsIHttpChannel);
channel.redirectionLimit = 3;
channel.notificationCallbacks = netRequest;
let loader = cal.provider.createStreamLoader();
netRequest.m_loader = loader;
log("opening channel.", netRequest);
loader.init(netRequest);
channel.asyncOpen(loader);
} catch (exc) {
netRequest.execRespFunc(exc);
}
}
function getWcapRequestStatusString(xml) {
let str = "request status: ";
let items = xml.getElementsByTagName("RSTATUS");
if (items != null && items.length > 0) {
str += items.item(0).textContent;
} else {
str += "none";
}
return str;
}
function stringToIcal(session, data, expectedErrno) {
if (!data || data.length == 0) {
// assuming time-out; WTF.
throw new Components.Exception(
errorToString(calIWcapErrors.WCAP_LOGIN_FAILED),
calIWcapErrors.WCAP_LOGIN_FAILED
);
}
let icalRootComp;
try {
icalRootComp = cal
.getIcsService()
.parseICS(data, session /* implements calITimezoneProvider */);
} catch (exc) {
// map into more useful error string:
throw new Components.Exception("error parsing ical data!", calIErrors.ICS_PARSE);
}
checkWcapIcalErrno(icalRootComp, expectedErrno);
return icalRootComp;
}
function stringToXml(session, data, expectedErrno) {
if (!data || data.length == 0) {
// assuming time-out
throw new Components.Exception(
errorToString(calIWcapErrors.WCAP_LOGIN_FAILED),
calIWcapErrors.WCAP_LOGIN_FAILED
);
}
let xml = getDomParser().parseFromString(data, "text/xml");
checkWcapXmlErrno(xml, expectedErrno);
return xml;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,242 +0,0 @@
/* 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/. */
/* exported getCalendarSearchService, getDomParser, isParent, filterXmlNodes,
* getIcalUTC, getDatetimeFromIcalProp, getWcapString
*/
/* import-globals-from calWcapCalendarModule.js */
var { Preferences } = ChromeUtils.import("resource://gre/modules/Preferences.jsm");
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
var g_bShutdown = false;
function initLogging() {
initLogging.mLogTimezone = cal.dtz.defaultTimezone;
if (initLogging.mLogFilestream) {
try {
initLogging.mLogFilestream.close();
} catch (exc) {
cal.ASSERT(false, exc);
}
initLogging.mLogFilestream = null;
}
LOG_LEVEL = getPref("calendar.wcap.log_level", 0);
if (LOG_LEVEL < 1 && getPref("calendar.debug.log", false)) {
LOG_LEVEL = 1; // at least basic logging when calendar.debug.log is set
}
if (LOG_LEVEL > 0) {
let logFileName = getPref("calendar.wcap.log_file", null);
if (logFileName) {
try {
// set up file:
let logFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
logFile.initWithPath(logFileName);
// create output stream:
let logFileStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(
Ci.nsIFileOutputStream
);
logFileStream.init(
logFile,
0x02 /* PR_WRONLY */ |
0x08 /* PR_CREATE_FILE */ |
(getPref("calendar.wcap.log_file_append", false)
? 0x10 /* PR_APPEND */
: 0x20) /* PR_TRUNCATE */,
parseInt("0700", 8) /* read, write, execute/search by owner */,
0 /* unused */
);
initLogging.mLogFilestream = logFileStream;
} catch (exc) {
logError(exc, "init logging");
}
}
log(
"################################# NEW WCAP LOG #################################",
"init logging"
);
logWarning(
"WCAP logging enabled! level=" +
LOG_LEVEL +
(initLogging.mLogFilestream ? ", file=" + logFileName : "")
);
}
if (!initLogging.mLogPrefObserver) {
initLogging.mLogPrefObserver = {
// nsIObserver:
observe: function(subject, topic, data) {
if (topic == "nsPref:changed") {
switch (data) {
case "calendar.wcap.log_level":
case "calendar.wcap.log_file":
case "calendar.debug.log":
initLogging();
break;
}
}
},
};
Services.prefs.addObserver("calendar.wcap.log_level", initLogging.mLogPrefObserver);
Services.prefs.addObserver("calendar.wcap.log_file", initLogging.mLogPrefObserver);
Services.prefs.addObserver("calendar.debug.log", initLogging.mLogPrefObserver);
let appObserver = {
// nsIObserver:
observe: function(subject, topic, data) {
if (topic == "quit-application") {
Services.prefs.removeObserver("calendar.", initLogging.mLogPrefObserver);
}
},
};
Services.obs.addObserver(appObserver, "quit-application");
}
}
function log(msg, context, bForce) {
if (bForce || LOG_LEVEL > 0) {
let ret = "";
if (context) {
ret += "[" + context + "]";
}
if (ret.length > 0) {
ret += "\n";
}
ret += msg;
let now = getTime();
if (now && initLogging.mLogTimezone) {
now = now.getInTimezone(initLogging.mLogTimezone);
}
let str = "### WCAP log entry: " + now + "\n" + ret;
Services.console.logStringMessage(str);
str = "\n" + str + "\n";
dump(str);
if (initLogging.mLogFilestream) {
try {
// xxx todo?
// assuming ANSI chars here, for logging sufficient:
initLogging.mLogFilestream.write(str, str.length);
} catch (exc) {
// catching any io errors here:
let err = "error writing log file: " + errorToString(exc);
Cu.reportError(exc);
Services.console.logStringMessage(err);
dump(err + "\n\n");
}
}
return ret;
} else {
return msg;
}
}
function logWarning(err, context) {
let msg = errorToString(err);
let scriptError = Cc["@mozilla.org/scripterror;1"].createInstance(Ci.nsIScriptError);
scriptError.init(
log("warning: " + msg, context, true),
null,
null,
0,
0,
Ci.nsIScriptError.warningFlag,
"component javascript"
);
Services.console.logMessage(scriptError);
return msg;
}
function logError(err, context) {
let msg = errorToString(err);
Cu.reportError(log("error: " + msg + "\nstack:\n" + cal.STACK(10), context, true));
return msg;
}
// late-inited service accessors:
function getCalendarSearchService() {
if (!getCalendarSearchService.m_obj) {
getCalendarSearchService.m_obj = Cc[
"@mozilla.org/calendar/calendarsearch-service;1"
].getService(Ci.calICalendarSearchService);
}
return getCalendarSearchService.m_obj;
}
function getDomParser() {
if (!getDomParser.m_obj) {
getDomParser.m_obj = new DOMParser();
}
return getDomParser.m_obj;
}
function isParent(item) {
if (item.id != item.parentItem.id) {
throw new Components.Exception("proxy has different id than its parent!");
}
return !item.recurrenceId;
}
function filterXmlNodes(name, rootNode) {
let ret = [];
if (rootNode) {
let nodeList = rootNode.getElementsByTagName(name);
for (let i = 0; i < nodeList.length; ++i) {
let node = nodeList.item(i);
ret.push(node.textContent.trim());
}
}
return ret;
}
function getTime() {
if (g_bShutdown) {
return null;
}
return cal.dtz.jsDateToDateTime(new Date());
}
function getIcalUTC(date) {
if (!date || !date.isValid) {
return "0";
} else {
let dtz = date.timezone;
if (dtz.isUTC || dtz.isFloating) {
return date.icalString;
} else {
return date.getInTimezone(cal.dtz.UTC).icalString;
}
}
}
function getDatetimeFromIcalString(val) {
if (!val || val.length == 0 || val == "0") {
return null;
}
// assuming timezone is known:
let date = cal.createDateTime();
date.icalString = val;
return date;
}
function getDatetimeFromIcalProp(prop) {
if (!prop) {
return null;
}
return getDatetimeFromIcalString(prop.valueAsIcalString);
}
function getPref(prefName, defaultValue) {
let ret = Preferences.get(prefName, defaultValue);
log(ret, "getPref(): prefName=" + prefName);
return ret;
}
function getWcapString(aStringName, aParams) {
return cal.l10n.getString("wcap", aStringName, aParams);
}

Просмотреть файл

@ -1,23 +0,0 @@
# vim: set filetype=python:
# 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/.
DIRS += ['public']
EXTRA_COMPONENTS += [
'calWcapCalendarModule.js',
'calWcapCalendarModule.manifest',
]
FINAL_TARGET_FILES['calendar-js'] += [
'calWcapCalendar.js',
'calWcapCalendarItems.js',
'calWcapErrors.js',
'calWcapRequest.js',
'calWcapSession.js',
'calWcapUtils.js',
]
with Files('**'):
BUG_COMPONENT = ('Calendar', 'Provider: WCAP')

Просмотреть файл

@ -1,281 +0,0 @@
/* 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/. */
#include "calICalendar.idl"
interface calIDateTime;
interface calIWcapSession;
/** Adds WCAP specific capabilities to calICalendar.
*/
[scriptable, uuid(21A189DF-6C92-41f6-9E2B-1929EF25CAEE)]
interface calIWcapCalendar : calICalendar
{
/**
* User session this calendar instance belongs to.
*/
readonly attribute calIWcapSession session;
/**
* Current calId the calendar instance acts on; defaults to userId.
* @exception NS_ERROR_NOT_AVAILABLE if not logged in
*/
readonly attribute string calId;
/**
* UserId of primary owner of this calendar instance.
* @exception NS_ERROR_NOT_AVAILABLE if not logged in
*/
readonly attribute string ownerId;
/**
* Determines whether this calendar instance is the user's default calendar.
* @exception NS_ERROR_NOT_AVAILABLE if not logged in
*/
readonly attribute boolean isDefaultCalendar;
/**
* Whether the currently selected calendar belongs to user.
* @exception NS_ERROR_NOT_AVAILABLE if not logged in
*/
readonly attribute boolean isOwnedCalendar;
/**
* Calendar description.
* @exception NS_ERROR_NOT_AVAILABLE if not logged in
*/
readonly attribute string description;
/**
* Calendar display name.
* @exception NS_ERROR_NOT_AVAILABLE if not logged in
*/
readonly attribute string displayName;
/**
* Gets this calendar's (calId) default timezone.
* @exception NS_ERROR_NOT_AVAILABLE if not logged in
*/
readonly attribute string defaultTimezone;
/**
* Gets calendar properties.
*
* @param propName property name (e.g. X-S1CS-CALPROPS-COMMON-NAME)
* @exception NS_ERROR_NOT_AVAILABLE if not logged in
*/
Array<AString> getCalendarProperties(in string propName);
/* xxx todo: additional filters sensible for calICalendar, too?
claiming bits 24-30 for now.
Those bits are somehow handled special now:
If at least one of the below is set, then
that filter bit(s) are active.
If none of the below is set, then those compstate
filters are not taken into account at all.
So there is no need to OR all of the below together
(ITEM_FILTER_ALL_ITEMS does not cover these bits) if you
don't care about the REQUEST/REPLY states.
xxx todo: ITEM_FILTER_CLASS_OCCURRENCES is not filter, rename?
*/
/* xxx todo: limit to currently needed ones: NEEDS-ACTION */
// /**
// * Scope: getItems only
// * Whether getItems should only return items that have alarms set for the
// * specified range.
// */
// const unsigned long ITEM_FILTER_BY_ALARM_RANGE = 1 << 23;
// /**
// * Scope: Attendee
// * The event or todo is an invitation from another
// * user and the current user has declined the invitation.
// */
// const unsigned long ITEM_FILTER_REPLY_DECLINED = 1 << 24;
// /**
// * Scope: Attendee
// * The event or todo is an invitation from another
// * user and the current user has accepted the invitation.
// */
// const unsigned long ITEM_FILTER_REPLY_ACCEPTED = 1 << 25;
// /**
// * Scope: Organizer
// * The event or todo is an invitation from the current
// * user to other invitees, and all invitees have replied.
// */
// const unsigned long ITEM_FILTER_REQUEST_COMPLETED = 1 << 26;
// /**
// * Scope: Attendee
// * The event or todo is an invitation from another
// * user and the current user has not replied to it yet.
// */
// const unsigned long ITEM_FILTER_REQUEST_NEEDS_ACTION = 1 << 27;
// /**
// * Scope: Attendee
// * The event or todo is an invitation from another
// * user and the current user is not required to reply.
// */
// const unsigned long ITEM_FILTER_REQUEST_NEEDSNOACTION = 1 << 28;
// /**
// * Scope: Organizer
// * The event or todo is an invitation from the current
// * user to other invitees, and is currently in the
// * process of sending out invitations.
// */
// const unsigned long ITEM_FILTER_REQUEST_PENDING = 1 << 29;
// /**
// * Scope: Organizer
// * The event or todo is an invitation from the current
// * user to other invitees, and is currently awaiting.
// */
// const unsigned long ITEM_FILTER_REQUEST_WAITFORREPLY = 1 << 30;
/* xxx todo:
separate out into another interface and leave only an attribute
readonly attribute calIWcapAccessControl accessControl;
here?
This would bloat client code somehow like
if (cal.accessControl &&
cal.accessControl.check(calIAccessControl.AC_COMP_WRITE))
cal.deleteItem(item, listener);
but makes it easier for provider implementors not implementing the
whole stuff...
Right now, the below are similar to *nix fs rights, i.e. "write" includes
"add", "delete" and "modify".
Does it make sense to separate "add" and "delete" out of "write"?
*/
/**
* Whether it is allowed or denied to get availability information
* (i.e. free-busy times).
*/
const unsigned long AC_FREEBUSY = 1 << 0;
/**
* Whether it is allowed or denied to invite a calendar's
* owner placing an invitation into the calendar.
*/
const unsigned long AC_SCHEDULE = 1 << 1;
/**
* Whether it is allowed or denied to read components.
*/
const unsigned long AC_COMP_READ = 1 << 2;
/**
* Whether it is allowed or denied to add, modify or delete components.
*/
const unsigned long AC_COMP_WRITE = 1 << 3;
/**
* Whether it is allowed or denied to read properties.
*/
const unsigned long AC_PROP_READ = 1 << 4;
/**
* Whether it is allowed or denied to add, modify or delete properties.
*/
const unsigned long AC_PROP_WRITE = 1 << 5;
/**
* Full access, includes all of the above.
*/
const unsigned long AC_FULL = (AC_FREEBUSY |
AC_SCHEDULE |
AC_COMP_READ |
AC_COMP_WRITE |
AC_PROP_READ |
AC_PROP_WRITE);
/**
* Checks whether the currently logged in user can perform the specified
* actions. Clients should check these bits before performing operations
* on a calendar instance, e.g.
*
* if (cal.checkAccess(calIWcapCalendar.AC_COMP_WRITE))
* cal.deleteItem(item, listener);
*
* or
*
* if (cal.checkAccess(calIWcapCalendar.AC_PROP_WRITE))
* cal.name = newName;
*
* @exception NS_ERROR_NOT_AVAILABLE if not logged in
* @param accessControlBits access control bits (above AC_ definitions)
* @return true if access is granted, false otherwise
*/
boolean checkAccess(in unsigned long accessControlBits);
// /**
// * Defines granted and denied permissions for a specific user or
// * user domain. Specific user entries precede over domain entries.
// *
// * Examples:
// * a) Allow all users availability and read access,
// * but jdoe only availability access:
// * defineAccessControl("@", AC_FREEBUSY | AC_COMP_READ);
// * defineAccessControl("jdoe", AC_FREEBUSY);
// *
// * b) Restrict jdoe to have no access:
// * defineAccessControl("jdoe", 0);
// *
// * Follow-up definition calls for the same user will overwrite previous
// * definitions.
// *
// * @param userId user that is affected by the access control bits
// * WCAP specific:
// * - @ stands in for everybody
// * xxx todo: change the above
// * @param accessControlBits access control bits (above AC_ definitions)
// * @param listener called when access control bits have been updated
// * @return optional object to track operation
// */
// calIOperation defineAccessControl(
// in string userId, in unsigned long accessControlBits,
// in calIGenericOperationListener listener);
// /**
// * To reset a user's access control definition to the default ones
// * that everybody is granted.
// * In case the user has no specific access control definition,
// * Cr.NS_ERROR_INVALID_ARG is thrown.
// *
// * @param userId user id
// * @param listener called when access control bits have been updated
// * @return optional object to track operation
// */
// calIOperation resetAccessControl(
// in string userId,
// in calIGenericOperationListener listener);
// /**
// * Gets the set of access control definitions (including "everybody").
// * Both out arrays have the same length.
// *
// * @param count length of returned arrays
// * @param users users ids
// * @param accessControlBits access control bits
// * @param listener called with xxx todo
// * @return optional object to track operation
// */
// calIOperation getAccessControlDefinitions(
// out unsigned long count,
// [array, size_is(count)] out string users,
// [array, size_is(count)] out unsigned long accessControlBits );
};

Просмотреть файл

@ -1,204 +0,0 @@
/* 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/. */
#include "calIErrors.idl"
/** WCAP error codes.
*/
[scriptable, uuid(2ADC008C-A7A6-4f9a-91C8-A99742B68F3D)]
interface calIWcapErrors : calIErrors
{
const unsigned long WCAP_NO_ERRNO = WCAP_ERROR_BASE + 0;
/* errno: */
/* 1 */ const unsigned long WCAP_LOGIN_FAILED =
WCAP_ERROR_BASE + 1;
/* 2 */ const unsigned long WCAP_LOGIN_OK_DEFAULT_CALENDAR_NOT_FOUND =
WCAP_ERROR_BASE + 2;
/* 6 */ const unsigned long WCAP_DELETE_EVENTS_BY_ID_FAILED =
WCAP_ERROR_BASE + 6;
/* 8 */ const unsigned long WCAP_SETCALPROPS_FAILED =
WCAP_ERROR_BASE + 8;
/* 9 */ const unsigned long WCAP_FETCH_EVENTS_BY_ID_FAILED =
WCAP_ERROR_BASE + 9;
/* 10 */ const unsigned long WCAP_CREATECALENDAR_FAILED =
WCAP_ERROR_BASE + 10;
/* 11 */ const unsigned long WCAP_DELETECALENDAR_FAILED =
WCAP_ERROR_BASE + 11;
/* 12 */ const unsigned long WCAP_ADDLINK_FAILED =
WCAP_ERROR_BASE + 12;
/* 13 */ const unsigned long WCAP_FETCHBYDATERANGE_FAILED =
WCAP_ERROR_BASE + 13;
/* 14 */ const unsigned long WCAP_STOREEVENTS_FAILED =
WCAP_ERROR_BASE + 14;
/* 15 */ const unsigned long WCAP_STORETODOS_FAILED =
WCAP_ERROR_BASE + 15;
/* 16 */ const unsigned long WCAP_DELETE_TODOS_BY_ID_FAILED =
WCAP_ERROR_BASE + 16;
/* 17 */ const unsigned long WCAP_FETCH_TODOS_BY_ID_FAILED =
WCAP_ERROR_BASE + 17;
/* 18 */ const unsigned long WCAP_FETCHCOMPONENTS_FAILED_BAD_TZID =
WCAP_ERROR_BASE + 18;
/* 19 */ const unsigned long WCAP_SEARCH_CALPROPS_FAILED =
WCAP_ERROR_BASE + 19;
/* 20 */ const unsigned long WCAP_GET_CALPROPS_FAILED =
WCAP_ERROR_BASE + 20;
/* 21 */ const unsigned long WCAP_DELETECOMPONENTS_BY_RANGE_FAILED =
WCAP_ERROR_BASE + 21;
/* 22 */ const unsigned long WCAP_DELETEEVENTS_BY_RANGE_FAILED =
WCAP_ERROR_BASE + 22;
/* 23 */ const unsigned long WCAP_DELETETODOS_BY_RANGE_FAILED =
WCAP_ERROR_BASE + 23;
/* 24 */ const unsigned long WCAP_GET_ALL_TIMEZONES_FAILED =
WCAP_ERROR_BASE + 24;
/* 25 */ const unsigned long WCAP_CREATECALENDAR_ALREADY_EXISTS_FAILED =
WCAP_ERROR_BASE + 25;
/* 26 */ const unsigned long WCAP_SET_USERPREFS_FAILED =
WCAP_ERROR_BASE + 26;
/* 27 */ const unsigned long WCAP_CHANGE_PASSWORD_FAILED =
WCAP_ERROR_BASE + 27;
/* 28 */ const unsigned long WCAP_ACCESS_DENIED_TO_CALENDAR =
WCAP_ERROR_BASE + 28;
/* 29 */ const unsigned long WCAP_CALENDAR_DOES_NOT_EXIST =
WCAP_ERROR_BASE + 29;
/* 30 */ const unsigned long WCAP_ILLEGAL_CALID_NAME =
WCAP_ERROR_BASE + 30;
/* 31 */ const unsigned long WCAP_CANNOT_MODIFY_LINKED_EVENTS =
WCAP_ERROR_BASE + 31;
/* 32 */ const unsigned long WCAP_CANNOT_MODIFY_LINKED_TODOS =
WCAP_ERROR_BASE + 32;
/* 33 */ const unsigned long WCAP_CANNOT_SENT_EMAIL =
WCAP_ERROR_BASE + 33;
/* 34 */ const unsigned long WCAP_CALENDAR_DISABLED =
WCAP_ERROR_BASE + 34;
/* 35 */ const unsigned long WCAP_WRITE_IMPORT_FAILED =
WCAP_ERROR_BASE + 35;
/* 36 */ const unsigned long WCAP_FETCH_BY_LAST_MODIFIED_FAILED =
WCAP_ERROR_BASE + 36;
/* 37 */ const unsigned long WCAP_CAPI_NOT_SUPPORTED =
WCAP_ERROR_BASE + 37;
/* 38 */ const unsigned long WCAP_CALID_NOT_SPECIFIED =
WCAP_ERROR_BASE + 38;
/* 39 */ const unsigned long WCAP_GET_FREEBUSY_FAILED =
WCAP_ERROR_BASE + 39;
/* 40 */ const unsigned long WCAP_STORE_FAILED_DOUBLE_BOOKED =
WCAP_ERROR_BASE + 40;
/* 41 */ const unsigned long WCAP_FETCH_BY_ALARM_RANGE_FAILED =
WCAP_ERROR_BASE + 41;
/* 42 */ const unsigned long WCAP_FETCH_BY_ATTENDEE_ERROR_FAILED =
WCAP_ERROR_BASE + 42;
/* 43 */ const unsigned long WCAP_ATTENDEE_GROUP_EXPANSION_CLIPPED =
WCAP_ERROR_BASE + 43;
/* 44 */ const unsigned long WCAP_USERPREFS_ACCESS_DENIED =
WCAP_ERROR_BASE + 44;
/* 45 */ const unsigned long WCAP_NOT_ALLOWED_TO_REQUEST_PUBLISH =
WCAP_ERROR_BASE + 45;
/* 46 */ const unsigned long WCAP_INSUFFICIENT_PARAMETERS =
WCAP_ERROR_BASE + 46;
/* 47 */ const unsigned long WCAP_MUSTBEOWNER_OPERATION =
WCAP_ERROR_BASE + 47;
/* 48 */ const unsigned long WCAP_DWP_CONNECTION_FAILED =
WCAP_ERROR_BASE + 48;
/* 49 */ const unsigned long WCAP_DWP_MAX_CONNECTION_REACHED =
WCAP_ERROR_BASE + 49;
/* 50 */ const unsigned long WCAP_DWP_CANNOT_RESOLVE_CALENDAR =
WCAP_ERROR_BASE + 50;
/* 51 */ const unsigned long WCAP_DWP_BAD_DATA =
WCAP_ERROR_BASE + 51;
/* 52 */ const unsigned long WCAP_BAD_COMMAND =
WCAP_ERROR_BASE + 52;
/* 53 */ const unsigned long WCAP_NOT_FOUND =
WCAP_ERROR_BASE + 53;
/* 54 */ const unsigned long WCAP_WRITE_IMPORT_CANT_EXPAND_CALID =
WCAP_ERROR_BASE + 54;
/* 55 */ const unsigned long WCAP_GETTIME_FAILED =
WCAP_ERROR_BASE + 55;
/* 56 */ const unsigned long WCAP_FETCH_DELETEDCOMPONENTS_FAILED =
WCAP_ERROR_BASE + 56;
/* 57 */ const unsigned long WCAP_FETCH_DELETEDCOMPONENTS_PARTIAL_RESULT =
WCAP_ERROR_BASE + 57;
/* 58 */ const unsigned long WCAP_WCAP_NO_SUCH_FORMAT =
WCAP_ERROR_BASE + 58;
/* 59 */ const unsigned long WCAP_COMPONENT_NOT_FOUND =
WCAP_ERROR_BASE + 59;
/* 60 */ const unsigned long WCAP_BAD_ARGUMENTS =
WCAP_ERROR_BASE + 60;
/* 61 */ const unsigned long WCAP_GET_USERPREFS_FAILED =
WCAP_ERROR_BASE + 61;
/* 62 */ const unsigned long WCAP_WCAP_MODIFY_NO_EVENT =
WCAP_ERROR_BASE + 62;
/* 63 */ const unsigned long WCAP_WCAP_CREATE_EXISTS =
WCAP_ERROR_BASE + 63;
/* 64 */ const unsigned long WCAP_WCAP_MODIFY_CANT_MAKE_COPY =
WCAP_ERROR_BASE + 64;
/* 65 */ const unsigned long WCAP_STORE_FAILED_RECUR_SKIP =
WCAP_ERROR_BASE + 65;
/* 66 */ const unsigned long WCAP_STORE_FAILED_RECUR_SAMEDAY =
WCAP_ERROR_BASE + 66;
/* 67 */ const unsigned long WCAP_BAD_ORG_ARGUMENTS =
WCAP_ERROR_BASE + 67;
/* 68 */ const unsigned long WCAP_STORE_FAILED_RECUR_PRIVACY =
WCAP_ERROR_BASE + 68;
/* 69 */ const unsigned long WCAP_LDAP_ERROR =
WCAP_ERROR_BASE + 69;
/* 70 */ const unsigned long WCAP_GET_INVITE_COUNT_FAILED =
WCAP_ERROR_BASE + 70;
/* 71 */ const unsigned long WCAP_LIST_FAILED =
WCAP_ERROR_BASE + 71;
/* 72 */ const unsigned long WCAP_LIST_SUBSCRIBED_FAILED =
WCAP_ERROR_BASE + 72;
/* 73 */ const unsigned long WCAP_SUBSCRIBE_FAILED =
WCAP_ERROR_BASE + 73;
/* 74 */ const unsigned long WCAP_UNSUBSCRIBE_FAILED =
WCAP_ERROR_BASE + 74;
/* 75 */ const unsigned long WCAP_ANONYMOUS_NOT_ALLOWED =
WCAP_ERROR_BASE + 75;
/* 76 */ const unsigned long WCAP_ACCESS_DENIED =
WCAP_ERROR_BASE + 76;
/* 77 */ const unsigned long WCAP_BAD_IMPORT_ARGUMENTS =
WCAP_ERROR_BASE + 77;
/* 78 */ const unsigned long WCAP_READONLY_DATABASE =
WCAP_ERROR_BASE + 78;
/* 79 */ const unsigned long WCAP_ATTENDEE_NOT_ALLOWED_TO_REQUEST_ON_MODIFY=
WCAP_ERROR_BASE + 79;
/* 80 */ const unsigned long WCAP_TRANSP_RESOURCE_NOT_ALLOWED =
WCAP_ERROR_BASE + 80;
/* 81 */ const unsigned long WCAP_RECURRING_COMPONENT_NOT_FOUND =
WCAP_ERROR_BASE + 81;
/* new by WCAP 4.0: */
/* 82 */ const unsigned long WCAP_BAD_MIME_TYPE =
WCAP_ERROR_BASE + 82;
/* 83 */ const unsigned long WCAP_MISSING_BOUNDARY =
WCAP_ERROR_BASE + 83;
/* 84 */ const unsigned long WCAP_INVALID_ATTACHMENT =
WCAP_ERROR_BASE + 84;
/* 85 */ const unsigned long WCAP_ATTACH_DELETE_SUCCESS =
WCAP_ERROR_BASE + 85;
/* 86 */ const unsigned long WCAP_ATTACH_DELETE_PARTIAL =
WCAP_ERROR_BASE + 86;
/* 87 */ const unsigned long WCAP_ATTACHMENT_NOT_FOUND =
WCAP_ERROR_BASE + 87;
/* / new by WCAP 4.0 */
/* 11000 */ const unsigned long WCAP_CDWP_ERR_MAX_CONNECTION_REACHED =
WCAP_ERROR_BASE + 100;
/* 11001 */ const unsigned long WCAP_CDWP_ERR_CANNOT_CONNECT =
WCAP_ERROR_BASE + 101;
/* 11002 */ const unsigned long WCAP_CDWP_ERR_CANNOT_RESOLVE_CALENDAR =
WCAP_ERROR_BASE + 102;
/* 11003 */ const unsigned long WCAP_CDWP_ERR_BAD_DATA =
WCAP_ERROR_BASE + 103;
/* 11004 */ const unsigned long WCAP_CDWP_ERR_DWPHOST_CTX_DOES_NOT_EXIST =
WCAP_ERROR_BASE + 104;
/* 11005 */ const unsigned long WCAP_CDWP_ERR_HOSTNAME_NOT_RESOLVABLE =
WCAP_ERROR_BASE + 105;
/* 11006 */ const unsigned long WCAP_CDWP_ERR_NO_DATA =
WCAP_ERROR_BASE + 106;
/* 11007 */ const unsigned long WCAP_CDWP_ERR_AUTH_FAILED =
WCAP_ERROR_BASE + 107;
/* 11008 */ const unsigned long WCAP_CDWP_ERR_CHECKVERSION_FAILED =
WCAP_ERROR_BASE + 108;
};

Просмотреть файл

@ -1,39 +0,0 @@
/* 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/. */
#include "nsISupports.idl"
interface calIWcapCalendar;
interface nsIURI;
/**
* WCAP session.
*/
[scriptable, uuid(477B4534-C297-40a1-ADF2-5A7E2A81816A)]
interface calIWcapSession : nsISupports
{
/**
* Setting this URI causes the session to logged out and disconnected.
*/
attribute nsIURI uri;
/**
* User that has established this session.
* @exception NS_ERROR_NOT_AVAILABLE if not logged in
*/
readonly attribute string userId;
/**
* Determines whether the user is currently logged in.
* Does _not_ check whether the user's ticket has timed out!
*/
readonly attribute boolean isLoggedIn;
/**
* Gets the default calendar instance of this session.
*/
readonly attribute calIWcapCalendar defaultCalendar;
};

Просмотреть файл

@ -1,13 +0,0 @@
# vim: set filetype=python:
# 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/.
XPIDL_SOURCES += [
'calIWcapCalendar.idl',
'calIWcapErrors.idl',
'calIWcapSession.idl',
]
XPIDL_MODULE = 'wcap'

Просмотреть файл

@ -58,7 +58,6 @@
<radiogroup id="calendar-format" onselect="onSelectProvider(this.value)">
<radio value="ics" label="&calendarproperties.webdav.label;" selected="true" />
<radio value="caldav" label="&calendarproperties.caldav.label;"/>
<radio id="wcap-radio" value="wcap" label="&calendarproperties.wcap.label;"/>
</radiogroup>
</html:td>
</html:tr>

Просмотреть файл

@ -523,7 +523,7 @@ function createCalendar(controller, name) {
* @param data (optional) dataset object
* showReminders - False to disable reminders.
* eMail - id of eMail account
* network.format - ics/caldav/wcap
* network.format - ics/caldav
* network.location - URI (undefined for local ICS)
* network.offline - False to disable cache.
*/