Fix bug 795102 - Use MailServices.js where possible. r=philipp
--HG-- extra : rebase_source : f281b452526c7dced99ac6d1dd66abe896d057c8
This commit is contained in:
Родитель
3c7ecbebc4
Коммит
5eb1a25085
|
@ -56,7 +56,6 @@
|
|||
<field name="mNumColumns">0</field>
|
||||
<field name="mIOService">null</field>
|
||||
<field name="mDirectoryServerObserver">null</field>
|
||||
<field name="mHeaderParser">null</field>
|
||||
<field name="mPrefs">null</field>
|
||||
<field name="mIsOffline">0</field>
|
||||
<field name="mLDAPSession">null</field>
|
||||
|
@ -97,11 +96,6 @@
|
|||
|
||||
this.mDirectoryServerObserver = observer;
|
||||
|
||||
var component = Components.classes["@mozilla.org/messenger/headerparser;1"];
|
||||
if (component) {
|
||||
this.mHeaderParser = component.getService(Components.interfaces.nsIMsgHeaderParser);
|
||||
}
|
||||
|
||||
// First get the preferences service
|
||||
try {
|
||||
this.mPrefs = Services.prefs.getBranch(null);
|
||||
|
@ -291,7 +285,7 @@
|
|||
// construct the display string from common name and/or email address.
|
||||
var inputValue = aAttendee.commonName;
|
||||
var regexp = new RegExp("^mailto:(.*)", "i");
|
||||
if (inputValue && this.mHeaderParser) {
|
||||
if (inputValue) {
|
||||
// Make the commonName appear in quotes if it
|
||||
// contains a comma or semicolon.
|
||||
if (inputValue.search(/[,;]/) != -1) {
|
||||
|
@ -443,15 +437,16 @@
|
|||
|
||||
<property name="attendees">
|
||||
<getter><![CDATA[
|
||||
var attendees = [];
|
||||
Components.utils.import("resource:///modules/mailServices.js");
|
||||
let attendees = [];
|
||||
let inputField;
|
||||
|
||||
var inputField;
|
||||
for (var i = 1; inputField = this.getInputElement(i); i++) {
|
||||
var fieldValue = inputField.value;
|
||||
for (let i = 1; inputField = this.getInputElement(i); i++) {
|
||||
let fieldValue = inputField.value;
|
||||
if (fieldValue != "") {
|
||||
// the inputfield already has a reference to the attendee
|
||||
// object, we just need to fill in the name.
|
||||
var attendee = inputField.attendee.clone();
|
||||
let attendee = inputField.attendee.clone();
|
||||
|
||||
attendee.role = this.getRoleElement(i).getAttribute("role");
|
||||
//attendee.participationStatus = this.getStatusElement(i).getAttribute("status");
|
||||
|
@ -459,25 +454,20 @@
|
|||
attendee.userType = (userType == "INDIVIDUAL" ? null : userType) // INDIVIDUAL is the default
|
||||
|
||||
// break the list of potentially many attendees back into individual names
|
||||
var emailAddresses = {};
|
||||
var names = {};
|
||||
var fullNames = {};
|
||||
let emailAddresses = {};
|
||||
let names = {};
|
||||
let fullNames = {};
|
||||
|
||||
if (this.mHeaderParser) {
|
||||
this.mHeaderParser.parseHeadersWithArray(fieldValue,
|
||||
emailAddresses,
|
||||
names,
|
||||
fullNames);
|
||||
} else {
|
||||
emailAddresses.value = [ fieldValue ];
|
||||
names.value = [];
|
||||
}
|
||||
MailServices.headerParser.parseHeadersWithArray(fieldValue,
|
||||
emailAddresses,
|
||||
names,
|
||||
fullNames);
|
||||
|
||||
if (emailAddresses.value.length > 0) {
|
||||
// If the new address has no 'mailto'-prefix but seems
|
||||
// to look like an email-address, we prepend the prefix.
|
||||
// This also allows for non-email-addresses.
|
||||
var email = emailAddresses.value[0];
|
||||
let email = emailAddresses.value[0];
|
||||
if (email.toLowerCase().indexOf("mailto:") != 0) {
|
||||
if (email.indexOf("@") >= 0) {
|
||||
email = "MAILTO:" + email;
|
||||
|
@ -502,13 +492,15 @@
|
|||
|
||||
<property name="organizer">
|
||||
<getter><![CDATA[
|
||||
var inputField;
|
||||
for (var i = 1; inputField = this.getInputElement(i); i++) {
|
||||
var fieldValue = inputField.value;
|
||||
Components.utils.import("resource:///modules/mailServices.js");
|
||||
|
||||
let inputField;
|
||||
for (let i = 1; inputField = this.getInputElement(i); i++) {
|
||||
let fieldValue = inputField.value;
|
||||
if (fieldValue != "") {
|
||||
// The inputfield already has a reference to the attendee
|
||||
// object, we just need to fill in the name.
|
||||
var attendee = inputField.attendee.clone();
|
||||
let attendee = inputField.attendee.clone();
|
||||
|
||||
//attendee.role = this.getRoleElement(i).getAttribute("role");
|
||||
attendee.participationStatus = this.getStatusElement(i).getAttribute("status");
|
||||
|
@ -516,25 +508,20 @@
|
|||
attendee.userType = null;
|
||||
|
||||
// break the list of potentially many attendees back into individual names
|
||||
var emailAddresses = {};
|
||||
var names = {};
|
||||
var fullNames = {};
|
||||
let emailAddresses = {};
|
||||
let names = {};
|
||||
let fullNames = {};
|
||||
|
||||
if (this.mHeaderParser) {
|
||||
this.mHeaderParser.parseHeadersWithArray(fieldValue,
|
||||
emailAddresses,
|
||||
names,
|
||||
fullNames);
|
||||
} else {
|
||||
emailAddresses.value = [ fieldValue ];
|
||||
names.value = [];
|
||||
}
|
||||
MailServices.headerParser.parseHeadersWithArray(fieldValue,
|
||||
emailAddresses,
|
||||
names,
|
||||
fullNames);
|
||||
|
||||
if (emailAddresses.value.length > 0) {
|
||||
// if the new address has no 'mailto'-prefix but seems
|
||||
// to look like an email-address, we prepend the prefix.
|
||||
// this also allows for non-email-addresses.
|
||||
var email = emailAddresses.value[0];
|
||||
let email = emailAddresses.value[0];
|
||||
if (email.toLowerCase().indexOf("mailto:") != 0) {
|
||||
if (email.indexOf("@") >= 0) {
|
||||
email = "MAILTO:" + email;
|
||||
|
@ -559,24 +546,23 @@
|
|||
<method name="onBlurInput">
|
||||
<parameter name="event"/>
|
||||
<body><![CDATA[
|
||||
if (this.mHeaderParser) {
|
||||
var emailAddresses = {};
|
||||
var names = {};
|
||||
var fullNames = {};
|
||||
this.mHeaderParser.parseHeadersWithArray(
|
||||
event.target.value,
|
||||
emailAddresses,
|
||||
names,
|
||||
fullNames);
|
||||
if (emailAddresses.value.length > 1) {
|
||||
let firstFullName = fullNames.value.shift();
|
||||
event.target.value = firstFullName;
|
||||
let insertAfterItem = this.getListItem(this.getRowByInputElement(event.target));
|
||||
for each (let full in fullNames.value) {
|
||||
insertAfterItem = this.appendNewRow(false, insertAfterItem);
|
||||
let textinput = this.getInputFromListitem(insertAfterItem);
|
||||
textinput.value = full;
|
||||
}
|
||||
Components.utils.import("resource:///modules/mailServices.js");
|
||||
|
||||
let emailAddresses = {};
|
||||
let names = {};
|
||||
let fullNames = {};
|
||||
MailServices.headerParser.parseHeadersWithArray(event.target.value,
|
||||
emailAddresses,
|
||||
names,
|
||||
fullNames);
|
||||
if (emailAddresses.value.length > 1) {
|
||||
let firstFullName = fullNames.value.shift();
|
||||
event.target.value = firstFullName;
|
||||
let insertAfterItem = this.getListItem(this.getRowByInputElement(event.target));
|
||||
for each (let full in fullNames.value) {
|
||||
insertAfterItem = this.appendNewRow(false, insertAfterItem);
|
||||
let textinput = this.getInputFromListitem(insertAfterItem);
|
||||
textinput.value = full;
|
||||
}
|
||||
}
|
||||
]]></body>
|
||||
|
@ -585,31 +571,28 @@
|
|||
<method name="_resolveListByName">
|
||||
<parameter name="value"/>
|
||||
<body><![CDATA[
|
||||
if (this.mHeaderParser) {
|
||||
let emailAddresses = {};
|
||||
let names = {};
|
||||
let fullNames = {};
|
||||
this.mHeaderParser.parseHeadersWithArray(value,
|
||||
emailAddresses,
|
||||
names,
|
||||
fullNames);
|
||||
Components.utils.import("resource:///modules/mailServices.js");
|
||||
|
||||
let abManager = Components.classes["@mozilla.org/abmanager;1"]
|
||||
.getService(Components.interfaces.nsIAbManager);
|
||||
let emailAddresses = {};
|
||||
let names = {};
|
||||
let fullNames = {};
|
||||
MailServices.headerParser.parseHeadersWithArray(value,
|
||||
emailAddresses,
|
||||
names,
|
||||
fullNames);
|
||||
|
||||
let abDir=this._findListInAddrBooks(abManager, names.value[0]);
|
||||
let abDir = this._findListInAddrBooks(names.value[0]);
|
||||
|
||||
return abDir;
|
||||
}
|
||||
return null;
|
||||
return abDir;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_findListInAddrBooks">
|
||||
<parameter name="abManager"/>
|
||||
<parameter name="entryname"/>
|
||||
<body><![CDATA[
|
||||
let allAddressBooks = abManager.directories;
|
||||
Components.utils.import("resource:///modules/mailServices.js");
|
||||
|
||||
let allAddressBooks = MailServices.ab.directories;
|
||||
|
||||
while (allAddressBooks.hasMoreElements()) {
|
||||
let abDir = null;
|
||||
|
@ -646,7 +629,6 @@
|
|||
<parameter name="attendees"/>
|
||||
<parameter name="allListsUri"/>
|
||||
<body><![CDATA[
|
||||
|
||||
function in_list(aList, listid) {
|
||||
for (var l=0;l<aList.length;l++){
|
||||
if (aList[l]===listid) return true;
|
||||
|
@ -654,12 +636,9 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
let abManager = Components.classes["@mozilla.org/abmanager;1"]
|
||||
.getService(Components.interfaces.nsIAbManager);
|
||||
|
||||
let addressLists=mailingList.addressLists;
|
||||
let addressLists = mailingList.addressLists;
|
||||
for (var i=0;i<addressLists.length;i++) {
|
||||
let abCard=addressLists.queryElementAt(i, Components.interfaces.nsIAbCard);
|
||||
let abCard = addressLists.queryElementAt(i, Components.interfaces.nsIAbCard);
|
||||
let thisId = abCard.primaryEmail;
|
||||
if (abCard.displayName.length > 0) {
|
||||
let rCn = abCard.displayName;
|
||||
|
@ -671,7 +650,7 @@
|
|||
if (in_list(attendees, thisId)) continue;
|
||||
|
||||
if (abCard.displayName.length > 0) {
|
||||
let ml=this._findListInAddrBooks(abManager, abCard.displayName);
|
||||
let ml = this._findListInAddrBooks(abCard.displayName);
|
||||
if (null!=ml){
|
||||
if (in_list(allListsUri, ml.URI)) continue;
|
||||
allListsUri.push(ml.URI);
|
||||
|
@ -783,28 +762,24 @@
|
|||
|
||||
<method name="onModify">
|
||||
<body><![CDATA[
|
||||
var list = [];
|
||||
for (var i = 1; i <= this.mMaxAttendees; i++) {
|
||||
Components.utils.import("resource:///modules/mailServices.js");
|
||||
|
||||
let list = [];
|
||||
for (let i = 1; i <= this.mMaxAttendees; i++) {
|
||||
// retrieve the string from the appropriate row
|
||||
var input = this.getInputElement(i);
|
||||
var fieldValue = input.value;
|
||||
let input = this.getInputElement(i);
|
||||
let fieldValue = input.value;
|
||||
|
||||
// parse the string to break this down to individual names and addresses
|
||||
var email = "";
|
||||
var emailAddresses = {};
|
||||
var names = {};
|
||||
var fullNames = {};
|
||||
let email = "";
|
||||
let emailAddresses = {};
|
||||
let names = {};
|
||||
let fullNames = {};
|
||||
|
||||
if (this.mHeaderParser) {
|
||||
this.mHeaderParser.parseHeadersWithArray(
|
||||
fieldValue,
|
||||
emailAddresses,
|
||||
names,
|
||||
fullNames);
|
||||
} else {
|
||||
emailAddresses.value = [ fieldValue ];
|
||||
names.value = [];
|
||||
}
|
||||
MailServices.headerParser.parseHeadersWithArray(fieldValue,
|
||||
emailAddresses,
|
||||
names,
|
||||
fullNames);
|
||||
|
||||
if (emailAddresses.value.length > 0) {
|
||||
// if the new address has no 'mailto'-prefix but seems
|
||||
|
@ -818,19 +793,19 @@
|
|||
}
|
||||
}
|
||||
|
||||
var isdirty = false;
|
||||
let isdirty = false;
|
||||
if (input.hasAttribute("dirty")) {
|
||||
isdirty = input.getAttribute("dirty");
|
||||
}
|
||||
input.removeAttribute("dirty");
|
||||
var entry = {
|
||||
let entry = {
|
||||
dirty: isdirty,
|
||||
calid: email
|
||||
};
|
||||
list.push(entry);
|
||||
}
|
||||
|
||||
var event = document.createEvent('Events');
|
||||
let event = document.createEvent('Events');
|
||||
event.initEvent('modify', true, false);
|
||||
event.details = list;
|
||||
this.dispatchEvent(event);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
Components.utils.import("resource://calendar/modules/calUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://calendar/modules/calRecurrenceUtils.jsm");
|
||||
Components.utils.import("resource:///modules/mailServices.js");
|
||||
|
||||
try {
|
||||
Components.utils.import("resource:///modules/cloudFileAccounts.js");
|
||||
|
@ -1252,15 +1253,13 @@ function openNewTask() {
|
|||
* Open a new Thunderbird compose window.
|
||||
*/
|
||||
function openNewMessage() {
|
||||
var msgComposeService = Components.classes["@mozilla.org/messengercompose;1"]
|
||||
.getService(Components.interfaces.nsIMsgComposeService);
|
||||
msgComposeService.OpenComposeWindow(null,
|
||||
null,
|
||||
null,
|
||||
Components.interfaces.nsIMsgCompType.New,
|
||||
Components.interfaces.nsIMsgCompFormat.Default,
|
||||
null,
|
||||
null);
|
||||
MailServices.compose.OpenComposeWindow(null,
|
||||
null,
|
||||
null,
|
||||
Components.interfaces.nsIMsgCompType.New,
|
||||
Components.interfaces.nsIMsgCompFormat.Default,
|
||||
null,
|
||||
null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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/mailServices.js");
|
||||
Components.utils.import("resource://calendar/modules/calUtils.jsm");
|
||||
Components.utils.import("resource://calendar/modules/calAlarmUtils.jsm");
|
||||
Components.utils.import("resource://calendar/modules/calIteratorUtils.jsm");
|
||||
|
@ -310,7 +311,7 @@ cal.itip = {
|
|||
}
|
||||
|
||||
let identities;
|
||||
let actMgr = cal.getAccountManager();
|
||||
let actMgr = MailServices.accounts;
|
||||
if (aMsgHdr.accountKey) {
|
||||
// First, check if the message has an account key. If so, we can use the
|
||||
// account identities to find the correct recipient
|
||||
|
@ -348,8 +349,7 @@ cal.itip = {
|
|||
}
|
||||
}
|
||||
|
||||
let hdrParser = Components.classes["@mozilla.org/messenger/headerparser;1"]
|
||||
.getService(Components.interfaces.nsIMsgHeaderParser);
|
||||
let hdrParser = MailServices.headerParser;
|
||||
let emails = {};
|
||||
|
||||
// First check the recipient list
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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/mailServices.js");
|
||||
Components.utils.import("resource://calendar/modules/calUtils.jsm");
|
||||
Components.utils.import("resource://calendar/modules/calAuthUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
@ -262,11 +263,11 @@ cal.getEmailIdentityOfCalendar = function calGetEmailIdentityOfCalendar(aCalenda
|
|||
return identity;
|
||||
} else { // take default account/identity:
|
||||
|
||||
let accounts = cal.getAccountManager().accounts;
|
||||
let accounts = MailServices.accounts.accounts;
|
||||
let account = null;
|
||||
let identity = null;
|
||||
try {
|
||||
account = cal.getAccountManager().defaultAccount;
|
||||
account = MailServices.accounts.defaultAccount;
|
||||
} catch (exc) {}
|
||||
|
||||
for (let i = 0; accounts && (i < accounts.Count()) && (!account || !identity); ++i) {
|
||||
|
|
|
@ -15,8 +15,6 @@ let cal = {
|
|||
// and more code should be moved from calUtils.js into this object to avoid
|
||||
// clashes with other extensions
|
||||
|
||||
getIOService: generateServiceAccessor("@mozilla.org/network/io-service;1",
|
||||
Components.interfaces.nsIIOService2),
|
||||
getDragService: generateServiceAccessor("@mozilla.org/widget/dragservice;1",
|
||||
Components.interfaces.nsIDragService),
|
||||
|
||||
|
@ -28,8 +26,6 @@ let cal = {
|
|||
* @param baseDir base dir; defaults to calendar-js/
|
||||
*/
|
||||
loadScripts: function cal_loadScripts(scriptNames, scope, baseDir) {
|
||||
let ioService = cal.getIOService();
|
||||
|
||||
if (!baseDir) {
|
||||
baseDir = __LOCATION__.parent.parent.clone();
|
||||
baseDir.append("calendar-js");
|
||||
|
@ -42,7 +38,7 @@ let cal = {
|
|||
}
|
||||
let scriptFile = baseDir.clone();
|
||||
scriptFile.append(script);
|
||||
let scriptUrlSpec = ioService.newFileURI(scriptFile).spec;
|
||||
let scriptUrlSpec = Services.io.newFileURI(scriptFile).spec;
|
||||
try {
|
||||
Services.scriptloader.loadSubScript(scriptUrlSpec, scope);
|
||||
} catch (exc) {
|
||||
|
@ -648,7 +644,7 @@ function shutdownCleanup(obj, prop) {
|
|||
}
|
||||
|
||||
// local to this module;
|
||||
// will be used to generate service accessor functions, getIOService()
|
||||
// will be used to generate service accessor functions
|
||||
function generateServiceAccessor(id, iface) {
|
||||
return function this_() {
|
||||
if (!("mService" in this_)) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
* that loading this file twice in the same scope will throw errors.
|
||||
*/
|
||||
|
||||
Components.utils.import("resource:///modules/mailServices.js");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function _calIcalCreator(cid, iid) {
|
||||
|
@ -48,12 +49,6 @@ function createRecurrenceInfo(aItem) {
|
|||
return recInfo;
|
||||
}
|
||||
|
||||
/* Shortcut to the account manager service */
|
||||
function getAccountManager() {
|
||||
return Components.classes["@mozilla.org/messenger/account-manager;1"]
|
||||
.getService(Components.interfaces.nsIMsgAccountManager);
|
||||
}
|
||||
|
||||
/* Shortcut to the calendar-manager service */
|
||||
function getCalendarManager() {
|
||||
return Components.classes["@mozilla.org/calendar/manager;1"]
|
||||
|
@ -1280,51 +1275,20 @@ calListenerBag.prototype = {
|
|||
};
|
||||
|
||||
function sendMailTo(aRecipient, aSubject, aBody) {
|
||||
let msgParams = Components.classes["@mozilla.org/messengercompose/composeparams;1"]
|
||||
.createInstance(Components.interfaces.nsIMsgComposeParams);
|
||||
let composeFields = Components.classes["@mozilla.org/messengercompose/composefields;1"]
|
||||
.createInstance(Components.interfaces.nsIMsgCompFields);
|
||||
|
||||
if (Components.classes["@mozilla.org/messengercompose;1"]) {
|
||||
// We are in Thunderbird, we can use the compose interface directly
|
||||
var msgComposeService = Components.classes["@mozilla.org/messengercompose;1"]
|
||||
.getService(Components.interfaces.nsIMsgComposeService);
|
||||
var msgParams = Components.classes["@mozilla.org/messengercompose/composeparams;1"]
|
||||
.createInstance(Components.interfaces.nsIMsgComposeParams);
|
||||
var composeFields = Components.classes["@mozilla.org/messengercompose/composefields;1"]
|
||||
.createInstance(Components.interfaces.nsIMsgCompFields);
|
||||
composeFields.to = aRecipient;
|
||||
composeFields.subject = aSubject;
|
||||
composeFields.body = aBody;
|
||||
|
||||
composeFields.to = aRecipient;
|
||||
composeFields.subject = aSubject;
|
||||
composeFields.body = aBody;
|
||||
msgParams.type = Components.interfaces.nsIMsgCompType.New;
|
||||
msgParams.format = Components.interfaces.nsIMsgCompFormat.Default;
|
||||
msgParams.composeFields = composeFields;
|
||||
|
||||
msgParams.type = Components.interfaces.nsIMsgCompType.New;
|
||||
msgParams.format = Components.interfaces.nsIMsgCompFormat.Default;
|
||||
msgParams.composeFields = composeFields;
|
||||
|
||||
msgComposeService.OpenComposeWindowWithParams(null, msgParams);
|
||||
} else {
|
||||
// We are in a place without a composer. Use the external protocol
|
||||
// service.
|
||||
var protoSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
|
||||
.getService(Components.interfaces.nsIExternalProtocolService);
|
||||
|
||||
var uriString = "mailto:";
|
||||
var uriParams = [];
|
||||
if (aRecipient) {
|
||||
uriString += aRecipient;
|
||||
}
|
||||
|
||||
if (aSubject) {
|
||||
uriParams.push("subject=" + encodeURIComponent(aSubject));
|
||||
}
|
||||
|
||||
if (aBody) {
|
||||
uriParams.push("body=" + encodeURIComponent(aSubject));
|
||||
}
|
||||
|
||||
if (uriParams.length > 0) {
|
||||
uriString += "?" + uriParams.join("&");
|
||||
}
|
||||
|
||||
protoSvc.loadUrl(makeURL(uriString));
|
||||
}
|
||||
MailServices.compose.OpenComposeWindowWithParams(null, msgParams);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1774,7 +1738,7 @@ calPropertyBagEnumerator.prototype = {
|
|||
* If the called function returns false, iteration is stopped.
|
||||
*/
|
||||
function calIterateEmailIdentities(func) {
|
||||
var accounts = getAccountManager().accounts;
|
||||
var accounts = MailServices.accounts.accounts;
|
||||
for (var i = 0; i < accounts.Count(); ++i) {
|
||||
var account = accounts.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgAccount);
|
||||
var identities = account.identities;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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/mailServices.js");
|
||||
Components.utils.import("resource://calendar/modules/calUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
@ -153,20 +154,15 @@ calItipEmailTransport.prototype = {
|
|||
this.mHasXpcomMail = true;
|
||||
|
||||
try {
|
||||
let smtpSvc = Components.classes["@mozilla.org/messengercompose/smtp;1"]
|
||||
.getService(Components.interfaces.nsISmtpService);
|
||||
this.mDefaultSmtpServer = smtpSvc.defaultServer;
|
||||
|
||||
let accountMgrSvc = Components.classes["@mozilla.org/messenger/account-manager;1"]
|
||||
.getService(Components.interfaces.nsIMsgAccountManager);
|
||||
this.mDefaultAccount = accountMgrSvc.defaultAccount;
|
||||
this.mDefaultSmtpServer = MailServices.smtp.defaultServer;
|
||||
this.mDefaultAccount = MailServices.accounts.defaultAccount;
|
||||
this.mDefaultIdentity = this.mDefaultAccount.defaultIdentity;
|
||||
|
||||
if (!this.mDefaultIdentity) {
|
||||
// If there isn't a default identity (i.e Local Folders is your
|
||||
// default identity, then go ahead and use the first available
|
||||
// identity.
|
||||
let allIdentities = accountMgrSvc.allIdentities;
|
||||
let allIdentities = MailServices.accounts.allIdentities;
|
||||
if (allIdentities.Count() > 0) {
|
||||
this.mDefaultIdentity = allIdentities.GetElementAt(0)
|
||||
.QueryInterface(Components.interfaces.nsIMsgIdentity);
|
||||
|
@ -287,14 +283,13 @@ calItipEmailTransport.prototype = {
|
|||
return convertFromUnicode("UTF-8", text).replace(/(\r\n)|\n/g, "\r\n");
|
||||
}
|
||||
function encodeMimeHeader(header) {
|
||||
let mimeConverter = Components.classes["@mozilla.org/messenger/mimeconverter;1"]
|
||||
.createInstance(Components.interfaces.nsIMimeConverter);
|
||||
let fieldNameLen = (header.indexOf(": ") + 2);
|
||||
return mimeConverter.encodeMimePartIIStr_UTF8(header,
|
||||
false,
|
||||
"UTF-8",
|
||||
fieldNameLen,
|
||||
Components.interfaces.nsIMimeConverter.MIME_ENCODED_WORD_SIZE);
|
||||
return MailServices.mimeConverter
|
||||
.encodeMimePartIIStr_UTF8(header,
|
||||
false,
|
||||
"UTF-8",
|
||||
fieldNameLen,
|
||||
Components.interfaces.nsIMimeConverter.MIME_ENCODED_WORD_SIZE);
|
||||
}
|
||||
|
||||
let itemList = aItem.getItemList({});
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
Components.utils.import("resource:///modules/iteratorUtils.jsm");
|
||||
Components.utils.import("resource:///modules/mailServices.js");
|
||||
Components.utils.import("resource://calendar/modules/calUtils.jsm");
|
||||
|
||||
/**
|
||||
|
@ -51,7 +52,7 @@ function ltnInitMailIdentitiesRow() {
|
|||
if (gCalendar && gCalendar.aclEntry && gCalendar.aclEntry.hasAccessControl) {
|
||||
identities = gCalendar.aclEntry.getOwnerIdentities({});
|
||||
} else {
|
||||
identities = cal.getAccountManager().allIdentities;
|
||||
identities = MailServices.accounts.allIdentities;
|
||||
}
|
||||
for each (let identity in fixIterator(identities, Components.interfaces.nsIMsgIdentity)) {
|
||||
addMenuItem(menuPopup, identity.identityName, identity.key);
|
||||
|
|
|
@ -29,9 +29,7 @@ var setupModule = function(module) {
|
|||
calendar = time;
|
||||
title = time;
|
||||
|
||||
file = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties)
|
||||
.get("TmpD", Components.interfaces.nsIFile);
|
||||
file = Services.dirsvc.get("TmpD", Components.interfaces.nsIFile);
|
||||
file.append(calendar + ".ics");
|
||||
let fileURI = Services.io.newFileURI(file);
|
||||
uri = fileURI.prePath + fileURI.path;
|
||||
|
|
|
@ -8,9 +8,7 @@ const Cc = Components.classes;
|
|||
const Ci = Components.interfaces;
|
||||
|
||||
(function load_lightning_manifest() {
|
||||
let bindir = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties)
|
||||
.get("CurProcD", Components.interfaces.nsIFile);
|
||||
let bindir = Services.dirsvc.get("CurProcD", Components.interfaces.nsIFile);
|
||||
bindir.append("extensions");
|
||||
bindir.append("{e2fda1a4-762b-4020-b5ad-a41df1933103}");
|
||||
bindir.append("chrome.manifest");
|
||||
|
@ -75,9 +73,7 @@ function getMemoryCal() {
|
|||
}
|
||||
|
||||
function getStorageCal() {
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties);
|
||||
var db = dirSvc.get("TmpD", Ci.nsIFile);
|
||||
var db = Services.dirsvc.get("TmpD", Ci.nsIFile);
|
||||
db.append("test_storage.sqlite");
|
||||
|
||||
// create URI
|
||||
|
|
Загрузка…
Ссылка в новой задаче